linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 01/20] ACPI: PPTT: Use table offset as fw_token instead of virtual address
       [not found] <20220621192034.3332546-1-sudeep.holla@arm.com>
@ 2022-06-21 19:20 ` Sudeep Holla
  2022-06-22 11:47   ` Rafael J. Wysocki
  2022-06-27 13:41   ` Ionela Voinescu
  0 siblings, 2 replies; 3+ messages in thread
From: Sudeep Holla @ 2022-06-21 19:20 UTC (permalink / raw)
  To: linux-kernel, Greg KH
  Cc: Sudeep Holla, Atish Patra, Atish Patra, Vincent Guittot,
	Dietmar Eggemann, Qing Wang, Rob Herring, Rafael J . Wysocki,
	Ionela Voinescu, Pierre Gondois, linux-arm-kernel, linux-riscv,
	linux-acpi

There is need to use the cache sharing information quite early during
the boot before the secondary cores are up and running. The permanent
memory map for all the ACPI tables(via acpi_permanent_mmap) is turned
on in acpi_early_init() which is quite late for the above requirement.

As a result there is possibility that the ACPI PPTT gets mapped to
different virtual addresses. In such scenarios, using virtual address as
fw_token before the acpi_permanent_mmap is enabled results in different
fw_token for the same cache entity and hence wrong cache sharing
information will be deduced based on the same.

Instead of using virtual address, just use the table offset as the
unique firmware token for the caches. The same offset is used as
ACPI identifiers if the firmware has not set a valid one for other
entries in the ACPI PPTT.

Cc: linux-acpi@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/acpi/pptt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Hi Rafael,

If you are happy with this change, can you provide Ack, so that it can be
merged together with other changes ?

Regards,
Sudeep

diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index 701f61c01359..763f021d45e6 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -437,7 +437,8 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
 		pr_debug("found = %p %p\n", found_cache, cpu_node);
 		if (found_cache)
 			update_cache_properties(this_leaf, found_cache,
-			                        cpu_node, table->revision);
+						ACPI_TO_POINTER(ACPI_PTR_DIFF(cpu_node, table)),
+						table->revision);
 
 		index++;
 	}
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v4 01/20] ACPI: PPTT: Use table offset as fw_token instead of virtual address
  2022-06-21 19:20 ` [PATCH v4 01/20] ACPI: PPTT: Use table offset as fw_token instead of virtual address Sudeep Holla
@ 2022-06-22 11:47   ` Rafael J. Wysocki
  2022-06-27 13:41   ` Ionela Voinescu
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-06-22 11:47 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Linux Kernel Mailing List, Greg KH, Atish Patra, Atish Patra,
	Vincent Guittot, Dietmar Eggemann, Qing Wang, Rob Herring,
	Rafael J . Wysocki, Ionela Voinescu, Pierre Gondois, Linux ARM,
	linux-riscv, ACPI Devel Maling List

On Tue, Jun 21, 2022 at 9:20 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> There is need to use the cache sharing information quite early during
> the boot before the secondary cores are up and running. The permanent
> memory map for all the ACPI tables(via acpi_permanent_mmap) is turned
> on in acpi_early_init() which is quite late for the above requirement.
>
> As a result there is possibility that the ACPI PPTT gets mapped to
> different virtual addresses. In such scenarios, using virtual address as
> fw_token before the acpi_permanent_mmap is enabled results in different
> fw_token for the same cache entity and hence wrong cache sharing
> information will be deduced based on the same.
>
> Instead of using virtual address, just use the table offset as the
> unique firmware token for the caches. The same offset is used as
> ACPI identifiers if the firmware has not set a valid one for other
> entries in the ACPI PPTT.
>
> Cc: linux-acpi@vger.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/acpi/pptt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> Hi Rafael,
>
> If you are happy with this change, can you provide Ack, so that it can be
> merged together with other changes ?

No objections:

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
> index 701f61c01359..763f021d45e6 100644
> --- a/drivers/acpi/pptt.c
> +++ b/drivers/acpi/pptt.c
> @@ -437,7 +437,8 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
>                 pr_debug("found = %p %p\n", found_cache, cpu_node);
>                 if (found_cache)
>                         update_cache_properties(this_leaf, found_cache,
> -                                               cpu_node, table->revision);
> +                                               ACPI_TO_POINTER(ACPI_PTR_DIFF(cpu_node, table)),
> +                                               table->revision);
>
>                 index++;
>         }
> --
> 2.36.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v4 01/20] ACPI: PPTT: Use table offset as fw_token instead of virtual address
  2022-06-21 19:20 ` [PATCH v4 01/20] ACPI: PPTT: Use table offset as fw_token instead of virtual address Sudeep Holla
  2022-06-22 11:47   ` Rafael J. Wysocki
@ 2022-06-27 13:41   ` Ionela Voinescu
  1 sibling, 0 replies; 3+ messages in thread
From: Ionela Voinescu @ 2022-06-27 13:41 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-kernel, Greg KH, Atish Patra, Atish Patra, Vincent Guittot,
	Dietmar Eggemann, Qing Wang, Rob Herring, Rafael J . Wysocki,
	Pierre Gondois, linux-arm-kernel, linux-riscv, linux-acpi

Hi Sudeep,

On Tuesday 21 Jun 2022 at 20:20:15 (+0100), Sudeep Holla wrote:
> There is need to use the cache sharing information quite early during
> the boot before the secondary cores are up and running. The permanent
> memory map for all the ACPI tables(via acpi_permanent_mmap) is turned
> on in acpi_early_init() which is quite late for the above requirement.
> 
> As a result there is possibility that the ACPI PPTT gets mapped to
> different virtual addresses. In such scenarios, using virtual address as
> fw_token before the acpi_permanent_mmap is enabled results in different
> fw_token for the same cache entity and hence wrong cache sharing
> information will be deduced based on the same.
> 
> Instead of using virtual address, just use the table offset as the
> unique firmware token for the caches. The same offset is used as
> ACPI identifiers if the firmware has not set a valid one for other
> entries in the ACPI PPTT.
> 
> Cc: linux-acpi@vger.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/acpi/pptt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Hi Rafael,
> 
> If you are happy with this change, can you provide Ack, so that it can be
> merged together with other changes ?
> 
> Regards,
> Sudeep
> 
> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
> index 701f61c01359..763f021d45e6 100644
> --- a/drivers/acpi/pptt.c
> +++ b/drivers/acpi/pptt.c
> @@ -437,7 +437,8 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
>  		pr_debug("found = %p %p\n", found_cache, cpu_node);
>  		if (found_cache)
>  			update_cache_properties(this_leaf, found_cache,
> -			                        cpu_node, table->revision);
> +						ACPI_TO_POINTER(ACPI_PTR_DIFF(cpu_node, table)),
> +						table->revision);
>  
>  		index++;
>  	}
> -- 
> 2.36.1
> 

I've run the set on Kunpeng920 where Dietmar noticed an issue [1] before
and it looks good to me.

Tested-by: Ionela Voinescu <ionela.voinescu@arm.com>

[1]
https://lore.kernel.org/lkml/0bf199a0-251d-323c-974a-bfd4e26f4cce@arm.com/

Thanks,
Ionela.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-27 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220621192034.3332546-1-sudeep.holla@arm.com>
2022-06-21 19:20 ` [PATCH v4 01/20] ACPI: PPTT: Use table offset as fw_token instead of virtual address Sudeep Holla
2022-06-22 11:47   ` Rafael J. Wysocki
2022-06-27 13:41   ` Ionela Voinescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).