Bug-fixes:

* 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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJQhsIHAAoJEFjIrFwIi8fJ9LsH+gLGiF7dvFIUw1IA/Ev+tZ9Y
 YFFMJwmP71ZoqrJnEH+0vXlDU7YQAF/qQysVfACfHU5en2OEO24IuINddrm3wcYU
 2YAwEiLQstWhK1bhYqRqWeczjR3BV0NWtUoHpQar/5h4Ykppl5OxmXdBEfv+ThzA
 ju2d9fvQoJR7flW/CsWqoNcyPubzzXWYRCBWLdChw3NXVQTr/5ZDwvkIwgk6Gv5g
 vR0Qlirjdf2IyyE77zYhZw61H82IXoVCKnmif3HC1lYnSvVdVxamI0UhtXIjPJQU
 KB2e9Qkfix8weXDtpNBqa/VUIW7R83qCTZszs4mD/ktPAhgvxzCF3h/XLLXuwS4=
 =FR/L
 -----END PGP SIGNATURE-----

Merge tag 'stable/for-linus-3.7-rc2-tag' of git://git.kernel.org/pub/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
This commit is contained in:
Linus Torvalds 2012-10-24 05:17:27 +03:00
commit 0e9e3e306c
17 changed files with 58 additions and 50 deletions

View File

@ -29,16 +29,22 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
/* Explicitly size integers that represent pfns in the interface with /* 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; typedef uint64_t xen_pfn_t;
#define PRI_xen_pfn "llx"
typedef uint64_t xen_ulong_t; typedef uint64_t xen_ulong_t;
#define PRI_xen_ulong "llx"
/* Guest handles for primitive C types. */ /* Guest handles for primitive C types. */
__DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uchar, unsigned char);
__DEFINE_GUEST_HANDLE(uint, unsigned int); __DEFINE_GUEST_HANDLE(uint, unsigned int);
__DEFINE_GUEST_HANDLE(ulong, unsigned long);
DEFINE_GUEST_HANDLE(char); DEFINE_GUEST_HANDLE(char);
DEFINE_GUEST_HANDLE(int); DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t); DEFINE_GUEST_HANDLE(uint32_t);

View File

@ -10,7 +10,7 @@
#include <xen/interface/grant_table.h> #include <xen/interface/grant_table.h>
#define pfn_to_mfn(pfn) (pfn) #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_pfn(mfn) (mfn)
#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
@ -30,6 +30,8 @@ typedef struct xpaddr {
#define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) #define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
#define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) #define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
#define INVALID_P2M_ENTRY (~0UL)
static inline xmaddr_t phys_to_machine(xpaddr_t phys) static inline xmaddr_t phys_to_machine(xpaddr_t phys)
{ {
unsigned offset = phys.paddr & ~PAGE_MASK; unsigned offset = phys.paddr & ~PAGE_MASK;
@ -74,9 +76,14 @@ static inline int m2p_remove_override(struct page *page, bool clear_pte)
return 0; 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) static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
{ {
BUG(); return __set_phys_to_machine(pfn, mfn);
return false;
} }
#endif /* _ASM_ARM_XEN_PAGE_H */ #endif /* _ASM_ARM_XEN_PAGE_H */

View File

@ -33,7 +33,7 @@
#include <xen/page.h> #include <xen/page.h>
#include <xen/grant_table.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, unsigned long max_nr_gframes,
void **__shared) void **__shared)
{ {

View File

@ -51,14 +51,14 @@
* with Xen so that on ARM we can have one ABI that works for 32 and 64 * with Xen so that on ARM we can have one ABI that works for 32 and 64
* bit guests. */ * bit guests. */
typedef unsigned long xen_pfn_t; typedef unsigned long xen_pfn_t;
#define PRI_xen_pfn "lx"
typedef unsigned long xen_ulong_t; typedef unsigned long xen_ulong_t;
#define PRI_xen_ulong "lx"
/* Guest handles for primitive C types. */ /* Guest handles for primitive C types. */
__DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uchar, unsigned char);
__DEFINE_GUEST_HANDLE(uint, unsigned int); __DEFINE_GUEST_HANDLE(uint, unsigned int);
__DEFINE_GUEST_HANDLE(ulong, unsigned long);
DEFINE_GUEST_HANDLE(char); DEFINE_GUEST_HANDLE(char);
DEFINE_GUEST_HANDLE(int); DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t); DEFINE_GUEST_HANDLE(uint32_t);

