Skip to content

Commit 7ca1a80

Browse files
James Morsejgouly
authored andcommitted
ACPI: tables: PPTT: Populate cache-id if provided by firmware
ACPI 6.4 adds a 'cache id' to the PPTT Cache Type Structure. Copy this property across into the cacheinfo leaf when it was provided by firmware. This value gets exposed to userspace as: /sys/devices/system/cpu/cpu*/cache/index*/id. See the "Cache IDs" section of Documentation/x86/resctrl.rst. Co-authored-by: Joey Gouly <joey.gouly@arm.com> Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Joey Gouly <joey.gouly@arm.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 614124b commit 7ca1a80

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

drivers/acpi/pptt.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
347347
* @this_leaf: Kernel cache info structure being updated
348348
* @found_cache: The PPTT node describing this cache instance
349349
* @cpu_node: A unique reference to describe this cache instance
350+
* @revision: The revision of the PPTT table
350351
*
351352
* The ACPI spec implies that the fields in the cache structures are used to
352353
* extend and correct the information probed from the hardware. Lets only
@@ -356,8 +357,11 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
356357
*/
357358
static void update_cache_properties(struct cacheinfo *this_leaf,
358359
struct acpi_pptt_cache *found_cache,
359-
struct acpi_pptt_processor *cpu_node)
360+
struct acpi_pptt_processor *cpu_node,
361+
u8 revision)
360362
{
363+
struct acpi_pptt_cache_v1* found_cache_v1;
364+
361365
this_leaf->fw_token = cpu_node;
362366
if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)
363367
this_leaf->size = found_cache->size;
@@ -405,6 +409,13 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
405409
if (this_leaf->type == CACHE_TYPE_NOCACHE &&
406410
found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)
407411
this_leaf->type = CACHE_TYPE_UNIFIED;
412+
413+
if (revision >= 3 && (found_cache->flags & ACPI_PPTT_CACHE_ID_VALID)) {
414+
found_cache_v1 = ACPI_ADD_PTR(struct acpi_pptt_cache_v1,
415+
found_cache, sizeof(struct acpi_pptt_cache));
416+
this_leaf->id = found_cache_v1->cache_id;
417+
this_leaf->attributes |= CACHE_ID;
418+
}
408419
}
409420

410421
static void cache_setup_acpi_cpu(struct acpi_table_header *table,
@@ -425,9 +436,8 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
425436
&cpu_node);
426437
pr_debug("found = %p %p\n", found_cache, cpu_node);
427438
if (found_cache)
428-
update_cache_properties(this_leaf,
429-
found_cache,
430-
cpu_node);
439+
update_cache_properties(this_leaf, found_cache,
440+
cpu_node, table->revision);
431441

432442
index++;
433443
}

0 commit comments

Comments
 (0)