From nobody Wed May 15 15:19:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94531+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94531+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1664481235; cv=none; d=zohomail.com; s=zohoarc; b=jONDwa7UjrJRNuiQb/r12t26p6ONx9Vqe5PfKAkFvhqcYA5JkrYj1n9s8rk9y9YaTZyuuu+nN81Sj/hIzvm1DXyNT4audcZyOMKF8JUaA9DYkHq2GIPiNqyIx7fjcahQMIalV3CP0t63oo8TPiV4gWGfPWBwHhH6PamTvLISkhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664481235; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7ZwMfEYZl4s0B7b3fsykg4zb7CbxUePOUwfdtpkWL5g=; b=Lhdwa4Duzr1k+T0yIPPrN6/sd3a24pYuT/B+mbYhBWGiOMNVqVsCH/0O+SHUySAox12lC2gW0mbjFVLxb/Cj7+0l/PzA69HXTLfXsKyfbr8JVK/PVx06nQT/lvVch6Rf8FtjeTOUMw0d1QVvSmnqpNa+cIeLEWw5u6gi8dGSbRM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94531+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1664481234970847.7281341838508; Thu, 29 Sep 2022 12:53:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id J4ahYY1788612xWSRzbHkQpv; Thu, 29 Sep 2022 12:53:54 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.773.1664481233904342830 for ; Thu, 29 Sep 2022 12:53:54 -0700 X-Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-163-oCjS3M40OnKrhZuU-dwtTw-1; Thu, 29 Sep 2022 15:53:52 -0400 X-MC-Unique: oCjS3M40OnKrhZuU-dwtTw-1 X-Received: by mail-oo1-f70.google.com with SMTP id z1-20020a4a3041000000b0047620da9e7dso879737ooz.18 for ; Thu, 29 Sep 2022 12:53:51 -0700 (PDT) X-Gm-Message-State: ovoGDoCwkdSxPTXcWA2v2O1Ix1787277AA= X-Received: by 2002:a05:6808:1986:b0:350:8c87:c5a2 with SMTP id bj6-20020a056808198600b003508c87c5a2mr2402492oib.57.1664481231280; Thu, 29 Sep 2022 12:53:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GJpXBbON9+M6GDIY1oiJIRyiFkbYbyYe4ozEOb/y8QqprdZ1ADdzlqDhk2/XUCc2Nu2W/BA== X-Received: by 2002:a05:6808:1986:b0:350:8c87:c5a2 with SMTP id bj6-20020a056808198600b003508c87c5a2mr2402483oib.57.1664481231036; Thu, 29 Sep 2022 12:53:51 -0700 (PDT) X-Received: from fedora.redhat.com (modemcable149.19-202-24.mc.videotron.ca. [24.202.19.149]) by smtp.gmail.com with ESMTPSA id 110-20020a9d0ef7000000b00654625c0c4dsm139529otj.17.2022.09.29.12.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 12:53:50 -0700 (PDT) From: "Adrien Thierry" To: Ard Biesheuvel , Leif Lindholm , Jeremy Linton , devel@edk2.groups.io Cc: Adrien Thierry Subject: [edk2-devel] [edk2-platforms PATCH 1/2] Platform/RaspberryPi: fix pci DT node address in SyncPcie() Date: Thu, 29 Sep 2022 15:53:34 -0400 Message-Id: <20220929195335.61495-2-athierry@redhat.com> In-Reply-To: <20220929195335.61495-1-athierry@redhat.com> References: <20220929195335.61495-1-athierry@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,athierry@redhat.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1664481234; bh=lR193I04EAUuCdBeo/Pi8lXMErFY4+2FRd2RMXjAA2U=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=BDY2EPTl7nDeyxB4iAbV+6KXo/735bI0oI8z9ZqgR2X8jnnAl8Nwcy2sPkym7Lyf4/b 9xmXsyA0aXADrme6Aedwc8a79+/KtGEYzqSZo5NMsT2H/geFOJlfrs39OCrRjVvCVE41R rg9KYWJQQudTfrq5l8LXiDz4MHhCJwT3P3k= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1664481236248100001 Content-Type: text/plain; charset="utf-8"; x-default="true" To make sure the XHCI controller does not get reset by Linux in DT mode, we remove its pci parent node from the device tree. However, the pci node address has been updated in the Raspberry Pi 4 device tree [1] and no longer matches the one we are trying to remove in SyncPcie(). This results in the XHCI controller actually being reset by Linux, which leads to errors during USB initialization: [ 3.563963] xhci_hcd 0000:01:00.0: xHCI Host Controller [ 3.569538] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus = number 1 [ 3.577452] xhci_hcd 0000:01:00.0: hcc params 0x002841eb hci version 0x1= 00 quirks 0x0000040000000890 [ 3.587725] xhci_hcd 0000:01:00.0: xHCI Host Controller [ 3.593115] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus = number 2 [ 3.600693] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed [ 3.608106] hub 1-0:1.0: USB hub found [ 3.612026] hub 1-0:1.0: 1 port detected [ 3.616819] hub 2-0:1.0: USB hub found [ 3.620726] hub 2-0:1.0: 4 ports detected [ 3.875902] usb 1-1: new high-speed USB device number 2 using xhci_hcd [ 4.008123] usb 1-1: device descriptor read/64, error -71 [ 4.256088] usb 1-1: device descriptor read/64, error -71 [ 4.495882] usb 1-1: new high-speed USB device number 3 using xhci_hcd [ 4.628111] usb 1-1: device descriptor read/64, error -71 [ 4.872083] usb 1-1: device descriptor read/64, error -71 [ 5.407888] usb 1-1: new high-speed USB device number 4 using xhci_hcd [ 6.023964] xhci_hcd 0000:01:00.0: Setup ERROR: setup address command fo= r slot 1. [ 6.239977] xhci_hcd 0000:01:00.0: Setup ERROR: setup address command fo= r slot 1. This patch updates the pci node address (and usb node address in the error messages) to match those found in the RPi4 device tree. [1] https://lore.kernel.org/all/20210831125843.1233488-1-nsaenzju@redhat.co= m/ Fixes: efff29cdcdb7 ("Platform/RaspberryPi: Always use non translating DMA = in DT mode") Signed-off-by: Adrien Thierry --- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Raspbe= rryPi/Drivers/FdtDxe/FdtDxe.c index e72d132b18..55c9d185fc 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c @@ -388,14 +388,14 @@ SyncPcie ( * triggering the mailbox by removing the node. */ =20 - Node =3D fdt_path_offset (mFdtImage, "/scb/pcie@7d500000/pci@1,0"); + Node =3D fdt_path_offset (mFdtImage, "/scb/pcie@7d500000/pci@0,0"); if (Node < 0) { // This can happen on CM4/etc which doesn't have an onboard XHCI - DEBUG ((DEBUG_INFO, "%a: failed to locate /scb/pcie@7d500000/pci@1/usb= @1\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a: failed to locate /scb/pcie@7d500000/pci@0/usb= @0\n", __FUNCTION__)); } else { Retval =3D fdt_del_node (mFdtImage, Node); if (Retval !=3D 0) { - DEBUG ((DEBUG_ERROR, "Failed to remove /scb/pcie@7d500000/pci@1/usb@= 1\n")); + DEBUG ((DEBUG_ERROR, "Failed to remove /scb/pcie@7d500000/pci@0/usb@= 0\n")); return EFI_NOT_FOUND; } } --=20 2.37.3 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94531): https://edk2.groups.io/g/devel/message/94531 Mute This Topic: https://groups.io/mt/94002755/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 15:19:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94532+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94532+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1664481238; cv=none; d=zohomail.com; s=zohoarc; b=YJqGDq+Xwdcx3YPedDTnqtA5fy07peGgu0VIYlGSG/XSwPhjckOt8n4F5kDBCHIruYVVl6iLkHK2KTwsoj3ItYzF8S4eGbOw3EHWwGnGeQ+vDWqAaEYK1xv7r52LBB1tYSZLTyX31LHWFUp2A+/5bpysLF9Di8b8JprQvMUWDBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664481238; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=qdxKKePEcimQNGvoqol2sDRebmRBq1jQFPE6BknugPs=; b=FiST7i78wEzzHUWYd7XdOPjSFkPmPn1hmmXIf2cAhfp2bMrdDnSvYy6Iv3C61sapi85GxaaCNYhswdB7jgpURUf4kqggs/SrfrcMZIaWlGKPbhE9dESzT1MCrG03j6y28Ma90zwPtCM45YDNZ0XTp+/KRUb5z9aoXEaJFXi7cc0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94532+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1664481238154859.8350338141605; Thu, 29 Sep 2022 12:53:58 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id StWRYY1788612xXMyc7rDqZP; Thu, 29 Sep 2022 12:53:56 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web09.15259.1664481236051991351 for ; Thu, 29 Sep 2022 12:53:56 -0700 X-Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-389-AwNOgeSHOiuoQAOgfTFRvw-1; Thu, 29 Sep 2022 15:53:54 -0400 X-MC-Unique: AwNOgeSHOiuoQAOgfTFRvw-1 X-Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-131e0b58b39so766147fac.18 for ; Thu, 29 Sep 2022 12:53:53 -0700 (PDT) X-Gm-Message-State: hJH889uIxM5LHcARIDA8Ypikx1787277AA= X-Received: by 2002:a05:6808:916:b0:350:138f:ad76 with SMTP id w22-20020a056808091600b00350138fad76mr7680449oih.111.1664481233327; Thu, 29 Sep 2022 12:53:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dhntyKUPE8FddE/Xyr35oYuBmUv9+JcvznXtHZz0R0ImW/vqdSQtCwg0X5x6UhXbNc+qkqA== X-Received: by 2002:a05:6808:916:b0:350:138f:ad76 with SMTP id w22-20020a056808091600b00350138fad76mr7680439oih.111.1664481233152; Thu, 29 Sep 2022 12:53:53 -0700 (PDT) X-Received: from fedora.redhat.com (modemcable149.19-202-24.mc.videotron.ca. [24.202.19.149]) by smtp.gmail.com with ESMTPSA id 110-20020a9d0ef7000000b00654625c0c4dsm139529otj.17.2022.09.29.12.53.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 12:53:52 -0700 (PDT) From: "Adrien Thierry" To: Ard Biesheuvel , Leif Lindholm , Jeremy Linton , devel@edk2.groups.io Cc: Adrien Thierry Subject: [edk2-devel] [edk2-platforms PATCH 2/2] Platform/RaspberryPi: delete usb node instead of pci in SyncPcie() Date: Thu, 29 Sep 2022 15:53:35 -0400 Message-Id: <20220929195335.61495-3-athierry@redhat.com> In-Reply-To: <20220929195335.61495-1-athierry@redhat.com> References: <20220929195335.61495-1-athierry@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,athierry@redhat.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1664481236; bh=Ixg0YkCC76Kccn71DvCahHuIUqASHnDbi6wer25QDaI=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=PX/8jnvtX4N3ElpnR7m1GgoiRMjAg/6FH1GxVcNvq+o7pUIHyQU8bv7UnwNreOdW+7n a0Wj2nI21aN/PT16yvMIRXrwysz8zLAek/PukBn06qt3sAa5NeV/XNVRP8WiZfbmWsvGZ vsWivf+8goagE28QJ1udcG61QX60qjTEoFU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1664481240143100007 Content-Type: text/plain; charset="utf-8"; x-default="true" In SyncPcie(), the pci node is removed from the device tree to make sure the XHCI controller is not reset by Linux in DT mode. However, we should only remove the usb child node and not the whole pci node. Removing the whole pci node prevents Linux to bypass XHCI handoff for the Raspberry Pi 4 [1]. Moreover, removing the usb node seems to have been the original intent according to the error messages shown if the node is not detected. [1] https://elixir.bootlin.com/linux/latest/source/drivers/usb/host/pci-qui= rks.c#L1258 Fixes: efff29cdcdb7 ("Platform/RaspberryPi: Always use non translating DMA = in DT mode") Signed-off-by: Adrien Thierry --- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Raspbe= rryPi/Drivers/FdtDxe/FdtDxe.c index 55c9d185fc..26334e50b8 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c @@ -388,7 +388,7 @@ SyncPcie ( * triggering the mailbox by removing the node. */ =20 - Node =3D fdt_path_offset (mFdtImage, "/scb/pcie@7d500000/pci@0,0"); + Node =3D fdt_path_offset (mFdtImage, "/scb/pcie@7d500000/pci@0,0/usb@0,0= "); if (Node < 0) { // This can happen on CM4/etc which doesn't have an onboard XHCI DEBUG ((DEBUG_INFO, "%a: failed to locate /scb/pcie@7d500000/pci@0/usb= @0\n", __FUNCTION__)); --=20 2.37.3 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94532): https://edk2.groups.io/g/devel/message/94532 Mute This Topic: https://groups.io/mt/94002757/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-