Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 316A9C432BE for ; Tue, 27 Jul 2021 14:37:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9D6561AF0 for ; Tue, 27 Jul 2021 14:37:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E9D6561AF0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=openhardware.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.161236.296059 (Exim 4.92) (envelope-from ) id 1m8OCv-0000LC-Vw; Tue, 27 Jul 2021 14:37:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 161236.296059; Tue, 27 Jul 2021 14:37:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m8OCv-0000L5-SA; Tue, 27 Jul 2021 14:37:21 +0000 Received: by outflank-mailman (input) for mailman id 161236; Tue, 27 Jul 2021 14:37:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m8OCu-0000Kz-PD for xen-devel@lists.xenproject.org; Tue, 27 Jul 2021 14:37:20 +0000 Received: from mail.jaffe-engineering.com (unknown [178.254.25.135]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0da7221a-cd29-4038-955b-3537d28f3c3e; Tue, 27 Jul 2021 14:37:18 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPA id 054511E0FAD; Tue, 27 Jul 2021 16:36:59 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0da7221a-cd29-4038-955b-3537d28f3c3e From: "luja" In-Reply-To: Content-Type: multipart/alternative; boundary="----=_=-_OpenGroupware_org_NGMime-67-1627396619.108475-62------" Date: Tue, 27 Jul 2021 16:36:59 +0200 Cc: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= , "xen-devel" To: "Andrew Cooper" MIME-Version: 1.0 Message-ID: <43-61001a00-75-6ab37100@54781652> Subject: =?utf-8?q?Re=3A?==?utf-8?q?_Xen-Error=3A?= Disabling IOMMU on Stepping C2 5520 Host-Bridge // SLH3P marking on die User-Agent: SOGoMail 5.1.1 X-Last-TLS-Session-Version: None ------=_=-_OpenGroupware_org_NGMime-67-1627396619.108475-62------ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Length: 5323 Hi all, No, the correct behavior is to just use the host bridge as it is correc= t and works! Just the PCI config space is done wrongly in the board's BIOS? To get the truth... I disassembled the cooler, cleaned the "phase change" wax from it, photographed the laser engraving of the flip chip die and compared the text with the errata "spec update" by Intel. According to the laser marking and the errata the chip is a 5520 with C= 2 stepping. As it has an SLH3P marking on its die. I made a photo of it, which is available on request. The errata sheet refers it to C2 stepping and states it supports Intel Trusted Execution TXT. This is on page 11 (3rd line of table) of said i= ntel errata. https://www.intel.com/content/dam/www/public/us/en/documents/specificat= ion-updates/5520-and-5500-chipset-ioh-specification-update.pdf So both Chipset errata #47, #53 mentioned in the code snippet disabling the Vt-d feature, are not present in this hardware, so the Ho= st bridge should=C2=A0 be kosher. For some wired reason the PCI rev is 13. I guess, that the ID is written by the bios using pci config cycles at early boot into registers of the host bridge to be then displayed using tools like lspci. Page 11 of the errata: "3. The Revision Number corresponds to bits 7:0 of the Revision ID Regi= ster located at offset 08h in the PCI function 0 configuration space " But in general: This is not Windows, so I would expect a kernel boot option to just say "I ignore your warning, and when a black hole forms in my m= ainboard it is my fault" so force=5F5520=5FC2=3D1 or something like this should = be appropriate. So a small readme would advise the people who are affected by a fleaky = implementation of C2 Hostbridge to give it a try! So what should happen?! Loose all your data on a freshly installed qubes-os?! Oh, I forgot my hdd password, and forgot to write it under the keyboard= ;-) , so I need to reinstall. What is the difference. Computers should do what the user wants them to= do, and when they break it is the fault of the user who ordered them to fai= l. So please add a kernel boot option to just go against this if-statement= , so only a warning is printed into the log but IOMMMU is not disabled:if= ( rev =3D=3D 0x13 && device =3D=3D 0x342e8086 ) { if (force=5F5520=5FC2=3D=3D1) { printk(XENLOG=5FWARNING VTDPREFIX "NOT Disabling IOMMU as you requested= force=5F5520=5FC2=3D1 and ignoring Intel 5500/5520/X58 Chipset errata = #47, #53\n"); } else { printk(XENLOG=5FWARNING VTDPREFIX "Disabling IOMMU due to Intel 5500/5520/X58 Chipset errata #47, #53\n")= ; iommu=5Fenable =3D 0; break; } } Cheers, luja Am Dienstag, Juli 27, 2021 14:21 CEST, schrieb Andrew Cooper : =C2=A0On 25/07/2021 14:55, Marek Marczykowski-G=C3=B3recki wrote: > On Sun, Jul 25, 2021 at 02:31:17PM +0200, luja wrote: >> This Z600 is equipped with 0B54h mainboard as can be seen with dmi-d= ecode. >> >> The manual states that 0B54h mainboard has the "newer C2 stepping", >> so it is *not* affected by Intel "spec update" (nota bene: Intel upd= ates the >> spec, others report erratas) bugs =C2=A0 > The code above checks for rev 0x13, and the spec (page 11) clearly sa= ys that rev > 0x13 is stepping B-3. Stepping C-2 is rev 0x22. So, if this check > triggers for you, I'm afraid you have the affected chipset. The ID in hardware is the authoritative information.=C2=A0 Sounds like = the Z600 manual is wrong. >> So the way Xen detects the "bug" (pci rev 13) is not sufficient, as = my Z600 >> shows pci rev13 with lspci but 0xB54h (board rev only on Z600) with = dmidecode >> I would suggest first to have an override xen kernel boot option to = disable the disablement in this code section. Or just patch this part o= ut of the Xen code and rebuild xen. If this stuff really crashes, one w= ill see it. > Patching it out is out of the question, this check if there for a > reason. Using interrupt remapping on these systems does cause it to cease functioning. >> So please build a new xen without this stupid disablement or please = add an override boot command for it. >> >> Please see the attached upgrade manual of Z600 and the errata "spec = update" by Intel. >> You see that the C2 stepping is not affected by the bugs refered to = in the xen code, >> so removing that section or adding better detection of the mask revi= sion (B3 vs. C2)=C2=A0 of 5520 host bridge would allow=C2=A0 many users= to operate Qubes4. > Maybe someone else has an alternative idea? The logic in Xen is broken.=C2=A0 I've tried fixing it before for XenSe= rver, but was objected to, and the patch is still in the patchqueue. The errata is with the Queued Invalidation, which (in Xen) is tied to interrupt remapping.=C2=A0 The rest of the IOMMU works fine. The current status quo is that if Xen boots with an Intel gen1 IOMMU, i= t will be happy with DMA remapping but no IRQ remapping.=C2=A0 If Xen boo= ts on this specific buggy system, it will turn the entire IOMMU off in protest, which leaves the system less secure than booting on the previous generation of hardware. The correct behaviour is to just disable interrupt remapping in this case, which brings Xen's behaviour in line with adjacent generations of= hardware. ~Andrew =C2=A0 =C2=A0 ------=_=-_OpenGroupware_org_NGMime-67-1627396619.108475-62------ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Length: 6887 Hi all,

No, the correct behavior is to just use the ho= st bridge as it is correct and works!
Just the PCI config space is= done wrongly in the board's BIOS?

To get the truth...
= I disassembled the cooler, cleaned the "phase change" wax from it,
photographed the laser engraving of the flip chip die and compared
the text with the errata "spec update" by Intel.

According= to the laser marking and the errata the chip is a 5520 with C2
st= epping. As it has an SLH3P marking on its die. I made a photo of it,which is available on request.
The errata sheet refers it to C2= stepping and states it supports Intel
Trusted Execution TXT. This= is on page 11 (3rd line of table) of said intel errata.
https://w= ww.intel.com/content/dam/www/public/us/en/documents/specification-updat= es/5520-and-5500-chipset-ioh-specification-update.pdf


= So both Chipset errata #47, #53 mentioned in the code snippet
disa= bling the Vt-d feature, are not present in this hardware, so the Host b= ridge should 
be kosher.

For some wired reason the= PCI rev is 13.
I guess, that the ID is written by the bios using<= br />pci config cycles at early boot into registers of the host bridge = to
be then displayed using tools like lspci.
Page 11 of the e= rrata:
"3. The Revision Number correspond= s to bits 7:0 of the Revision ID Register located at offset 08h in the = PCI
function 0 configurat= ion space
"


But in general:
This is not Win= dows, so I would expect a kernel boot option
to just say "I ignore= your warning, and when a black hole forms in my mainboard
it is m= y fault" so force=5F5520=5FC2=3D1 or something like this should be appr= opriate.
So a small readme would advise the people who are affecte= d by a fleaky implementation
of C2 Hostbridge to give it a try! So= what should happen?!
Loose all your data on a freshly installed q= ubes-os?!
Oh, I forgot my hdd password, and forgot to write it und= er the keyboard ;-) , so
I need to reinstall.
What is the dif= ference. Computers should do what the user wants them to do,
and w= hen they break it is the fault of the user who ordered them to fail.
So please add a kernel boot option to just go against this if-= statement,
so only a warning is printed into the log but IOMMMU is= not disabled:
if ( rev =3D=3D 0x13 && dev=
ice =3D=3D 0x342e8086 ) 
{
if (force=5F5520=5FC2=3D=3D1)
{
printk(XENLOG=5FWARNING VTDPREFIX "NOT Disabling IOMMU as you requested=
 force=5F5520=5FC2=3D1 and ignoring Intel 5500/5520/X58 Chipset errata =
#47, #53\n"); 
}
else
{
printk(XENLOG=5FWARNING VTDPREFIX
"Disabling IOMMU due to Intel 5500/5520/X58 Chipset errata #47, #53\n")=
;
iommu=5Fenable =3D 0;
break; 
}
}


Cheers,

luja


Am Dienstag= , Juli 27, 2021 14:21 CEST, schrieb Andrew Cooper <andrew.cooper3@ci= trix.com>:
 
On 25/07/2021 14:55, Marek Marczyk= owski-G=C3=B3recki wrote:
> On Sun, Jul 25, 2021 at 02:31:17PM = +0200, luja wrote:
>> This Z600 is equipped with 0B54h mainb= oard as can be seen with dmi-decode.
>>
>> The ma= nual states that 0B54h mainboard has the "newer C2 stepping",
>= > so it is *not* affected by Intel "spec update" (nota bene: Intel u= pdates the
>> spec, others report erratas) bugs  
= > The code above checks for rev 0x13, and the spec (page 11) clearly= says that rev
> 0x13 is stepping B-3. Stepping C-2 is rev 0x22= . So, if this check
> triggers for you, I'm afraid you have the= affected chipset.

The ID in hardware is the authoritative i= nformation.  Sounds like the
Z600 manual is wrong.

>> So the way Xen detects the "bug" (pci rev 13) is not sufficie= nt, as my Z600
>> shows pci rev13 with lspci but 0xB54h (boa= rd rev only on Z600) with dmidecode
>> I would suggest first= to have an override xen kernel boot option to disable the disablement = in this code section. Or just patch this part out of the Xen code and r= ebuild xen. If this stuff really crashes, one will see it.
> Pa= tching it out is out of the question, this check if there for a
&g= t; reason.

Using interrupt remapping on these systems does c= ause it to cease
functioning.

>> So please build = a new xen without this stupid disablement or please add an override boo= t command for it.
>>
>> Please see the attached u= pgrade manual of Z600 and the errata "spec update" by Intel.
>&= gt; You see that the C2 stepping is not affected by the bugs refered to= in the xen code,
>> so removing that section or adding bett= er detection of the mask revision (B3 vs. C2)  of 5520 host bridge= would allow  many users to operate Qubes4.
> Maybe someon= e else has an alternative idea?

The logic in Xen is broken.&= nbsp; I've tried fixing it before for XenServer,
but was objected = to, and the patch is still in the patchqueue.

The errata is = with the Queued Invalidation, which (in Xen) is tied to
interrupt = remapping.  The rest of the IOMMU works fine.

The curre= nt status quo is that if Xen boots with an Intel gen1 IOMMU, it
wi= ll be happy with DMA remapping but no IRQ remapping.  If Xen boots= on
this specific buggy system, it will turn the entire IOMMU off = in
protest, which leaves the system less secure than booting on th= e
previous generation of hardware.

The correct behaviou= r is to just disable interrupt remapping in this
case, which bring= s Xen's behaviour in line with adjacent generations of
hardware.
~Andrew
 



  ------=_=-_OpenGroupware_org_NGMime-67-1627396619.108475-62--------