Skip to content

Commit

Permalink
Merge tag 'stable/for-linus-3.7-rc2-tag' of git://git.kernel.org/pub/…
Browse files Browse the repository at this point in the history
…scm/linux/kernel/git/konrad/xen

Pull xen bug-fixes from Konrad Rzeszutek Wilk:
 - Fix mysterious SIGSEGV or SIGKILL in applications due to corrupting
   of the %eip when returning from a signal handler.
 - Fix various ARM compile issues after the merge fallout.
 - Continue on making more of the Xen generic code usable by ARM
   platform.
 - Fix SR-IOV passthrough to mirror multifunction PCI devices.
 - Fix various compile warnings.
 - Remove hypercalls that don't exist anymore.

* tag 'stable/for-linus-3.7-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen: dbgp: Fix warning when CONFIG_PCI is not enabled.
  xen: arm: comment on why 64-bit xen_pfn_t is safe even on 32 bit
  xen: balloon: use correct type for frame_list
  xen/x86: don't corrupt %eip when returning from a signal handler
  xen: arm: make p2m operations NOPs
  xen: balloon: don't include e820.h
  xen: grant: use xen_pfn_t type for frame_list.
  xen: events: pirq_check_eoi_map is X86 specific
  xen: XENMEM_translate_gpfn_list was remove ages ago and is unused.
  xen: sysfs: fix build warning.
  xen: sysfs: include err.h for PTR_ERR etc
  xen: xenbus: quirk uses x86 specific cpuid
  xen PV passthru: assign SR-IOV virtual functions to separate virtual slots
  xen/xenbus: Fix compile warning.
  xen/x86: remove duplicated include from enlighten.c
  • Loading branch information
torvalds committed Oct 24, 2012
2 parents 3185bd2 + 801e7fb commit 0e9e3e3
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 50 deletions.
12 changes: 9 additions & 3 deletions arch/arm/include/asm/xen/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@

#ifndef __ASSEMBLY__
/* Explicitly size integers that represent pfns in the interface with
* Xen so that we can have one ABI that works for 32 and 64 bit guests. */
* Xen so that we can have one ABI that works for 32 and 64 bit guests.
* Note that this means that the xen_pfn_t type may be capable of
* representing pfn's which the guest cannot represent in its own pfn
* type. However since pfn space is controlled by the guest this is
* fine since it simply wouldn't be able to create any sure pfns in
* the first place.
*/
typedef uint64_t xen_pfn_t;
#define PRI_xen_pfn "llx"
typedef uint64_t xen_ulong_t;
#define PRI_xen_ulong "llx"
/* Guest handles for primitive C types. */
__DEFINE_GUEST_HANDLE(uchar, unsigned char);
__DEFINE_GUEST_HANDLE(uint, unsigned int);
__DEFINE_GUEST_HANDLE(ulong, unsigned long);
DEFINE_GUEST_HANDLE(char);
DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t);
Expand Down
13 changes: 10 additions & 3 deletions arch/arm/include/asm/xen/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <xen/interface/grant_table.h>

#define pfn_to_mfn(pfn) (pfn)
#define phys_to_machine_mapping_valid (1)
#define phys_to_machine_mapping_valid(pfn) (1)
#define mfn_to_pfn(mfn) (mfn)
#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))

Expand All @@ -30,6 +30,8 @@ typedef struct xpaddr {
#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })

#define INVALID_P2M_ENTRY (~0UL)

static inline xmaddr_t phys_to_machine(xpaddr_t phys)
{
unsigned offset = phys.paddr & ~PAGE_MASK;
Expand Down Expand Up @@ -74,9 +76,14 @@ static inline int m2p_remove_override(struct page *page, bool clear_pte)
return 0;
}

static inline bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
{
BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
return true;
}

static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
{
BUG();
return false;
return __set_phys_to_machine(pfn, mfn);
}
#endif /* _ASM_ARM_XEN_PAGE_H */
2 changes: 1 addition & 1 deletion arch/arm/xen/grant-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <xen/page.h>
#include <xen/grant_table.h>

int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
unsigned long max_nr_gframes,
void **__shared)
{
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/include/asm/xen/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
* with Xen so that on ARM we can have one ABI that works for 32 and 64
* bit guests. */
typedef unsigned long xen_pfn_t;
#define PRI_xen_pfn "lx"
typedef unsigned long xen_ulong_t;
#define PRI_xen_ulong "lx"
/* Guest handles for primitive C types. */
__DEFINE_GUEST_HANDLE(uchar, unsigned char);
__DEFINE_GUEST_HANDLE(uint, unsigned int);
__DEFINE_GUEST_HANDLE(ulong, unsigned long);
DEFINE_GUEST_HANDLE(char);
DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t);
Expand Down
8 changes: 5 additions & 3 deletions arch/x86/kernel/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ ENTRY(xen_sysenter_target)

