LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/4] amd-iommu fixes for 2.6.31
@ 2009-05-22 12:06 Joerg Roedel
2009-05-22 12:06 ` [PATCH 1/4] amd-iommu: fix an off-by-one error in the AMD IOMMU driver Joerg Roedel
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Joerg Roedel @ 2009-05-22 12:06 UTC (permalink / raw)
To: iommu, linux-kernel
This small patchset contain the fixes for the AMD IOMMU driver in the
Linux kernel I have queued up for 2.6.31. Please review.
diffstat:
arch/x86/kernel/amd_iommu.c | 6 +++++-
arch/x86/kernel/amd_iommu_init.c | 6 ++++--
2 files changed, 9 insertions(+), 3 deletions(-)
shortlog:
Chris Wright (1):
amd iommu: properly detach from protection domain on ->remove
Joerg Roedel (1):
amd-iommu: make sure only ivmd entries are parsed
Neil Turton (2):
amd-iommu: fix an off-by-one error in the AMD IOMMU driver.
amd-iommu: fix the handling of device aliases in the AMD IOMMU driver.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] amd-iommu: fix an off-by-one error in the AMD IOMMU driver.
2009-05-22 12:06 [PATCH 0/4] amd-iommu fixes for 2.6.31 Joerg Roedel
@ 2009-05-22 12:06 ` Joerg Roedel
2009-05-22 12:06 ` [PATCH 2/4] amd-iommu: fix the handling of device aliases " Joerg Roedel
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2009-05-22 12:06 UTC (permalink / raw)
To: iommu, linux-kernel; +Cc: Neil Turton, Joerg Roedel
From: Neil Turton <nturton@solarflare.com>
[ impact: bugfix ]
The variable amd_iommu_last_bdf holds the maximum bdf of any device
controlled by an IOMMU, so the number of device entries needed is
amd_iommu_last_bdf+1. The function tbl_size used amd_iommu_last_bdf
instead. This would be a problem if the last device were a large
enough power of 2.
Signed-off-by: Neil Turton <nturton@solarflare.com>
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 8c0be09..35fc965 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -175,7 +175,7 @@ static inline void update_last_devid(u16 devid)
static inline unsigned long tbl_size(int entry_size)
{
unsigned shift = PAGE_SHIFT +
- get_order(amd_iommu_last_bdf * entry_size);
+ get_order(((int)amd_iommu_last_bdf + 1) * entry_size);
return 1UL << shift;
}
--
1.6.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] amd-iommu: fix the handling of device aliases in the AMD IOMMU driver.
2009-05-22 12:06 [PATCH 0/4] amd-iommu fixes for 2.6.31 Joerg Roedel
2009-05-22 12:06 ` [PATCH 1/4] amd-iommu: fix an off-by-one error in the AMD IOMMU driver Joerg Roedel
@ 2009-05-22 12:06 ` Joerg Roedel
2009-05-22 12:06 ` [PATCH 3/4] amd-iommu: make sure only ivmd entries are parsed Joerg Roedel
2009-05-22 12:06 ` [PATCH 4/4] amd iommu: properly detach from protection domain on ->remove Joerg Roedel
3 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2009-05-22 12:06 UTC (permalink / raw)
To: iommu, linux-kernel; +Cc: Neil Turton, Joerg Roedel
From: Neil Turton <nturton@solarflare.com>
[ impact: set flags for the right req-id in the device table ]
The devid parameter to set_dev_entry_from_acpi is the requester ID
rather than the device ID since it is used to index the IOMMU device
table. The handling of IVHD_DEV_ALIAS used to pass the device ID.
This patch fixes it to pass the requester ID.
Signed-off-by: Neil Turton <nturton@solarflare.com>
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 35fc965..53f93db 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -618,7 +618,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
case IVHD_DEV_ALIAS:
devid = e->devid;
devid_to = e->ext >> 8;
- set_dev_entry_from_acpi(iommu, devid, e->flags, 0);
+ set_dev_entry_from_acpi(iommu, devid_to, e->flags, 0);
amd_iommu_alias_table[devid] = devid_to;
break;
case IVHD_DEV_ALIAS_RANGE:
--
1.6.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] amd-iommu: make sure only ivmd entries are parsed
2009-05-22 12:06 [PATCH 0/4] amd-iommu fixes for 2.6.31 Joerg Roedel
2009-05-22 12:06 ` [PATCH 1/4] amd-iommu: fix an off-by-one error in the AMD IOMMU driver Joerg Roedel
2009-05-22 12:06 ` [PATCH 2/4] amd-iommu: fix the handling of device aliases " Joerg Roedel
@ 2009-05-22 12:06 ` Joerg Roedel
2009-05-22 12:06 ` [PATCH 4/4] amd iommu: properly detach from protection domain on ->remove Joerg Roedel
3 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2009-05-22 12:06 UTC (permalink / raw)
To: iommu, linux-kernel; +Cc: Joerg Roedel
[ impact: protect against broken ivrs acpi table ]
The bug never triggered. But it should be fixed to protect against
broken ACPI tables in the future.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kernel/amd_iommu_init.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 53f93db..a3a2b98 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -906,6 +906,8 @@ static int __init init_unity_map_range(struct ivmd_header *m)
switch (m->type) {
default:
+ kfree(e);
+ return 0;
case ACPI_IVMD_TYPE:
e->devid_start = e->devid_end = m->devid;
break;
--
1.6.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] amd iommu: properly detach from protection domain on ->remove
2009-05-22 12:06 [PATCH 0/4] amd-iommu fixes for 2.6.31 Joerg Roedel
` (2 preceding siblings ...)
2009-05-22 12:06 ` [PATCH 3/4] amd-iommu: make sure only ivmd entries are parsed Joerg Roedel
@ 2009-05-22 12:06 ` Joerg Roedel
3 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2009-05-22 12:06 UTC (permalink / raw)
To: iommu, linux-kernel; +Cc: Chris Wright, Chris Wright, Joerg Roedel
From: Chris Wright <chrisw@sous-sol.org>
[ impact: bugfix ]
Some drivers may use the dma api during ->remove which will
cause a protection domain to get reattached to a device. Delay the
detach until after the driver is completely unbound.
[ joro: added a little merge helper ]
Signed-off-by: Chris Wright <chrisw@redhat.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kernel/amd_iommu.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index a97db99..d689883 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -57,6 +57,10 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
static struct dma_ops_domain *find_protection_domain(u16 devid);
+#ifndef BUS_NOTIFY_UNBOUND_DRIVER
+#define BUS_NOTIFY_UNBOUND_DRIVER 0x0005
+#endif
+
#ifdef CONFIG_AMD_IOMMU_STATS
/*
@@ -1012,7 +1016,7 @@ static int device_change_notifier(struct notifier_block *nb,
printk(KERN_INFO "AMD IOMMU: Using protection domain %d for "
"device %s\n", dma_domain->domain.id, dev_name(dev));
break;
- case BUS_NOTIFY_UNBIND_DRIVER:
+ case BUS_NOTIFY_UNBOUND_DRIVER:
if (!domain)
goto out;
detach_device(domain, devid);
--
1.6.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-22 12:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-22 12:06 [PATCH 0/4] amd-iommu fixes for 2.6.31 Joerg Roedel
2009-05-22 12:06 ` [PATCH 1/4] amd-iommu: fix an off-by-one error in the AMD IOMMU driver Joerg Roedel
2009-05-22 12:06 ` [PATCH 2/4] amd-iommu: fix the handling of device aliases " Joerg Roedel
2009-05-22 12:06 ` [PATCH 3/4] amd-iommu: make sure only ivmd entries are parsed Joerg Roedel
2009-05-22 12:06 ` [PATCH 4/4] amd iommu: properly detach from protection domain on ->remove Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).