diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-11-03 10:54:14 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-11-03 10:54:14 -0500 |
| commit | 1d87cff407ceddf0bc4e825949a4b1bf645418bd (patch) | |
| tree | fc099ab5881ac0822ecec83e3684cf3686715730 | |
| parent | 05154752cf3767c544b65b5e340793d40b3f1229 (diff) | |
| parent | 342688f9db392ec82ab9e6b25a6137f9ee1647d7 (diff) | |
Merge branch 'iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into x86/urgent
| -rw-r--r-- | arch/x86/include/asm/amd_iommu.h | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/amd_iommu.c | 2 | ||||
| -rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 24 | ||||
| -rw-r--r-- | lib/dma-debug.c | 6 |
4 files changed, 30 insertions, 3 deletions
diff --git a/arch/x86/include/asm/amd_iommu.h b/arch/x86/include/asm/amd_iommu.h index ac95995b7bad..4b180897e6b5 100644 --- a/arch/x86/include/asm/amd_iommu.h +++ b/arch/x86/include/asm/amd_iommu.h | |||
| @@ -31,6 +31,7 @@ extern irqreturn_t amd_iommu_int_handler(int irq, void *data); | |||
| 31 | extern void amd_iommu_flush_all_domains(void); | 31 | extern void amd_iommu_flush_all_domains(void); |
| 32 | extern void amd_iommu_flush_all_devices(void); | 32 | extern void amd_iommu_flush_all_devices(void); |
| 33 | extern void amd_iommu_shutdown(void); | 33 | extern void amd_iommu_shutdown(void); |
| 34 | extern void amd_iommu_apply_erratum_63(u16 devid); | ||
| 34 | #else | 35 | #else |
| 35 | static inline int amd_iommu_init(void) { return -ENODEV; } | 36 | static inline int amd_iommu_init(void) { return -ENODEV; } |
| 36 | static inline void amd_iommu_detect(void) { } | 37 | static inline void amd_iommu_detect(void) { } |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 98f230f6a28d..0285521e0a99 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
| @@ -1220,6 +1220,8 @@ static void __detach_device(struct protection_domain *domain, u16 devid) | |||
| 1220 | amd_iommu_dev_table[devid].data[1] = 0; | 1220 | amd_iommu_dev_table[devid].data[1] = 0; |
| 1221 | amd_iommu_dev_table[devid].data[2] = 0; | 1221 | amd_iommu_dev_table[devid].data[2] = 0; |
| 1222 | 1222 | ||
| 1223 | amd_iommu_apply_erratum_63(devid); | ||
| 1224 | |||
| 1223 | /* decrease reference counter */ | 1225 | /* decrease reference counter */ |
| 1224 | domain->dev_cnt -= 1; | 1226 | domain->dev_cnt -= 1; |
| 1225 | 1227 | ||
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index b4b61d462dcc..c20001e4f556 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) | |||
| 240 | writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET); | 240 | writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET); |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit) | 243 | static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit) |
| 244 | { | 244 | { |
| 245 | u32 ctrl; | 245 | u32 ctrl; |
| 246 | 246 | ||
| @@ -519,6 +519,26 @@ static void set_dev_entry_bit(u16 devid, u8 bit) | |||
| 519 | amd_iommu_dev_table[devid].data[i] |= (1 << _bit); | 519 | amd_iommu_dev_table[devid].data[i] |= (1 << _bit); |
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | static int get_dev_entry_bit(u16 devid, u8 bit) | ||
| 523 | { | ||
| 524 | int i = (bit >> 5) & 0x07; | ||
| 525 | int _bit = bit & 0x1f; | ||
| 526 | |||
| 527 | return (amd_iommu_dev_table[devid].data[i] & (1 << _bit)) >> _bit; | ||
| 528 | } | ||
| 529 | |||
| 530 | |||
| 531 | void amd_iommu_apply_erratum_63(u16 devid) | ||
| 532 | { | ||
| 533 | int sysmgt; | ||
| 534 | |||
| 535 | sysmgt = get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1) | | ||
| 536 | (get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2) << 1); | ||
| 537 | |||
| 538 | if (sysmgt == 0x01) | ||
| 539 | set_dev_entry_bit(devid, DEV_ENTRY_IW); | ||
| 540 | } | ||
| 541 | |||
| 522 | /* Writes the specific IOMMU for a device into the rlookup table */ | 542 | /* Writes the specific IOMMU for a device into the rlookup table */ |
| 523 | static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) | 543 | static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) |
| 524 | { | 544 | { |
| @@ -547,6 +567,8 @@ static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu, | |||
| 547 | if (flags & ACPI_DEVFLAG_LINT1) | 567 | if (flags & ACPI_DEVFLAG_LINT1) |
| 548 | set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); | 568 | set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); |
| 549 | 569 | ||
| 570 | amd_iommu_apply_erratum_63(devid); | ||
| 571 | |||
| 550 | set_iommu_for_device(iommu, devid); | 572 | set_iommu_for_device(iommu, devid); |
| 551 | } | 573 | } |
| 552 | 574 | ||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 58a9f9fc609a..ce6b7eabf674 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
| @@ -819,9 +819,11 @@ static void check_unmap(struct dma_debug_entry *ref) | |||
| 819 | err_printk(ref->dev, entry, "DMA-API: device driver frees " | 819 | err_printk(ref->dev, entry, "DMA-API: device driver frees " |
| 820 | "DMA memory with different CPU address " | 820 | "DMA memory with different CPU address " |
| 821 | "[device address=0x%016llx] [size=%llu bytes] " | 821 | "[device address=0x%016llx] [size=%llu bytes] " |
| 822 | "[cpu alloc address=%p] [cpu free address=%p]", | 822 | "[cpu alloc address=0x%016llx] " |
| 823 | "[cpu free address=0x%016llx]", | ||
| 823 | ref->dev_addr, ref->size, | 824 | ref->dev_addr, ref->size, |
| 824 | (void *)entry->paddr, (void *)ref->paddr); | 825 | (unsigned long long)entry->paddr, |
| 826 | (unsigned long long)ref->paddr); | ||
| 825 | } | 827 | } |
| 826 | 828 | ||
| 827 | if (ref->sg_call_ents && ref->type == dma_debug_sg && | 829 | if (ref->sg_call_ents && ref->type == dma_debug_sg && |