ENTRY(xen_hypervisor_callback)
CFI_STARTPROC
pushl_cfi $0
pushl_cfi $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL
TRACE_IRQS_OFF

Expand Down Expand Up @@ -1077,14 +1077,16 @@ ENTRY(xen_failsafe_callback)
2: mov 8(%esp),%es
3: mov 12(%esp),%fs
4: mov 16(%esp),%gs
/* EAX == 0 => Category 1 (Bad segment)
EAX != 0 => Category 2 (Bad IRET) */
testl %eax,%eax
popl_cfi %eax
lea 16(%esp),%esp
CFI_ADJUST_CFA_OFFSET -16
jz 5f
addl $16,%esp
jmp iret_exc # EAX != 0 => Category 2 (Bad IRET)
5: pushl_cfi $0 # EAX == 0 => Category 1 (Bad segment)
jmp iret_exc
5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL
jmp ret_from_exception
CFI_ENDPROC
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ ENTRY(xen_failsafe_callback)
CFI_RESTORE r11
addq $0x30,%rsp
CFI_ADJUST_CFA_OFFSET -0x30
pushq_cfi $0
pushq_cfi $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL
jmp error_exit
CFI_ENDPROC
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
#include "smp.h"
#include "multicalls.h"

#include <xen/events.h>

EXPORT_SYMBOL_GPL(hypercall_page);

DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
Expand Down
3 changes: 1 addition & 2 deletions drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/tlb.h>
#include <asm/e820.h>

#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>
Expand Down Expand Up @@ -88,7 +87,7 @@ struct balloon_stats balloon_stats;
EXPORT_SYMBOL_GPL(balloon_stats);

/* We increase/decrease in batches which fit in a page */
static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)];

#ifdef CONFIG_HIGHMEM
#define inc_totalhigh_pages() (totalhigh_pages++)
Expand Down
2 changes: 2 additions & 0 deletions drivers/xen/dbgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

static int xen_dbgp_op(struct usb_hcd *hcd, int op)
{
#ifdef CONFIG_PCI
const struct device *ctrlr = hcd_to_bus(hcd)->controller;
#endif
struct physdev_dbgp_op dbgp;

if (!xen_initial_domain())
Expand Down
4 changes: 4 additions & 0 deletions drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ struct irq_info {
#define PIRQ_SHAREABLE (1 << 1)

static int *evtchn_to_irq;
#ifdef CONFIG_X86
static unsigned long *pirq_eoi_map;
#endif
static bool (*pirq_needs_eoi)(unsigned irq);

static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG],
Expand Down Expand Up @@ -277,10 +279,12 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn)
return ret;
}

#ifdef CONFIG_X86
static bool pirq_check_eoi_map(unsigned irq)
{
return test_bit(pirq_from_irq(irq), pirq_eoi_map);
}
#endif

