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

@ -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);