Skip to content

Commit

Permalink
x86/amd-iommu: enable iommu before attaching devices
Browse files Browse the repository at this point in the history
Hit another kdump problem as reported by Neil Horman.  When initializaing
the IOMMU, we attach devices to their domains before the IOMMU is
fully (re)initialized.  Attaching a device will issue some important
invalidations.  In the context of the newly kexec'd kdump kernel, the
IOMMU may have stale cached data from the original kernel.  Because we
do the attach too early, the invalidation commands are placed in the new
command buffer before the IOMMU is updated w/ that buffer.  This leaves
the stale entries in the kdump context and can renders device unusable.
Simply enable the IOMMU before we do the attach.

Cc: stable@kernel.org
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Chris Wright authored and Joerg Roedel committed Apr 7, 2010
1 parent 8b408fe commit 75f6653
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/kernel/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,8 @@ static int __init amd_iommu_init(void)
if (ret)
goto free;

enable_iommus();

if (iommu_pass_through)
ret = amd_iommu_init_passthrough();
else
Expand All @@ -1316,8 +1318,6 @@ static int __init amd_iommu_init(void)

amd_iommu_init_notifier();

enable_iommus();

if (iommu_pass_through)
goto out;

Expand All @@ -1331,6 +1331,7 @@ static int __init amd_iommu_init(void)
return ret;

free:
disable_iommus();

amd_iommu_uninit_devices();

Expand Down

0 comments on commit 75f6653

Please sign in to comment.