IOMMU updates for 2.6.32-rc5
Subsystems (3)
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
PATCH 1/4 x86/amd-iommu: Workaround for erratum 63
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.
--- 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(-)
arch/x86/include/asm/amd_iommu.h +1 -0
@@ -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 ) { }
arch/x86/kernel/amd_iommu.c +2 -0
@@ -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 ;
arch/x86/kernel/amd_iommu_init.c +22 -0
@@ -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); }
Signature · 1 line
1.6.5
Re: [PATCH 1/4] x86/amd-iommu: Workaround for erratum 63
Quoted 5 lines · Joerg Roedel
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_FAULTSin my case.
This should go to comment.
arch/x86/kernel/amd_iommu_init.c static void set_dev_entry_bit(u16 devid, u8 bit) · line 524
Quoted 6 lines
arch/x86/kernel/amd_iommu_init.c +6
-0+ + +void amd_iommu_apply_erratum_63 (u16 devid) +{ +int sysmgt; +
...that should go here. Pointer to pdf with erratum would be cool, too.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 2/4 x86/amd-iommu: Un__init function required on shutdown
In reply to Joerg RoedelThe 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.
--- arch/x86/kernel/amd_iommu_init.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/amd_iommu_init.c +1 -1
@@ -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;
Signature · 1 line
1.6.5
PATCH 3/4 dma-debug: Fix compile warning with PAE enabled
In reply to Joerg RoedelWhen 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.
--- lib/dma-debug.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
lib/dma-debug.c +4 -2
@@ -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 &&
Signature · 1 line
1.6.5
PATCH 4/4 agp/amd64: Remove GART dependency on AGP_AMD64
In reply to Joerg RoedelFrom: Pavel Vasilyev <[email protected]>
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.
--- drivers/char/agp/Kconfig | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/char/agp/Kconfig +1 -2
@@ -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.
Signature · 1 line
1.6.5