summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2023-05-25 15:54:33 -0600
committerFelix Held <felix-coreboot@felixheld.de>2023-05-27 01:58:53 +0000
commit01c9dfbae63aaf36d35085dd004c67f09af5fad5 (patch)
tree9dc7a47dbee0772ee2b5e77185382b7f6396ec18
parent1da0340aa8834681082128b5da42ac96ed55af33 (diff)
soc/amd/common/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: If1d355972cc743b8d8c451e1b3f827abd15e98fe Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75453 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
-rw-r--r--src/soc/amd/common/psp_verstage/psp_verstage.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/soc/amd/common/psp_verstage/psp_verstage.c b/src/soc/amd/common/psp_verstage/psp_verstage.c
index 294950b392..c9092f4f42 100644
--- a/src/soc/amd/common/psp_verstage/psp_verstage.c
+++ b/src/soc/amd/common/psp_verstage/psp_verstage.c
@@ -113,6 +113,7 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
if (ef_table->signature != EMBEDDED_FW_SIGNATURE) {
printk(BIOS_ERR, "ROMSIG address is not correct.\n");
cbfs_unmap(amdfw_location);
+ rdev_munmap(boot_device_ro(), amdfw_location);
rdev_munmap(boot_device_ro(), map_base);
return POSTCODE_ROMSIG_MISMATCH_ERROR;
}
@@ -124,6 +125,7 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
if (*psp_dir_in_spi != PSP_COOKIE) {
printk(BIOS_ERR, "PSP Directory address is not correct.\n");
cbfs_unmap(amdfw_location);
+ rdev_munmap(boot_device_ro(), amdfw_location);
rdev_munmap(boot_device_ro(), map_base);
return POSTCODE_PSP_COOKIE_MISMATCH_ERROR;
}
@@ -134,6 +136,7 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
if (*bios_dir_in_spi != BHD_COOKIE) {
printk(BIOS_ERR, "BIOS Directory address is not correct.\n");
cbfs_unmap(amdfw_location);
+ rdev_munmap(boot_device_ro(), amdfw_location);
rdev_munmap(boot_device_ro(), map_base);
return POSTCODE_BHD_COOKIE_MISMATCH_ERROR;
}
@@ -149,6 +152,7 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
if (update_psp_bios_dir(&psp_dir_addr, &bios_dir_addr)) {
printk(BIOS_ERR, "Updated BIOS Directory could not be set.\n");
cbfs_unmap(amdfw_location);
+ rdev_munmap(boot_device_ro(), amdfw_location);
rdev_munmap(boot_device_ro(), map_base);
return POSTCODE_UPDATE_PSP_BIOS_DIR_ERROR;
}
@@ -157,6 +161,7 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
update_psp_fw_hash_table(hash_fname);
cbfs_unmap(amdfw_location);
+ rdev_munmap(boot_device_ro(), amdfw_location);
rdev_munmap(boot_device_ro(), map_base);
return 0;
}