mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Chris Wright <chrisw@sous-sol.org>,
	stable@kernel.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 3/4] x86/amd-iommu: Pt mode fix for domain_destroy
Date: Mon, 1 Mar 2010 14:24:41 +0100	[thread overview]
Message-ID: <1267449882-1415-4-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1267449882-1415-1-git-send-email-joerg.roedel@amd.com>

From: Chris Wright <chrisw@sous-sol.org>

After a guest is shutdown, assigned devices are not properly
returned to the pt domain.  This can leave the device using
stale cached IOMMU data, and result in a non-functional
device after it's re-bound to the host driver.  For example,
I see this upon rebinding:

 AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8000 flags=0x0050]
 AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8040 flags=0x0050]
 AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8080 flags=0x0050]
 AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a80c0 flags=0x0050]
 0000:02:00.0: eth2: Detected Hardware Unit Hang:
 ...

The amd_iommu_destroy_domain() function calls do_detach()
which doesn't reattach the pt domain to the device.
Use __detach_device() instead.

Cc: stable@kernel.org
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kernel/amd_iommu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index b97f2f1..0c04254 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -2298,7 +2298,7 @@ static void cleanup_domain(struct protection_domain *domain)
 	list_for_each_entry_safe(dev_data, next, &domain->dev_list, list) {
 		struct device *dev = dev_data->dev;
 
-		do_detach(dev);
+		__detach_device(dev);
 		atomic_set(&dev_data->bind, 0);
 	}
 
-- 
1.7.0



  parent reply	other threads:[~2010-03-01 13:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 13:24 [PATCH 0/4] AMD IOMMU fixes for 2.6.34 Joerg Roedel
2010-03-01 13:24 ` [PATCH 1/4] x86/amd-iommu: Remove double NULL check in check_device Joerg Roedel
2010-03-01 13:24 ` [PATCH 2/4] x86/amd-iommu: Protect IOMMU-API map/unmap path Joerg Roedel
2010-03-01 13:24 ` Joerg Roedel [this message]
2010-03-01 13:24 ` [PATCH 4/4] x86/amd-iommu: Report errors in acpi parsing functions upstream Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1267449882-1415-4-git-send-email-joerg.roedel@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=chrisw@sous-sol.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®