static bool pirq_needs_eoi_flag(unsigned irq)
{
Expand Down
8 changes: 4 additions & 4 deletions drivers/xen/grant-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct gnttab_ops {
* nr_gframes is the number of frames to map grant table. Returning
* GNTST_okay means success and negative value means failure.
*/
int (*map_frames)(unsigned long *frames, unsigned int nr_gframes);
int (*map_frames)(xen_pfn_t *frames, unsigned int nr_gframes);
/*
* Release a list of frames which are mapped in map_frames for grant
* entry status.
Expand Down Expand Up @@ -960,7 +960,7 @@ static unsigned nr_status_frames(unsigned nr_grant_frames)
return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP;
}

static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes)
static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes)
{
int rc;

Expand All @@ -977,7 +977,7 @@ static void gnttab_unmap_frames_v1(void)
arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames);
}

static int gnttab_map_frames_v2(unsigned long *frames, unsigned int nr_gframes)
static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes)
{
uint64_t *sframes;
unsigned int nr_sframes;
Expand Down Expand Up @@ -1029,7 +1029,7 @@ static void gnttab_unmap_frames_v2(void)
static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{
struct gnttab_setup_table setup;
unsigned long *frames;
xen_pfn_t *frames;
unsigned int nr_gframes = end_idx + 1;
int rc;

Expand Down
4 changes: 3 additions & 1 deletion drivers/xen/sys-hypervisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/err.h>

#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>
Expand Down Expand Up @@ -284,7 +285,8 @@ static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer)
ret = HYPERVISOR_xen_version(XENVER_platform_parameters,
parms);
if (!ret)
ret = sprintf(buffer, "%lx\n", parms->virt_start);
ret = sprintf(buffer, "%"PRI_xen_ulong"\n",
parms->virt_start);
kfree(parms);
}

Expand Down
14 changes: 10 additions & 4 deletions drivers/xen/xen-pciback/vpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,

mutex_lock(&vpci_dev->lock);

/* Keep multi-function devices together on the virtual PCI bus */
for (slot = 0; slot < PCI_SLOT_MAX; slot++) {
if (!list_empty(&vpci_dev->dev_list[slot])) {
/*
* Keep multi-function devices together on the virtual PCI bus, except
* virtual functions.
*/
if (!dev->is_virtfn) {
for (slot = 0; slot < PCI_SLOT_MAX; slot++) {
if (list_empty(&vpci_dev->dev_list[slot]))
continue;

t = list_entry(list_first(&vpci_dev->dev_list[slot]),
struct pci_dev_entry, list);

Expand All @@ -116,7 +122,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
pci_name(dev), slot);
list_add_tail(&dev_entry->list,
&vpci_dev->dev_list[slot]);
func = PCI_FUNC(dev->devfn);
func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn);
goto unlock;
}
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/xen/xenbus/xenbus_xs.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,15 @@ static struct xenbus_watch *find_watch(const char *token)
*/
static bool xen_strict_xenbus_quirk(void)
{
#ifdef CONFIG_X86
uint32_t eax, ebx, ecx, edx, base;

base = xen_cpuid_base();
cpuid(base + 1, &eax, &ebx, &ecx, &edx);

if ((eax >> 16) < 4)
return true;
#endif
return false;

}
Expand Down
2 changes: 1 addition & 1 deletion include/xen/grant_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
unmap->dev_bus_addr = 0;
}

int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
unsigned long max_nr_gframes,
void **__shared);
int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
Expand Down
2 changes: 1 addition & 1 deletion include/xen/interface/grant_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ struct gnttab_setup_table {
uint32_t nr_frames;
/* OUT parameters. */
int16_t status; /* GNTST_* */
GUEST_HANDLE(ulong) frame_list;
GUEST_HANDLE(xen_pfn_t) frame_list;
};
DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table);

Expand Down
24 changes: 2 additions & 22 deletions include/xen/interface/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,28 +179,8 @@ struct xen_add_to_physmap {
};
DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);

/*
* Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
* code on failure. This call only works for auto-translated guests.
*/
#define XENMEM_translate_gpfn_list 8
struct xen_translate_gpfn_list {
/* Which domain to translate for? */
domid_t domid;

/* Length of list. */
xen_ulong_t nr_gpfns;

/* List of GPFNs to translate. */
GUEST_HANDLE(ulong) gpfn_list;

/*
* Output list to contain MFN translations. May be the same as the input
* list (in which case each input GPFN is overwritten with the output MFN).
*/
GUEST_HANDLE(ulong) mfn_list;
};
DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
/*** REMOVED ***/
/*#define XENMEM_translate_gpfn_list 8*/

/*
* Returns the pseudo-physical memory map as it was when the domain
Expand Down

0 comments on commit 0e9e3e3

Please sign in to comment.