View File

@ -1035,7 +1035,7 @@ ENTRY(xen_sysenter_target)
ENTRY(xen_hypervisor_callback) ENTRY(xen_hypervisor_callback)
CFI_STARTPROC CFI_STARTPROC
pushl_cfi $0 pushl_cfi $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL SAVE_ALL
TRACE_IRQS_OFF TRACE_IRQS_OFF
@ -1077,14 +1077,16 @@ ENTRY(xen_failsafe_callback)
2: mov 8(%esp),%es 2: mov 8(%esp),%es
3: mov 12(%esp),%fs 3: mov 12(%esp),%fs
4: mov 16(%esp),%gs 4: mov 16(%esp),%gs
/* EAX == 0 => Category 1 (Bad segment)
EAX != 0 => Category 2 (Bad IRET) */
testl %eax,%eax testl %eax,%eax
popl_cfi %eax popl_cfi %eax
lea 16(%esp),%esp lea 16(%esp),%esp
CFI_ADJUST_CFA_OFFSET -16 CFI_ADJUST_CFA_OFFSET -16
jz 5f jz 5f
addl $16,%esp addl $16,%esp
jmp iret_exc # EAX != 0 => Category 2 (Bad IRET) jmp iret_exc
5: pushl_cfi $0 # EAX == 0 => Category 1 (Bad segment) 5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL SAVE_ALL
jmp ret_from_exception jmp ret_from_exception
CFI_ENDPROC CFI_ENDPROC

View File

@ -1435,7 +1435,7 @@ ENTRY(xen_failsafe_callback)
CFI_RESTORE r11 CFI_RESTORE r11
addq $0x30,%rsp addq $0x30,%rsp
CFI_ADJUST_CFA_OFFSET -0x30 CFI_ADJUST_CFA_OFFSET -0x30
pushq_cfi $0 pushq_cfi $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL SAVE_ALL
jmp error_exit jmp error_exit
CFI_ENDPROC CFI_ENDPROC

View File

@ -81,8 +81,6 @@
#include "smp.h" #include "smp.h"
#include "multicalls.h" #include "multicalls.h"
#include <xen/events.h>
EXPORT_SYMBOL_GPL(hypercall_page); EXPORT_SYMBOL_GPL(hypercall_page);
DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);

View File

