From nobody Fri Apr 26 13:14:10 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+74139+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+74139+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1618514533; cv=none; d=zohomail.com; s=zohoarc; b=kyEt2wd+wfq0se7RNoHyx61a5T62Gns07Kd1iLbPTOmx8v2WyVSwf/WW6m6HwFLcLR65AKEzpoYN/FObCDEJsDO2ecL5i2ekrh931jWMz0WPknQ2O8WLFtFYoXRM1MPQREFjVmzIO1hDhi8n8kqxldf1TVRdTJwTIRjajqsmlg4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618514533; 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=aKBrK/kbkYrXkU36DdI9cwlRomxoxCKX4BktVS4FQpg=; b=JoihpGrxKJPHn4t+Fvo+0sVNL0+TZNN/SCyjNCGqOvnpjhjbUPoJGMwd0y5ilkt+fbAcgzO5ZZ+YLflYk1avniBmHrxWe/mGCPzyF6uQLTwy35tIAAtrwLUjI6Z8YrByB5ZLHYOma0lnQ8+DjEmpgQOO2hVTwon28lEn1IC1wEQ= 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+74139+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 1618514533542212.6856756357506; Thu, 15 Apr 2021 12:22:13 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id p1HcYY1788612xYN7dOqCeWa; Thu, 15 Apr 2021 12:22:13 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.183.1618514532132705674 for ; Thu, 15 Apr 2021 12:22:12 -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 BFFA512FC; Thu, 15 Apr 2021 12:22:11 -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 AE2D73FA35; Thu, 15 Apr 2021 12:22:11 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, samer.el-haj-mahmoud@arm.com, awarkentin@vmware.com, Jeremy Linton Subject: [edk2-devel] [PATCH 1/2] Silicon/Broadcom/BcmGenetDxe: Delay for linkup in transmit Date: Thu, 15 Apr 2021 14:22:06 -0500 Message-Id: <20210415192207.3257790-2-jeremy.linton@arm.com> In-Reply-To: <20210415192207.3257790-1-jeremy.linton@arm.com> References: <20210415192207.3257790-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: MX3g8mtgT1NWARlbb6SkSNjOx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1618514533; bh=GtgZWgaTX++JWkAtPLqeic36QoEpivqUyK8/ObAKcYo=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=cYsQhtERCoA2WWb+tKEyKXLKYAsH+AxGLE8g88C9qjSPK7GhMM2FQgxCnJ37u49QmQX kzWgm65CVZ8gRaCBYmtlp1sahj80Ft7WqCd4J9q9N+AKj2PnZgLeFPsIz5Suc98VH92l+ HANzN1GenOsFCooITmCArngNTmNP3r7FT/0= 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 Signed-off-by: Jeremy Linton 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 (#74139): https://edk2.groups.io/g/devel/message/74139 Mute This Topic: https://groups.io/mt/82125863/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 Fri Apr 26 13:14:10 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+74140+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+74140+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1618514539; cv=none; d=zohomail.com; s=zohoarc; b=EHO0IWitZmBnkln83Xe8F0ldZ6yuXrLjG2W+wBxztaUwkzBkbzghJb2xUSb7IRw+gjqnpiMK5M7oEqxjnMdnefHhkUMwzhyQbGpe2NE6tV2C9mWdmmYeOne4X9n88rMZzzPvjXmQNlb/qUW5Rh3/yYaET2EsvkSqxyYm/3oL024= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618514539; 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=Z3fSuN4UHSQItfHT3dlXeP4uT2PHQZxRk5w03J5Phto=; b=NjfWfAEyPXOZ1yv15WrMe30dcmtjXQcK8t6MyXe2xbPb9R6z5CwV3rDp0C/tpmUDBC+5cEetY3kLTqMyNFBI/QroH1dWrb2V623ynYDhQNt8AKx8Q0N1aAcFhOXJMJksXndi1UMVdw3bwicjqQueMVcFLPOZqFSD5sEhPctYN4c= 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+74140+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 1618514539031515.4529308450287; Thu, 15 Apr 2021 12:22:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gQJ8YY1788612xBNq3b22cj4; Thu, 15 Apr 2021 12:22:18 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.184.1618514533020930757 for ; Thu, 15 Apr 2021 12:22:13 -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 97E371396; Thu, 15 Apr 2021 12:22:12 -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 8728A3FA35; Thu, 15 Apr 2021 12:22:12 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, samer.el-haj-mahmoud@arm.com, awarkentin@vmware.com, Jeremy Linton Subject: [edk2-devel] [PATCH 2/2] Platform/RaspberryPi: Increase genet dma window Date: Thu, 15 Apr 2021 14:22:07 -0500 Message-Id: <20210415192207.3257790-3-jeremy.linton@arm.com> In-Reply-To: <20210415192207.3257790-1-jeremy.linton@arm.com> References: <20210415192207.3257790-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: 8MOuGw0Xs0o5GZu1vQVxhNeGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1618514538; bh=e1cjTw+yMixalcn7bOXfdzDF6RgeXf7ks2Hy3SpjjbQ=; h=Cc:Date:From:Reply-To:Subject:To; b=tovtfCd1DcKWl9YeO5sOfKkjURBfq7q+dpiI3++YavHQygvuc/CKHQzyAFiF8F3+tA8 Ij5m/GU8MdFy/g/Gfl2Y1wp+6RJ78SOkg743wJW9Fv2FDe6//4N7Do9PnFq3t1PW9kE4O rljicJcZN81aFe0iEcGsZvj79jB0Dsrjm7Y= 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 Acked-by: Ard Biesheuvel Reviewed-By: Samer El-Haj-Mahmoud --- 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 ddf4dd6a41..facf34f034 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -698,7 +698,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 (#74140): https://edk2.groups.io/g/devel/message/74140 Mute This Topic: https://groups.io/mt/82125864/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-