1 |
From cad9080c919e580c37c3fe508522f17bcc07f83d Mon Sep 17 00:00:00 2001 |
2 |
From: Jeffrey Hugo <jhugo@codeaurora.org> |
3 |
Date: Thu, 4 Oct 2018 09:20:06 -0600 |
4 |
Subject: [PATCH 033/145] ACPI/PPTT: Handle architecturally unknown cache types |
5 |
|
6 |
[ Upstream commit 59bbff3775c0951300f7b41345a54b999438f8d0 ] |
7 |
|
8 |
The type of a cache might not be specified by architectural mechanisms (ie |
9 |
system registers), but its type might be specified in the PPTT. In this |
10 |
case, we should populate the type of the cache, rather than leave it |
11 |
undefined. |
12 |
|
13 |
This fixes the issue where the cacheinfo driver will not populate sysfs |
14 |
for such caches, resulting in the information missing from utilities like |
15 |
lstopo and lscpu, thus degrading the user experience. |
16 |
|
17 |
Fixes: 2bd00bcd73e5 (ACPI/PPTT: Add Processor Properties Topology Table parsing) |
18 |
Reported-by: Vijaya Kumar K <vkilari@codeaurora.org> |
19 |
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org> |
20 |
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> |
21 |
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
22 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
23 |
--- |
24 |
drivers/acpi/pptt.c | 33 +++++++++++++-------------------- |
25 |
1 file changed, 13 insertions(+), 20 deletions(-) |
26 |
|
27 |
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c |
28 |
index d1e26cb599bf..da031b1df6f5 100644 |
29 |
--- a/drivers/acpi/pptt.c |
30 |
+++ b/drivers/acpi/pptt.c |
31 |
@@ -338,9 +338,6 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta |
32 |
return found; |
33 |
} |
34 |
|
35 |
-/* total number of attributes checked by the properties code */ |
36 |
-#define PPTT_CHECKED_ATTRIBUTES 4 |
37 |
- |
38 |
/** |
39 |
* update_cache_properties() - Update cacheinfo for the given processor |
40 |
* @this_leaf: Kernel cache info structure being updated |
41 |
@@ -357,25 +354,15 @@ static void update_cache_properties(struct cacheinfo *this_leaf, |
42 |
struct acpi_pptt_cache *found_cache, |
43 |
struct acpi_pptt_processor *cpu_node) |
44 |
{ |
45 |
- int valid_flags = 0; |
46 |
- |
47 |
this_leaf->fw_token = cpu_node; |
48 |
- if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) { |
49 |
+ if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) |
50 |
this_leaf->size = found_cache->size; |
51 |
- valid_flags++; |
52 |
- } |
53 |
- if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID) { |
54 |
+ if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID) |
55 |
this_leaf->coherency_line_size = found_cache->line_size; |
56 |
- valid_flags++; |
57 |
- } |
58 |
- if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID) { |
59 |
+ if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID) |
60 |
this_leaf->number_of_sets = found_cache->number_of_sets; |
61 |
- valid_flags++; |
62 |
- } |
63 |
- if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID) { |
64 |
+ if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID) |
65 |
this_leaf->ways_of_associativity = found_cache->associativity; |
66 |
- valid_flags++; |
67 |
- } |
68 |
if (found_cache->flags & ACPI_PPTT_WRITE_POLICY_VALID) { |
69 |
switch (found_cache->attributes & ACPI_PPTT_MASK_WRITE_POLICY) { |
70 |
case ACPI_PPTT_CACHE_POLICY_WT: |
71 |
@@ -402,11 +389,17 @@ static void update_cache_properties(struct cacheinfo *this_leaf, |
72 |
} |
73 |
} |
74 |
/* |
75 |
- * If the above flags are valid, and the cache type is NOCACHE |
76 |
- * update the cache type as well. |
77 |
+ * If cache type is NOCACHE, then the cache hasn't been specified |
78 |
+ * via other mechanisms. Update the type if a cache type has been |
79 |
+ * provided. |
80 |
+ * |
81 |
+ * Note, we assume such caches are unified based on conventional system |
82 |
+ * design and known examples. Significant work is required elsewhere to |
83 |
+ * fully support data/instruction only type caches which are only |
84 |
+ * specified in PPTT. |
85 |
*/ |
86 |
if (this_leaf->type == CACHE_TYPE_NOCACHE && |
87 |
- valid_flags == PPTT_CHECKED_ATTRIBUTES) |
88 |
+ found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID) |
89 |
this_leaf->type = CACHE_TYPE_UNIFIED; |
90 |
} |
91 |
|
92 |
-- |
93 |
2.19.1 |
94 |
|