summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shvetsov <alexxy@gentoo.org>2011-09-18 12:15:09 +0000
committerAlexey Shvetsov <alexxy@gentoo.org>2011-09-18 12:15:09 +0000
commit54d24c32f9fc56a2c1b83b5e1ccb1a35626b07ef (patch)
tree169240955c7ab8dc878dacc949c559cbb89e6b1e /app-emulation
parentDrop predefined cflags for debug useflag. Bug #383481 (diff)
downloadgentoo-2-54d24c32f9fc56a2c1b83b5e1ccb1a35626b07ef.tar.gz
gentoo-2-54d24c32f9fc56a2c1b83b5e1ccb1a35626b07ef.tar.bz2
gentoo-2-54d24c32f9fc56a2c1b83b5e1ccb1a35626b07ef.zip
[app-emulation/xen] Fix bug #379241
(Portage version: 2.2.0_alpha58/cvs/Linux x86_64)
Diffstat (limited to 'app-emulation')
-rw-r--r--app-emulation/xen/ChangeLog8
-rw-r--r--app-emulation/xen/files/xen-4.1.1-iommu_sec_fix.patch74
-rw-r--r--app-emulation/xen/xen-4.1.1-r2.ebuild (renamed from app-emulation/xen/xen-4.1.1-r1.ebuild)4
3 files changed, 84 insertions, 2 deletions
diff --git a/app-emulation/xen/ChangeLog b/app-emulation/xen/ChangeLog
index 4e20a8ffc9b0..19bfacd00d43 100644
--- a/app-emulation/xen/ChangeLog
+++ b/app-emulation/xen/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-emulation/xen
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen/ChangeLog,v 1.79 2011/09/11 14:48:15 alexxy Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen/ChangeLog,v 1.80 2011/09/18 12:15:08 alexxy Exp $
+
+*xen-4.1.1-r2 (18 Sep 2011)
+
+ 18 Sep 2011; Alexey Shvetsov <alexxy@gentoo.org> -xen-4.1.1-r1.ebuild,
+ +xen-4.1.1-r2.ebuild, +files/xen-4.1.1-iommu_sec_fix.patch:
+ Fix bug #379241
*xen-4.1.1-r1 (11 Sep 2011)
diff --git a/app-emulation/xen/files/xen-4.1.1-iommu_sec_fix.patch b/app-emulation/xen/files/xen-4.1.1-iommu_sec_fix.patch
new file mode 100644
index 000000000000..737c2bd777aa
--- /dev/null
+++ b/app-emulation/xen/files/xen-4.1.1-iommu_sec_fix.patch
@@ -0,0 +1,74 @@
+
+# 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>
+
+diff -r cb22fa57ff25 -r 84e3706df07a xen/drivers/passthrough/amd/iommu_init.c
+--- a/xen/drivers/passthrough/amd/iommu_init.c Mon Jul 25 16:48:39 2011 +0100
++++ b/xen/drivers/passthrough/amd/iommu_init.c Fri Aug 12 11:33:41 2011 +0100
+@@ -462,7 +462,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",
+@@ -497,6 +497,18 @@
+ "%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);
++ }
+ }
+ else
+ {
+diff -r cb22fa57ff25 -r 84e3706df07a xen/drivers/passthrough/vtd/iommu.c
+--- a/xen/drivers/passthrough/vtd/iommu.c Mon Jul 25 16:48:39 2011 +0100
++++ b/xen/drivers/passthrough/vtd/iommu.c Fri Aug 12 11:33:41 2011 +0100
+@@ -893,7 +893,7 @@
+ while (1)
+ {
+ u8 fault_reason;
+- u16 source_id;
++ u16 source_id, cword;
+ u32 data;
+ u64 guest_addr;
+ int type;
+@@ -926,6 +926,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;
+
diff --git a/app-emulation/xen/xen-4.1.1-r1.ebuild b/app-emulation/xen/xen-4.1.1-r2.ebuild
index 00bb1ad28940..d94f818b86f6 100644
--- a/app-emulation/xen/xen-4.1.1-r1.ebuild
+++ b/app-emulation/xen/xen-4.1.1-r2.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen/xen-4.1.1-r1.ebuild,v 1.1 2011/09/11 14:48:15 alexxy Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen/xen-4.1.1-r2.ebuild,v 1.1 2011/09/18 12:15:08 alexxy Exp $
EAPI="4"
@@ -73,6 +73,8 @@ src_prepare() {
-e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
-i {} \;
fi
+ # Add sccurity fix bug #379241
+ epatch "${FILESDIR}/${P}-iommu_sec_fix.patch"
}
src_configure() {