From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id AB9D4740041 for ; Mon, 1 Jul 2024 13:36:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=SSq5Oiiv5i7Q5DnACGTgN+bQZSOfjdcUXz3qy/oFJx8=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1719840971; v=1; b=YJ0BAXtgKDfcsSq7HMDNcftE/yfWJSawkpmBrVmu5ag3pJmO2YHHVeJvK+tdkplDV91gJrL5 gmaom3XlGMsh3Q6iSDDviWJU4+4vI84p/l4Y4/F9ldSFgh45TtpnczAx87D+ajq5MZYCbgs55ms UYm3NVcDOnQGVHKFqKV0qWMMTVnfAeZhhvKdYCjGL4UKfI4tT8Zw8TgAl+fe41rtnwtC5h+PxDJ vgC6E2kFlPnAofuay8EtAcIPwNw/L4SEEvTk5/A+BzQ3lv9GkupqX1n636ttS2Ys/G7UVeGIqkj jeN2IeOHJI2dR17YkGni8wHuYpcoUdSlamCVMIOWbXnjg== X-Received: by 127.0.0.2 with SMTP id t2iSYY7687511xdy2tlp7sBg; Mon, 01 Jul 2024 06:36:10 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.19910.1719840969730815697 for ; Mon, 01 Jul 2024 06:36:09 -0700 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2E827612FD for ; Mon, 1 Jul 2024 13:36:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5C93C116B1 for ; Mon, 1 Jul 2024 13:36:08 +0000 (UTC) X-Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2eaae2a6dc1so39389321fa.0 for ; Mon, 01 Jul 2024 06:36:08 -0700 (PDT) X-Gm-Message-State: IPXf7dLPnlbE5FsODIzAYZW5x7686176AA= X-Google-Smtp-Source: AGHT+IERkD4BS0g8EB1FES13IyzatoSs0g2qaQGetnb73efoyhn2o2t4uJXGHdh3GhjT2h9A5XNpa/FfOeq+cTWwmo0= X-Received: by 2002:a2e:96c6:0:b0:2ec:2038:925d with SMTP id 38308e7fff4ca-2ee5e37ffa9mr48699401fa.1.1719840967162; Mon, 01 Jul 2024 06:36:07 -0700 (PDT) MIME-Version: 1.0 References: <20240627142212.408917-1-marcin.juszkiewicz@linaro.org> <20240627142212.408917-2-marcin.juszkiewicz@linaro.org> <59847794-9dd1-4be1-b5ac-e61f22c60386@quicinc.com> <2176e4bf-dcd1-4aa5-9866-eaa852ae0fb0@linaro.org> <9b49bd01-ef9d-4a7d-8738-138a2c6c2ebd@quicinc.com> In-Reply-To: <9b49bd01-ef9d-4a7d-8738-138a2c6c2ebd@quicinc.com> From: "Ard Biesheuvel" Date: Mon, 1 Jul 2024 15:35:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH edk2-platforms 1/1] SbsaQemu: use FEAT_RNG for EFI_RNG_PROTOCOL To: devel@edk2.groups.io, quic_llindhol@quicinc.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 01 Jul 2024 06:36:09 -0700 Resent-From: ardb@kernel.org Reply-To: devel@edk2.groups.io,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=YJ0BAXtg; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io On Mon, 1 Jul 2024 at 15:28, Leif Lindholm wrote: > > On 2024-07-01 13:58, Marcin Juszkiewicz wrote: > > >>> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > >>> b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > >>> index 9306986bf7c0..3463e5c7a635 100644 > >>> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > >>> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > >>> @@ -148,7 +148,9 @@ [LibraryClasses.common] > >>> # > >> > >> Since sbsa-ref still supports processors without FEAT_RNG, this may > >> cause unexpected breakages for some users. > > > > That's why I sent it as more of RFC than changes for merging. > > > >> Could we first of all conditionalise this change: > >> > >> [Defines] > >> ... > >> DEFINE_DEBUG_PRINT_ERROR_LEVEL = ... > >> DEFINE FEATRNG_ENABLE = TRUE > >> > >> so that someone who still wishes to run tests against older cpus can > >> still do so through a rebuild with -D FEATRNG_ENABLE=FALSE > > > > Is there a way to load both BaseRngLib and BaseRngLibTimerLib and switch > > between them depending on availability of FEAT_RNG? > > Not without severe hackery. The library is statically linked into RngDxe. > > >>> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf > >>> b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf > >>> index b35f42e11aa4..51a1ef8519f9 100644 > >>> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf > >>> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf > >>> @@ -192,6 +192,7 @@ [FV.FvMain] > >>> INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf > >>> INF OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf > >>> INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf > >>> + INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf > >> > >> Second: > >> What is the failure mode of running the BaseRngLib flavour on cpus > >> that don't support FEAT_RNG? RngDxe itself seems to do the right > >> thing, but do we get any warning messages or will certain operations > >> now fail silently? > > > > On FEAT_RNG cores we get: > > > > InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 101FAD68798 > > ProtectUefiImageCommon - 0xFAD683C0 > > - 0x00000101FBBDB000 - 0x0000000000007000 > > ArmTrngLib could not be correctly initialized. > > InstallProtocolInterface: 3152BCA5-EADE-433D-862E-C01CDC291F44 101FBBE0020 > > Loading driver B601F8C4-43B7-4784-95B1-F4226CB40CEE > > > > > > On core without FEAT_RNG: > > > > InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 101FAD68798 > > ProtectUefiImageCommon - 0xFAD683C0 > > - 0x00000101FBBDB000 - 0x0000000000007000 > > ArmTrngLib could not be correctly initialized. > > Error: Image at 101FBBDB000 start failed: 00000001 > > Loading driver B601F8C4-43B7-4784-95B1-F4226CB40CEE > > But it still keeps booting correctly after that? With some missing > functionality? > > > So there is some kind of information but you need to know what > > to look for ;( > > Ard: would you be opposed to putting a DEBUG print and/or an ASSERT in > BaseRngLibContructor if mRndrSupported == 0? > > An alternative would be to place a test and noisy warning inside > SbsaQemuPlatformDxe. > I'm not sure I follow what we are trying to fix here. RngDxe will simply not load if BaseRngLib does not find FEAT_RNG support. If the issue is other, existing users of RngLib that are currently served by BaseRngTimerLib, we could make the library class resolutions introduced here local the RngDxe driver, using SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf { RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf ArmTrngLib|ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf ArmMonitorLib|ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf } -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119738): https://edk2.groups.io/g/devel/message/119738 Mute This Topic: https://groups.io/mt/106909459/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-