From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 9BD9D7803DB for ; Tue, 24 Oct 2023 16:51:07 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1sl4dMXIqXl3Ly7qDfV6Fivxcy1hqctxgI9fNc0U3Iw=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698166266; v=1; b=TOWnpO52RHhBasr2sA14bwfuNiM3lvIAKfmN4TuiJsXFp+bpXaQpWYZvSJMdCYBwNoZTxpdg Ns8MdGFUXpE7SDQ1uvqHGSreLoeaeCPEXTixUrDLcb6UdagMzFtd0t0oz8cS9jgng3rtM6Ka9rU YSOIrnSjseeYo4uS7D8JH78k= X-Received: by 127.0.0.2 with SMTP id Y4VvYY7687511xhfzgVjMPut; Tue, 24 Oct 2023 09:51:06 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.152987.1698166265453058118 for ; Tue, 24 Oct 2023 09:51:05 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-365-P6FQ5JlHOlOZKlyz-qxQpQ-1; Tue, 24 Oct 2023 12:51:01 -0400 X-MC-Unique: P6FQ5JlHOlOZKlyz-qxQpQ-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4CA91C0754E; Tue, 24 Oct 2023 16:51:00 +0000 (UTC) X-Received: from [10.39.195.39] (unknown [10.39.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B2648492BFB; Tue, 24 Oct 2023 16:50:59 +0000 (UTC) Message-ID: <2b57b0c9-7717-56f5-ab0e-062e0fd0c8b8@redhat.com> Date: Tue, 24 Oct 2023 18:50:58 +0200 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] ArmPlatformPkg/PL031RealTimeClockLib: remove superfluous instance init steps To: devel@edk2.groups.io, ardb@kernel.org Cc: Ard Biesheuvel , Leif Lindholm References: <20231020121748.44862-1-lersek@redhat.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.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 Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Da9Eyu5bnAH53fqj6MhRBzdQx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=TOWnpO52; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 10/20/23 14:27, Ard Biesheuvel wrote: > On Fri, 20 Oct 2023 at 14:17, Laszlo Ersek wrote: >> >> RealTimeClockLib instances are consumed by edk2's >> EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function >> InitializeRealTimeClock(), the driver: >> >> (1) calls LibRtcInitialize(), >> >> (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() >> runtime services to its own similarly-named functions -- where those >> functions wrap the corresponding RealTimeClockLib APIs, >> >> (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol >> interface. >> >> Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through >> II-9.7.2.7. >> >> However, this means that LibRtcInitialize() (of any RealTimeClockLib >> instance) should not itself (a) set the GetTime(), SetTime(), >> GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install >> EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be >> overwritten in step (2) anyway, and step (3) will uselessly install a >> second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in th= e >> protocol database. (The protocol only serves to notify the DXE Foundatio= n >> about said runtime services being available.) >> >> Clean up ArmPlatformPkg/PL031RealTimeClockLib accordingly (it only has >> code that's redundant for step (3); it does not try to set "gRT" fields)= . >> >> (Note that the lib instance INF file already does not list >> gEfiRealTimeClockArchProtocolGuid.) >> >> Tested with ArmVirtQemu. >> >> Cc: Ard Biesheuvel >> Cc: Leif Lindholm >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 >> Signed-off-by: Laszlo Ersek >> --- >> >> Notes: >> context:-W >> >> ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | = 13 ------------- >> 1 file changed, 13 deletions(-) >> >=20 > Acked-by: Ard Biesheuvel >=20 > Thanks a lot for cleaning up this mess. Merged via as commit d85bf54b7f46. Thanks! Laszlo >=20 >=20 >> diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeC= lockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClock= Lib.c >> index 9e852696d2fd..1896f9d16d3b 100644 >> --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib= .c >> +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib= .c >> @@ -1,34 +1,32 @@ >> /** @file >> Implement EFI RealTimeClock runtime services via RTC Lib. >> >> Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
>> Copyright (c) 2011 - 2020, Arm Limited. All rights reserved.
>> Copyright (c) 2019, Linaro Ltd. All rights reserved.
>> >> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> >> #include >> >> #include >> #include >> >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> >> -#include >> - >> #include "PL031RealTimeClock.h" >> >> STATIC BOOLEAN mPL031Initialized =3D FALSE; >> @@ -307,52 +305,41 @@ EFIAPI >> LibRtcInitialize ( >> IN EFI_HANDLE ImageHandle, >> IN EFI_SYSTEM_TABLE *SystemTable >> ) >> { >> EFI_STATUS Status; >> - EFI_HANDLE Handle; >> >> // Initialize RTC Base Address >> mPL031RtcBase =3D PcdGet32 (PcdPL031RtcBase); >> >> // Declare the controller as EFI_MEMORY_RUNTIME >> Status =3D gDS->AddMemorySpace ( >> EfiGcdMemoryTypeMemoryMappedIo, >> mPL031RtcBase, >> SIZE_4KB, >> EFI_MEMORY_UC | EFI_MEMORY_RUNTIME >> ); >> if (EFI_ERROR (Status)) { >> return Status; >> } >> >> Status =3D gDS->SetMemorySpaceAttributes (mPL031RtcBase, SIZE_4KB, EF= I_MEMORY_UC | EFI_MEMORY_RUNTIME); >> if (EFI_ERROR (Status)) { >> return Status; >> } >> >> - // Install the protocol >> - Handle =3D NULL; >> - Status =3D gBS->InstallMultipleProtocolInterfaces ( >> - &Handle, >> - &gEfiRealTimeClockArchProtocolGuid, >> - NULL, >> - NULL >> - ); >> - ASSERT_EFI_ERROR (Status); >> - >> // >> // Register for the virtual address change event >> // >> Status =3D gBS->CreateEventEx ( >> EVT_NOTIFY_SIGNAL, >> TPL_NOTIFY, >> VirtualNotifyEvent, >> NULL, >> &gEfiEventVirtualAddressChangeGuid, >> &mRtcVirtualAddrChangeEvent >> ); >> ASSERT_EFI_ERROR (Status); >> >> return Status; >> } >=20 >=20 >=20 >=20 >=20 -=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 (#110008): https://edk2.groups.io/g/devel/message/110008 Mute This Topic: https://groups.io/mt/102079629/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-