From bc8bbeed3b8a1e1ee60b0e184e2afb6603721c34 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 24 Feb 2023 19:49:20 +0000 Subject: soc/intel/cmn/tom: Cache TOM region early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch implements a module that can store the top_of_ram (TOM) address into non-volatile space (CMOS) during the first boot and use it across all consecutive boot. As top_of_ram address is not known until FSP-M has exited, it results into lacking of MTRR programming to cache the 16 MB TOM, hence accessing that range during FSP-M and/or late romstage causing long access times. Purpose of this driver code is to cache the TOM (with a fixed size of 16MB) for all consecutive boots even before calling into the FSP. Otherwise, this range remains un-cached until postcar boot stage updates the MTRR programming. FSP-M and late romstage uses this uncached TOM range for various purposes (like relocating services between SPI mapped cached memory to DRAM based uncache memory) hence having the ability to cache this range beforehand would help to optimize the boot time (more than 50ms as applicable). TEST=Able to build and boot google/rex to ChromeOS. Without this patch: 950:calling FspMemoryInit               936,811 (19,941)   951:returning from FspMemoryInit        1,041,935 (105,123) With this patch:  950:calling FspMemoryInit               905,108 (20,103)   951:returning from FspMemoryInit        987,038 (81,929) Change-Id: I29d3e1df91c6057280bdf7fb6a4a356db31a408f Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/73272 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Lean Sheng Tan --- src/soc/intel/common/basecode/include/intelbasecode/tom.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/soc/intel/common/basecode/include/intelbasecode/tom.h (limited to 'src/soc/intel/common/basecode/include/intelbasecode') diff --git a/src/soc/intel/common/basecode/include/intelbasecode/tom.h b/src/soc/intel/common/basecode/include/intelbasecode/tom.h new file mode 100644 index 0000000000..d78ecd1a60 --- /dev/null +++ b/src/soc/intel/common/basecode/include/intelbasecode/tom.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_INTEL_COMMON_BASECODE_TOM_H +#define SOC_INTEL_COMMON_BASECODE_TOM_H + +#include + +/* Early caching of TOM region */ +void early_tom_enable_cache_range(void); + +/* Update the TOM if required based on the input TOM address */ +void update_tom(uint32_t addr); + +#endif -- cgit v1.2.3