* [git pull] AMD IOMMU fixes for 2.6.33
@ 2009-12-10 11:55 Joerg Roedel
2009-12-10 11:55 ` [PATCH 1/2] x86/amd-iommu: Fix passthrough mode Joerg Roedel
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Joerg Roedel @ 2009-12-10 11:55 UTC (permalink / raw)
To: Ingo Molnar; +Cc: iommu, linux-kernel
Hi Ingo,
The following changes since commit 4528752f49c1f4025473d12bc5fa9181085c3f22:
Darrick J. Wong (1):
x86, Calgary IOMMU quirk: Find nearest matching Calgary while walking up the PCI tree
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git amd-iommu/fixes
Joerg Roedel (2):
x86/amd-iommu: Fix passthrough mode
x86/amd-iommu: Fix PCI hotplug with passthrough mode
arch/x86/include/asm/amd_iommu_proto.h | 4 ++-
arch/x86/kernel/amd_iommu.c | 46 +++++++++++++++++++++++++++++---
arch/x86/kernel/amd_iommu_init.c | 9 ++++++
3 files changed, 54 insertions(+), 5 deletions(-)
The data structure changes introduced a regression when the IOMMU runs in
passthrough mode. These updates fix these regressions. Please pull.
Joerg
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] x86/amd-iommu: Fix passthrough mode
2009-12-10 11:55 [git pull] AMD IOMMU fixes for 2.6.33 Joerg Roedel
@ 2009-12-10 11:55 ` Joerg Roedel
2009-12-10 11:55 ` [PATCH 2/2] x86/amd-iommu: Fix PCI hotplug with " Joerg Roedel
2009-12-10 13:25 ` [git pull] AMD IOMMU fixes for 2.6.33 Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2009-12-10 11:55 UTC (permalink / raw)
To: Ingo Molnar; +Cc: iommu, linux-kernel, Joerg Roedel
The data structure changes to use dev->archdata.iommu field
broke the iommu=pt mode because in this case the
dev->archdata.iommu was left uninitialized. This moves the
inititalization of the devices into the main init function
and fixes the problem.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/include/asm/amd_iommu_proto.h | 3 +-
arch/x86/kernel/amd_iommu.c | 39 ++++++++++++++++++++++++++++++-
arch/x86/kernel/amd_iommu_init.c | 7 +++++
3 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/amd_iommu_proto.h b/arch/x86/include/asm/amd_iommu_proto.h
index 84786fb..2566e26 100644
--- a/arch/x86/include/asm/amd_iommu_proto.h
+++ b/arch/x86/include/asm/amd_iommu_proto.h
@@ -28,7 +28,8 @@ extern void amd_iommu_flush_all_domains(void);
extern void amd_iommu_flush_all_devices(void);
extern void amd_iommu_apply_erratum_63(u16 devid);
extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
-
+extern int amd_iommu_init_devices(void);
+extern void amd_iommu_uninit_devices(void);
#ifndef CONFIG_AMD_IOMMU_STATS
static inline void amd_iommu_stats_init(void) { }
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 32fb091..450dd6a 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -166,6 +166,43 @@ static void iommu_uninit_device(struct device *dev)
{
kfree(dev->archdata.iommu);
}
+
+void __init amd_iommu_uninit_devices(void)
+{
+ struct pci_dev *pdev = NULL;
+
+ for_each_pci_dev(pdev) {
+
+ if (!check_device(&pdev->dev))
+ continue;
+
+ iommu_uninit_device(&pdev->dev);
+ }
+}
+
+int __init amd_iommu_init_devices(void)
+{
+ struct pci_dev *pdev = NULL;
+ int ret = 0;
+
+ for_each_pci_dev(pdev) {
+
+ if (!check_device(&pdev->dev))
+ continue;
+
+ ret = iommu_init_device(&pdev->dev);
+ if (ret)
+ goto out_free;
+ }
+
+ return 0;
+
+out_free:
+
+ amd_iommu_uninit_devices();
+
+ return ret;
+}
#ifdef CONFIG_AMD_IOMMU_STATS
/*
@@ -2145,8 +2182,6 @@ static void prealloc_protection_domains(void)
if (!check_device(&dev->dev))
continue;
- iommu_init_device(&dev->dev);
-
/* Is there already any domain for it? */
if (domain_for_device(&dev->dev))
continue;
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 7ffc399..df01c69 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -1274,6 +1274,10 @@ static int __init amd_iommu_init(void)
if (ret)
goto free;
+ ret = amd_iommu_init_devices();
+ if (ret)
+ goto free;
+
if (iommu_pass_through)
ret = amd_iommu_init_passthrough();
else
@@ -1296,6 +1300,9 @@ out:
return ret;
free:
+
+ amd_iommu_uninit_devices();
+
free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
get_order(MAX_DOMAIN_ID/8));
--
1.6.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] x86/amd-iommu: Fix PCI hotplug with passthrough mode
2009-12-10 11:55 [git pull] AMD IOMMU fixes for 2.6.33 Joerg Roedel
2009-12-10 11:55 ` [PATCH 1/2] x86/amd-iommu: Fix passthrough mode Joerg Roedel
@ 2009-12-10 11:55 ` Joerg Roedel
2009-12-10 13:25 ` [git pull] AMD IOMMU fixes for 2.6.33 Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2009-12-10 11:55 UTC (permalink / raw)
To: Ingo Molnar; +Cc: iommu, linux-kernel, Joerg Roedel
The device change notifier is initialized in the dma_ops
initialization path. But this path is never executed for
iommu=pt. Move the notifier initialization to IOMMU hardware
init code to fix this.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/include/asm/amd_iommu_proto.h | 1 +
arch/x86/kernel/amd_iommu.c | 7 +++++--
arch/x86/kernel/amd_iommu_init.c | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/amd_iommu_proto.h b/arch/x86/include/asm/amd_iommu_proto.h
index 2566e26..4d817f9 100644
--- a/arch/x86/include/asm/amd_iommu_proto.h
+++ b/arch/x86/include/asm/amd_iommu_proto.h
@@ -30,6 +30,7 @@ extern void amd_iommu_apply_erratum_63(u16 devid);
extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
extern int amd_iommu_init_devices(void);
extern void amd_iommu_uninit_devices(void);
+extern void amd_iommu_init_notifier(void);
#ifndef CONFIG_AMD_IOMMU_STATS
static inline void amd_iommu_stats_init(void) { }
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 450dd6a..a831850 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1624,6 +1624,11 @@ static struct notifier_block device_nb = {
.notifier_call = device_change_notifier,
};
+void amd_iommu_init_notifier(void)
+{
+ bus_register_notifier(&pci_bus_type, &device_nb);
+}
+
/*****************************************************************************
*
* The next functions belong to the dma_ops mapping/unmapping code.
@@ -2250,8 +2255,6 @@ int __init amd_iommu_init_dma_ops(void)
register_iommu(&amd_iommu_ops);
- bus_register_notifier(&pci_bus_type, &device_nb);
-
amd_iommu_stats_init();
return 0;
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index df01c69..309a52f 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -1285,6 +1285,8 @@ static int __init amd_iommu_init(void)
if (ret)
goto free;
+ amd_iommu_init_notifier();
+
enable_iommus();
if (iommu_pass_through)
--
1.6.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [git pull] AMD IOMMU fixes for 2.6.33
2009-12-10 11:55 [git pull] AMD IOMMU fixes for 2.6.33 Joerg Roedel
2009-12-10 11:55 ` [PATCH 1/2] x86/amd-iommu: Fix passthrough mode Joerg Roedel
2009-12-10 11:55 ` [PATCH 2/2] x86/amd-iommu: Fix PCI hotplug with " Joerg Roedel
@ 2009-12-10 13:25 ` Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-12-10 13:25 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel
* Joerg Roedel <joerg.roedel@amd.com> wrote:
> Hi Ingo,
>
> The following changes since commit 4528752f49c1f4025473d12bc5fa9181085c3f22:
> Darrick J. Wong (1):
> x86, Calgary IOMMU quirk: Find nearest matching Calgary while walking up the PCI tree
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git amd-iommu/fixes
>
> Joerg Roedel (2):
> x86/amd-iommu: Fix passthrough mode
> x86/amd-iommu: Fix PCI hotplug with passthrough mode
>
> arch/x86/include/asm/amd_iommu_proto.h | 4 ++-
> arch/x86/kernel/amd_iommu.c | 46 +++++++++++++++++++++++++++++---
> arch/x86/kernel/amd_iommu_init.c | 9 ++++++
> 3 files changed, 54 insertions(+), 5 deletions(-)
>
> The data structure changes introduced a regression when the IOMMU runs in
> passthrough mode. These updates fix these regressions. Please pull.
Pulled, thanks a lot Joerg!
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-10 13:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-10 11:55 [git pull] AMD IOMMU fixes for 2.6.33 Joerg Roedel
2009-12-10 11:55 ` [PATCH 1/2] x86/amd-iommu: Fix passthrough mode Joerg Roedel
2009-12-10 11:55 ` [PATCH 2/2] x86/amd-iommu: Fix PCI hotplug with " Joerg Roedel
2009-12-10 13:25 ` [git pull] AMD IOMMU fixes for 2.6.33 Ingo Molnar
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).