Skip to contentSkip to conversation

AMD IOMMU updates for 2.6.37

GIT PULL New Joerg Roedel 2 participants 4 messages Oct 13, 2010 x86

lore
Share & tools
lore
#0 lore raw

Hi Ingo,

The following changes since commit 899611ee7d373e5eeda08e9a8632684e1ebbbf00:
Linus Torvalds (1):

        Linux 2.6.36-rc6

are available in the git repository at:

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

Joerg Roedel (1):
x86/amd-iommu: Update copyright headers

Matthew Garrett (1):
x86/amd-iommu: Reenable AMD IOMMU if it's mysteriously vanished over suspend

 arch/x86/include/asm/amd_iommu.h       |    2 +-
 arch/x86/include/asm/amd_iommu_proto.h |    2 +-
 arch/x86/include/asm/amd_iommu_types.h |   23 ++++--
 arch/x86/kernel/amd_iommu.c            |    2 +-
 arch/x86/kernel/amd_iommu_init.c       |  124 ++++++++++++++++++++++++++++----
 5 files changed, 128 insertions(+), 25 deletions(-)

This update is mostly about a workaround for BIOS problems with AMD IOMMU when resuming from S3. The BIOS on an AMD IOMMU capable machine might be buggy so that the IOMMU device is not re-enabled on resume. The patch from Matthew implement a workaround for this problem by manually re-enabling an re-programming the IOMMU device on resume. Please pull.

Joerg

#1 lore raw

PATCH 1/2 x86/amd-iommu: Reenable AMD IOMMU if it's mysteriously vanished over suspend

From: Matthew Garrett <[email protected]>

AMD's reference BIOS code had a bug that could result in the firmware failing to reenable the iommu on resume. It transpires that this causes certain less than desirable behaviour when it comes to PCI accesses, to whit them ending up somewhere near Bristol when the more desirable outcome was Edinburgh. Sadness ensues, perhaps along with filesystem corruption. Let's make sure that it gets turned back on, and that we restore its configuration so decisions it makes bear some resemblance to those made by reasonable people rather than crack-addled lemurs who spent all your DMA on Thunderbird.

---
 arch/x86/include/asm/amd_iommu_types.h |   21 ++++--
 arch/x86/kernel/amd_iommu_init.c       |  122 ++++++++++++++++++++++++++++----
 2 files changed, 123 insertions(+), 20 deletions(-)
arch/x86/include/asm/amd_iommu_types.h +15 -6
index 0861618..bdd20c8 100644
@@ -416,13 +416,22 @@ struct amd_iommu {
 	struct dma_ops_domain *default_dom;
 
 	/*
-	 * This array is required to work around a potential BIOS bug.
-	 * The BIOS may miss to restore parts of the PCI configuration
-	 * space when the system resumes from S3. The result is that the
-	 * IOMMU does not execute commands anymore which leads to system
-	 * failure.
+	 * We can't rely on the BIOS to restore all values on reinit, so we
+	 * need to stash them
 	 */
-	u32 cache_cfg[4];
+
+	/* The iommu BAR */
+	u32 stored_addr_lo;
+	u32 stored_addr_hi;
+
+	/*
+	 * Each iommu has 6 l1s, each of which is documented as having 0x12
+	 * registers
+	 */
+	u32 stored_l1[6][0x12];
+
+	/* The l2 indirect registers */
+	u32 stored_l2[0x83];
 };
 
 /*
arch/x86/kernel/amd_iommu_init.c +108 -14

159 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 x86/amd-iommu: Update copyright headers

In reply to Joerg Roedel

This patch updates the copyright headers in all source files of the AMD IOMMU driver.

---
 arch/x86/include/asm/amd_iommu.h       |    2 +-
 arch/x86/include/asm/amd_iommu_proto.h |    2 +-
 arch/x86/include/asm/amd_iommu_types.h |    2 +-
 arch/x86/kernel/amd_iommu.c            |    2 +-
 arch/x86/kernel/amd_iommu_init.c       |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/include/asm/amd_iommu.h +1 -1
index 5af2982..f16a2ca 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Advanced Micro Devices, Inc.
+ * Copyright (C) 2007-2010 Advanced Micro Devices, Inc.
  * Author: Joerg Roedel <[email protected]>
  *         Leo Duran <[email protected]>
  *
arch/x86/include/asm/amd_iommu_proto.h +1 -1
index cb03037..916bc81 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Advanced Micro Devices, Inc.
+ * Copyright (C) 2009-2010 Advanced Micro Devices, Inc.
  * Author: Joerg Roedel <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify it
arch/x86/include/asm/amd_iommu_types.h +1 -1
index bdd20c8..e3509fc 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Advanced Micro Devices, Inc.
+ * Copyright (C) 2007-2010 Advanced Micro Devices, Inc.
  * Author: Joerg Roedel <[email protected]>
  *         Leo Duran <[email protected]>
  *
arch/x86/kernel/amd_iommu.c +1 -1
index 679b645..d2fdb08 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Advanced Micro Devices, Inc.
+ * Copyright (C) 2007-2010 Advanced Micro Devices, Inc.
  * Author: Joerg Roedel <[email protected]>
  *         Leo Duran <[email protected]>
  *
arch/x86/kernel/amd_iommu_init.c +1 -1
index 44710d8..3cb482e 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Advanced Micro Devices, Inc.
+ * Copyright (C) 2007-2010 Advanced Micro Devices, Inc.
  * Author: Joerg Roedel <[email protected]>
  *         Leo Duran <[email protected]>
  *
Signature · 1 line
1.7.0.4
#3 lore raw
In reply to Joerg Roedel
Quoted 23 lines · Joerg Roedel

Hi Ingo,

The following changes since commit 899611ee7d373e5eeda08e9a8632684e1ebbbf00:
Linus Torvalds (1):

        Linux 2.6.36-rc6

are available in the git repository at:

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

Joerg Roedel (1):
x86/amd-iommu: Update copyright headers

Matthew Garrett (1):
x86/amd-iommu: Reenable AMD IOMMU if it's mysteriously vanished over suspend

 arch/x86/include/asm/amd_iommu.h       |    2 +-
 arch/x86/include/asm/amd_iommu_proto.h |    2 +-
 arch/x86/include/asm/amd_iommu_types.h |   23 ++++--
 arch/x86/kernel/amd_iommu.c            |    2 +-
 arch/x86/kernel/amd_iommu_init.c       |  124 ++++++++++++++++++++++++++++----
 5 files changed, 128 insertions(+), 25 deletions(-)
Quoted 6 lines

This update is mostly about a workaround for BIOS problems with AMD IOMMU when resuming from S3. The BIOS on an AMD IOMMU capable machine might be buggy so that the IOMMU device is not re-enabled on resume. The patch from Matthew implement a workaround for this problem by manually re-enabling an re-programming the IOMMU device on resume. Please pull.

Pulled, thanks a lot Joerg!

Ingo