aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Hugo <jhugo@codeaurora.org>2018-10-04 11:20:06 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-10-04 17:02:17 -0400
commit59bbff3775c0951300f7b41345a54b999438f8d0 (patch)
treed25c1be9819e008e002f0b7b0202243e4c19262e
parentca388e436f588a7fa88fcdefcb0b2c55aff6836c (diff)
ACPI/PPTT: Handle architecturally unknown cache types
The type of a cache might not be specified by architectural mechanisms (ie system registers), but its type might be specified in the PPTT. In this case, we should populate the type of the cache, rather than leave it undefined. This fixes the issue where the cacheinfo driver will not populate sysfs for such caches, resulting in the information missing from utilities like lstopo and lscpu, thus degrading the user experience. Fixes: 2bd00bcd73e5 (ACPI/PPTT: Add Processor Properties Topology Table parsing) Reported-by: Vijaya Kumar K <vkilari@codeaurora.org> Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/pptt.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index d1e26cb599bf..da031b1df6f5 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -338,9 +338,6 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
338 return found; 338 return found;
339} 339}
340 340
341/* total number of attributes checked by the properties code */
342#define PPTT_CHECKED_ATTRIBUTES 4
343
344/** 341/**
345 * update_cache_properties() - Update cacheinfo for the given processor 342 * update_cache_properties() - Update cacheinfo for the given processor
346 * @this_leaf: Kernel cache info structure being updated 343 * @this_leaf: Kernel cache info structure being updated
@@ -357,25 +354,15 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
357 struct acpi_pptt_cache *found_cache, 354 struct acpi_pptt_cache *found_cache,
358 struct acpi_pptt_processor *cpu_node) 355 struct acpi_pptt_processor *cpu_node)
359{ 356{
360 int valid_flags = 0;
361
362 this_leaf->fw_token = cpu_node; 357 this_leaf->fw_token = cpu_node;
363 if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) { 358 if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)
364 this_leaf->size = found_cache->size; 359 this_leaf->size = found_cache->size;
365 valid_flags++; 360 if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID)
366 }
367 if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID) {
368 this_leaf->coherency_line_size = found_cache->line_size; 361 this_leaf->coherency_line_size = found_cache->line_size;
369 valid_flags++; 362 if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID)
370 }
371 if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID) {
372 this_leaf->number_of_sets = found_cache->number_of_sets; 363 this_leaf->number_of_sets = found_cache->number_of_sets;
373 valid_flags++; 364 if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID)
374 }
375 if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID) {
376 this_leaf->ways_of_associativity = found_cache->associativity; 365 this_leaf->ways_of_associativity = found_cache->associativity;
377 valid_flags++;
378 }
379 if (found_cache->flags & ACPI_PPTT_WRITE_POLICY_VALID) { 366 if (found_cache->flags & ACPI_PPTT_WRITE_POLICY_VALID) {
380 switch (found_cache->attributes & ACPI_PPTT_MASK_WRITE_POLICY) { 367 switch (found_cache->attributes & ACPI_PPTT_MASK_WRITE_POLICY) {
381 case ACPI_PPTT_CACHE_POLICY_WT: 368 case ACPI_PPTT_CACHE_POLICY_WT:
@@ -402,11 +389,17 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
402 } 389 }
403 } 390 }
404 /* 391 /*
405 * If the above flags are valid, and the cache type is NOCACHE 392 * If cache type is NOCACHE, then the cache hasn't been specified
406 * update the cache type as well. 393 * via other mechanisms. Update the type if a cache type has been
394 * provided.
395 *
396 * Note, we assume such caches are unified based on conventional system
397 * design and known examples. Significant work is required elsewhere to
398 * fully support data/instruction only type caches which are only
399 * specified in PPTT.
407 */ 400 */
408 if (this_leaf->type == CACHE_TYPE_NOCACHE && 401 if (this_leaf->type == CACHE_TYPE_NOCACHE &&
409 valid_flags == PPTT_CHECKED_ATTRIBUTES) 402 found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)
410 this_leaf->type = CACHE_TYPE_UNIFIED; 403 this_leaf->type = CACHE_TYPE_UNIFIED;
411} 404}
412 405