diff mbox series

[v2,19/32] sandbox: move the TCG event log to the start of ram memory

Message ID 20240814110009.45310-20-sughosh.ganu@linaro.org
State New
Headers show
Series Make LMB memory map global and persistent | expand

Commit Message

Sughosh Ganu Aug. 14, 2024, 10:59 a.m. UTC
The TCG event log buffer is being set at the end of ram memory. This
region of memory is to be reserved as LMB_NOMAP memory in the LMB
memory map. The current location of this buffer overlaps with the
memory region reserved for the U-Boot image, which is at the top of
the usable memory. This worked earlier as the LMB memory map was not
global but caller specific, but fails now because of the overlap.

Move the TCG event log buffer to the start of the ram memory region
instead. Move the location of the bloblist address up by 8KB to
accomodate the event log buffer, and update the sandbox memory map
specified in the documentation accordingly.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V1:
* Rejig the memory map to have the event log at 0xb000 and bloblist at
  0xd000.
* Update the memory map in the document accordingly.


 arch/sandbox/dts/test.dts    | 2 +-
 common/Kconfig               | 2 +-
 doc/arch/sandbox/sandbox.rst | 3 ++-
 test/lib/kconfig.c           | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

Comments

Simon Glass Aug. 15, 2024, 8:32 p.m. UTC | #1
Hi Sughosh,

On Wed, 14 Aug 2024 at 05:02, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> The TCG event log buffer is being set at the end of ram memory. This
> region of memory is to be reserved as LMB_NOMAP memory in the LMB
> memory map. The current location of this buffer overlaps with the
> memory region reserved for the U-Boot image, which is at the top of
> the usable memory. This worked earlier as the LMB memory map was not
> global but caller specific, but fails now because of the overlap.
>
> Move the TCG event log buffer to the start of the ram memory region
> instead. Move the location of the bloblist address up by 8KB to
> accomodate the event log buffer, and update the sandbox memory map
> specified in the documentation accordingly.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V1:
> * Rejig the memory map to have the event log at 0xb000 and bloblist at
>   0xd000.
> * Update the memory map in the document accordingly.
>
>
>  arch/sandbox/dts/test.dts    | 2 +-
>  common/Kconfig               | 2 +-
>  doc/arch/sandbox/sandbox.rst | 3 ++-
>  test/lib/kconfig.c           | 4 ++--
>  4 files changed, 6 insertions(+), 5 deletions(-)

I think the TCG should be in a bloblist. I can do a patch to do that.

So if you are OK with that:

Reviewed-by: Simon Glass <sjg@chromium.org>

and I will send a patch later.

Regards,
SImon
Tom Rini Aug. 16, 2024, 7:38 p.m. UTC | #2
On Wed, Aug 14, 2024 at 04:29:56PM +0530, Sughosh Ganu wrote:

> The TCG event log buffer is being set at the end of ram memory. This
> region of memory is to be reserved as LMB_NOMAP memory in the LMB
> memory map. The current location of this buffer overlaps with the
> memory region reserved for the U-Boot image, which is at the top of
> the usable memory. This worked earlier as the LMB memory map was not
> global but caller specific, but fails now because of the overlap.
> 
> Move the TCG event log buffer to the start of the ram memory region
> instead. Move the location of the bloblist address up by 8KB to
> accomodate the event log buffer, and update the sandbox memory map

With checkpatch.pl we see this should be "accommodate".
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 5fb5eac862..76a9bc3b01 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -78,7 +78,7 @@ 
 
 		event_log: tcg_event_log {
 			no-map;
-			reg = <(CFG_SYS_SDRAM_SIZE - 0x2000) 0x2000>;
+			reg = <(CFG_SYS_SDRAM_BASE + 0xb000) 0x2000>;
 		};
 	};
 
diff --git a/common/Kconfig b/common/Kconfig
index 83c81edac2..7762dd216b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1054,7 +1054,7 @@  endchoice
 
 config BLOBLIST_ADDR
 	hex "Address of bloblist"
-	default 0xb000 if SANDBOX
+	default 0xd000 if SANDBOX
 	depends on BLOBLIST_FIXED
 	help
 	  Sets the address of the bloblist, set up by the first part of U-Boot
diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst
index 5f8db12665..698634a65f 100644
--- a/doc/arch/sandbox/sandbox.rst
+++ b/doc/arch/sandbox/sandbox.rst
@@ -659,7 +659,8 @@  that are mapped into that memory:
 Addr      Config                     Usage
 =======   ========================   ===============================
     100   CONFIG_SYS_FDT_LOAD_ADDR   Device tree
-   b000   CONFIG_BLOBLIST_ADDR       Blob list
+   b000   TCG Event log              TCG Event Log
+   d000   CONFIG_BLOBLIST_ADDR       Blob list
   10000   CFG_MALLOC_F_ADDR          Early memory allocation
   f0000   CONFIG_PRE_CON_BUF_ADDR    Pre-console buffer
  100000   CONFIG_TRACE_EARLY_ADDR    Early trace buffer (if enabled). Also used
diff --git a/test/lib/kconfig.c b/test/lib/kconfig.c
index 0c463bb794..a3fc56a9ec 100644
--- a/test/lib/kconfig.c
+++ b/test/lib/kconfig.c
@@ -21,9 +21,9 @@  static int lib_test_is_enabled(struct unit_test_state *uts)
 	ut_asserteq(0, CONFIG_IS_ENABLED(OF_PLATDATA));
 	ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED));
 
-	ut_asserteq(0xb000,
+	ut_asserteq(0xd000,
 		    IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR));
-	ut_asserteq(0xb000,
+	ut_asserteq(0xd000,
 		    CONFIG_IF_ENABLED_INT(BLOBLIST_FIXED, BLOBLIST_ADDR));
 
 	/*