diff options
author | Ian Delaney <idell5@iinet.com.au> | 2011-11-29 02:08:55 +0800 |
---|---|---|
committer | Ian Delaney <idell5@iinet.com.au> | 2011-11-29 02:08:55 +0800 |
commit | d6e73198410451ad57c0227af185c4049b75f4eb (patch) | |
tree | 08251a49e992d7156518d0442366f43f5bf16008 /app-emulation/files/xen-3.4.2-no-DMA.patch | |
parent | Revork ebuilds (diff) | |
download | virtualization-d6e73198410451ad57c0227af185c4049b75f4eb.tar.gz virtualization-d6e73198410451ad57c0227af185c4049b75f4eb.tar.bz2 virtualization-d6e73198410451ad57c0227af185c4049b75f4eb.zip |
Merge branch 'master' of git+ssh://git.overlays.gentoo.org/proj/virtualization
Conflicts:
app-emulation/xen-tools/Manifest
Diffstat (limited to 'app-emulation/files/xen-3.4.2-no-DMA.patch')
-rw-r--r-- | app-emulation/files/xen-3.4.2-no-DMA.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/app-emulation/files/xen-3.4.2-no-DMA.patch b/app-emulation/files/xen-3.4.2-no-DMA.patch new file mode 100644 index 0000000..f04d9e2 --- /dev/null +++ b/app-emulation/files/xen-3.4.2-no-DMA.patch @@ -0,0 +1,71 @@ +# HG changeset patch +# User Tim Deegan <Tim.Deegan@citrix.com> +# Date 1313145221 -3600 +# Node ID 84e3706df07a1963e23cd3875d8603917657d462 +# Parent cb22fa57ff252893b6adb1481e09b1287eacd990 +Passthrough: disable bus-mastering on any card that causes an IOMMU fault. + +This stops the card from raising back-to-back faults and live-locking +the CPU that handles them. + +Signed-off-by: Tim Deegan <tim@xen.org> +Acked-by: Wei Wang2 <wei.wang2@amd.com> +Acked-by: Allen M Kay <allen.m.kay@intel.com> + +--- a/xen/drivers/passthrough/vtd/iommu.c.orig Mon Jul 25 16:48:39 2011 +0100 ++++ b/xen/drivers/passthrough/vtd/iommu.c Fri Aug 12 11:33:41 2011 +0100 +@@ -733,7 +733,7 @@ + while (1) + { + u8 fault_reason; +- u16 source_id; ++ u16 source_id, cword; + u32 data; + u64 guest_addr; + int type; +@@ -766,6 +766,14 @@ + iommu_page_fault_do_one(iommu, type, fault_reason, + source_id, guest_addr); + ++ /* Tell the device to stop DMAing; we can't rely on the guest to ++ * control it for us. */ ++ cword = pci_conf_read16(PCI_BUS(source_id), PCI_SLOT(source_id), ++ PCI_FUNC(source_id), PCI_COMMAND); ++ pci_conf_write16(PCI_BUS(source_id), PCI_SLOT(source_id), ++ PCI_FUNC(source_id), PCI_COMMAND, ++ cword & ~PCI_COMMAND_MASTER); ++ + fault_index++; + if ( fault_index > cap_num_fault_regs(iommu->cap) ) + fault_index = 0; + +--- a/xen/drivers/passthrough/amd/iommu_init.c.orig Mon Jul 25 16:48:39 2011 +0100 ++++ b/xen/drivers/passthrough/amd/iommu_init.c Fri Aug 12 11:33:41 2011 +0100 +@@ -415,7 +415,7 @@ + + static void parse_event_log_entry(u32 entry[]) + { +- u16 domain_id, device_id; ++ u16 domain_id, device_id, bdf, cword; + u32 code; + u64 *addr; + char * event_str[] = {"ILLEGAL_DEV_TABLE_ENTRY", +@@ -449,6 +449,18 @@ + printk(XENLOG_ERR "AMD-Vi: " + "%s: domain = %d, device id = 0x%04x, fault address = 0x%"PRIx64"\n", + event_str[code-1], domain_id, device_id, *addr); ++ ++ /* Tell the device to stop DMAing; we can't rely on the guest to ++ * control it for us. */ ++ for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ ) ++ if ( get_dma_requestor_id(bdf) == device_id ) ++ { ++ cword = pci_conf_read16(PCI_BUS(bdf), PCI_SLOT(bdf), ++ PCI_FUNC(bdf), PCI_COMMAND); ++ pci_conf_write16(PCI_BUS(bdf), PCI_SLOT(bdf), ++ PCI_FUNC(bdf), PCI_COMMAND, ++ cword & ~PCI_COMMAND_MASTER); ++ } + } + } + |