From 01c9dfbae63aaf36d35085dd004c67f09af5fad5 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Thu, 25 May 2023 15:54:33 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/75453 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel --- src/soc/amd/common/psp_verstage/psp_verstage.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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; } -- cgit v1.2.3