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 762CEAC131F for ; Thu, 29 Aug 2024 13:38:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1LtbBlG3LV+sN+4BVK1JIi9NeynJ9Wy27w0rinvQQR8=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc: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=1724938706; v=1; b=3EhYdCT4VL+LpFWEalWDgweemGFtJ8x2L8qxh7t5XZwlPgmeL48oEj4LYb2Xxjkjx7a2LeFK gp6QE5JJvX4+eZ5EfVtXeY/f8o2RQyy0wCAN0CNfXAqwQ/XygtoVzFsfOELWjX0F0JjLlbspNlR oCeQpekR53mXnOXVnrMh4SLAjMxxcDXch+siUagVJYkZ0Eyz/U5ve6y3UhxK7p/lMjeymJScR7m CR5rEbqsawSr7vGaNKBOMisiQl7Ci7EkPATgC5B3w5zCCOPtPMoLPi+fb+qP/mArM3Ju660qKRQ meHodu60uR29Sr4viTBNikzu2baSRxEeUSezqIa7KSDfA== X-Received: by 127.0.0.2 with SMTP id BKSzYY7687511x74ZVkCOF78; Thu, 29 Aug 2024 06:38:25 -0700 X-Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by mx.groups.io with SMTP id smtpd.web11.15746.1724938704030034172 for ; Thu, 29 Aug 2024 06:38:24 -0700 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 21B6BA44049 for ; Thu, 29 Aug 2024 13:38:16 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD29FC4CEC7 for ; Thu, 29 Aug 2024 13:38:22 +0000 (UTC) X-Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-533488ffaf7so930994e87.0 for ; Thu, 29 Aug 2024 06:38:22 -0700 (PDT) X-Gm-Message-State: uxORtWvAnJGzCpPMGeuw19e7x7686176AA= X-Google-Smtp-Source: AGHT+IHTEbBpBk+wUYejVEKYTucrDznz1kIweAtDdWPAJuNv0SM2XDpNC0A5IB3k33qM9/8nhVJd5jZ91AziubzcMH4= X-Received: by 2002:a05:6512:e92:b0:533:97b:e272 with SMTP id 2adb3069b0e04-5353e5aae0emr2169582e87.41.1724938701051; Thu, 29 Aug 2024 06:38:21 -0700 (PDT) MIME-Version: 1.0 References: <20240814032242.2353572-1-nhi@os.amperecomputing.com> <82e50c43-e924-49f3-bc17-8b32cb51bd7b@amperemail.onmicrosoft.com> In-Reply-To: From: "Ard Biesheuvel via groups.io" Date: Thu, 29 Aug 2024 15:38:10 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH 1/1] AmpereAltraPkg/FlashLib: Fix kernel crash if not call SetVirtualAddressMap() To: devel@edk2.groups.io, nhi@os.amperecomputing.com Cc: Chuong Tran OS , "quic_llindhol@quicinc.com" , Chuong Tran OS , Rebecca Cran OS 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: Thu, 29 Aug 2024 06:38:24 -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=3EhYdCT4; dmarc=pass (policy=none) header.from=groups.io; 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 Thu, 29 Aug 2024 at 10:48, Nhi Pham via groups.io wrote: > > Pushed as 03d3395552c5 > Thanks for finally providing a fix for this! Is there any way to detect whether a firmware build has this fix? > ________________________________ > From: Chuong Tran OS > Sent: Thursday, August 29, 2024 3:25 PM > To: Nhi Pham OS ; devel@edk2.groups.io > Cc: quic_llindhol@quicinc.com ; Chuong Tran OS ; Rebecca Cran OS > Subject: Re: [PATCH 1/1] AmpereAltraPkg/FlashLib: Fix kernel crash if not call SetVirtualAddressMap() > > Acked-by: Chuong Tran > > Thanks, > Chuong > > On 8/14/2024 10:22 AM, Nhi Pham wrote: > > From: Chuong Tran > > > > OS kernel with greater than or equal to 48-bit VA space avoids EFI's > > SetVirtualAddressMap() runtime service on Arm64 and simply uses the 1:1 > > address mapping that UEFI used at booting. However, AmpereAltraPkg's > > RuntimeFlashLib replies on function call SetVirtualAddressMap() to > > determine whether it is in boot time or run-time. If > > SetVirtualAddressMap() has not been called prior, it causes the kernel > > crash. This patch fixes that issue by removing the separation between > > UEFI boot time and run-time in RuntimeFlashLib. > > > > Signed-off-by: Nhi Pham > > --- > > Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c | 11 +++-------- > > Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c | 2 -- > > 2 files changed, 3 insertions(+), 10 deletions(-) > > > > diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c > > index 83695c857a11..0b000c2aad46 100644 > > --- a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c > > +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c > > @@ -15,7 +15,6 @@ > > > > #include "FlashLibCommon.h" > > > > -BOOLEAN gFlashLibRuntime = FALSE; > > UINT8 *gFlashLibPhysicalBuffer; > > UINT8 *gFlashLibVirtualBuffer; > > > > @@ -34,13 +33,9 @@ ConvertToPhysicalBuffer ( > > IN UINT32 Size > > ) > > { > > - if (gFlashLibRuntime) { > > - ASSERT (VirtualPtr != NULL); > > - CopyMem (gFlashLibVirtualBuffer, VirtualPtr, Size); > > - return gFlashLibPhysicalBuffer; > > - } > > - > > - return VirtualPtr; > > + ASSERT (VirtualPtr != NULL); > > + CopyMem (gFlashLibVirtualBuffer, VirtualPtr, Size); > > + return gFlashLibPhysicalBuffer; > > } > > > > /** > > diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c > > index 2dcd13e08146..14cef8e17ece 100644 > > --- a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c > > +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c > > @@ -35,8 +35,6 @@ FlashLibAddressChangeEvent ( > > { > > gRT->ConvertPointer (0x0, (VOID **)&gFlashLibVirtualBuffer); > > gRT->ConvertPointer (0x0, (VOID **)&mMmCommunicationProtocol); > > - > > - gFlashLibRuntime = TRUE; > > } > > > > /** > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120430): https://edk2.groups.io/g/devel/message/120430 Mute This Topic: https://groups.io/mt/107889187/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-