@ -55,7 +55,6 @@
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/tlb.h> #include <asm/tlb.h>
#include <asm/e820.h>
#include <asm/xen/hypervisor.h> #include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h> #include <asm/xen/hypercall.h>
@ -88,7 +87,7 @@ struct balloon_stats balloon_stats;
EXPORT_SYMBOL_GPL(balloon_stats); EXPORT_SYMBOL_GPL(balloon_stats);
/* We increase/decrease in batches which fit in a page */ /* 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 #ifdef CONFIG_HIGHMEM
#define inc_totalhigh_pages() (totalhigh_pages++) #define inc_totalhigh_pages() (totalhigh_pages++)

View File

@ -8,7 +8,9 @@
static int xen_dbgp_op(struct usb_hcd *hcd, int op) static int xen_dbgp_op(struct usb_hcd *hcd, int op)
{ {
#ifdef CONFIG_PCI
const struct device *ctrlr = hcd_to_bus(hcd)->controller; const struct device *ctrlr = hcd_to_bus(hcd)->controller;
#endif
struct physdev_dbgp_op dbgp; struct physdev_dbgp_op dbgp;
if (!xen_initial_domain()) if (!xen_initial_domain())

View File

@ -115,7 +115,9 @@ struct irq_info {
#define PIRQ_SHAREABLE (1 << 1) #define PIRQ_SHAREABLE (1 << 1)
static int *evtchn_to_irq; static int *evtchn_to_irq;
#ifdef CONFIG_X86
static unsigned long *pirq_eoi_map; static unsigned long *pirq_eoi_map;
#endif
static bool (*pirq_needs_eoi)(unsigned irq); static bool (*pirq_needs_eoi)(unsigned irq);
static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG],
@ -277,10 +279,12 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn)
return ret; return ret;
} }
#ifdef CONFIG_X86
static bool pirq_check_eoi_map(unsigned irq) static bool pirq_check_eoi_map(unsigned irq)
{ {
return test_bit(pirq_from_irq(irq), pirq_eoi_map); return test_bit(pirq_from_irq(irq), pirq_eoi_map);
} }
#endif
static bool pirq_needs_eoi_flag(unsigned irq) static bool pirq_needs_eoi_flag(unsigned irq)
{ {

View File

@ -84,7 +84,7 @@ struct gnttab_ops {
* nr_gframes is the number of frames to map grant table. Returning * nr_gframes is the number of frames to map grant table. Returning
* GNTST_okay means success and negative value means failure. * 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 * Release a list of frames which are mapped in map_frames for grant
* entry status. * entry status.
@ -960,7 +960,7 @@ static unsigned nr_status_frames(unsigned nr_grant_frames)
return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; 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; int rc;
@ -977,7 +977,7 @@ static void gnttab_unmap_frames_v1(void)
arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); 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; uint64_t *sframes;
unsigned int nr_sframes; unsigned int nr_sframes;
@ -1029,7 +1029,7 @@ static void gnttab_unmap_frames_v2(void)
static int gnttab_map(unsigned int start_idx, unsigned int end_idx) static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{ {
struct gnttab_setup_table setup; struct gnttab_setup_table setup;
unsigned long *frames; xen_pfn_t *frames;
unsigned int nr_gframes = end_idx + 1; unsigned int nr_gframes = end_idx + 1;
int rc; int rc;

View File

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

View File

@ -89,9 +89,15 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
mutex_lock(&vpci_dev->lock); mutex_lock(&vpci_dev->lock);
/* Keep multi-function devices together on the virtual PCI bus */ /*
for (slot = 0; slot < PCI_SLOT_MAX; slot++) { * Keep multi-function devices together on the virtual PCI bus, except
if (!list_empty(&vpci_dev->dev_list[slot])) { * 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]), t = list_entry(list_first(&vpci_dev->dev_list[slot]),
struct pci_dev_entry, list); struct pci_dev_entry, list);
@ -116,7 +122,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
pci_name(dev), slot); pci_name(dev), slot);
list_add_tail(&dev_entry->list, list_add_tail(&dev_entry->list,
&vpci_dev->dev_list[slot]); &vpci_dev->dev_list[slot]);
func = PCI_FUNC(dev->devfn); func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn);
goto unlock; goto unlock;
} }
} }

View File

@ -627,6 +627,7 @@ static struct xenbus_watch *find_watch(const char *token)
*/ */
static bool xen_strict_xenbus_quirk(void) static bool xen_strict_xenbus_quirk(void)
{ {
#ifdef CONFIG_X86
uint32_t eax, ebx, ecx, edx, base; uint32_t eax, ebx, ecx, edx, base;
base = xen_cpuid_base(); base = xen_cpuid_base();
@ -634,6 +635,7 @@ static bool xen_strict_xenbus_quirk(void)
if ((eax >> 16) < 4) if ((eax >> 16) < 4)
return true; return true;
#endif
return false; return false;
} }

View File

@ -170,7 +170,7 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
unmap->dev_bus_addr = 0; 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, unsigned long max_nr_gframes,
void **__shared); void **__shared);
int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,

View File

@ -310,7 +310,7 @@ struct gnttab_setup_table {
uint32_t nr_frames; uint32_t nr_frames;
/* OUT parameters. */ /* OUT parameters. */
int16_t status; /* GNTST_* */ int16_t status; /* GNTST_* */
GUEST_HANDLE(ulong) frame_list; GUEST_HANDLE(xen_pfn_t) frame_list;
}; };
DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table); DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table);

View File

@ -179,28 +179,8 @@ struct xen_add_to_physmap {
}; };
DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
/* /*** REMOVED ***/
* Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error /*#define XENMEM_translate_gpfn_list 8*/
* 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);
/* /*
* Returns the pseudo-physical memory map as it was when the domain * Returns the pseudo-physical memory map as it was when the domain