All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap
@ 2024-10-14 13:01 ` Yunhui Cui
  0 siblings, 0 replies; 6+ messages in thread
From: Yunhui Cui @ 2024-10-14 13:01 UTC (permalink / raw)
  To: punit.agrawal, paul.walmsley, palmer, aou, sunilvl, alexghiti,
	conor.dooley, rafael.j.wysocki, haibo1.xu, cuiyunhui, jeeheng.sia,
	linux-riscv, linux-kernel

When SVPBMT is enabled, __acpi_map_table() will directly access the
data in DDR through the IO attribute, rather than through hardware
cache consistency, resulting in incorrect data in the obtained ACPI
table.

The log: ACPI: [ACPI:0x18] Invalid zero length.

We do not assume whether the bootloader flushes or not. We should
access in a cacheable way instead of maintaining cache consistency
by software.

Fixes: 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers in different address space")
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index 6e0d333f57e5..2fd29695a788 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -210,7 +210,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
 	if (!size)
 		return NULL;
 
-	return early_ioremap(phys, size);
+	return early_memremap(phys, size);
 }
 
 void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
@@ -218,7 +218,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
 	if (!map || !size)
 		return;
 
-	early_iounmap(map, size);
+	early_memunmap(map, size);
 }
 
 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
-- 
2.39.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap
@ 2024-10-14 13:01 ` Yunhui Cui
  0 siblings, 0 replies; 6+ messages in thread
From: Yunhui Cui @ 2024-10-14 13:01 UTC (permalink / raw)
  To: punit.agrawal, paul.walmsley, palmer, aou, sunilvl, alexghiti,
	conor.dooley, rafael.j.wysocki, haibo1.xu, cuiyunhui, jeeheng.sia,
	linux-riscv, linux-kernel

When SVPBMT is enabled, __acpi_map_table() will directly access the
data in DDR through the IO attribute, rather than through hardware
cache consistency, resulting in incorrect data in the obtained ACPI
table.

The log: ACPI: [ACPI:0x18] Invalid zero length.

We do not assume whether the bootloader flushes or not. We should
access in a cacheable way instead of maintaining cache consistency
by software.

Fixes: 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers in different address space")
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index 6e0d333f57e5..2fd29695a788 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -210,7 +210,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
 	if (!size)
 		return NULL;
 
-	return early_ioremap(phys, size);
+	return early_memremap(phys, size);
 }
 
 void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
@@ -218,7 +218,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
 	if (!map || !size)
 		return;
 
-	early_iounmap(map, size);
+	early_memunmap(map, size);
 }
 
 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
-- 
2.39.2


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

