Add allocation of a buffer for pvmfw within cbmem

Add an allocation of an empty buffer for the Android protected virtual
machine firmware within cbmem. The buffer will be filled by the payload
and the purpose is to just reserve the memory. cbmem is used to make
sure that the region won't overlap with other reserved regions
or device regions.

BUG=b:354045389
BUG=b:359340876
TEST=depthcharge receives the buffer through lib_sysinfo
BRANCH=main

Change-Id: I48efc033ac0f5fbfcf3a52fabf40be016cd4c6f7
Signed-off-by: Bartłomiej Grzesik <bgrzesik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87107
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Bartłomiej Grzesik 2025-01-21 17:02:39 +01:00 committed by Julius Werner
commit 584f9bcc3f
6 changed files with 44 additions and 1 deletions

View file

@ -162,6 +162,10 @@ struct sysinfo_t {
uint32_t cbfs_ro_mcache_size;
uintptr_t cbfs_rw_mcache_offset;
uint32_t cbfs_rw_mcache_size;
/* pvmfw buffer location */
uintptr_t pvmfw;
uint32_t pvmfw_size;
};
extern struct sysinfo_t lib_sysinfo;

View file

@ -268,6 +268,10 @@ static void cb_parse_cbmem_entry(void *ptr, struct sysinfo_t *info)
case CBMEM_ID_CSE_INFO:
info->cse_info = cbmem_entry->address;
break;
case CBMEM_ID_PVMFW:
info->pvmfw = cbmem_entry->address;
info->pvmfw_size = cbmem_entry->entry_size;
break;
default:
break;
}

View file

@ -90,6 +90,7 @@
#define CBMEM_ID_CSE_INFO 0x4553435F
#define CBMEM_ID_CSE_BP_INFO 0x42455343
#define CBMEM_ID_AMD_OPENSIL 0x4153494C
#define CBMEM_ID_PVMFW 0x666d7670
#define CBMEM_ID_TO_NAME_TABLE \
{ CBMEM_ID_ACPI, "ACPI " }, \
@ -172,5 +173,6 @@
{ CBMEM_ID_AMD_MP2, "AMD MP2 BUFFER"},\
{ CBMEM_ID_CSE_INFO, "CSE SPECIFIC INFO"},\
{ CBMEM_ID_CSE_BP_INFO, "CSE BP INFO"}, \
{ CBMEM_ID_AMD_OPENSIL, "OPENSIL DATA"}
{ CBMEM_ID_AMD_OPENSIL, "OPENSIL DATA"}, \
{ CBMEM_ID_PVMFW, "PVMFW "}
#endif /* _CBMEM_ID_H_ */

View file

@ -37,3 +37,18 @@ config MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD
config ACPI_FNKEY_GEN_SCANCODE
default 94 if MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD
config GOOGLE_PVMFW_CBMEM
bool "Enable reserving memory for pvmfw using cbmem"
default n
help
Select this config to enable allocating a region for Android protected
virtual machine firmware within cbmem. The region shall be filled by
the payload and the purpose is to just reserve the memory.
cbmem is used to make sure that the region won't overlap with other
reserved regions or device regions.
config GOOGLE_PVMFW_CBMEM_SIZE
hex "Size of the pvmfw buffer to be reserved using cbmem"
depends on GOOGLE_PVMFW_CBMEM
default 0x400000

View file

@ -4,3 +4,4 @@ subdirs-$(CONFIG_CHROMEOS) += chromeos
ramstage-$(CONFIG_GOOGLE_DSM_CALIB) += dsm_calib.c
ramstage-$(CONFIG_GOOGLE_SMBIOS_MAINBOARD_VERSION) += smbios.c
ramstage-$(CONFIG_GOOGLE_PVMFW_CBMEM) += pvmfw_cbmem.c

View file

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <bootstate.h>
#include <cbmem.h>
static void add_pvmfw_cbmem(void *unused)
{
(void)unused;
void *pvmfw;
pvmfw = cbmem_add(CBMEM_ID_PVMFW, CONFIG_GOOGLE_PVMFW_CBMEM_SIZE);
if (!pvmfw)
printk(BIOS_ERR, "Failed to add pvmfw info to CBMEM\n");
}
BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, add_pvmfw_cbmem, NULL);