Skip to contentSkip to conversation

AMD IOMMU updates for 2.6.32-rc

GIT PULL New Joerg Roedel 1 participant 3 messages Nov 23, 2009 x86

lore
Share & tools
lore
#0 lore raw

Hi Ingo,

The following changes since commit 123bf0e2eddcda36a33bdfc87aa1fb07229f07b5:
Ingo Molnar (1):
x86: gart: Clean up the code a bit

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git amd-iommu/fixes

Joerg Roedel (2):
x86/amd-iommu: un__init iommu_setup_msi x86/amd-iommu: attach devices to pre-allocated domains early

 arch/x86/kernel/amd_iommu.c      |    8 ++++++--
 arch/x86/kernel/amd_iommu_init.c |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

The first patch fixes a possible crash on resume if the compiler does not inline the iommu_setup_msi function. The second patch fixes possible I/O page faults on boot if BIOS is still using a device before the Linux driver takes it over. Please pull.

Joerg

#1 lore raw

PATCH 1/2 x86/amd-iommu: un__init iommu_setup_msi

This function may be called on the resume path and can not be dropped after booting.

---
 arch/x86/kernel/amd_iommu_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/amd_iommu_init.c +1 -1
index 0d4581e..72bdbda 100644
@@ -926,7 +926,7 @@ static int __init init_iommu_all(struct acpi_table_header *table)
  *
  ****************************************************************************/
 
-static int __init iommu_setup_msi(struct amd_iommu *iommu)
+static int iommu_setup_msi(struct amd_iommu *iommu)
 {
 	int r;
 
Signature · 1 line
1.6.5.3
#2 lore raw

PATCH 2/2 x86/amd-iommu: attach devices to pre-allocated domains early

In reply to Joerg Roedel

For some devices the ACPI table may define unity map requirements which must me met when the IOMMU is enabled. So we need to attach devices to their domains as early as possible so that these mappings are in place when needed. This patch assigns the domains right after they are allocated. Otherwise this can result in I/O page faults before a driver binds to a device and BIOS is still using it.

---
 arch/x86/kernel/amd_iommu.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/kernel/amd_iommu.c +6 -2
index 093bd52..b74b212 100644
@@ -2047,10 +2047,10 @@ static void prealloc_protection_domains(void)
 	struct pci_dev *dev = NULL;
 	struct dma_ops_domain *dma_dom;
 	struct amd_iommu *iommu;
-	u16 devid;
+	u16 devid, __devid;
 
 	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
-		devid = calc_devid(dev->bus->number, dev->devfn);
+		__devid = devid = calc_devid(dev->bus->number, dev->devfn);
 		if (devid > amd_iommu_last_bdf)
 			continue;
 		devid = amd_iommu_alias_table[devid];
@@ -2065,6 +2065,10 @@ static void prealloc_protection_domains(void)
 		init_unity_mappings_for_device(dma_dom, devid);
 		dma_dom->target_dev = devid;
 
+		attach_device(iommu, &dma_dom->domain, devid);
+		if (__devid != devid)
+			attach_device(iommu, &dma_dom->domain, __devid);
+
 		list_add_tail(&dma_dom->list, &iommu_pd_list);
 	}
 }
Signature · 1 line
1.6.5.3