Add amd iommu emulation for Xen.
PATCH 1/1 Add amd iommu emulation for Xen.
HI,
Attached patch adds amd iommu emulation for Xen. Please review it. Thanks,
Wei
From 122517435641384e4f5e36eaad8302ff273648e8 Mon Sep 17 00:00:00 2001
From: Wei Wang <[email protected]>
Date: Wed, 26 Sep 2012 16:43:40 +0200
Subject: [PATCH] Add amd iommu emulation for Xen.
To passthrough amd southern islands series gpu to guest, a virtual iommu device must be registered on qemu pci bus. It uses a new hypercall xc_domain_update_iommu_msi to notify xen the msi vector of iommu.
Signed-off-by Wei Wang <[email protected]>
--- hw/i386/Makefile.objs | 2 +- hw/pc_piix.c | 6 ++ hw/xen_iommu.c | 191 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen_pt.h | 1 + 4 files changed, 199 insertions(+), 1 deletions(-) create mode 100644 hw/xen_iommu.c
hw/i386/Makefile.objs +1 -1
@@ -8,7 +8,7 @@ obj-y += pc_piix.o obj-y += pc_sysfw.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o -obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o +obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o xen_iommu.o obj-y += kvm/ obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
hw/pc_piix.c +6 -0
@@ -46,6 +46,9 @@#ifdef CONFIG_XEN # include <xen/hvm/hvm_info_table.h> #endif +#ifdef CONFIG_XEN_PCI_PASSTHROUGH +# include "xen_pt.h" +#endif #define MAX_IDE_BUS 2
@@ -228,6 +231,9 @@ static void pc_init1(MemoryRegion *system_memory,pc_vga_init (isa_bus, pci_enabled ? pci_bus :NULL );if (xen_enabled ()) {pci_create_simple (pci_bus,-1 ,"xen-platform" ); +#ifdef CONFIG_XEN_PCI_PASSTHROUGH +xen_pt_iommu_create (pci_bus); +#endif }/* init basic PC hardware */
hw/xen_iommu.c new file +191 -0
191 lines not on this page · raw message
hw/xen_pt.h +1 -0
@@ -291,6 +291,7 @@ void xen_pt_msix_delete(XenPCIPassthroughState *s);int xen_pt_msix_update (XenPCIPassthroughState *s);int xen_pt_msix_update_remap (XenPCIPassthroughState *s,int bar_index);void xen_pt_msix_disable (XenPCIPassthroughState *s); +void xen_pt_iommu_create (PCIBus *pci_bus);static inline bool xen_pt_has_msix_mapping (XenPCIPassthroughState *s,int bar) {
Signature · 1 line
1.7.4