From nobody Wed May 15 21:01:56 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+75039+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+75039+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1620772663; cv=none; d=zohomail.com; s=zohoarc; b=S8ZGF6SELDLtlbaThUUdPzKXQOdTFXdL8jijQcwPf89FnnUNMqdncdUPh8Y9MbxR9p2faJ5V5Tpp7FypWP8jEvNrXtumh+mmFUSb8/7p3BDcf3adHjfVMi1QvA1aKJ2IOsqsPaQapi2uvjXXmzSb9RPTXjeXIEHOwBrIjMW8zaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620772663; 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=S47nnIQ4/qQDvO9kWan0Xh0bIVVmm2bQA94Ah8o9tls=; b=V2MwtRcUHca13DfQtiIAkb8QfvyUgQVfeUbtKkv2WK/iQmfRPVMUqYi69Bx4kJkdlfcI9NP9Tw2jZpv771M1sFAZDXufQPlgPagYgg4BwGLoUKknz8KYeycj26us0mpovoZjwEaV93ZZkiI4frLPIquGdT5bCnmpBB98/XSQnP8= 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+75039+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1620772663971811.1014128891105; Tue, 11 May 2021 15:37:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZTk6YY1788612xL4HAlVluno; Tue, 11 May 2021 15:37:43 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4326.1620772658008725492 for ; Tue, 11 May 2021 15:37:38 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 964BDED1; Tue, 11 May 2021 15:37:37 -0700 (PDT) X-Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 839CB3F718; Tue, 11 May 2021 15:37:37 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, pete@akeo.ie, samer.el-haj-mahmoud@arm.com, awarkentin@vmware.com, Jeremy Linton , Jared McNeill Subject: [edk2-devel] [PATCH v2 1/2] Silicon/Broadcom/BcmGenetDxe: Delay for linkup in transmit Date: Tue, 11 May 2021 17:37:33 -0500 Message-Id: <20210511223734.864455-2-jeremy.linton@arm.com> In-Reply-To: <20210511223734.864455-1-jeremy.linton@arm.com> References: <20210511223734.864455-1-jeremy.linton@arm.com> MIME-Version: 1.0 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,jeremy.linton@arm.com X-Gm-Message-State: quGj1ZqKNMnsD3BhjOITooBxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620772663; bh=p/FrpJd1jqpqPjY1AsNDXaaEZ4s9GZ1RvD1FmjHxnFs=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=H9ibUhhFi9LqtVYa/OdcQcg6sZqw9gs78J7+r8l0rp+yuQPJdAq2ec+M2/jd6YBRegO m4Hzci7xQEJBDBIF8xvsb/Wujrj+CP9DltxdbHbRLj9AqZfdC4eRaCFbb59gWOPWDoaUY BB+3SVbvsPMkDyaVeeHfhPn/zPej/sJTv8Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Under normal circumstances GenetSimpleNetworkTransmit won't be called unless the rest of the network stack detects the link is up. So, during normal operation when the adapter is initialized the link naturally transitions to link up, and then is ready for activity later in the boot sequence. If that hasn't happened by the time PXE runs then it will itself wait for the link. OTOH, the normal distro PXE sequence involves PXE loading shim which in turn loads grub, which tries to read machine specific configs, modules, and grub.cfg in order to prepare the boot menu. Then, once a grub selection is picked, it might try to load the kernel+initrd. In this sequence the network stack is shutdown and restarted multiple times. Grub though, starts up, notices its been network booted, reads saved network parameters and immediately tries to transmit data assuming the link is still up. When that happens grub will print "couldn't send network packet" and if that lasts long enough it fails to load grub.cfg and the user gets dropped to the grub prompt because no one in the path bothers to assure the link state has transitioned back up. For reference: https://github.com/pftf/RPi4/issues/113 This patch fixes that by polling the link state via GenericPhyUpdateConfig() for ten seconds in the transmit path when the link is down. If the link recovers within this timeout the state machine is transitioned and we continue data transmission. If the 10 seconds expires without the link resuming we will fail as before. While full link negotiation can be fast, it frequently can take a second or two, or longer depending on the remote peer on the other end of the Ethernet cable. It seems auto MDX can slow this down, and certain vendors products seem to be slower than the norm. Ten seconds may not cover some of these possibilities, but the user should validate cabling and the switch/peer's port configuration if resuming the link is taking > 10 seconds. Picking a longer timeout is a tradeoff between the machine appearing to hang for extended periods of time (due to grub retries) if the link is actually down vs generally providing enough time for most endpoints to complete the negotiation. Signed-off-by: Jeremy Linton Reviewed-by: Jared McNeill Reviewed-by: Andrei Warkentin --- .../Drivers/Net/BcmGenetDxe/SimpleNetwork.c | 24 ++++++++++++++++++= ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c b/Sil= icon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c index 1bda18f157..29c76d8495 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c @@ -13,6 +13,7 @@ #include #include #include +#include #include =20 #include "BcmGenetDxe.h" @@ -590,9 +591,28 @@ GenetSimpleNetworkTransmit ( =20 if (!Genet->SnpMode.MediaPresent) { // - // Don't bother transmitting if there's no link. + // We should only really get here if the link was up + // and is now down due to a stop/shutdown sequence, and + // the app (grub) doesn't bother to check link state + // because it was up a moment before. + // Lets wait a bit for the link to resume, rather than + // failing to send. In the case of grub it works either way + // but we can't be sure that is universally true, and + // hanging for a couple seconds is nicer than a screen of + // grub send failure messages. // - return EFI_NOT_READY; + int retries =3D 1000; + DEBUG ((DEBUG_INFO, "%a: Waiting 10s for link\n", __FUNCTION__)); + do { + gBS->Stall (10000); + Status =3D GenericPhyUpdateConfig (&Genet->Phy); + } while (EFI_ERROR (Status) && retries--); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: no link\n", __FUNCTION__)); + return EFI_NOT_READY; + } else { + Genet->SnpMode.MediaPresent =3D TRUE; + } } =20 if (HeaderSize !=3D 0) { --=20 2.13.7 -=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 (#75039): https://edk2.groups.io/g/devel/message/75039 Mute This Topic: https://groups.io/mt/82759387/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 21:01:56 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+75040+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+75040+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1620772661; cv=none; d=zohomail.com; s=zohoarc; b=jDrSD96dKrS8bArQnEnr9dBuYn5JECfbSqCH+5XmfBM391auADZ6lJ3WXl8Yp+zvenKe9CnIeOnibGjUm4z21VM/4dmOL3n+TaS9ITQe6DcQiBTwysF0MUlyoy7zygYDa0ID6yD03+bBhumGuw0UlX7jc5G5FoJa6YtlAm7w8Jk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620772661; h=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=1HSL9m2uuH+2D4Jjs4gTcr7oK2P6EIpiJtu3q1xsKSU=; b=Eq2sgbF9hPiXuz192qeCztorDnjTo/C8iuTCEhAVder/ZmuGM9HMpAzmrzIZyHPUpAyER3Z5Azw+prN5zG/zInJvFLev1COUyHo4bT1YeyWiokD9chEV8zS927qwPgHaC2Nt2LoYVKv6z/yISeGKcog4KyuBXOsP2ZZKcJxRgN4= 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+75040+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16207726609661.2907973768534475; Tue, 11 May 2021 15:37:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id KdxIYY1788612xZYmfVBfeqx; Tue, 11 May 2021 15:37:40 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4327.1620772659995148344 for ; Tue, 11 May 2021 15:37:40 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 418EED6E; Tue, 11 May 2021 15:37:39 -0700 (PDT) X-Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2F1083F718; Tue, 11 May 2021 15:37:39 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, pete@akeo.ie, samer.el-haj-mahmoud@arm.com, awarkentin@vmware.com, Jeremy Linton , Jared McNeill Subject: [edk2-devel] [PATCH v2 2/2] Platform/RaspberryPi: Increase genet dma window Date: Tue, 11 May 2021 17:37:34 -0500 Message-Id: <20210511223734.864455-3-jeremy.linton@arm.com> In-Reply-To: <20210511223734.864455-1-jeremy.linton@arm.com> References: <20210511223734.864455-1-jeremy.linton@arm.com> MIME-Version: 1.0 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,jeremy.linton@arm.com X-Gm-Message-State: bm1DI5cTHRtJNWQsQXcYvXLXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620772660; bh=EDra95gTa1t8k2vlW9xA0wm4iNilGfkQSIOsi6UMtBY=; h=Cc:Date:From:Reply-To:Subject:To; b=LOM7/Jx59qUMv/BOY1Bztr0oaHoALgCv4FGxzslx0l7s2zGX2ZPxNau3WWxHsGHfAj6 XbDRtNTQvk0gHakAz6oV7ESE60MXf55zvVkLRNVAG+z4h55wCy4E6hf+NTFtRH3iruZye cxLUeMPIAByYS0iWJjwtamRHLygjEK1Qrvs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The genet is capable of addressing the entire memory space on the RPI4. Lets allow it to dma into those regions. This solves intermittent issues with grub/etc being able to communicate when the 3G limit is lifted on 8G boards. Signed-off-by: Jeremy Linton Reviewed-by: Jared McNeill --- Platform/RaspberryPi/RPi4/RPi4.dsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 5c6783eae7..cf796acf6a 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -717,7 +717,7 @@ Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf { gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x00000000 - gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffff + gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffffff } =20 # --=20 2.13.7 -=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 (#75040): https://edk2.groups.io/g/devel/message/75040 Mute This Topic: https://groups.io/mt/82759388/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-