public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH edk2-platforms v1 0/1] Use BaseMemoryLibMmio with NorFlashDxe
@ 2020-05-14  8:46 Sami Mujawar
  2020-05-14  8:46 ` [PATCH edk2-platforms v1 1/2] Platform/ARM: Link NorFlashDxe with BaseMemoryLibMmio Sami Mujawar
  2020-05-14  8:46 ` [PATCH edk2-platforms v1 2/2] Platform/Comcast: " Sami Mujawar
  0 siblings, 2 replies; 3+ messages in thread
From: Sami Mujawar @ 2020-05-14  8:46 UTC (permalink / raw)
  To: devel
  Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
	Matteo.Carlini, Laura.Moretta, nd

NorFlashDxe must use aligned MMIO accesses to
read data from flash as this is device memory.

The AlignedCopyMem() in NorFlashDxe was used to
copy the flash data which prevented unaligned
access to device memory. However, the compiler
could optimize the code to generate pre/post
indexed or LDP operations. This is a problem
for guest/virtual firmware as the hypervisor
code cannot get the syndrome information for
the trapped accesses.

With the introduction of virtual firmware
support for Kvmtool guests, it is necessary
to link NorFlashDxe with BaseMemoryLibMmio
(as it enforces aligned MMIO accesses).

This patch series updates the workspaces
for platforms that use the NorFlashDxe to
link with BaseMemoryLibMmio.

This patch series is dependent on the edk2
patch series that implements BaseMemoryLibMmio
and can be seen at:
https://edk2.groups.io/g/devel/topic/patch_v2_00_11_kvmtool/74200861?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,74200861

This changes in this patch series can be seen at:
https://github.com/samimujawar/edk2-platforms/tree/299_kvmtool_plat_support_v2

Sami Mujawar (2):
  Platform/ARM: Link NorFlashDxe with BaseMemoryLibMmio
  Platform/Comcast: Link NorFlashDxe with BaseMemoryLibMmio

 Platform/ARM/JunoPkg/ArmJuno.dsc                     | 7 +++++--
 Platform/ARM/SgiPkg/SgiPlatform.dsc.inc              | 5 ++++-
 Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc    | 7 +++++--
 Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 7 +++++--
 Platform/Comcast/RDKQemu/RDKQemu.dsc                 | 8 ++++++--
 5 files changed, 25 insertions(+), 9 deletions(-)

-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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

* [PATCH edk2-platforms v1 1/2] Platform/ARM: Link NorFlashDxe with BaseMemoryLibMmio
  2020-05-14  8:46 [PATCH edk2-platforms v1 0/1] Use BaseMemoryLibMmio with NorFlashDxe Sami Mujawar
@ 2020-05-14  8:46 ` Sami Mujawar
  2020-05-14  8:46 ` [PATCH edk2-platforms v1 2/2] Platform/Comcast: " Sami Mujawar
  1 sibling, 0 replies; 3+ messages in thread
From: Sami Mujawar @ 2020-05-14  8:46 UTC (permalink / raw)
  To: devel
  Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
	Matteo.Carlini, Laura.Moretta, nd

NorFlashDxe must use aligned MMIO accesses to
read data from flash as this is device memory.

The AlignedCopyMem() in NorFlashDxe was used to
copy the flash data which prevented unaligned
access to device memory. However, the compiler
could optimize the code to generate pre/post
indexed or LDP operations. This is a problem
for guest/virtual firmware as the hypervisor
code cannot get the syndrome information for
the trapped accesses.

To address the such issues, BaseMemoryLibMmio
library has been introduced to perform aligned
MMIO accesses.

The NorFlashDxe has been updated to use
CopyMem() instead of using AlignedCopyMem()
and therefore the NorFlashDxe must be linked
with BaseMemoryLibMmio.

