From: "Jan Beulich" Subject: [PATCH 3/3] VT-d: deal with 5500/5520/X58 errata Date: Tue, 19 Mar 2013 16:48:02 +0000 Message-ID: <5148A4D202000078000C6DEF@nat28.tlf.novell.com> References: <51489E3A02000078000C6DB2@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part350521D2.3__=" Return-path: In-Reply-To: <51489E3A02000078000C6DB2@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Malcolm Crossley , Jacob Shin , xiantao.zhang@intel.com, suravee.suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part350521D2.3__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline http://www.intel.com/content/www/us/en/chipsets/5520-and-5500-chipset-ioh-s= pecification-update.html=20 Stepping B-3 has two errata (#47 and #53) related to Interrupt remapping, to which the workaround is for the BIOS to completely disable interrupt remapping. These errata are fixed in stepping C-2. Unfortunately this chipset stepping is very common and many BIOSes are not disabling interrupt remapping on this stepping . We can detect this = in Xen and prevent Xen from using the problematic interrupt remapping = feature. The Intel 5500/5520/X58 chipset does not support VT-d Extended Interrupt Mode(EIM). This means the iommu_supports_eim() check always fails and so x2apic mode cannot be enabled in Xen before this quirk disables the interrupt remapping feature. Signed-off-by: Malcolm Crossley Signed-off-by: Andrew Cooper Gate the function call to check the quirk on interrupt remapping being requested to get enabled, and upon failure disable the IOMMU to be in line with what the changes for XSA-36 (plus follow-ups) did. Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2125,6 +2125,11 @@ int __init intel_vtd_setup(void) } =20 platform_quirks_init(); + if ( !iommu_enable ) + { + ret =3D -ENODEV; + goto error; + } =20 /* We enable the following features only if they are supported by all = VT-d * engines: Snoop Control, DMA passthrough, Queued Invalidation and --- a/xen/drivers/passthrough/vtd/quirks.c +++ b/xen/drivers/passthrough/vtd/quirks.c @@ -244,6 +244,29 @@ void vtd_ops_postamble_quirk(struct iomm } } =20 +/* 5500/5520/X58 Chipset Interrupt remapping errata, for stepping B-3. + * Fixed in stepping C-2. */ +static void __init tylersburg_intremap_quirk(void) +{ + uint32_t bus, device; + uint8_t rev; + + for ( bus =3D 0; bus < 0x100; bus++ ) + { + /* Match on System Management Registers on Device 20 Function 0 = */ + device =3D pci_conf_read32(0, bus, 20, 0, PCI_VENDOR_ID); + rev =3D pci_conf_read8(0, bus, 20, 0, PCI_REVISION_ID); + + if ( rev =3D=3D 0x13 && device =3D=3D 0x342e8086 ) + { + printk(XENLOG_WARNING VTDPREFIX + "Disabling IOMMU due to Intel 5500/5520/X58 Chipset = errata #47, #53\n"); + iommu_enable =3D 0; + break; + } + } +} + /* initialize platform identification flags */ void __init platform_quirks_init(void) { @@ -264,6 +287,10 @@ void __init platform_quirks_init(void) =20 /* ioremap IGD MMIO+0x2000 page */ map_igd_reg(); + + /* Tylersburg interrupt remap quirk */ + if ( iommu_intremap ) + tylersburg_intremap_quirk(); } =20 /* --=__Part350521D2.3__= Content-Type: text/plain; name="VT-d-5500-5700-X58-errata.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="VT-d-5500-5700-X58-errata.patch" VT-d: deal with 5500/5520/X58 errata=0A=0Ahttp://www.intel.com/content/www/= us/en/chipsets/5520-and-5500-chipset-ioh-specification-update.html = =0A=0AStepping B-3 has two errata (#47 and #53) related to Interrupt=0Arema= pping, to which the workaround is for the BIOS to completely disable=0Ainte= rrupt remapping. These errata are fixed in stepping C-2.=0A=0AUnfortunatel= y this chipset stepping is very common and many BIOSes are=0Anot disabling = interrupt remapping on this stepping . We can detect this in=0AXen and = prevent Xen from using the problematic interrupt remapping feature.=0A=0ATh= e Intel 5500/5520/X58 chipset does not support VT-d=0AExtended Interrupt = Mode(EIM). This means the iommu_supports_eim() check=0Aalways fails and so = x2apic mode cannot be enabled in Xen before this quirk=0Adisables the = interrupt remapping feature.=0A=0ASigned-off-by: Malcolm Crossley = =0ASigned-off-by: Andrew Cooper =0A=0AGate the function call to check the quirk on interrupt = remapping being=0Arequested to get enabled, and upon failure disable the = IOMMU to be in=0Aline with what the changes for XSA-36 (plus follow-ups) = did.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/drivers/passthrough/vtd/iommu.c=0A+++ b/xen/drivers/passthrough/vtd/i= ommu.c=0A@@ -2125,6 +2125,11 @@ int __init intel_vtd_setup(void)=0A = }=0A =0A platform_quirks_init();=0A+ if ( !iommu_enable )=0A+ = {=0A+ ret =3D -ENODEV;=0A+ goto error;=0A+ }=0A =0A = /* We enable the following features only if they are supported by all = VT-d=0A * engines: Snoop Control, DMA passthrough, Queued Invalidation= and=0A--- a/xen/drivers/passthrough/vtd/quirks.c=0A+++ b/xen/drivers/passt= hrough/vtd/quirks.c=0A@@ -244,6 +244,29 @@ void vtd_ops_postamble_quirk(str= uct iomm=0A }=0A }=0A =0A+/* 5500/5520/X58 Chipset Interrupt remapping = errata, for stepping B-3.=0A+ * Fixed in stepping C-2. */=0A+static void = __init tylersburg_intremap_quirk(void)=0A+{=0A+ uint32_t bus, device;=0A= + uint8_t rev;=0A+=0A+ for ( bus =3D 0; bus < 0x100; bus++ )=0A+ = {=0A+ /* Match on System Management Registers on Device 20 Function = 0 */=0A+ device =3D pci_conf_read32(0, bus, 20, 0, PCI_VENDOR_ID);= =0A+ rev =3D pci_conf_read8(0, bus, 20, 0, PCI_REVISION_ID);=0A+=0A+= if ( rev =3D=3D 0x13 && device =3D=3D 0x342e8086 )=0A+ = {=0A+ printk(XENLOG_WARNING VTDPREFIX=0A+ = "Disabling IOMMU due to Intel 5500/5520/X58 Chipset errata #47, #53\n");=0A= + iommu_enable =3D 0;=0A+ break;=0A+ }=0A+ = }=0A+}=0A+=0A /* initialize platform identification flags */=0A void = __init platform_quirks_init(void)=0A {=0A@@ -264,6 +287,10 @@ void __init = platform_quirks_init(void)=0A =0A /* ioremap IGD MMIO+0x2000 page = */=0A map_igd_reg();=0A+=0A+ /* Tylersburg interrupt remap quirk = */=0A+ if ( iommu_intremap )=0A+ tylersburg_intremap_quirk();=0A = }=0A =0A /*=0A --=__Part350521D2.3__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part350521D2.3__=--