public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion
@ 2018-03-29  2:31 Heyi Guo
  2018-03-29  2:53 ` Zeng, Star
  2018-03-29  3:19 ` Zeng, Star
  0 siblings, 2 replies; 10+ messages in thread
From: Heyi Guo @ 2018-03-29  2:31 UTC (permalink / raw)
  To: edk2-devel
  Cc: Heyi Guo, Yi Li, Renhao Liang, Star Zeng, Eric Dong,
	Michael D Kinney, Liming Gao

For gDS->SetMemorySpaceAttributes(), when user passes a combined
memory attribute including CPU arch attribute and other attributes,
like EFI_MEMORY_RUNTIME, ConverToCpuArchAttributes() will return
INVALID_CPU_ARCH_ATTRIBUTES and skip setting page/cache attribute for
the specified memory space.

We don't see any reason to forbid combining CPU arch attributes and
non-CPU-arch attributes when calling gDS->SetMemorySpaceAttributes(),
so we change ConverToCpuArchAttributes() to only check if there is
valid CPU arch attributes in the input "Attribute" parameter and just
ignore other attributes.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Signed-off-by: Yi Li <phoenix.liyi@huawei.com>
Signed-off-by: Renhao Liang <liangrenhao@huawei.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 77f4adb4bc01..2ababdd14cc6 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -673,8 +673,8 @@ ConverToCpuArchAttributes (
 {
   UINT64      CpuArchAttributes;
 
-  if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES |
-                      NONEXCLUSIVE_MEMORY_ATTRIBUTES)) != 0) {
+  if ((Attributes & (EXCLUSIVE_MEMORY_ATTRIBUTES |
+                     NONEXCLUSIVE_MEMORY_ATTRIBUTES)) == 0) {
     return INVALID_CPU_ARCH_ATTRIBUTES;
   }
 
-- 
2.7.4



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

end of thread, other threads:[~2018-03-29  7:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-29  2:31 [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion Heyi Guo
2018-03-29  2:53 ` Zeng, Star
2018-03-29  3:19 ` Zeng, Star
2018-03-29  4:40   ` Wang, Jian J
2018-03-29  5:09     ` Guo Heyi
2018-03-29  5:44       ` Wang, Jian J
2018-03-29  5:54         ` Guo Heyi
2018-03-29  6:13           ` Wang, Jian J
2018-03-29  7:12             ` Ni, Ruiyu
2018-03-29  7:53               ` Guo Heyi

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