hmat acpi: Build Memory Side Cache Information Structure(s) in ACPI HMAT
PATCH 3/7 hmat acpi: Build Memory Side Cache Information Structure(s) in ACPI HMAT
This structure describes memory side cache information for memory proximity domains if the memory side cache is present and the physical device(SMBIOS handle) forms the memory side cache. The software could use this information to effectively place the data in memory to maximize the performance of the system memory that use the memory side cache.
Signed-off-by Liu Jingqi <[email protected]>
--- hw/acpi/hmat.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/hmat.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+)
hw/acpi/hmat.c +56 -0
@@ -37,6 +37,9 @@#define HOLE_640K_END (1024 * 1024)struct numa_hmat_lb_info *hmat_lb_info[HMAT_LB_LEVELS ][HMAT_LB_TYPES ] = {0 }; +struct numa_hmat_cache_info + *hmat_cache_info[MAX_NODES ][MAX_HMAT_CACHE_LEVEL +1 ] = {0 }; +uint32_t initiator_pxm[MAX_NODES ], target_pxm[MAX_NODES ];uint32_t num_initiator =0 , num_target =0 ;
@@ -222,6 +225,56 @@ static void hmat_build_lb(GArray *table_data) } } +static void hmat_build_cache (GArray *table_data) +{ +AcpiHmatCacheInfo *hmat_cache; +struct numa_hmat_cache_info *numa_hmat_cache; +int i, level; + +for (i =0 ; i < nb_numa_nodes; i++) { +for (level =0 ; level <=MAX_HMAT_CACHE_LEVEL ; level++) { + numa_hmat_cache = hmat_cache_info[i][level]; +if (numa_hmat_cache) { +uint64_t start = table_data->len; + + hmat_cache =acpi_data_push (table_data,sizeof (*hmat_cache)); + hmat_cache->length =sizeof (*hmat_cache); + hmat_cache->type =ACPI_HMAT_CACHE_INFO ; + hmat_cache->mem_proximity = numa_hmat_cache->mem_proximity; + hmat_cache->cache_size = numa_hmat_cache->size; + hmat_cache->cache_attr =HMAT_CACHE_TOTAL_LEVEL ( + numa_hmat_cache->total_levels); + hmat_cache->cache_attr |=HMAT_CACHE_CURRENT_LEVEL ( + numa_hmat_cache->level); + hmat_cache->cache_attr |=HMAT_CACHE_ASSOC ( + numa_hmat_cache->associativity); + hmat_cache->cache_attr |=HMAT_CACHE_WRITE_POLICY ( + numa_hmat_cache->write_policy); + hmat_cache->cache_attr |=HMAT_CACHE_LINE_SIZE ( + numa_hmat_cache->line_size); + hmat_cache->num_smbios_handles = + numa_hmat_cache->num_smbios_handles; + +if (hmat_cache->num_smbios_handles !=0 ) { +uint16_t *smbios_handles; +int size; + + size = hmat_cache->num_smbios_handles *sizeof (uint16_t ); + smbios_handles =acpi_data_push (table_data, size); + + hmat_cache = (AcpiHmatCacheInfo *) + (table_data->data + start); + hmat_cache->length += size; + +/* TBD: how to set smbios handles? */ +memset (smbios_handles,0 , size); + } + + } + } + } +} +static void hmat_build_hma (GArray *hma,PCMachineState *pcms) {/* Build HMAT Memory Subsystem Address Range. */
@@ -229,6 +282,9 @@ static void hmat_build_hma(GArray *hma, PCMachineState *pcms)/* Build HMAT System Locality Latency and Bandwidth Information. */ hmat_build_lb (hma); + +/* Build HMAT Memory Side Cache Information. */ +hmat_build_cache (hma); } void hmat_build_acpi(GArray *table_data, BIOSLinker *linker,
hw/acpi/hmat.h +44 -0
65 lines not on this page · raw message
Signature · 1 line
2.7.4