lib/bootmem: Add memory type for Armv9 MTE tag storage

The Armv9-A architecture introduces the Memory Tagging Extension (MTE),
which uses a dedicated memory region for tag storage.

This patch adds a new memory type, BM_MEM_TAG, to allow for the proper
accounting and reservation of this memory region. This ensures that the
payload, e.g. depthcharge, can correctly identify and utilize the tag
storage area.

BUG=b:438666196

Change-Id: I2f6d2b3c2c1a8e1f0e9b2c3d4e5f6a7b8c9d0e1f
Signed-off-by: Yidi Lin <yidilin@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90470
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Yidi Lin 2025-12-11 12:03:46 +08:00 committed by Matt DeVillier
commit 3d5135fdd0
3 changed files with 5 additions and 0 deletions

View file

@ -143,6 +143,7 @@ struct lb_memory_range {
#define LB_MEM_NVS 4 /* ACPI NVS Memory */
#define LB_MEM_UNUSABLE 5 /* Unusable address space */
#define LB_MEM_VENDOR_RSVD 6 /* Vendor Reserved */
#define LB_MEM_TAG 7 /* Armv9 tag storage for MTE */
#define LB_MEM_TABLE 16 /* Ram configuration tables are kept in */
#define LB_MEM_SOFT_RESERVED 0xefffffff /* Specific purpose memory */
};

View file

@ -29,6 +29,7 @@ enum bootmem_type {
BM_MEM_VENDOR_RSVD, /* Vendor Reserved */
BM_MEM_OPENSBI, /* Risc-V OpenSBI */
BM_MEM_BL31, /* Arm64 BL31 executable */
BM_MEM_TAG, /* Armv9-A tag storage for MTE */
BM_MEM_TABLE, /* Ram configuration tables are kept in */
/* Tags below this point are ignored for the OS table. */
BM_MEM_OS_CUTOFF = BM_MEM_TABLE,

View file

@ -55,6 +55,8 @@ static uint32_t bootmem_to_lb_tag(const enum bootmem_type tag)
return LB_MEM_TABLE;
case BM_MEM_SOFT_RESERVED:
return LB_MEM_SOFT_RESERVED;
case BM_MEM_TAG:
return LB_MEM_TAG;
default:
printk(BIOS_ERR, "Unsupported tag %u\n", tag);
return LB_MEM_RESERVED;
@ -166,6 +168,7 @@ static const struct range_strings type_strings[] = {
{ BM_MEM_SOFT_RESERVED, "SOFT RESERVED" },
{ BM_MEM_RAMSTAGE, "RAMSTAGE" },
{ BM_MEM_PAYLOAD, "PAYLOAD" },
{ BM_MEM_TAG, "TAG STORAGE" },
};
static const char *bootmem_range_string(const enum bootmem_type tag)