* Re: [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap
  2024-10-14 13:01 ` Yunhui Cui
@ 2024-10-16  8:48   ` Sunil V L
  -1 siblings, 0 replies; 6+ messages in thread
From: Sunil V L @ 2024-10-16  8:48 UTC (permalink / raw)
  To: Yunhui Cui
  Cc: punit.agrawal, paul.walmsley, palmer, aou, alexghiti,
	conor.dooley, rafael.j.wysocki, haibo1.xu, jeeheng.sia,
	linux-riscv, linux-kernel

On Mon, Oct 14, 2024 at 09:01:41PM +0800, Yunhui Cui wrote:
> When SVPBMT is enabled, __acpi_map_table() will directly access the
> data in DDR through the IO attribute, rather than through hardware
> cache consistency, resulting in incorrect data in the obtained ACPI
> table.
> 
> The log: ACPI: [ACPI:0x18] Invalid zero length.
> 
> We do not assume whether the bootloader flushes or not. We should
> access in a cacheable way instead of maintaining cache consistency
> by software.
> 
> Fixes: 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers in different address space")
> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> ---
>  arch/riscv/kernel/acpi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
> index 6e0d333f57e5..2fd29695a788 100644
> --- a/arch/riscv/kernel/acpi.c
> +++ b/arch/riscv/kernel/acpi.c
> @@ -210,7 +210,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
>  	if (!size)
>  		return NULL;
>  
> -	return early_ioremap(phys, size);
> +	return early_memremap(phys, size);
>  }
>  
>  void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
> @@ -218,7 +218,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
>  	if (!map || !size)
>  		return;
>  
> -	early_iounmap(map, size);
> +	early_memunmap(map, size);
>  }
>  
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks,
Sunil

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap
@ 2024-10-16  8:48   ` Sunil V L
  0 siblings, 0 replies; 6+ messages in thread
From: Sunil V L @ 2024-10-16  8:48 UTC (permalink / raw)
  To: Yunhui Cui
  Cc: punit.agrawal, paul.walmsley, palmer, aou, alexghiti,
	conor.dooley, rafael.j.wysocki, haibo1.xu, jeeheng.sia,
	linux-riscv, linux-kernel

On Mon, Oct 14, 2024 at 09:01:41PM +0800, Yunhui Cui wrote:
> When SVPBMT is enabled, __acpi_map_table() will directly access the
> data in DDR through the IO attribute, rather than through hardware
> cache consistency, resulting in incorrect data in the obtained ACPI
> table.
> 
> The log: ACPI: [ACPI:0x18] Invalid zero length.
> 
> We do not assume whether the bootloader flushes or not. We should
> access in a cacheable way instead of maintaining cache consistency
> by software.
> 
> Fixes: 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers in different address space")
> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> ---
>  arch/riscv/kernel/acpi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
> index 6e0d333f57e5..2fd29695a788 100644
> --- a/arch/riscv/kernel/acpi.c
> +++ b/arch/riscv/kernel/acpi.c
> @@ -210,7 +210,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
>  	if (!size)
>  		return NULL;
>  
> -	return early_ioremap(phys, size);
> +	return early_memremap(phys, size);
>  }
>  
>  void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
> @@ -218,7 +218,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
>  	if (!map || !size)
>  		return;
>  
> -	early_iounmap(map, size);
> +	early_memunmap(map, size);
>  }
>  
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks,
Sunil

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

* Re: [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap
  2024-10-14 13:01 ` Yunhui Cui
@ 2024-10-17 16:30   ` patchwork-bot+linux-riscv
  -1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-10-17 16:30 UTC (permalink / raw)
  To: Yunhui Cui
  Cc: aou, alexghiti, jeeheng.sia, rafael.j.wysocki, linux-kernel,
	conor.dooley, palmer, paul.walmsley, punit.agrawal, linux-riscv,
	haibo1.xu

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Mon, 14 Oct 2024 21:01:41 +0800 you wrote:
> When SVPBMT is enabled, __acpi_map_table() will directly access the
> data in DDR through the IO attribute, rather than through hardware
> cache consistency, resulting in incorrect data in the obtained ACPI
> table.
> 
> The log: ACPI: [ACPI:0x18] Invalid zero length.
> 
> [...]

Here is the summary with links:
  - [v2] RISC-V: ACPI: fix early_ioremap to early_memremap
    https://git.kernel.org/riscv/c/0dcf8269ecee

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap
@ 2024-10-17 16:30   ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-10-17 16:30 UTC (permalink / raw)
  To: Yunhui Cui
  Cc: linux-riscv, punit.agrawal, paul.walmsley, palmer, aou, sunilvl,
	alexghiti, conor.dooley, rafael.j.wysocki, haibo1.xu, jeeheng.sia,
	linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Mon, 14 Oct 2024 21:01:41 +0800 you wrote:
> When SVPBMT is enabled, __acpi_map_table() will directly access the
> data in DDR through the IO attribute, rather than through hardware
> cache consistency, resulting in incorrect data in the obtained ACPI
> table.
> 
> The log: ACPI: [ACPI:0x18] Invalid zero length.
> 
> [...]

Here is the summary with links:
  - [v2] RISC-V: ACPI: fix early_ioremap to early_memremap
    https://git.kernel.org/riscv/c/0dcf8269ecee

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-10-17 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 13:01 [PATCH v2] RISC-V: ACPI: fix early_ioremap to early_memremap Yunhui Cui
2024-10-14 13:01 ` Yunhui Cui
2024-10-16  8:48 ` Sunil V L
2024-10-16  8:48   ` Sunil V L
2024-10-17 16:30 ` patchwork-bot+linux-riscv
2024-10-17 16:30   ` patchwork-bot+linux-riscv

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.