Xen updates
Subsystems (10)
Hi Linus,
Here's a set of Xen updates. The main new feature is added support for paravirtualized drivers even in fully virtualized domains (pv-on-hvm), as well as a number of smaller bugfixes and improvements.
The only non-Xen files touched are:
kernel-parameters.txt
We add a new kernel command-line parameter for pv-on-hvm
arch/x86/include/asm/hypervisor.h
Add Xen hypervisor detection to the hypervisor infrastructure
include/linux/pci_ids.h
Add ID for our pseudo-PCI device
arch/x86/include/asm/irq_vectors.harch/x86/kernel/entry_*.S
Add a new vector for injecting interrupts into the domain
arch/x86/include/asm/setup.hinclude/asm-generic/vmlinux.lds.h
Avoid a section conflict on newer gccs by adding multiple .discard sections for differently typed symbols.
Thanks,
J
The following changes since commit 9fe6206f400646a2322096b56c59891d530e8d51:
Linux 2.6.35 (2010-08-01 15:11:14 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git upstream/xen
Donald Dutile (1):
Xen: register panic notifier to take crashes of xen guests on panic
Ian Campbell (2):
xenbus: do not hold transaction_mutex when returning to userspace xen/panic: use xen_reboot and fix smp_send_stop
Jeremy Fitzhardinge (9):
xen: make sure pages are really part of domain before freeing
xen: Add support for HVM hypercalls.
xenfs: enable for HVM domains too
xen/pvhvm: fix build problem when !CONFIG_XEN
support multiple .discard.* sections to avoid section type conflicts
xen: drop xen_sched_clock in favour of using plain wallclock time Merge branch 'upstream/core' into upstream/xen
Merge branch 'upstream/pvhvm' into upstream/xen
Merge branch 'xen/xenbus' into upstream/xen
Miroslav Rezanina (1):
xen: release unused free memory
Mukesh Rathor (1):
xen: support large numbers of CPUs with vcpu info placement
Paolo Bonzini (1):
implement O_NONBLOCK for /proc/xen/xenbus
Sheng Yang (2):
x86: early PV on HVM features initialization. x86/xen: event channels delivery on HVM.
Stefano Stabellini (9):
xen: Xen PCI platform device driver.
xen: Add suspend/resume support for PV on HVM guests.
xen: Fix find_unbound_irq in presence of ioapic irqs.
x86: Use xen_vcpuop_clockevent, xen_clocksource and xen wallclock.
x86: Unplug emulated disks and nics.
x86: Call HVMOP_pagetable_dying on exit_mmap.
blkfront: do not create a PV cdrom device if xen_hvm_guest Introduce CONFIG_XEN_PVHVM compile option
pvops: do not notify callers from register_xenstore_notifier
Documentation/kernel-parameters.txt | 11 ++ arch/x86/include/asm/hypervisor.h | 1 + arch/x86/include/asm/irq_vectors.h | 3 + arch/x86/include/asm/setup.h | 2 +- arch/x86/include/asm/xen/hypercall.h | 6 + arch/x86/kernel/cpu/hypervisor.c | 3 + arch/x86/kernel/entry_32.S | 3 + arch/x86/kernel/entry_64.S | 3 + arch/x86/xen/Kconfig | 5 + arch/x86/xen/Makefile | 2 +- arch/x86/xen/enlighten.c | 197 +++++++++++++++++++++++++++++--- arch/x86/xen/mmu.c | 35 ++++++ arch/x86/xen/mmu.h | 1 + arch/x86/xen/platform-pci-unplug.c | 137 ++++++++++++++++++++++ arch/x86/xen/setup.c | 72 ++++++++++++ arch/x86/xen/smp.c | 2 + arch/x86/xen/suspend.c | 12 ++ arch/x86/xen/time.c | 96 +++++++++------- arch/x86/xen/xen-ops.h | 13 ++- drivers/block/xen-blkfront.c | 30 +++++ drivers/input/xen-kbdfront.c | 2 +- drivers/video/xen-fbfront.c | 2 +- drivers/xen/Kconfig | 9 ++ drivers/xen/Makefile | 3 +- drivers/xen/events.c | 95 ++++++++++++++-- drivers/xen/grant-table.c | 77 +++++++++++-- drivers/xen/manage.c | 46 +++++++- drivers/xen/platform-pci.c | 207 ++++++++++++++++++++++++++++++++++ drivers/xen/xenbus/xenbus_probe.c | 52 +++++++-- drivers/xen/xenbus/xenbus_xs.c | 57 ++++++++-- drivers/xen/xenfs/super.c | 4 +- drivers/xen/xenfs/xenbus.c | 3 + include/asm-generic/vmlinux.lds.h | 1 + include/linux/pci_ids.h | 3 + include/xen/events.h | 7 + include/xen/grant_table.h | 4 + include/xen/hvm.h | 30 +++++ include/xen/interface/features.h | 6 + include/xen/interface/grant_table.h | 1 + include/xen/interface/hvm/hvm_op.h | 46 ++++++++ include/xen/interface/hvm/params.h | 95 ++++++++++++++++ include/xen/platform_pci.h | 49 ++++++++ include/xen/xen-ops.h | 3 + 43 files changed, 1317 insertions(+), 119 deletions(-) create mode 100644 arch/x86/xen/platform-pci-unplug.c create mode 100644 drivers/xen/platform-pci.c create mode 100644 include/xen/hvm.h create mode 100644 include/xen/interface/hvm/hvm_op.h create mode 100644 include/xen/interface/hvm/params.h create mode 100644 include/xen/platform_pci.h
git diff v2.6.35..upstream/xen
Documentation/kernel-parameters.txt +11 -0
@@ -115,6 +115,7 @@ parameter is applicable: More X86-64 boot options can be found in Documentation/x86/x86_64/boot-options.txt . X86 Either 32bit or 64bit x86 (same as X86-32+X86-64) + XEN Xen support is enabled In addition, the following text indicates that the option:
@@ -2879,6 +2880,16 @@ and is between 256 and 4096 characters. It is defined in the file xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. xd_geo= See header of drivers/block/xd.c. + xen_emul_unplug= [HW,X86,XEN] + Unplug Xen emulated devices + Format: [unplug0,][unplug1] + ide-disks -- unplug primary master IDE devices + aux-ide-disks -- unplug non-primary-master IDE devices + nics -- unplug network devices + all -- unplug all emulated devices (NICs and IDE disks) + ignore -- continue loading the Xen platform PCI driver even + if the version check failed + xirc2ps_cs= [NET,PCMCIA] Format: <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
arch/x86/include/asm/hypervisor.h +1 -0
@@ -45,5 +45,6 @@ extern const struct hypervisor_x86 *x86_hyper;/* Recognized hypervisors */ extern const struct hypervisor_x86 x86_hyper_vmware;extern const struct hypervisor_x86 x86_hyper_ms_hyperv; +extern const struct hypervisor_x86 x86_hyper_xen_hvm;#endif
arch/x86/include/asm/irq_vectors.h +3 -0
@@ -125,6 +125,9 @@*/ #define MCE_SELF_VECTOR 0xeb +/* Xen vector callback to receive events in a HVM domain */ +#define XEN_HVM_EVTCHN_CALLBACK 0xe9 +#define NR_VECTORS 256#define FPU_IRQ 13
arch/x86/include/asm/setup.h +1 -1
@@ -82,7 +82,7 @@ void *extend_brk(size_t size, size_t align);* executable.) */ #define RESERVE_BRK (name,sz) \ - static void __section(.discard) __used \ + static void __section(.discard.text) __used \ __brk_reservation_fn_##name##__(void) { \ asm volatile ( \ ".pushsection .brk_reservation,\"aw\",@nobits;" \
arch/x86/include/asm/xen/hypercall.h +6 -0
@@ -417,6 +417,12 @@ HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)return _hypercall2 (int, nmi_op, op, arg); } +static inline unsigned long __must_check +HYPERVISOR_hvm_op (int op,void *arg) +{ + return _hypercall2(unsigned long, hvm_op, op, arg); +} +static inline void MULTI_fpu_taskswitch (struct multicall_entry *mcl,int set) {
arch/x86/kernel/cpu/hypervisor.c +3 -0
@@ -34,6 +34,9 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] = { &x86_hyper_vmware, &x86_hyper_ms_hyperv, +#ifdef CONFIG_XEN_PVHVM + &x86_hyper_xen_hvm, +#endif };const struct hypervisor_x86 *x86_hyper;
arch/x86/kernel/entry_32.S +3 -0
@@ -1166,6 +1166,9 @@ ENTRY(xen_failsafe_callback) .previous ENDPROC(xen_failsafe_callback) +BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, + xen_evtchn_do_upcall) + #endif /* CONFIG_XEN */ #ifdef CONFIG_FUNCTION_TRACER
arch/x86/kernel/entry_64.S +3 -0
@@ -1329,6 +1329,9 @@ ENTRY(xen_failsafe_callback) CFI_ENDPROC END(xen_failsafe_callback) +apicinterrupt XEN_HVM_EVTCHN_CALLBACK \ + xen_hvm_callback_vector xen_evtchn_do_upcall + #endif /* CONFIG_XEN */ /*
arch/x86/xen/Kconfig +5 -0
@@ -13,6 +13,11 @@ config XEN kernel to boot in a paravirtualized environment under the Xen hypervisor. +config XEN_PVHVM + def_bool y + depends on XEN + depends on X86_LOCAL_APIC + config XEN_MAX_DOMAIN_MEMORY int "Maximum allowed size of a domain in gigabytes" default 8 if X86_32
arch/x86/xen/Makefile +1 -1
@@ -12,7 +12,7 @@ CFLAGS_mmu.o := $(nostackp) obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ time.o xen-asm.o xen-asm_$(BITS).o \ - grant-table.o suspend.o + grant-table.o suspend.o platform-pci-unplug.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
arch/x86/xen/enlighten.c +180 -17
278 lines not on this page · raw message
arch/x86/xen/mmu.c +35 -0
@@ -58,6 +58,7 @@#include <xen/page.h> #include <xen/interface/xen.h> +#include <xen/interface/hvm/hvm_op.h> #include <xen/interface/version.h> #include <xen/hvc-console.h>
@@ -1941,6 +1942,40 @@ void __init xen_init_mmu_ops(void) pv_mmu_ops = xen_mmu_ops; } +#ifdef CONFIG_XEN_PVHVM +static void xen_hvm_exit_mmap (struct mm_struct *mm) +{ +struct xen_hvm_pagetable_dying a; +int rc; + + a.domid =DOMID_SELF ; + a.gpa =__pa (mm->pgd); + rc =HYPERVISOR_hvm_op (HVMOP_pagetable_dying,&a); +WARN_ON_ONCE (rc<0 ); +} + +static int is_pagetable_dying_supported (void ) +{ +struct xen_hvm_pagetable_dying a; +int rc =0 ; + + a.domid =DOMID_SELF ; + a.gpa =0x00 ; + rc =HYPERVISOR_hvm_op (HVMOP_pagetable_dying,&a); +if (rc<0 ) { +printk (KERN_DEBUG "HVMOP_pagetable_dying not supported\n" ); +return 0 ; + } +return 1 ; +} + +void __init xen_hvm_init_mmu_ops (void ) +{ +if (is_pagetable_dying_supported ()) + pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap; +} +#endif +#ifdef CONFIG_XEN_DEBUG_FS static struct dentry *d_mmu_debug;
arch/x86/xen/mmu.h +1 -0
@@ -60,4 +60,5 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,unsigned long xen_read_cr2_direct (void );extern void xen_init_mmu_ops (void ); +extern void xen_hvm_init_mmu_ops (void );#endif /* _XEN_MMU_H */
arch/x86/xen/platform-pci-unplug.c new file +137 -0
137 lines not on this page · raw message
arch/x86/xen/setup.c +72 -0
96 lines not on this page · raw message
arch/x86/xen/smp.c +2 -0
@@ -394,6 +394,8 @@ static void stop_self(void *v)load_cr3 (swapper_pg_dir);/* should set up a minimal gdt */ +set_cpu_online (cpu, false); +HYPERVISOR_vcpu_op (VCPUOP_down, cpu,NULL );BUG (); }
arch/x86/xen/suspend.c +12 -0
@@ -26,6 +26,18 @@ void xen_pre_suspend(void)BUG (); } +void xen_hvm_post_suspend (int suspend_cancelled) +{ +int cpu; +xen_hvm_init_shared_info (); +xen_callback_vector (); +if (xen_feature (XENFEAT_hvm_safe_pvclock)) { +for_each_online_cpu (cpu) { +xen_setup_runstate_info (cpu); + } + } +} +void xen_post_suspend (int suspend_cancelled) {xen_build_mfn_list_list ();
arch/x86/xen/time.c +53 -43
130 lines not on this page · raw message
arch/x86/xen/xen-ops.h +8 -5
@@ -38,6 +38,10 @@ void xen_enable_sysenter(void);void xen_enable_syscall (void );void xen_vcpu_restore (void ); +void xen_callback_vector (void ); +void xen_hvm_init_shared_info (void ); +void __init xen_unplug_emulated_devices (void ); +void __init xen_build_dynamic_phys_to_machine (void );void xen_init_irq_ops (void );
@@ -46,11 +50,8 @@ void xen_setup_runstate_info(int cpu);void xen_teardown_timer (int cpu);cycle_t xen_clocksource_read (void );void xen_setup_cpu_clockevents (void ); -unsigned long xen_tsc_khz (void ); -void __init xen_time_init (void ); -unsigned long xen_get_wallclock (void ); -int xen_set_wallclock (unsigned long time); -unsigned long long xen_sched_clock (void ); +void __init xen_init_time_ops (void ); +void __init xen_hvm_init_time_ops (void );irqreturn_t xen_debug_interrupt (int irq,void *dev_id);
@@ -101,4 +102,6 @@ void xen_sysret32(void);void xen_sysret64 (void );void xen_adjust_exception_frame (void ); +extern int xen_panic_handler_init (void ); +#endif /* XEN_OPS_H */
drivers/block/xen-blkfront.c +30 -0
@@ -48,6 +48,7 @@#include <xen/grant_table.h> #include <xen/events.h> #include <xen/page.h> +#include <xen/platform_pci.h> #include <xen/interface/grant_table.h> #include <xen/interface/io/blkif.h>
@@ -737,6 +738,35 @@ static int blkfront_probe(struct xenbus_device *dev, } } +if (xen_hvm_domain ()) { +char *type; +int len; +/* no unplug has been done: do not hook devices != xen vbds */ +if (xen_platform_pci_unplug&XEN_UNPLUG_IGNORE ) { +int major; + +if (!VDEV_IS_EXTENDED (vdevice)) + major =BLKIF_MAJOR (vdevice); +else + major =XENVBD_MAJOR ; + +if (major !=XENVBD_MAJOR ) { +printk (KERN_INFO +"%s: HVM does not support vbd %d as xen block device\n" , + __FUNCTION__, vdevice); +return -ENODEV ; + } + } +/* do not create a PV cdrom device if we are an HVM guest */ + type =xenbus_read (XBT_NIL , dev->nodename,"device-type" ,&len); +if (IS_ERR (type)) +return -ENODEV ; +if (strncmp (type,"cdrom" ,5 ) ==0 ) { +kfree (type); +return -ENODEV ; + } +kfree (type); + } info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info) {xenbus_dev_fatal (dev, -ENOMEM ,"allocating info structure" );
drivers/input/xen-kbdfront.c +1 -1
@@ -339,7 +339,7 @@ static struct xenbus_driver xenkbd_driver = {static int __init xenkbd_init (void ) { -if (!xen_domain ()) +if (!xen_pv_domain ())return -ENODEV ;/* Nothing to do if running in dom0. */
drivers/video/xen-fbfront.c +1 -1
@@ -684,7 +684,7 @@ static struct xenbus_driver xenfb_driver = {static int __init xenfb_init (void ) { -if (!xen_domain ()) +if (!xen_pv_domain ())return -ENODEV ;/* Nothing to do if running in dom0. */
drivers/xen/Kconfig +9 -0
@@ -62,4 +62,13 @@ config XEN_SYS_HYPERVISOR virtual environment, /sys/hypervisor will still be present, but will have no xen contents. +config XEN_PLATFORM_PCI + tristate "xen platform pci device driver" + depends on XEN_PVHVM + default m + help + Driver for the Xen PCI Platform device: it is responsible for + initializing xenbus and grant_table when running in a Xen HVM + domain. As a consequence this driver is required to run any Xen PV + frontend on Xen HVM. endmenu
drivers/xen/Makefile +2 -1
@@ -9,4 +9,5 @@ obj-$(CONFIG_XEN_XENCOMM) += xencomm.o obj-$(CONFIG_XEN_BALLOON) += balloon.o obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o obj-$(CONFIG_XENFS) += xenfs/ -obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o +obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o +obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o
drivers/xen/events.c +84 -11
165 lines not on this page · raw message
drivers/xen/grant-table.c +67 -10
146 lines not on this page · raw message
drivers/xen/manage.c +42 -4
83 lines not on this page · raw message
drivers/xen/platform-pci.c new file +207 -0
207 lines not on this page · raw message
drivers/xen/xenbus/xenbus_probe.c +40 -12
97 lines not on this page · raw message
drivers/xen/xenbus/xenbus_xs.c +47 -10
127 lines not on this page · raw message
drivers/xen/xenfs/super.c +2 -2
@@ -65,7 +65,7 @@ static struct file_system_type xenfs_type = {static int __init xenfs_init (void ) { -if (xen_pv_domain ()) +if (xen_domain ())return register_filesystem (&xenfs_type);printk (KERN_INFO "XENFS: not registering filesystem on non-xen platform\n" );
@@ -74,7 +74,7 @@ static int __init xenfs_init(void) static void __exit xenfs_exit(void) { -if (xen_pv_domain ()) +if (xen_domain ())unregister_filesystem (&xenfs_type); }
drivers/xen/xenfs/xenbus.c +3 -0
@@ -124,6 +124,9 @@ static ssize_t xenbus_file_read(struct file *filp,mutex_lock (&u->reply_mutex);while (list_empty (&u->read_buffers)) {mutex_unlock (&u->reply_mutex); +if (filp->f_flags&O_NONBLOCK ) +return -EAGAIN ; + ret =wait_event_interruptible (u->read_waitq, !list_empty (&u->read_buffers));if (ret)
include/asm-generic/vmlinux.lds.h +1 -0
@@ -653,6 +653,7 @@EXIT_DATA \ EXIT_CALL \ *(.discard) \ + *(.discard.*) \ }/**
include/linux/pci_ids.h +3 -0
@@ -2772,3 +2772,6 @@#define PCI_DEVICE_ID_RME_DIGI32 0x9896#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 + +#define PCI_VENDOR_ID_XEN 0x5853 +#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
include/xen/events.h +7 -0
@@ -56,4 +56,11 @@ void xen_poll_irq(int irq);/* Determine the IRQ which is bound to an event channel */ unsigned irq_from_evtchn (unsigned int evtchn); +/* Xen HVM evtchn vector callback */ +extern void xen_hvm_callback_vector (void ); +extern int xen_have_vector_callback; +int xen_set_callback_via (uint64_t via); +void xen_evtchn_do_upcall (struct pt_regs *regs); +void xen_hvm_evtchn_do_upcall (void ); +#endif /* _XEN_EVENTS_H */
include/xen/grant_table.h +4 -0
@@ -51,6 +51,7 @@ struct gnttab_free_callback {u16 count; }; +int gnttab_init (void );int gnttab_suspend (void );int gnttab_resume (void );
@@ -112,6 +113,9 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,void arch_gnttab_unmap_shared (struct grant_entry *shared,unsigned long nr_gframes); +extern unsigned long xen_hvm_resume_frames; +unsigned int gnttab_max_grant_frames (void ); +#define gnttab_map_vaddr (map) ((void *)(map.host_virt_addr))#endif /* __ASM_GNTTAB_H__ */
include/xen/hvm.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Simple wrappers around HVM functions */ +#ifndef XEN_HVM_H__ +#define XEN_HVM_H__ + +#include <xen/interface/hvm/params.h> +#include <asm/xen/hypercall.h> + +static inline int hvm_get_parameter (int idx,uint64_t *value) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =HYPERVISOR_hvm_op (HVMOP_get_param,&xhv); +if (r<0 ) { +printk (KERN_ERR "Cannot get hvm parameter %d: %d!\n" , + idx, r); +return r; + } + *value = xhv.value; +return r; +} + +#define HVM_CALLBACK_VIA_TYPE_VECTOR 0x2 +#define HVM_CALLBACK_VIA_TYPE_SHIFT 56 +#define HVM_CALLBACK_VECTOR (x) (((uint64_t)HVM_CALLBACK_VIA_TYPE_VECTOR)<<\ + HVM_CALLBACK_VIA_TYPE_SHIFT | (x)) + +#endif /* XEN_HVM_H__ */
include/xen/interface/features.h +6 -0
@@ -41,6 +41,12 @@/* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */ #define XENFEAT_mmu_pt_update_preserve_ad 5 +/* x86: Does this Xen host support the HVM callback vector type? */ +#define XENFEAT_hvm_callback_vector 8 + +/* x86: pvclock algorithm is safe to use on HVM */ +#define XENFEAT_hvm_safe_pvclock 9 +#define XENFEAT_NR_SUBMAPS 1#endif /* __XEN_PUBLIC_FEATURES_H__ */
include/xen/interface/grant_table.h +1 -0
@@ -28,6 +28,7 @@#ifndef __XEN_PUBLIC_GRANT_TABLE_H__#define __XEN_PUBLIC_GRANT_TABLE_H__ +#include <xen/interface/xen.h> /*********************************** * GRANT TABLE REPRESENTATION
include/xen/interface/hvm/hvm_op.h new file +46 -0
46 lines not on this page · raw message
include/xen/interface/hvm/params.h new file +95 -0
95 lines not on this page · raw message
include/xen/platform_pci.h new file +49 -0
49 lines not on this page · raw message
include/xen/xen-ops.h +3 -0
@@ -7,6 +7,7 @@ DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);void xen_pre_suspend (void );void xen_post_suspend (int suspend_cancelled); +void xen_hvm_post_suspend (int suspend_cancelled);void xen_mm_pin_all (void );void xen_mm_unpin_all (void );
@@ -14,4 +15,6 @@ void xen_mm_unpin_all(void);void xen_timer_resume (void );void xen_arch_resume (void ); +int xen_setup_shutdown_event (void ); +#endif /* INCLUDE_XEN_OPS_H */