mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [git pull] AMD IOMMU updates for 2.6.32-rc
@ 2009-11-23 13:49 Joerg Roedel
  2009-11-23 13:49 ` [PATCH 1/2] x86/amd-iommu: un__init iommu_setup_msi Joerg Roedel
  2009-11-23 13:49 ` [PATCH 2/2] x86/amd-iommu: attach devices to pre-allocated domains early Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Joerg Roedel @ 2009-11-23 13:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86, linux-kernel, iommu

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] x86/amd-iommu: un__init iommu_setup_msi
  2009-11-23 13:49 [git pull] AMD IOMMU updates for 2.6.32-rc Joerg Roedel
@ 2009-11-23 13:49 ` Joerg Roedel
  2009-11-23 13:49 ` [PATCH 2/2] x86/amd-iommu: attach devices to pre-allocated domains early Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2009-11-23 13:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86, linux-kernel, iommu, Joerg Roedel, stable

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

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kernel/amd_iommu_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 0d4581e..72bdbda 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -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;
 
-- 
1.6.5.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] x86/amd-iommu: attach devices to pre-allocated domains early
  2009-11-23 13:49 [git pull] AMD IOMMU updates for 2.6.32-rc Joerg Roedel
  2009-11-23 13:49 ` [PATCH 1/2] x86/amd-iommu: un__init iommu_setup_msi Joerg Roedel
@ 2009-11-23 13:49 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2009-11-23 13:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86, linux-kernel, iommu, Joerg Roedel, stable

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.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kernel/amd_iommu.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 093bd52..b74b212 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -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);
 	}
 }
-- 
1.6.5.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-23 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-23 13:49 [git pull] AMD IOMMU updates for 2.6.32-rc Joerg Roedel
2009-11-23 13:49 ` [PATCH 1/2] x86/amd-iommu: un__init iommu_setup_msi Joerg Roedel
2009-11-23 13:49 ` [PATCH 2/2] x86/amd-iommu: attach devices to pre-allocated domains early Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®