diff mbox series

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

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

Commit Message

Sughosh Ganu Aug. 21, 2024, 10:58 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 early trace buffer and the load
buffer for U-Boot(spl boot) accordingly.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V2:
* Move the TCG event log to a location such that it does not clash
  with any load addresses in the tests.
* Adjust the values of CONFIG_TRACE_EARLY_ADDR and U-Boot load address
  for SPL accordingly.

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

Comments

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

On Wed, 21 Aug 2024 at 05:00, 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 early trace buffer and the load
> buffer for U-Boot(spl boot) accordingly.
>

On condition that we can move this to the bloblist and avoid this
problem once your series is in:

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


> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V2:
> * Move the TCG event log to a location such that it does not clash
>   with any load addresses in the tests.
> * Adjust the values of CONFIG_TRACE_EARLY_ADDR and U-Boot load address
>   for SPL accordingly.
>
>  arch/sandbox/dts/test.dts     | 2 +-
>  configs/sandbox_spl_defconfig | 2 +-
>  doc/arch/sandbox/sandbox.rst  | 5 +++--
>  lib/Kconfig                   | 2 +-
>  4 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index 5fb5eac862..8412506c17 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 + 0x100000) 0x2000>;
>                 };
>         };
>
> diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
> index f7b92dc844..826a82d092 100644
> --- a/configs/sandbox_spl_defconfig
> +++ b/configs/sandbox_spl_defconfig
> @@ -1,4 +1,4 @@
> -CONFIG_TEXT_BASE=0x200000
> +CONFIG_TEXT_BASE=0x400000
>  CONFIG_SPL_GPIO=y
>  CONFIG_SPL_LIBCOMMON_SUPPORT=y
>  CONFIG_SPL_LIBGENERIC_SUPPORT=y
> diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst
> index 5f8db12665..4967551724 100644
> --- a/doc/arch/sandbox/sandbox.rst
> +++ b/doc/arch/sandbox/sandbox.rst
> @@ -662,7 +662,8 @@ Addr      Config                     Usage
>     b000   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
> + 100000   TCG Event log              TCG Event Log
> + 200000   CONFIG_TRACE_EARLY_ADDR    Early trace buffer (if enabled). Also used
>                                       as the SPL load buffer in spl_test_load().
> - 200000   CONFIG_TEXT_BASE           Load buffer for U-Boot (sandbox_spl only)
> + 400000   CONFIG_TEXT_BASE           Load buffer for U-Boot (sandbox_spl only)
>  =======   ========================   ===============================
> diff --git a/lib/Kconfig b/lib/Kconfig
> index e352b5550a..5f282ecb54 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -403,7 +403,7 @@ config TRACE_EARLY_CALL_DEPTH_LIMIT
>  config TRACE_EARLY_ADDR
>         hex "Address of early trace buffer in U-Boot"
>         depends on TRACE_EARLY
> -       default 0x00100000
> +       default 0x00200000
>         help
>           Sets the address of the early trace buffer in U-Boot. This memory
>           must be accessible before relocation.
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 5fb5eac862..8412506c17 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 + 0x100000) 0x2000>;
 		};
 	};
 
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index f7b92dc844..826a82d092 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -1,4 +1,4 @@ 
-CONFIG_TEXT_BASE=0x200000
+CONFIG_TEXT_BASE=0x400000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst
index 5f8db12665..4967551724 100644
--- a/doc/arch/sandbox/sandbox.rst
+++ b/doc/arch/sandbox/sandbox.rst
@@ -662,7 +662,8 @@  Addr      Config                     Usage
    b000   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
+ 100000   TCG Event log              TCG Event Log
+ 200000   CONFIG_TRACE_EARLY_ADDR    Early trace buffer (if enabled). Also used
                                      as the SPL load buffer in spl_test_load().
- 200000   CONFIG_TEXT_BASE           Load buffer for U-Boot (sandbox_spl only)
+ 400000   CONFIG_TEXT_BASE           Load buffer for U-Boot (sandbox_spl only)
 =======   ========================   ===============================
diff --git a/lib/Kconfig b/lib/Kconfig
index e352b5550a..5f282ecb54 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -403,7 +403,7 @@  config TRACE_EARLY_CALL_DEPTH_LIMIT
 config TRACE_EARLY_ADDR
 	hex "Address of early trace buffer in U-Boot"
 	depends on TRACE_EARLY
-	default 0x00100000
+	default 0x00200000
 	help
 	  Sets the address of the early trace buffer in U-Boot. This memory
 	  must be accessible before relocation.