RISC-V: ACPI: fix early_ioremap to early_memremap
PATCH 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.
--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/acpi.c +1 -1
@@ -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)
Signature · 1 line
2.39.2
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0
arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 215
Quoted 7 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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); }
I think __acpi_unmap_table() also needs similar change. You might need to typecast to suppress the sparse error [1] then.
[1] - https://lore.kernel.org/oe-kbuild-all/[email protected]/#r
Thanks,
Sunil
Hi Sunil,
Quoted 27 lines · Sunil V L
Hi Yunhui,
Quoted 24 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0@@ -210,7 +210,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)if (!size)return NULL ;
Quoted 6 lines
arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 215
Quoted 4 lines
arch/riscv/kernel/acpi.c +1
-1-return early_ioremap (phys, size); +return early_memremap (phys, size); }I think
__acpi_unmap_table()also needs similar change. You might need to typecast to suppress the sparse error [1] then.
OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 5 lines
[1] - https://lore.kernel.org/oe-kbuild-all/[email protected]/#r
Thanks,
Sunil
Thanks,
Yunhui
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0
arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)
It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
With the corresponding fix in __acpi_unmap_table() as pointed by Sunil, you can add:
And regarding the sparse error, I don't see any other architecture casting to __iomem, so maybe that's not necessary anymore?
Thanks,
Alex
Hi Alex,
Quoted 44 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
Quoted 7 lines
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?
OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 6 lines
Thanks,
Alex
Thanks,
Yunhui
Alexandre Ghiti
reviewerQuoted 48 lines · yunhui cui
Hi Alex,
Quoted 45 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:
Quoted 6 lines
Quoted 4 lines
Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
If the second patch only consists in casting, I would not use another patch since the patch 2 would fix something introduced in patch 1.
But if patch 2 is more complicated, it may make sense to do as you suggest, the goal is to merge patch 1 asap.
Thanks!
Alex
Quoted 8 lines
Quoted 6 lines
Thanks,
Alex
Thanks,
Yunhui
Hi Alex,
Quoted 58 lines · Alexandre Ghiti
Quoted 48 lines · yunhui cui
Hi Alex,
Quoted 45 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:Quoted 6 lines
Quoted 4 lines
Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 5 lines
If the second patch only consists in casting, I would not use another patch since the patch 2 would fix something introduced in patch 1.
But if patch 2 is more complicated, it may make sense to do as you suggest, the goal is to merge patch 1 asap.
Regarding patch 2, I executed "make & make install" for sparse of the riscv arch. I "git cloned" from
https://github.com/ConchuOD/sparse.git.
Then when compiling the kernel, the following error was reported:
cd /data00/cyh/linux-next/
make defconfig
cp .config build-riscv64/
make O=build-riscv64/ C=1 W=1 arch/riscv/kernel/ drivers/acpi/ drivers/mailbox/ -j
make[1]: Entering directory '/data00/cyh/linux-next/build-riscv64'
GEN Makefile CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s CHECK ../scripts/mod/empty.c
invalid argument to '-march': '_zicsr_zifencei'
make[3]: *** [../scripts/Makefile.build:229: scripts/mod/empty.o] Error 1 make[3]: *** Deleting file 'scripts/mod/empty.o'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/data00/cyh/linux-next/Makefile:1215: prepare0] Error 2 make[1]: *** [/data00/cyh/linux-next/Makefile:224: __sub-make] Error 2
Do you know the solution?
Quoted 14 lines
Thanks!
Alex
Quoted 8 lines
Quoted 6 lines
Thanks,
Alex
Thanks,
Yunhui
Thanks,
Yunhui
Hi Yunhui,
Sorry for the late reply, I was on vacation last week.
Quoted 86 lines · yunhui cui
Hi Alex,
Quoted 58 lines · Alexandre Ghiti
Quoted 48 lines · yunhui cui
Hi Alex,
Quoted 45 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:Quoted 6 lines
Quoted 4 lines
Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 5 lines
If the second patch only consists in casting, I would not use another patch since the patch 2 would fix something introduced in patch 1.
But if patch 2 is more complicated, it may make sense to do as you suggest, the goal is to merge patch 1 asap.
Regarding patch 2, I executed "make & make install" for sparse of the riscv arch. I "git cloned" from
https://github.com/ConchuOD/sparse.git.
Then when compiling the kernel, the following error was reported:cd /data00/cyh/linux-next/
make defconfig
cp .config build-riscv64/make O=build-riscv64/ C=1 W=1
arch/riscv/kernel/drivers/acpi/drivers/mailbox/-j
make[1]: Entering directory '/data00/cyh/linux-next/build-riscv64'GEN Makefile CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s CHECK ../scripts/mod/empty.cinvalid argument to '-march': '
_zicsr_zifencei'
Quoted 7 lines
make[3]: *** [../scripts/Makefile.build:229:
scripts/mod/empty.o] Error 1 make[3]: *** Deleting file 'scripts/mod/empty.o'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/data00/cyh/linux-next/Makefile:1215: prepare0] Error 2 make[1]: *** [/data00/cyh/linux-next/Makefile:224: __sub-make] Error 2Do you know the solution?
In case you did not find the solution yet, I would say that your toolchain is too old.
Let me know if I can help,
Thanks,
Alex
Quoted 18 lines
Quoted 15 lines
Thanks!
Alex
Quoted 8 lines
Quoted 6 lines
Thanks,
Alex
Thanks,
YunhuiThanks,
Yunhui
Hi Alex,
Quoted 98 lines · Alexandre Ghiti
Hi Yunhui,
Sorry for the late reply, I was on vacation last week.
Quoted 92 lines · yunhui cui
Hi Alex,
Quoted 58 lines · Alexandre Ghiti
Quoted 48 lines · yunhui cui
Hi Alex,
Quoted 45 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:Quoted 6 lines
Quoted 4 lines
Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 5 lines
If the second patch only consists in casting, I would not use another patch since the patch 2 would fix something introduced in patch 1.
But if patch 2 is more complicated, it may make sense to do as you suggest, the goal is to merge patch 1 asap.
Regarding patch 2, I executed "make & make install" for sparse of the riscv arch. I "git cloned" from
https://github.com/ConchuOD/sparse.git.
Then when compiling the kernel, the following error was reported:cd /data00/cyh/linux-next/
make defconfig
cp .config build-riscv64/make O=build-riscv64/ C=1 W=1
arch/riscv/kernel/drivers/acpi/drivers/mailbox/-j
make[1]: Entering directory '/data00/cyh/linux-next/build-riscv64'GEN Makefile CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s CHECK ../scripts/mod/empty.cinvalid argument to '-march': '
_zicsr_zifencei'make[3]: *** [../scripts/Makefile.build:229:
scripts/mod/empty.o] Error 1 make[3]: *** Deleting file 'scripts/mod/empty.o'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/data00/cyh/linux-next/Makefile:1215: prepare0] Error 2 make[1]: *** [/data00/cyh/linux-next/Makefile:224: __sub-make] Error 2
Quoted 6 lines
Quoted 1 line
Do you know the solution?
In case you did not find the solution yet, I would say that your toolchain is too old.
Let me know if I can help,
It may not be a problem of an old compiler. The version of the compiler I am using is 13.2.
It is a problem with sparse. When running "sparse --arch=riscv -march=rv64imac_zicsr_zifencei scripts/mod/empty.c", there is an invalid argument for '-march': '_zicsr_zifencei'.
Quoted 23 lines
Thanks,
Alex
Quoted 18 lines
Quoted 15 lines
Thanks!
Alex
Quoted 8 lines
Quoted 6 lines
Thanks,
Alex
Thanks,
YunhuiThanks,
Yunhui
Thanks,
Yunhui
Quoted 107 lines · yunhui cui
Hi Alex,
Quoted 103 lines · Alexandre Ghiti
Hi Yunhui,
Sorry for the late reply, I was on vacation last week.
Quoted 86 lines · yunhui cui
Hi Alex,
Quoted 58 lines · Alexandre Ghiti
Quoted 48 lines · yunhui cui
Hi Alex,
Quoted 45 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:Quoted 6 lines
Quoted 4 lines
Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 5 lines
If the second patch only consists in casting, I would not use another patch since the patch 2 would fix something introduced in patch 1.
But if patch 2 is more complicated, it may make sense to do as you suggest, the goal is to merge patch 1 asap.
Regarding patch 2, I executed "make & make install" for sparse of the riscv arch. I "git cloned" from
https://github.com/ConchuOD/sparse.git.
Then when compiling the kernel, the following error was reported:cd /data00/cyh/linux-next/
make defconfig
cp .config build-riscv64/make O=build-riscv64/ C=1 W=1
arch/riscv/kernel/drivers/acpi/drivers/mailbox/-j
make[1]: Entering directory '/data00/cyh/linux-next/build-riscv64'GEN Makefile CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s CHECK ../scripts/mod/empty.cinvalid argument to '-march': '
_zicsr_zifencei'Quoted 7 lines
make[3]: *** [../scripts/Makefile.build:229:
scripts/mod/empty.o] Error 1 make[3]: *** Deleting file 'scripts/mod/empty.o'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/data00/cyh/linux-next/Makefile:1215: prepare0] Error 2 make[1]: *** [/data00/cyh/linux-next/Makefile:224: __sub-make] Error 2Do you know the solution?
In case you did not find the solution yet, I would say that your toolchain is too old.
Quoted 7 lines
Quoted 1 line
Let me know if I can help,
It may not be a problem of an old compiler. The version of the compiler I am using is 13.2.
It is a problem with sparse. When running "sparse --arch=riscv -march=rv64imac_zicsr_zifenceiscripts/mod/empty.c", there is an invalid argument for '-march': '_zicsr_zifencei'.
Hi Yunhui,
I think you need latest sparse. I remember building sparse from latest sources to avoid this error.
https://www.kernel.org/doc/html/v4.11/dev-tools/sparse.html
Thanks,
Sunil
Hi Sunil, Alex
Quoted 118 lines · Sunil V L
Quoted 107 lines · yunhui cui
Hi Alex,
Quoted 103 lines · Alexandre Ghiti
Hi Yunhui,
Sorry for the late reply, I was on vacation last week.
Quoted 86 lines · yunhui cui
Hi Alex,
Quoted 58 lines · Alexandre Ghiti
Quoted 48 lines · yunhui cui
Hi Alex,
Quoted 45 lines · Alexandre Ghiti
Hi Yunhui,
Quoted 21 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.
Signed-off-by Yunhui Cui <[email protected]>--- arch/riscv/kernel/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/acpi.c +0
-0arch/riscv/kernel/acpi.c void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) · line 216
Quoted 8 lines
arch/riscv/kernel/acpi.c +1
-1@@ -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)It makes sense to me since with this, we don't have to care about how the firmware mapped the table. And it mimics all other architectures (arm64, loongarch and x86).
Here is the corresponding fixes tag:
Fixes 3b426d4b5b14 ("RISC-V: ACPI : Fix for usage of pointers indifferent address space")
With the corresponding fix in
__acpi_unmap_table()as pointed by Sunil, you can add:Quoted 6 lines
Quoted 4 lines
Reviewed-by Alexandre Ghiti <[email protected]>And regarding the sparse error, I don't see any other architecture casting to
__iomem, so maybe that's not necessary anymore?OK. I will make the changes in v2. Regarding the sparse error, I will use another patch specifically to solve it. Is that okay?
Quoted 5 lines
If the second patch only consists in casting, I would not use another patch since the patch 2 would fix something introduced in patch 1.
But if patch 2 is more complicated, it may make sense to do as you suggest, the goal is to merge patch 1 asap.
Regarding patch 2, I executed "make & make install" for sparse of the riscv arch. I "git cloned" from
https://github.com/ConchuOD/sparse.git.
Then when compiling the kernel, the following error was reported:cd /data00/cyh/linux-next/
make defconfig
cp .config build-riscv64/make O=build-riscv64/ C=1 W=1
arch/riscv/kernel/drivers/acpi/drivers/mailbox/-j
make[1]: Entering directory '/data00/cyh/linux-next/build-riscv64'GEN Makefile CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s CHECK ../scripts/mod/empty.cinvalid argument to '-march': '
_zicsr_zifencei'Quoted 7 lines
make[3]: *** [../scripts/Makefile.build:229:
scripts/mod/empty.o] Error 1 make[3]: *** Deleting file 'scripts/mod/empty.o'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/data00/cyh/linux-next/Makefile:1215: prepare0] Error 2 make[1]: *** [/data00/cyh/linux-next/Makefile:224: __sub-make] Error 2Do you know the solution?
In case you did not find the solution yet, I would say that your toolchain is too old.
Quoted 7 lines
Quoted 1 line
Let me know if I can help,
It may not be a problem of an old compiler. The version of the compiler I am using is 13.2.
It is a problem with sparse. When running "sparse --arch=riscv -march=rv64imac_zicsr_zifenceiscripts/mod/empty.c", there is an invalid argument for '-march': '_zicsr_zifencei'.Hi Yunhui,
Quoted 7 lines
I think you need latest sparse. I remember building sparse from latest sources to avoid this error.
https://www.kernel.org/doc/html/v4.11/dev-tools/sparse.html
Thanks,
Sunil
Thank you for your suggestions on sparse. The patch has been sent to the community. Please refer to:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/.
Thanks,
Yunhui