All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] amd iommu: Fix a xen crash after pci-attach
@ 2011-02-01 16:27 Wei Wang2
  2011-02-09 15:24 ` [osrc-patches] [PATCH] amd iommu: Fix a xen crash after pci-attach (backport) Wei Wang2
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Wang2 @ 2011-02-01 16:27 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel@lists.xensource.com

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-09 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-01 16:27 [PATCH] amd iommu: Fix a xen crash after pci-attach Wei Wang2
2011-02-09 15:24 ` [osrc-patches] [PATCH] amd iommu: Fix a xen crash after pci-attach (backport) Wei Wang2

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.