Bartłomiej Grzesik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/87107?usp=email )
Change subject: Add allocation of a buffer for pvmfw within cbmem ......................................................................
Add allocation of a buffer for pvmfw within cbmem
This change adds 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=Check if pvmfw buffer is available for depthcharge BRANCH=firmware-android-15949.B
Change-Id: I48efc033ac0f5fbfcf3a52fabf40be016cd4c6f7 Signed-off-by: Bartłomiej Grzesik bgrzesik@google.com --- M payloads/libpayload/include/sysinfo.h M payloads/libpayload/libc/coreboot.c M src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h M src/vendorcode/google/Kconfig M src/vendorcode/google/Makefile.mk A src/vendorcode/google/pvmfw_cbmem.c 6 files changed, 44 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/87107/1
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index cbfc7bf..2eb0da3 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -162,6 +162,10 @@ 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; diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index 7873426..7a9f997 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -268,6 +268,10 @@ 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; } diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h b/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h index 7873d58..4cf1f09 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h +++ b/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h @@ -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_ */ diff --git a/src/vendorcode/google/Kconfig b/src/vendorcode/google/Kconfig index b24c554..f6542f0 100644 --- a/src/vendorcode/google/Kconfig +++ b/src/vendorcode/google/Kconfig @@ -29,6 +29,7 @@ Management (DSM). Enable this config to assign dsm parameters file name in ACPI SSDT table. Kernel driver uses this to load the DSM parameter file.
+ config MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD bool default n @@ -37,3 +38,15 @@
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 buffer for pvmfw within + cbmem. + +config GOOGLE_PVMFW_CBMEM_SIZE + hex "Size of the pvmfw buffer to be reserved using cbmem" + depends on GOOGLE_PVMFW_CBMEM + default 0x400000 diff --git a/src/vendorcode/google/Makefile.mk b/src/vendorcode/google/Makefile.mk index c9e8389..32bb90f 100644 --- a/src/vendorcode/google/Makefile.mk +++ b/src/vendorcode/google/Makefile.mk @@ -4,3 +4,4 @@
ramstage-$(CONFIG_GOOGLE_DSM_CALIB) += dsm_calib.c ramstage-$(CONFIG_GOOGLE_SMBIOS_MAINBOARD_VERSION) += smbios.c +ramstage-$(CONFIG_GOOGLE_PVMFW_CBMEM) += pvmfw_cbmem.c diff --git a/src/vendorcode/google/pvmfw_cbmem.c b/src/vendorcode/google/pvmfw_cbmem.c new file mode 100644 index 0000000..1aaa9d8 --- /dev/null +++ b/src/vendorcode/google/pvmfw_cbmem.c @@ -0,0 +1,19 @@ +/* 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 *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"); + return; + } +} + +BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, add_pvmfw_cbmem, + NULL);