soc/amd/common/block/lpc/spi_dma: Leverage CBFS_CACHE when using SPI DMA
commite4fd7dc9ff7ff6cd5dac32f27bd069d9d350f275
authorKarthikeyan Ramasubramanian <kramasub@google.com>
Mon, 10 Apr 2023 23:46:41 +0000 (10 17:46 -0600)
committerKarthik Ramasubramanian <kramasub@google.com>
Wed, 19 Apr 2023 19:09:47 +0000 (19 19:09 +0000)
tree934f2edeb16d336cc3101d5d4451a9a3e038cc05
parentea68fa0b2387be67ab1c77f4e12b31c231b93eff
soc/amd/common/block/lpc/spi_dma: Leverage CBFS_CACHE when using SPI DMA

CBFS library performs memory mapped access of the files during loading,
verification and de-compression. Even with MTRRs configured correctly,
first few file access through memory map are taking longer times to
load. Update the SPI DMA driver to load the files into CBFS cache, so
that they can be verified and de-compressed with less overhead. This
saves ~60 ms in boot time.

BUG=None
TEST=Build Skyrim BIOS image and boot to OS. Observe ~60 ms improvement
with the boot time. Performing additional test to confirm there are no
regressions.
Before:
=======
 970:loading FSP-M
  15:starting LZMA decompress (ignore for x86)       760,906 (60,035)
  16:finished LZMA decompress (ignore for x86)       798,787 (37,881)
   8:starting to load ramstage
  17:starting LZ4 decompress (ignore for x86)        1,050,093 (13,790)
  18:finished LZ4 decompress (ignore for x86)        1,054,086 (3,993)
 971:loading FSP-S
  17:starting LZ4 decompress (ignore for x86)        1,067,778 (3,313)
  18:finished LZ4 decompress (ignore for x86)        1,068,022 (244)
  90:starting to load payload
  17:starting LZ4 decompress (ignore for x86)        1,302,155 (11,285)
  18:finished LZ4 decompress (ignore for x86)        1,303,938 (1,783)

After:
======
 970:loading FSP-M
  15:starting LZMA decompress (ignore for x86)       709,542 (12,178)
  16:finished LZMA decompress (ignore for x86)       739,379 (29,837)
   8:starting to load ramstage
  17:starting LZ4 decompress (ignore for x86)        1,001,316 (12,368)
  18:finished LZ4 decompress (ignore for x86)        1,001,971 (655)
 971:loading FSP-S
  17:starting LZ4 decompress (ignore for x86)        1,016,514 (3,031)
  18:finished LZ4 decompress (ignore for x86)        1,016,722 (207)
  90:starting to load payload
  17:starting LZ4 decompress (ignore for x86)        1,244,602 (10,313)
  18:finished LZ4 decompress (ignore for x86)        1,244,831 (228)

Change-Id: Ie30b6324f9977261c60e55ed509e979ef290f1f1
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74334
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
src/soc/amd/common/block/lpc/spi_dma.c
src/soc/amd/mendocino/Kconfig