Skip to content

Commit d9e8844

Browse files
Keith Buschgregkh
authored andcommitted
acpi/hmat: Register memory side cache attributes
Register memory side cache attributes with the memory's node if HMAT provides the side cache iniformation table. Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Keith Busch <keith.busch@intel.com> Tested-by: Brice Goglin <Brice.Goglin@inria.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8d59f5a commit d9e8844

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎drivers/acpi/hmat/hmat.c‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
314314
const unsigned long end)
315315
{
316316
struct acpi_hmat_cache *cache = (void *)header;
317+
struct node_cache_attrs cache_attrs;
317318
u32 attrs;
318319

319320
if (cache->header.length < sizeof(*cache)) {
@@ -327,6 +328,37 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
327328
cache->memory_PD, cache->cache_size, attrs,
328329
cache->number_of_SMBIOShandles);
329330

331+
cache_attrs.size = cache->cache_size;
332+
cache_attrs.level = (attrs & ACPI_HMAT_CACHE_LEVEL) >> 4;
333+
cache_attrs.line_size = (attrs & ACPI_HMAT_CACHE_LINE_SIZE) >> 16;
334+
335+
switch ((attrs & ACPI_HMAT_CACHE_ASSOCIATIVITY) >> 8) {
336+
case ACPI_HMAT_CA_DIRECT_MAPPED:
337+
cache_attrs.indexing = NODE_CACHE_DIRECT_MAP;
338+
break;
339+
case ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING:
340+
cache_attrs.indexing = NODE_CACHE_INDEXED;
341+
break;
342+
case ACPI_HMAT_CA_NONE:
343+
default:
344+
cache_attrs.indexing = NODE_CACHE_OTHER;
345+
break;
346+
}
347+
348+
switch ((attrs & ACPI_HMAT_WRITE_POLICY) >> 12) {
349+
case ACPI_HMAT_CP_WB:
350+
cache_attrs.write_policy = NODE_CACHE_WRITE_BACK;
351+
break;
352+
case ACPI_HMAT_CP_WT:
353+
cache_attrs.write_policy = NODE_CACHE_WRITE_THROUGH;
354+
break;
355+
case ACPI_HMAT_CP_NONE:
356+
default:
357+
cache_attrs.write_policy = NODE_CACHE_WRITE_OTHER;
358+
break;
359+
}
360+
361+
node_add_cache(pxm_to_node(cache->memory_PD), &cache_attrs);
330362
return 0;
331363
}
332364

0 commit comments

Comments
 (0)