This patch updates the workspace files to link
NorFlashDxe with BaseMemoryLibMmio for the
following platforms:
  - Arm Juno
  - Sgi Platform
  - Arm VExpress CTA15-A7
  - Arm VExpress FVP

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/ARM/JunoPkg/ArmJuno.dsc                     | 7 +++++--
 Platform/ARM/SgiPkg/SgiPlatform.dsc.inc              | 5 ++++-
 Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc    | 7 +++++--
 Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 7 +++++--
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc
index a6ea957b383219283354500d4c9f0baaa7ade6c9..fc9f2450fddac69e605a2821efa5fc3476ac7c2f 100644
--- a/Platform/ARM/JunoPkg/ArmJuno.dsc
+++ b/Platform/ARM/JunoPkg/ArmJuno.dsc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2013-2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2013-2020, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -275,7 +275,10 @@ [Components.common]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf {
+    <LibraryClasses>
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf
+  }
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
 
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
index f5f9f144eee9ee1d24aaac1a434a7d26f28c4eb3..c57c561c58502f3429f353207680692d3be2b837 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
@@ -225,7 +225,10 @@ [Components.common]
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
   ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf
-  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf {
+    <LibraryClasses>
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf
+  }
   EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
   EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
   EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc b/Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc
index 144dd4f8b8e9bf3639719709ad02c042ea8481eb..3a2d25bc8ec64094f3c51b203cde678afbf43d78 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2012-2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2012-2020, ARM Limited. All rights reserved.
 #  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -228,7 +228,10 @@ [Components.common]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf {
+    <LibraryClasses>
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf
+  }
   ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
index a6f536a332281a624403dac2e4bf18aa9ba96d0b..b0066e12d75820ebf5972d73b4b3907f3f5f697e 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2011-2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2011-2020, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -270,7 +270,10 @@ [Components.common]
 !endif
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf {
+    <LibraryClasses>
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf
+  }
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
 !ifdef EDK2_ENABLE_PL111
   ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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

* [PATCH edk2-platforms v1 2/2] Platform/Comcast: Link NorFlashDxe with BaseMemoryLibMmio
  2020-05-14  8:46 [PATCH edk2-platforms v1 0/1] Use BaseMemoryLibMmio with NorFlashDxe Sami Mujawar
  2020-05-14  8:46 ` [PATCH edk2-platforms v1 1/2] Platform/ARM: Link NorFlashDxe with BaseMemoryLibMmio Sami Mujawar
@ 2020-05-14  8:46 ` Sami Mujawar
  1 sibling, 0 replies; 3+ messages in thread
From: Sami Mujawar @ 2020-05-14  8:46 UTC (permalink / raw)
  To: devel
  Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
	Matteo.Carlini, Laura.Moretta, nd

NorFlashDxe must use aligned MMIO accesses to
read data from flash as this is device memory.

The AlignedCopyMem() in NorFlashDxe was used to
copy the flash data which prevented unaligned
access to device memory. However, the compiler
could optimize the code to generate pre/post
indexed or LDP operations. This is a problem
for guest/virtual firmware as the hypervisor
code cannot get the syndrome information for
the trapped accesses.

To address the such issues, BaseMemoryLibMmio
library has been introduced to perform aligned
MMIO accesses.

The NorFlashDxe has been updated to use
CopyMem() instead of using AlignedCopyMem()
and therefore the NorFlashDxe must be linked
with BaseMemoryLibMmio.

This patch updates the workspace files to
link NorFlashDxe with BaseMemoryLibMmio for
the RDK Qemu platform.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/Comcast/RDKQemu/RDKQemu.dsc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Platform/Comcast/RDKQemu/RDKQemu.dsc b/Platform/Comcast/RDKQemu/RDKQemu.dsc
index 440d2ace917cb639a04d1581fae71364d49c774f..c4e09c716a506c7e33a9cafd3612d81c21375751 100644
--- a/Platform/Comcast/RDKQemu/RDKQemu.dsc
+++ b/Platform/Comcast/RDKQemu/RDKQemu.dsc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2011-2020, ARM Limited. All rights reserved.
 #  Copyright (c) 2014 - 2018, Linaro Limited. All rights reserved.
 #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 #
@@ -301,7 +301,11 @@ [Components.common]
     <LibraryClasses>
       NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
   }
-  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf {
+    <LibraryClasses>
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf
+  }
+
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 
   #
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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

end of thread, other threads:[~2020-05-14  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-14  8:46 [PATCH edk2-platforms v1 0/1] Use BaseMemoryLibMmio with NorFlashDxe Sami Mujawar
2020-05-14  8:46 ` [PATCH edk2-platforms v1 1/2] Platform/ARM: Link NorFlashDxe with BaseMemoryLibMmio Sami Mujawar
2020-05-14  8:46 ` [PATCH edk2-platforms v1 2/2] Platform/Comcast: " Sami Mujawar

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