From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2C71D211B736F for ; Mon, 14 Jan 2019 22:37:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2019 22:37:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,480,1539673200"; d="scan'208";a="108311226" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 14 Jan 2019 22:37:00 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 14 Jan 2019 22:36:59 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 14 Jan 2019 22:36:58 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.196]) by shsmsx102.ccr.corp.intel.com ([169.254.2.63]) with mapi id 14.03.0415.000; Tue, 15 Jan 2019 14:36:56 +0800 From: "Wu, Hao A" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH V2 01/15] MdeModulePkg Variable: Add some missing changes for 9b18845 Thread-Index: AQHUrBynf3OaHfKx0Ui2WeaReYE0AKWvhFug Date: Tue, 15 Jan 2019 06:36:55 +0000 Message-ID: References: <1547479196-40248-1-git-send-email-star.zeng@intel.com> <1547479196-40248-2-git-send-email-star.zeng@intel.com> In-Reply-To: <1547479196-40248-2-git-send-email-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH V2 01/15] MdeModulePkg Variable: Add some missing changes for 9b18845 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2019 06:37:02 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Star Zeng > Sent: Monday, January 14, 2019 11:20 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A; Zeng, Star > Subject: [edk2] [PATCH V2 01/15] MdeModulePkg Variable: Add some > missing changes for 9b18845 >=20 > To improve performance 9b18845a4b4cd1d2cf004cbc1cadf8a93ccb37ea > changed the code which read from physical MMIO address to read > from memory cache, but it missed some places that could be updated > at the same away for performance optimization. >=20 > The patch updates these places as supplementary. >=20 > I found them when updating code for > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1323 > Merge EmuVariable and Real variable driver. >=20 > Cc: Jian J Wang > Cc: Hao Wu > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 12 +++++---- > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c | 6 +++--- > 2 files changed, 8 insertions(+), 10 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index 443cf07144a1..99d487adac9e 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -16,7 +16,7 @@ > VariableServiceSetVariable() should also check authenticate data to av= oid > buffer overflow, > integer overflow. It should also check attribute to avoid authenticati= on > bypass. >=20 > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > @@ -262,13 +262,12 @@ UpdateVariableStore ( > UINT8 *CurrBuffer; > EFI_LBA LbaNumber; > UINTN Size; > - EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; > VARIABLE_STORE_HEADER *VolatileBase; > EFI_PHYSICAL_ADDRESS FvVolHdr; > EFI_PHYSICAL_ADDRESS DataPtr; > EFI_STATUS Status; >=20 > - FwVolHeader =3D NULL; > + FvVolHdr =3D 0; > DataPtr =3D DataPtrIndex; >=20 > // > @@ -281,7 +280,6 @@ UpdateVariableStore ( > Status =3D Fvb->GetPhysicalAddress(Fvb, &FvVolHdr); > ASSERT_EFI_ERROR (Status); >=20 > - FwVolHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) > FvVolHdr); > // > // Data Pointer should point to the actual Address where data is to = be > // written. > @@ -290,7 +288,7 @@ UpdateVariableStore ( > DataPtr +=3D mVariableModuleGlobal- > >VariableGlobal.NonVolatileVariableBase; > } >=20 > - if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *= ) > FwVolHeader + FwVolHeader->FvLength))) { > + if ((DataPtr + DataSize) > (FvVolHdr + mNvFvHeaderCache->FvLength)) = { > return EFI_OUT_OF_RESOURCES; > } > } else { > @@ -317,7 +315,7 @@ UpdateVariableStore ( > // > // If we are here we are dealing with Non-Volatile Variables. > // > - LinearOffset =3D (UINTN) FwVolHeader; > + LinearOffset =3D (UINTN) FvVolHdr; > CurrWritePtr =3D (UINTN) DataPtr; > CurrWriteSize =3D DataSize; > CurrBuffer =3D Buffer; > @@ -2739,7 +2737,7 @@ UpdateVariable ( > } > } >=20 > - State =3D Variable->CurrPtr->State; > + State =3D CacheVariable->CurrPtr->State; > State &=3D VAR_DELETED; >=20 > Status =3D UpdateVariableStore ( > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c > index 23186176be75..f7185df3a7eb 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c > @@ -3,7 +3,7 @@ > and volatile storage space and install variable architecture protocol. >=20 > Copyright (C) 2013, Red Hat, Inc. > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > @@ -402,8 +402,8 @@ FtwNotificationEvent ( > // > // Mark the variable storage region of the FLASH as RUNTIME. > // > - VariableStoreBase =3D NvStorageVariableBase + > (((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)(NvStorageVariableBase))- > >HeaderLength); > - VariableStoreLength =3D ((VARIABLE_STORE_HEADER > *)(UINTN)VariableStoreBase)->Size; > + VariableStoreBase =3D NvStorageVariableBase + mNvFvHeaderCache- > >HeaderLength; > + VariableStoreLength =3D mNvVariableCache->Size; > BaseAddress =3D VariableStoreBase & (~EFI_PAGE_MASK); > Length =3D VariableStoreLength + (VariableStoreBase - BaseAddress= ); > Length =3D (Length + EFI_PAGE_SIZE - 1) & (~EFI_PAGE_MASK); > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel