From: Bhavna Sarathy <bnagendr@redhat.com> Date: Thu, 22 Oct 2009 20:00:02 -0400 Subject: [xen] iommu: move iommu_setup() to setup ioapic correctly Message-id: <20091022200223.3419.49256.sendpatchset@localhost.localdomain> Patchwork-id: 21200 O-Subject: [RHEL5.5 PATCH 1/5] Move iommu_setup() to setup IOAPIC correctly Bugzilla: 518474 526766 RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> RH-Acked-by: Christopher Lalancette <clalance@redhat.com> Move iommu_setup() ahead, before we begin to use IOAPIC, prior to enabling interrupt remapping. Upstream c/s 20168: only the setup portion is taken from this VT-d c/s Resolves BZ 526766 and 518474 diff --git a/arch/x86/setup.c b/arch/x86/setup.c index 2f0204f..861c855 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -955,6 +955,8 @@ void __init __start_xen(unsigned long mbi_p) if ( opt_nosmp ) max_cpus = 0; + iommu_setup(); + smp_prepare_cpus(max_cpus); /* diff --git a/drivers/passthrough/iommu.c b/drivers/passthrough/iommu.c index 0cd3aa9..6f88364 100644 --- a/drivers/passthrough/iommu.c +++ b/drivers/passthrough/iommu.c @@ -188,7 +188,7 @@ int deassign_device(struct domain *d, u8 bus, u8 devfn) return hd->platform_ops->reassign_device(d, dom0, bus, devfn); } -static int iommu_setup(void) +int iommu_setup(void) { int rc = -ENODEV; @@ -206,7 +206,6 @@ static int iommu_setup(void) printk("I/O virtualisation %sabled\n", iommu_enabled ? "en" : "dis"); return rc; } -__initcall(iommu_setup); int iommu_get_device_group(struct domain *d, u8 bus, u8 devfn, XEN_GUEST_HANDLE_64(uint32_t) buf, int max_sdevs) diff --git a/include/xen/iommu.h b/include/xen/iommu.h index 19f21c5..fac578c 100644 --- a/include/xen/iommu.h +++ b/include/xen/iommu.h @@ -57,6 +57,8 @@ struct iommu { struct intel_iommu *intel; }; +int iommu_setup(void); + int iommu_add_device(struct pci_dev *pdev); int iommu_remove_device(struct pci_dev *pdev); int iommu_domain_init(struct domain *d);