pv-ops: register xen pci notifier
PATCH v3 1/1 pv-ops: register xen pci notifier
Register the notifier to handle hot-plug devices and SR-IOV devices for Xen hypervisor. When a device is hot added or removed, it adds or removes it to Xen via hypercalls.
Changes in v3:
It isn't necessarily to explicitly initialize elements to 0, because initializer will do it implicitly. Remove the unnecessary initilization.
Changes in v2:
Remove inline #ifdef and the awkward dangling else/#endif construction, and rather than using memset, use variable declaration and initializer to assign the elements in xen_add_device.
Signed-off-by Weidong Han <[email protected]>
--- drivers/xen/Makefile | 5 +- drivers/xen/pci.c | 114 +++++++++++++++++++++++++++++++++++++++ include/xen/interface/physdev.h | 21 +++++++ 3 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 drivers/xen/pci.c
drivers/xen/Makefile +3 -2
@@ -1,12 +1,13 @@ obj-y += grant-table.o features.o events.o manage.o biomerge.o obj-y += xenbus/ +obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o obj-$(CONFIG_XEN_XENCOMM) += xencomm.o obj-$(CONFIG_XEN_BALLOON) += balloon.o obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o -obj-$(CONFIG_XEN_GNTDEV) += gntdev.o +obj-$(CONFIG_XEN_GNTDEV) += gntdev.o obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/ obj-$(CONFIG_XENFS) += xenfs/ -obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o +obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o
drivers/xen/pci.c new file +114 -0
114 lines not on this page · raw message
include/xen/interface/physdev.h +21 -0
@@ -106,6 +106,27 @@ struct physdev_irq {uint32_t vector; }; +#define PHYSDEVOP_manage_pci_add 15 +#define PHYSDEVOP_manage_pci_remove 16 +struct physdev_manage_pci { +/* IN */ +uint8_t bus; +uint8_t devfn; +}; + +#define PHYSDEVOP_manage_pci_add_ext 20 +struct physdev_manage_pci_ext { +/* IN */ +uint8_t bus; +uint8_t devfn; +unsigned is_extfn; +unsigned is_virtfn; +struct { +uint8_t bus; +uint8_t devfn; + } physfn; +}; +/* * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op() * hypercall since 0x00030202.
Signature · 1 line
1.6.0.4