From nobody Thu May 9 12:38:59 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+94799+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+94799+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665078386; cv=none; d=zohomail.com; s=zohoarc; b=a8vWTu5Am6Kp9l+dq0ZmxX+vMZx/x+lF48PfyxDENDiIf5wFNP2pFMA4Il1OpA6NL/7GCpRrNKTu14nou8IgVqyzQ1nezyy7c+vWBD5D0WcPvPUZ3YlAwrn+HF0RZpwe//YA9VZ+hBtOqmuToT3cs/nCjoyCJFu6LpCtSQxyLXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665078386; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=1HbnI8XB6fI4g8GHN2/BYiW88m9bVhAn5yA+d2E22Tw=; b=lloyuT3aDRYp3paGd/t2DzUKpzW4oY/Jn9I3P4nRyHLiGB4CgQfxjzyjU5hXxH0dLNiuALNtI5DSjiZWrnh3mmTPAQ85AckzcvNbq5H46xME0mF7+szcDY1c8qYa97EcgAjhpvgmfvK6kUMt1y7YevBXiM+lthNu/Xi8XIC2EzY= 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+94799+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 1665078386340663.0207691477136; Thu, 6 Oct 2022 10:46:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Fm0cYY1788612xHt5r1Qspsi; Thu, 06 Oct 2022 10:46:25 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web09.691.1665078384373693911 for ; Thu, 06 Oct 2022 10:46:25 -0700 X-Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-346-GyLv79-fNw2QIB4nVFxvTg-1; Thu, 06 Oct 2022 13:46:20 -0400 X-MC-Unique: GyLv79-fNw2QIB4nVFxvTg-1 X-Received: by mail-qt1-f199.google.com with SMTP id ff14-20020a05622a4d8e00b00394aaf0f653so1106663qtb.19 for ; Thu, 06 Oct 2022 10:46:20 -0700 (PDT) X-Gm-Message-State: MnAtiURFuqJ886mmI7zj1sesx1787277AA= X-Received: by 2002:a0c:ca09:0:b0:4b1:c6ea:dcd2 with SMTP id c9-20020a0cca09000000b004b1c6eadcd2mr807663qvk.17.1665078380109; Thu, 06 Oct 2022 10:46:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FVbdvJQh0QtmnCOjpjl/HIR9CD2yoOKZb+q3BOL6UvhcGHyg65P/Z98QTE/MbDduduLR+3Q== X-Received: by 2002:a0c:ca09:0:b0:4b1:c6ea:dcd2 with SMTP id c9-20020a0cca09000000b004b1c6eadcd2mr807646qvk.17.1665078379893; Thu, 06 Oct 2022 10:46:19 -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 c9-20020ac86e89000000b0035cd6a4ba3csm166767qtv.39.2022.10.06.10.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 10:46:19 -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 v2] Platform/RaspberryPi: fix pci DT node address in SyncPcie() Date: Thu, 6 Oct 2022 13:46:11 -0400 Message-Id: <20221006174611.36996-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=1665078385; bh=VJkEKk2A4u6eJBR4hW44NTwM3fVPQGcsxyL+xmPoyJ8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=b7JOsDpwKpnih8qmKr7qMkFnK0oy/cNbQU7rHCp5+rc3IN6eBT+qp00kYZSVeNxnzZV 0H44bHSTYxZDAsYdAEcnIK/L06PqCq5m+TPeOD3QX/xP7n5xQf7jjC+q521/0z1EhrSD9 LL5pF3KqemR0JTgyfmje+o8xT/nE4kAziYE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1665078387966100002 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 allows matching any address for the pci node, thus working with both legacy and new device trees. [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 Reviewed-by: Jeremy Linton Tested-by: Jeremy Linton --- v1->v2: Match both pci@1,0 and pci@0,0 I chose to remove the address altogether, since there is only one pci node for the Raspberry Pi 4 and thus no ambiguity. Let me know if you prefer explicitly matching pci@1,0 and pci@0,0. 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..cbbc2ad30d 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"); 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\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\n")); return EFI_NOT_FOUND; } } base-commit: ae75c51f27e21036b6ee021a2d5b9f365f951413 --=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 (#94799): https://edk2.groups.io/g/devel/message/94799 Mute This Topic: https://groups.io/mt/94163254/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-