From: Wei Wang2 <wei.wang2@amd.com>
To: Keir Fraser <keir@xen.org>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [osrc-patches] [PATCH] amd iommu: Fix a xen crash after pci-attach (backport)
Date: Wed, 9 Feb 2011 16:24:59 +0100 [thread overview]
Message-ID: <201102091625.00122.wei.wang2@amd.com> (raw)
In-Reply-To: <201102011727.17297.wei.wang2@amd.com>
[-- Attachment #1: Type: text/plain, Size: 752 bytes --]
On Tuesday 01 February 2011 17:27:16 Wei Wang2 wrote:
> Keir,
> pci-detach triggers IO page table deallocation if the last passthru device
> has been removed from pdev list, and this will result a BUG on amd systems
> for next pci-attach. This patch fixes this issue.
> Thanks,
> Wei
>
> Signed-off-by: Wei Wang <wei.wang2@amd.com>
> --
> Advanced Micro Devices GmbH
> Sitz: Dornach, Gemeinde Aschheim,
> Landkreis München Registergericht München,
> HRB Nr. 43632
> WEEE-Reg-Nr: DE 12919551
> Geschäftsführer:
> Alberto Bozzo, Andrew Bowd
Keir,
I think this should also be back ported to 4.0, I found the same issue with
xen-4.0.2-rc2-pre. Patch has been attached.
Thanks,
Wei
Signed-off-by: Wei Wang <wei.wang2@amd.com>
[-- Attachment #2: fix_detach_xen40.patch --]
[-- Type: text/x-diff, Size: 1021 bytes --]
diff -r a8bc981ce9c7 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Mon Feb 07 10:01:19 2011 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Wed Feb 09 16:03:59 2011 +0100
@@ -277,6 +277,7 @@ static int reassign_device( struct domai
struct pci_dev *pdev;
struct amd_iommu *iommu;
int bdf;
+ struct hvm_iommu *t = domain_hvm_iommu(target);
ASSERT(spin_is_locked(&pcidevs_lock));
pdev = pci_get_pdev_by_domain(source, bus, devfn);
@@ -297,6 +298,11 @@ static int reassign_device( struct domai
list_move(&pdev->domain_list, &target->arch.pdev_list);
pdev->domain = target;
+
+ /* IO page tables might be destroyed after pci-detach the last device
+ * In this case, we have to re-allocate root table for next pci-attach.*/
+ if ( t->root_table == NULL )
+ allocate_domain_resources(t);
amd_iommu_setup_domain_device(target, iommu, bdf);
AMD_IOMMU_DEBUG("reassign %x:%x.%x domain %d -> domain %d\n",
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
prev parent reply other threads:[~2011-02-09 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-01 16:27 [PATCH] amd iommu: Fix a xen crash after pci-attach Wei Wang2
2011-02-09 15:24 ` Wei Wang2 [this message]
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=201102091625.00122.wei.wang2@amd.com \
--to=wei.wang2@amd.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.