* [GIT PULL] IOMMU updates for 2.6.32-rc5
@ 2009-10-29 16:50 Joerg Roedel
2009-10-29 16:50 ` [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63 Joerg Roedel
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Joerg Roedel @ 2009-10-29 16:50 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, iommu
Hi Ingo,
The following changes since commit 012abeea669ea49636cf952d13298bb68654146a:
Linus Torvalds (1):
Linux 2.6.32-rc5
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git iommu/fixes
Joerg Roedel (4):
x86/amd-iommu: Workaround for erratum 63
x86/amd-iommu: Un__init function required on shutdown
dma-debug: Fix compile warning with PAE enabled
Merge branches 'amd-iommu/fixes', 'dma-debug/fixes' and 'gart/fixes' into iommu/fixes
Pavel Vasilyev (1):
agp/amd64: Remove GART dependency on AGP_AMD64
arch/x86/include/asm/amd_iommu.h | 1 +
arch/x86/kernel/amd_iommu.c | 2 ++
arch/x86/kernel/amd_iommu_init.c | 24 +++++++++++++++++++++++-
drivers/char/agp/Kconfig | 3 +--
lib/dma-debug.c | 6 ++++--
5 files changed, 31 insertions(+), 5 deletions(-)
The patches contain two important fixes for the AMD IOMMU driver (one
erratum workaround and a section mismatch that only shows when the
compiler does not inline the iommu_feature_disable function).
Also included in this pull request is da dma-debug fix for a compilation
warning on 32bit with PAE enabled and a previously missed patch which
removes the build dependency between GART and AGP_AMD64 code.
Please pull.
Joerg
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63
2009-10-29 16:50 [GIT PULL] IOMMU updates for 2.6.32-rc5 Joerg Roedel
@ 2009-10-29 16:50 ` Joerg Roedel
2009-11-05 19:23 ` Pavel Machek
2009-10-29 16:50 ` [PATCH 2/4] x86/amd-iommu: Un__init function required on shutdown Joerg Roedel
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Joerg Roedel @ 2009-10-29 16:50 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, iommu, Joerg Roedel, stable
There is an erratum for IOMMU hardware which documents
undefined behavior when forwarding SMI requests from
peripherals and the DTE of that peripheral has a sysmgt
value of 01b. This problem caused weird IO_PAGE_FAULTS in my
case.
This patch implements the suggested workaround for that
erratum into the AMD IOMMU driver. The erratum is
documented with number 63.
Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/include/asm/amd_iommu.h | 1 +
arch/x86/kernel/amd_iommu.c | 2 ++
arch/x86/kernel/amd_iommu_init.c | 22 ++++++++++++++++++++++
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/amd_iommu.h b/arch/x86/include/asm/amd_iommu.h
index bdf96f1..9dbd403 100644
--- a/arch/x86/include/asm/amd_iommu.h
+++ b/arch/x86/include/asm/amd_iommu.h
@@ -30,6 +30,7 @@ extern irqreturn_t amd_iommu_int_handler(int irq, void *data);
extern void amd_iommu_flush_all_domains(void);
extern void amd_iommu_flush_all_devices(void);
extern void amd_iommu_shutdown(void);
+extern void amd_iommu_apply_erratum_63(u16 devid);
#else
static inline int amd_iommu_init(void) { return -ENODEV; }
static inline void amd_iommu_detect(void) { }
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 6c99f50..f95dfe5 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1114,6 +1114,8 @@ static void __detach_device(struct protection_domain *domain, u16 devid)
amd_iommu_dev_table[devid].data[1] = 0;
amd_iommu_dev_table[devid].data[2] = 0;
+ amd_iommu_apply_erratum_63(devid);
+
/* decrease reference counter */
domain->dev_cnt -= 1;
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index c1b17e9..498c8c7 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -509,6 +509,26 @@ static void set_dev_entry_bit(u16 devid, u8 bit)
amd_iommu_dev_table[devid].data[i] |= (1 << _bit);
}
+static int get_dev_entry_bit(u16 devid, u8 bit)
+{
+ int i = (bit >> 5) & 0x07;
+ int _bit = bit & 0x1f;
+
+ return (amd_iommu_dev_table[devid].data[i] & (1 << _bit)) >> _bit;
+}
+
+
+void amd_iommu_apply_erratum_63(u16 devid)
+{
+ int sysmgt;
+
+ sysmgt = get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1) |
+ (get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2) << 1);
+
+ if (sysmgt == 0x01)
+ set_dev_entry_bit(devid, DEV_ENTRY_IW);
+}
+
/* Writes the specific IOMMU for a device into the rlookup table */
static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid)
{
@@ -537,6 +557,8 @@ static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu,
if (flags & ACPI_DEVFLAG_LINT1)
set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS);
+ amd_iommu_apply_erratum_63(devid);
+
set_iommu_for_device(iommu, devid);
}
--
1.6.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] x86/amd-iommu: Un__init function required on shutdown
2009-10-29 16:50 [GIT PULL] IOMMU updates for 2.6.32-rc5 Joerg Roedel
2009-10-29 16:50 ` [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63 Joerg Roedel
@ 2009-10-29 16:50 ` Joerg Roedel
2009-10-29 16:50 ` [PATCH 3/4] dma-debug: Fix compile warning with PAE enabled Joerg Roedel
2009-10-29 16:50 ` [PATCH 4/4] agp/amd64: Remove GART dependency on AGP_AMD64 Joerg Roedel
3 siblings, 0 replies; 6+ messages in thread
From: Joerg Roedel @ 2009-10-29 16:50 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, iommu, Joerg Roedel, stable
The function iommu_feature_disable is required on system
shutdown to disable the IOMMU but it is marked as __init.
This may result in a panic if the memory is reused. This
patch fixes this bug.
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 498c8c7..1e423b2 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -240,7 +240,7 @@ static void iommu_feature_enable(struct amd_iommu *iommu, u8 bit)
writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
}
-static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
+static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
{
u32 ctrl;
--
1.6.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] dma-debug: Fix compile warning with PAE enabled
2009-10-29 16:50 [GIT PULL] IOMMU updates for 2.6.32-rc5 Joerg Roedel
2009-10-29 16:50 ` [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63 Joerg Roedel
2009-10-29 16:50 ` [PATCH 2/4] x86/amd-iommu: Un__init function required on shutdown Joerg Roedel
@ 2009-10-29 16:50 ` Joerg Roedel
2009-10-29 16:50 ` [PATCH 4/4] agp/amd64: Remove GART dependency on AGP_AMD64 Joerg Roedel
3 siblings, 0 replies; 6+ messages in thread
From: Joerg Roedel @ 2009-10-29 16:50 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, iommu, Joerg Roedel
When PAE is enabled in the kernel configuration the size of
phys_addr_t differs from the size of a void pointer. The gcc
prints a warning about that in dma-debug code.
This patch fixes the warning by converting the output to
unsigned long long instead of a pointer.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
lib/dma-debug.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 58a9f9f..ce6b7ea 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -819,9 +819,11 @@ static void check_unmap(struct dma_debug_entry *ref)
err_printk(ref->dev, entry, "DMA-API: device driver frees "
"DMA memory with different CPU address "
"[device address=0x%016llx] [size=%llu bytes] "
- "[cpu alloc address=%p] [cpu free address=%p]",
+ "[cpu alloc address=0x%016llx] "
+ "[cpu free address=0x%016llx]",
ref->dev_addr, ref->size,
- (void *)entry->paddr, (void *)ref->paddr);
+ (unsigned long long)entry->paddr,
+ (unsigned long long)ref->paddr);
}
if (ref->sg_call_ents && ref->type == dma_debug_sg &&
--
1.6.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] agp/amd64: Remove GART dependency on AGP_AMD64
2009-10-29 16:50 [GIT PULL] IOMMU updates for 2.6.32-rc5 Joerg Roedel
` (2 preceding siblings ...)
2009-10-29 16:50 ` [PATCH 3/4] dma-debug: Fix compile warning with PAE enabled Joerg Roedel
@ 2009-10-29 16:50 ` Joerg Roedel
3 siblings, 0 replies; 6+ messages in thread
From: Joerg Roedel @ 2009-10-29 16:50 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, iommu, Pavel Vasilyev, Dave Jones, Joerg Roedel
From: Pavel Vasilyev <pavel@pavlinux.ru>
The GART IOMMU code has no strong dependency to the AMD64
AGP code. So the automatic selection of AGP_AMD64 for GART
can be removed.
Cc: Dave Jones <davej@redhat.com>
Signed-off-by: Pavel Vasilyev <pavel@pavlinux.ru>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
drivers/char/agp/Kconfig | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index ccb1fa8..2fb3a48 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -56,9 +56,8 @@ config AGP_AMD
X on AMD Irongate, 761, and 762 chipsets.
config AGP_AMD64
- tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
+ tristate "AMD Opteron/Athlon64 on-CPU GART support"
depends on AGP && X86
- default y if GART_IOMMU
help
This option gives you AGP support for the GLX component of
X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
--
1.6.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63
2009-10-29 16:50 ` [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63 Joerg Roedel
@ 2009-11-05 19:23 ` Pavel Machek
0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2009-11-05 19:23 UTC (permalink / raw)
To: Joerg Roedel; +Cc: Ingo Molnar, linux-kernel, iommu, stable
On Thu 2009-10-29 17:50:09, Joerg Roedel wrote:
> There is an erratum for IOMMU hardware which documents
> undefined behavior when forwarding SMI requests from
> peripherals and the DTE of that peripheral has a sysmgt
> value of 01b. This problem caused weird IO_PAGE_FAULTS in my
> case.
This should go to comment.
> +
> +
> +void amd_iommu_apply_erratum_63(u16 devid)
> +{
> + int sysmgt;
> +
...that should go here. Pointer to pdf with erratum would be cool,
too.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-05 19:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 16:50 [GIT PULL] IOMMU updates for 2.6.32-rc5 Joerg Roedel
2009-10-29 16:50 ` [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63 Joerg Roedel
2009-11-05 19:23 ` Pavel Machek
2009-10-29 16:50 ` [PATCH 2/4] x86/amd-iommu: Un__init function required on shutdown Joerg Roedel
2009-10-29 16:50 ` [PATCH 3/4] dma-debug: Fix compile warning with PAE enabled Joerg Roedel
2009-10-29 16:50 ` [PATCH 4/4] agp/amd64: Remove GART dependency on AGP_AMD64 Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox