From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web12.9520.1627052986008999625 for ; Fri, 23 Jul 2021 08:09:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h0W0HMTf; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: by mail.kernel.org (Postfix) with ESMTPSA id F041E60EE2 for ; Fri, 23 Jul 2021 15:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627052985; bh=XsCF6cezcf8La9X9eH4Cf2Kled48Ucbn6if3DTCITr0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=h0W0HMTfftN7rS09aIAXEx5MM+vfquce6nGK6ryv93SWiAWyb5FA9bj+/wxSrYVCl 8LxLbLo2pNYd0iFukobMJfqTS6jnjjwCTif3pb2SRwmhf2UI5vm2Eq37OdozDyz+GL 7W3OlKa0UyfmzdoF1v62PiA1llbSZG5mpDACT9QI72MIUGicp02bhj8ee8eNI6WuKY uYP1ala6DcijQMueWfOxaE/zwyG99idRqc2mJUhIJGCv48BAXvzMKfwzBjb+5p0TTm OWSqdnNkOD1YSPXeYIe3ElMKA+mOyBdVIwvKEv3+BpkA3B/0dIxPw9WM67UM/xHw0Y Z4uctWMgy0/Tw== Received: by mail-oo1-f47.google.com with SMTP id 13-20020a4ae1ad0000b029024b19a4d98eso454312ooy.5 for ; Fri, 23 Jul 2021 08:09:44 -0700 (PDT) X-Gm-Message-State: AOAM532a27oazq53o1v0djfHwCPQ20vXpn1qSIK5NisrwkNMR+YvT8WP zZc+4X9JfT6yNex732T9B9WumY2lmNd/ZM6Ox0g= X-Google-Smtp-Source: ABdhPJz8AKFfvHCmcxE0ABE1SSdnbWtQTYiArLnwHsUbnyGEUEy9/PhJ6ou8hGb4DM1cOtdRHDlALKguHqiq/dxGLWM= X-Received: by 2002:a4a:e923:: with SMTP id a3mr2953234ooe.45.1627052984356; Fri, 23 Jul 2021 08:09:44 -0700 (PDT) MIME-Version: 1.0 References: <20210723091521.1663-1-Sunny.Wang@arm.com> In-Reply-To: <20210723091521.1663-1-Sunny.Wang@arm.com> From: "Ard Biesheuvel" Date: Fri, 23 Jul 2021 17:09:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-platform PATCH v1 1/1] Platform/RaspberryPi: Make SetVariable return EFI_UNSUPPORTED at runtime To: Sunny Wang Cc: edk2-devel-groups-io , Samer El-Haj-Mahmoud , Sami Mujawar , Jeremy Linton , Ard Biesheuvel , Pete Batard , Leif Lindholm Content-Type: text/plain; charset="UTF-8" On Fri, 23 Jul 2021 at 11:15, Sunny Wang wrote: > > The RPi does not support storing UEFI NV variables at runtime. For now, > gRT->SetVariable at runtime returns EFI_OUT_OF_RESOURCES which is not a > proper error and would cause FWTS failures. Therefore, this patch is > to make gRT->SetVariable at runtime return EFI_UNSUPPORTED. > > For more information, please check the issues below: > -https://github.com/pftf/RPi4/issues/6 > -https://github.com/pftf/RPi4/issues/93 > -https://github.com/pftf/RPi4/issues/163 > > I also tested this with the ACS 3.0 FWTS. All the failures > reported in issue 93 and 163 can be fixed by this patch. > > Cc: Samer El-Haj-Mahmoud > Cc: Sami Mujawar > Cc: Jeremy Linton > Cc: Ard Biesheuvel > Cc: Pete Batard > Cc: Leif Lindholm > > Signed-off-by: Sunny Wang This looks ok to me, but we should also expose this fact via the EFI_RT_PROPERTIES_TABLE, so that the OS can anticipate this result. > --- > .../Drivers/VarBlockServiceDxe/VarBlockService.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockService.c b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockService.c > index 572309439a..16d4d4f178 100644 > --- a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockService.c > +++ b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockService.c > @@ -2,6 +2,7 @@ > * > * Copyright (c) 2018, Andrei Warkentin > * Copyright (c) 2006-2014, Intel Corporation. All rights reserved. > + * Copyright (c) 2021, ARM Limited. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -596,6 +597,7 @@ FvbProtocolWrite ( > EFI_DEVICE_ERROR - The block device is not functioning correctly and > could not be written > EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL > + EFI_UNSUPPORTED This function is not supported at runtime > > --*/ > { > @@ -605,6 +607,16 @@ FvbProtocolWrite ( > EFI_STATUS Status; > EFI_STATUS ReturnStatus; > > + // > + // The current variables support relies on modifying RPI_EFI.FD on SD > + // card, which works fine at boot time. However, at runtime, the SD > + // controller is exposed via ACPI and subsequently owned by the OS. > + // Therefore, we need to direclty return EFI_UNSUPPORTED. > + // > + if (EfiAtRuntime ()) { > + return EFI_UNSUPPORTED; > + } > + > // > // Check for invalid conditions. > // > -- > 2.31.0.windows.1 >