diff options
author | Karthikeyan Ramasubramanian <kramasub@google.com> | 2023-05-25 15:58:25 -0600 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-05-27 01:59:26 +0000 |
commit | d6f73972cf7a1424ac81ffa5576aa233fb4d9b52 (patch) | |
tree | a9b23544c6896419ea5e588821f0fe3584a734ce /src | |
parent | 01c9dfbae63aaf36d35085dd004c67f09af5fad5 (diff) |
soc/amd/mendocino/psp_verstage: Fix pending maps
cbfs_unmap does not unmap the mapped region from the boot device. This
leads to some resource leaks eg. TLB slots in PSP. Explicitly call
rdev_munmap on the address mapped by cbfs_map.
BUG=b:240664755
TEST=Build and boot to OS in Skyrim with unsigned PSP verstage.
Change-Id: I51b9d066a40103f2ebdf2ef2fc3da13beb467921
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75454
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/amd/mendocino/psp_verstage/chipset.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/soc/amd/mendocino/psp_verstage/chipset.c b/src/soc/amd/mendocino/psp_verstage/chipset.c index 0b622e73de..282ad21227 100644 --- a/src/soc/amd/mendocino/psp_verstage/chipset.c +++ b/src/soc/amd/mendocino/psp_verstage/chipset.c @@ -6,6 +6,7 @@ #include <arch/hlt.h> #include <bl_uapp/bl_errorcodes_public.h> #include <bl_uapp/bl_syscall_public.h> +#include <boot_device.h> #include <cbfs.h> #include <console/console.h> #include <psp_verstage.h> @@ -25,7 +26,8 @@ static struct psp_fw_entry_hash_384 hash_384[MAX_NUM_HASH_ENTRIES]; void update_psp_fw_hash_table(const char *fname) { - uint8_t *spi_ptr = (uint8_t *)cbfs_map(fname, NULL); + void *hash_file = cbfs_map(fname, NULL); + uint8_t *spi_ptr = (uint8_t *)hash_file; uint32_t len; if (!spi_ptr) { @@ -44,7 +46,8 @@ void update_psp_fw_hash_table(const char *fname) printk(BIOS_ERR, "Too many entries in AMD Firmware hash table" " (SHA256:%d, SHA384:%d)\n", hash_table.no_of_entries_256, hash_table.no_of_entries_384); - cbfs_unmap(spi_ptr); + cbfs_unmap(hash_file); + rdev_munmap(boot_device_ro(), hash_file); return; } @@ -53,7 +56,8 @@ void update_psp_fw_hash_table(const char *fname) printk(BIOS_ERR, "No entries in AMD Firmware hash table" " (SHA256:%d, SHA384:%d)\n", hash_table.no_of_entries_256, hash_table.no_of_entries_384); - cbfs_unmap(spi_ptr); + cbfs_unmap(hash_file); + rdev_munmap(boot_device_ro(), hash_file); return; } @@ -69,7 +73,8 @@ void update_psp_fw_hash_table(const char *fname) memcpy(hash_384, spi_ptr, len); svc_set_fw_hash_table(&hash_table); - cbfs_unmap(spi_ptr); + cbfs_unmap(hash_file); + rdev_munmap(boot_device_ro(), hash_file); } uint32_t update_psp_bios_dir(uint32_t *psp_dir_offset, uint32_t *bios_dir_offset) |