public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
@ 2018-07-04  2:02 Brijesh Singh
  2018-07-04 13:59 ` Zeng, Star
  0 siblings, 1 reply; 4+ messages in thread
From: Brijesh Singh @ 2018-07-04  2:02 UTC (permalink / raw)
  To: edk2-devel
  Cc: Tom Lendacky, Brijesh Singh, Dong Eric, Justen Jordan L,
	Zeng Star, Laszlo Ersek

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
Reviewed-by: Star Zeng <star.zeng@intel.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---

Change since v1:
 - fix coding style

 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..23186176be75 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) == 0) {
+      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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
  2018-07-04  2:02 [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it Brijesh Singh
@ 2018-07-04 13:59 ` Zeng, Star
  2018-07-04 14:23   ` Zeng, Star
  0 siblings, 1 reply; 4+ messages in thread
From: Zeng, Star @ 2018-07-04 13:59 UTC (permalink / raw)
  To: Brijesh Singh, edk2-devel@lists.01.org
  Cc: Tom Lendacky, Dong, Eric, Justen, Jordan L, Laszlo Ersek,
	Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>


Thanks,
Star
-----Original Message-----
From: Brijesh Singh [mailto:brijesh.singh@amd.com] 
Sent: Wednesday, July 4, 2018 10:02 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 v2 1/1] 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
Reviewed-by: Star Zeng <star.zeng@intel.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---

Change since v1:
 - fix coding style

 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..23186176be75 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) == 0) {
+      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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
  2018-07-04 13:59 ` Zeng, Star
@ 2018-07-04 14:23   ` Zeng, Star
  2018-07-05  8:09     ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Zeng, Star @ 2018-07-04 14:23 UTC (permalink / raw)
  To: Brijesh Singh, edk2-devel@lists.01.org
  Cc: Tom Lendacky, Dong, Eric, Justen, Jordan L, Laszlo Ersek,
	Zeng, Star

Pushed at f88290964fe528ffeb67ff108e8174fc2ce52741.

Thanks,
Star
-----Original Message-----
From: Zeng, Star 
Sent: Wednesday, July 4, 2018 10:00 PM
To: Brijesh Singh <brijesh.singh@amd.com>; edk2-devel@lists.01.org
Cc: 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>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it

Reviewed-by: Star Zeng <star.zeng@intel.com>


Thanks,
Star
-----Original Message-----
From: Brijesh Singh [mailto:brijesh.singh@amd.com] 
Sent: Wednesday, July 4, 2018 10:02 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 v2 1/1] 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
Reviewed-by: Star Zeng <star.zeng@intel.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---

Change since v1:
 - fix coding style

 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..23186176be75 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) == 0) {
+      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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
  2018-07-04 14:23   ` Zeng, Star
@ 2018-07-05  8:09     ` Laszlo Ersek
  0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2018-07-05  8:09 UTC (permalink / raw)
  To: Zeng, Star, Brijesh Singh, edk2-devel@lists.01.org
  Cc: Tom Lendacky, Dong, Eric, Justen, Jordan L

On 07/04/18 16:23, Zeng, Star wrote:
> Pushed at f88290964fe528ffeb67ff108e8174fc2ce52741.

Thank you!
Laszlo

> -----Original Message-----
> From: Zeng, Star 
> Sent: Wednesday, July 4, 2018 10:00 PM
> To: Brijesh Singh <brijesh.singh@amd.com>; edk2-devel@lists.01.org
> Cc: 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>; Zeng, Star <star.zeng@intel.com>
> Subject: RE: [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
> 
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> 
> 
> Thanks,
> Star
> -----Original Message-----
> From: Brijesh Singh [mailto:brijesh.singh@amd.com] 
> Sent: Wednesday, July 4, 2018 10:02 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 v2 1/1] 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
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
> 
> Change since v1:
>  - fix coding style
> 
>  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..23186176be75 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) == 0) {
> +      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
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-05  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04  2:02 [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it Brijesh Singh
2018-07-04 13:59 ` Zeng, Star
2018-07-04 14:23   ` Zeng, Star
2018-07-05  8:09     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox