RISC-V: Remove IORESOURCE_BUSY flag for no-map reserved memory
PATCH 1/1 RISC-V: Remove IORESOURCE_BUSY flag for no-map reserved memory
Commit 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree") added IORESOURCE_BUSY flag for no-map reserved memory, this casued devm_ioremap_resource() failed for the no-map reserved memory in subsequent operations of related driver, so remove the IORESOURCE_BUSY flag.
The code to reproduce the issue,
dts:
mem0: memory@a0000000 {
reg = <0x0 0xa0000000 0 0x1000000>;
no-map;
};
&test {
status = "okay";
memory-region = <&mem0>;
};code:
np = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret = of_address_to_resource(np, 0, &r); base = devm_ioremap_resource(&pdev->dev, &r); // base = -EBUSY
--- arch/riscv/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/setup.c +1 -1
@@ -214,7 +214,7 @@ static void __init init_resources(void)if (unlikely (memblock_is_nomap (region))) { res->name ="Reserved" ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_MEM ; }else { res->name ="System RAM" ; res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;
Signature · 7 lines
2.17.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 25 lines · Xianting Tian
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Commit
00ab027a3b82("RISC-V: Add kernel image sections to the resource tree") addedIORESOURCE_BUSYflag for no-map reserved memory, this casueddevm_ioremap_resource()failed for the no-map reserved memory in subsequent operations of related driver, so remove theIORESOURCE_BUSYflag.The code to reproduce the issue,
dts:mem0: memory@a0000000 { reg = <0x0 0xa0000000 0 0x1000000>; no-map; }; &test { status = "okay"; memory-region = <&mem0>; };code:
np = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret = of_address_to_resource(np, 0, &r); base = devm_ioremap_resource(&pdev->dev, &r); // base = -EBUSY
Quoted 5 lines
Fixes 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree")Reported-by Huaming Jiang <[email protected]>Reviewed-by Guo Ren <[email protected]>CC Nick Kossifidis <[email protected]>Signed-off-by Xianting Tian <[email protected]>
Hey Xianting,
This resend is no different to the patch you sent 5 mins ago, right? Thanks,
Conor.
Quoted 37 lines · Xianting Tian
Commit
00ab027a3b82("RISC-V: Add kernel image sections to the resource tree") addedIORESOURCE_BUSYflag for no-map reserved memory, this casueddevm_ioremap_resource()failed for the no-map reserved memory in subsequent operations of related driver, so remove theIORESOURCE_BUSYflag.The code to reproduce the issue,
dts:mem0: memory@a0000000 { reg = <0x0 0xa0000000 0 0x1000000>; no-map; }; &test { status = "okay"; memory-region = <&mem0>; };code:
np = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret = of_address_to_resource(np, 0, &r); base = devm_ioremap_resource(&pdev->dev, &r); // base = -EBUSYFixes 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree")Reported-by Huaming Jiang <[email protected]>Reviewed-by Guo Ren <[email protected]>CC Nick Kossifidis <[email protected]>Signed-off-by Xianting Tian <[email protected]>--- arch/riscv/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/setup.c +0
-0
arch/riscv/kernel/setup.c static void __init init_resources(void) · line 220
Quoted 8 lines
arch/riscv/kernel/setup.c +1
-1@@ -214,7 +214,7 @@ static void __init init_resources(void)if (unlikely (memblock_is_nomap (region))) { res->name ="Reserved" ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_MEM ; }else { res->name ="System RAM" ; res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;
I assume the "Reserved" part is essentially unused by the kernel correct?
Signature · 3 lines
Thanks, David / dhildenb
Quoted 39 lines · David Hildenbrand
Quoted 38 lines · Xianting Tian
Commit
00ab027a3b82("RISC-V: Add kernel image sections to the resource tree") addedIORESOURCE_BUSYflag for no-map reserved memory, this casueddevm_ioremap_resource()failed for the no-map reserved memory in subsequent operations of related driver, so remove theIORESOURCE_BUSYflag.The code to reproduce the issue,
dts:mem0: memory@a0000000 { reg = <0x0 0xa0000000 0 0x1000000>; no-map; }; &test { status = "okay"; memory-region = <&mem0>; };code:
np = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret = of_address_to_resource(np, 0, &r); base = devm_ioremap_resource(&pdev->dev, &r); // base = -EBUSYFixes 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree")Reported-by Huaming Jiang <[email protected]>Reviewed-by Guo Ren <[email protected]>CC Nick Kossifidis <[email protected]>Signed-off-by Xianting Tian <[email protected]>--- arch/riscv/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/setup.c +0
-0@@ -214,7 +214,7 @@ static void __init init_resources(void)
Quoted 8 lines
arch/riscv/kernel/setup.c static void __init init_resources(void) · line 220
Quoted 7 lines
arch/riscv/kernel/setup.c +1
-1if (unlikely (memblock_is_nomap (region))) { res->name ="Reserved" ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_MEM ; }else { res->name ="System RAM" ; res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;I assume the "Reserved" part is essentially unused by the kernel correct?
I think we may use it, actually we found the issue in our product after merged kdump functionality.
Actually, the code didn't add IORESOURCE_BUSY for no-map reserved memory before 00ab027a3b82 merged, so it is a typo for commit 00ab027a3b82 to add IORESOURCE_BUSY?
Quoted 1 line
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 49 lines · Xianting Tian
Quoted 33 lines · David Hildenbrand
Quoted 32 lines · Xianting Tian
Commit
00ab027a3b82("RISC-V: Add kernel image sections to the resource tree") addedIORESOURCE_BUSYflag for no-map reserved memory, this casueddevm_ioremap_resource()failed for the no-map reserved memory in subsequent operations of related driver, so remove theIORESOURCE_BUSYflag.The code to reproduce the issue,
dts:
mem0: memory@a0000000 {
reg = <0x00xa000000000x1000000>; no-map;
};&test {
status = "okay";
memory-region = <&mem0>;
};code:
np =of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret =of_address_to_resource(np, 0, &r);
base =devm_ioremap_resource(&pdev->dev, &r);
// base =-EBUSYFixes 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree")Reported-by Huaming Jiang <[email protected]>Reviewed-by Guo Ren <[email protected]>CC Nick Kossifidis <[email protected]>Signed-off-by Xianting Tian <[email protected]>---
arch/riscv/kernel/setup.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
arch/riscv/kernel/setup.c static void __init init_resources(void) · line 219
Quoted 12 lines
arch/riscv/kernel/setup.c +1
-1@@ -214,7 +214,7 @@ static void __init init_resources(void) if (unlikely(memblock_is_nomap(region))) { res->name = "Reserved"; - res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; + res->flags = IORESOURCE_MEM; } else { res->name = "System RAM"; res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;I assume the "Reserved" part is essentially unused by the kernel correct?
Quoted 3 lines
I think we may use it, actually we found the issue in our product after merged kdump functionality.
Actually, the code didn't add
IORESOURCE_BUSYfor no-map reserved memory before00ab027a3b82merged, so it is a typo for commit00ab027a3b82to addIORESOURCE_BUSY?
This is arm64 code, which doesn't add IORESOURCE_BUSY for no-map reserved memory,
arch/arm64/kernel/setup.c
for_each_mem_region(region) {
res = &standard_resources[i++];
if (memblock_is_nomap(region)) {
res->name = "reserved";
res->flags = IORESOURCE_MEM;
res->start = __pfn_to_phys(memblock_region_reserved_base_pfn(region)); res->end = __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1;
Quoted 2 lines
Quoted 2 lines