public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Brijesh Singh <brijesh.singh@amd.com>
To: "Zeng, Star" <star.zeng@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: brijesh.singh@amd.com, Tom Lendacky <Thomas.Lendacky@amd.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"Bi, Dandan" <dandan.bi@intel.com>
Subject: Re: [PATCH 1/2] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
Date: Mon, 2 Jul 2018 22:24:08 -0500	[thread overview]
Message-ID: <81ff2248-3212-7e6c-3fa1-db83d51b156d@amd.com> (raw)
In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BB60D45@shsmsx102.ccr.corp.intel.com>


On 7/2/18 10:21 PM, Zeng, Star wrote:
> Please use
> if ((GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME) == 0) {
> instead of
> if (!(GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME)) {
>
> There is coding style and ECC tool check about it. See https://edk2-docs.gitbooks.io/edk-ii-c-coding-standards-specification/content/5_source_files/57_c_programming.html#table-10-predicate-expression-examples.

thanks for quick feedback, I will update the patch with coding style fix
in next rev.

>
> With the change above, Reviewed-by: Star Zeng <star.zeng@intel.com>
>
>
> Thanks,
> Star
> -----Original Message-----
> From: Brijesh Singh [mailto:brijesh.singh@amd.com] 
> Sent: Tuesday, July 3, 2018 11:11 AM
> To: edk2-devel@lists.01.org
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>; Brijesh Singh <brijesh.singh@amd.com>; Dong, Eric <eric.dong@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Zeng, Star <star.zeng@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [PATCH 1/2] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
>
> Set the EFI_MEMORY_RUNTIME attribute in FtwNotificationEvent() only if the attribute is not already present. This will ensure that the attributes set by the platform drivers (e.g Ovmf pflash) is not lost.
>
> Cc: Dong Eric <eric.dong@intel.com>
> Cc: Justen Jordan L <jordan.l.justen@intel.com>
> Cc: Zeng Star <star.zeng@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
> index 6b04f4f7b394..f5ab6641ef28 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
> @@ -412,13 +412,15 @@ FtwNotificationEvent (
>    if (EFI_ERROR (Status)) {
>      DEBUG ((DEBUG_WARN, "Variable driver failed to get flash memory attribute.\n"));
>    } else {
> -    Status = gDS->SetMemorySpaceAttributes (
> -                    BaseAddress,
> -                    Length,
> -                    GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME
> -                    );
> -    if (EFI_ERROR (Status)) {
> -      DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));
> +    if (!(GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME)) {
> +      Status = gDS->SetMemorySpaceAttributes (
> +                      BaseAddress,
> +                      Length,
> +                      GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME
> +                      );
> +      if (EFI_ERROR (Status)) {
> +        DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));
> +      }
>      }
>    }
>  
> --
> 2.7.4
>



      reply	other threads:[~2018-07-03  3:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03  3:11 [PATCH 1/2] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it Brijesh Singh
2018-07-03  3:11 ` [PATCH 2/2] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: mark Runtime Data as MMIO when SEV is active Brijesh Singh
2018-07-03 15:08   ` Laszlo Ersek
2018-07-03  3:21 ` [PATCH 1/2] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it Zeng, Star
2018-07-03  3:24   ` Brijesh Singh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81ff2248-3212-7e6c-3fa1-db83d51b156d@amd.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox