* [PATCH v1] ACPI / PPTT: Populate cache-id from rev3 of PPTT in ACPIv6.4
@ 2021-05-27 14:39 Joey Gouly
2021-05-31 12:07 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Joey Gouly @ 2021-05-27 14:39 UTC (permalink / raw)
To: linux-acpi; +Cc: Rafael J . Wysocki, Len Brown, nd, James Morse, Joey Gouly
From: James Morse <james.morse@arm.com>
ACPIv6.4 adds a 'cache id' to the PPTT Cache Type Structure.
Copy this property accross into the cacheinfo leaf when it was
provided by firmware.
This value getes 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>
---
drivers/acpi/pptt.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index 4ae93350b70d..c18a30154db5 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -344,6 +344,7 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
/**
* update_cache_properties() - Update cacheinfo for the given processor
+ * @table: The PPTT table - for testing the revision
* @this_leaf: Kernel cache info structure being updated
* @found_cache: The PPTT node describing this cache instance
* @cpu_node: A unique reference to describe this cache instance
@@ -354,10 +355,13 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
*
* Return: nothing. Side effect of updating the global cacheinfo
*/
-static void update_cache_properties(struct cacheinfo *this_leaf,
+static void update_cache_properties(struct acpi_table_header *table,
+ struct cacheinfo *this_leaf,
struct acpi_pptt_cache *found_cache,
struct acpi_pptt_processor *cpu_node)
{
+ struct acpi_pptt_cache_v1* found_cache_v1;
+
this_leaf->fw_token = cpu_node;
if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)
this_leaf->size = found_cache->size;
@@ -405,6 +409,14 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
if (this_leaf->type == CACHE_TYPE_NOCACHE &&
found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)
this_leaf->type = CACHE_TYPE_UNIFIED;
+
+ if (table->revision >= 3 &&
+ (found_cache->flags & ACPI_PPTT_CACHE_ID_VALID)) {
+ found_cache_v1 = ACPI_ADD_PTR(struct acpi_pptt_cache_v1,
+ found_cache, sizeof(struct acpi_pptt_cache));
+ this_leaf->id = found_cache_v1->cache_id;
+ this_leaf->attributes |= CACHE_ID;
+ }
}
static void cache_setup_acpi_cpu(struct acpi_table_header *table,
@@ -425,7 +437,7 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
&cpu_node);
pr_debug("found = %p %p\n", found_cache, cpu_node);
if (found_cache)
- update_cache_properties(this_leaf,
+ update_cache_properties(table, this_leaf,
found_cache,
cpu_node);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] ACPI / PPTT: Populate cache-id from rev3 of PPTT in ACPIv6.4
2021-05-27 14:39 [PATCH v1] ACPI / PPTT: Populate cache-id from rev3 of PPTT in ACPIv6.4 Joey Gouly
@ 2021-05-31 12:07 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-05-31 12:07 UTC (permalink / raw)
To: Joey Gouly
Cc: ACPI Devel Maling List, Rafael J . Wysocki, Len Brown, nd, James Morse
On Thu, May 27, 2021 at 4:40 PM Joey Gouly <joey.gouly@arm.com> wrote:
>
> From: James Morse <james.morse@arm.com>
>
> ACPIv6.4 adds a 'cache id' to the PPTT Cache Type Structure.
> Copy this property accross into the cacheinfo leaf when it was
> provided by firmware.
>
> This value getes 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>
> ---
> drivers/acpi/pptt.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
> index 4ae93350b70d..c18a30154db5 100644
> --- a/drivers/acpi/pptt.c
> +++ b/drivers/acpi/pptt.c
> @@ -344,6 +344,7 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
>
> /**
> * update_cache_properties() - Update cacheinfo for the given processor
> + * @table: The PPTT table - for testing the revision
What about passing the revision itself instead of a pointer to the whole table?
Or even a bool value indicating whether or not to skip the last check?
> * @this_leaf: Kernel cache info structure being updated
> * @found_cache: The PPTT node describing this cache instance
> * @cpu_node: A unique reference to describe this cache instance
> @@ -354,10 +355,13 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
> *
> * Return: nothing. Side effect of updating the global cacheinfo
> */
> -static void update_cache_properties(struct cacheinfo *this_leaf,
> +static void update_cache_properties(struct acpi_table_header *table,
> + struct cacheinfo *this_leaf,
> struct acpi_pptt_cache *found_cache,
> struct acpi_pptt_processor *cpu_node)
> {
> + struct acpi_pptt_cache_v1* found_cache_v1;
> +
> this_leaf->fw_token = cpu_node;
> if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)
> this_leaf->size = found_cache->size;
> @@ -405,6 +409,14 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
> if (this_leaf->type == CACHE_TYPE_NOCACHE &&
> found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)
> this_leaf->type = CACHE_TYPE_UNIFIED;
> +
> + if (table->revision >= 3 &&
> + (found_cache->flags & ACPI_PPTT_CACHE_ID_VALID)) {
> + found_cache_v1 = ACPI_ADD_PTR(struct acpi_pptt_cache_v1,
> + found_cache, sizeof(struct acpi_pptt_cache));
> + this_leaf->id = found_cache_v1->cache_id;
> + this_leaf->attributes |= CACHE_ID;
> + }
> }
>
> static void cache_setup_acpi_cpu(struct acpi_table_header *table,
> @@ -425,7 +437,7 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
> &cpu_node);
> pr_debug("found = %p %p\n", found_cache, cpu_node);
> if (found_cache)
> - update_cache_properties(this_leaf,
> + update_cache_properties(table, this_leaf,
> found_cache,
> cpu_node);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-31 12:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 14:39 [PATCH v1] ACPI / PPTT: Populate cache-id from rev3 of PPTT in ACPIv6.4 Joey Gouly
2021-05-31 12:07 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.