Skip to contentSkip to conversation

RISC-V: ACPI: fix early_ioremap to early_memremap

PATCH Applied Yunhui Cui 3 participants 3 messages Oct 14, 2024 – Oct 17, 2024 RISC-V

lore
Share & tools
lore

Yunhui Cui

author
#0 lore raw

PATCH v2 1/1 RISC-V: ACPI: fix early_ioremap to early_memremap

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")
---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/acpi.c +2 -2
index 6e0d333f57e5..2fd29695a788 100644
@@ -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)
Signature · 1 line
2.39.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 32 lines · Yunhui Cui

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")
---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/acpi.c +1 -1
index 6e0d333f57e5..2fd29695a788 100644
@@ -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)

arch/riscv/kernel/acpi.c void __init __acpi_unmap_table(void __iomem *map, unsigned long size) · line 223

Quoted 7 lines
arch/riscv/kernel/acpi.c +1 -1
@@ -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);
 }
 

Thanks,
Sunil

#2 lore raw
In reply to Yunhui Cui
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html