xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
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: [PATCH] amd iommu: Fix a xen crash after pci-attach
Date: Tue, 1 Feb 2011 17:27:16 +0100	[thread overview]
Message-ID: <201102011727.17297.wei.wang2@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

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

[-- Attachment #2: fix_detach.patch --]
[-- Type: text/x-diff, Size: 809 bytes --]

diff -r a69965e61ae9 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Mon Jan 31 17:47:24 2011 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Tue Feb 01 17:19:16 2011 +0100
@@ -301,6 +301,11 @@ static int reassign_device( struct domai
     if ( target->max_pages > 0 )
         t->paging_mode = get_paging_mode(target->max_pages);
 
+    /* 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("Re-assign %02x:%02x.%x from domain %d to domain %d\n",
                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn),

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2011-02-01 16:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-01 16:27 Wei Wang2 [this message]
2011-02-09 15:24 ` [osrc-patches] [PATCH] amd iommu: Fix a xen crash after pci-attach (backport) Wei Wang2

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=201102011727.17297.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 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).