riscv: Respect the initrd found in the dt, if any.
PATCH 1/1 riscv: Respect the initrd found in the dt, if any.
--- arch/riscv/kernel/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/riscv/kernel/setup.c +6 -1
@@ -88,15 +88,20 @@ static void __init setup_initrd(void)extern unsigned long __initramfs_size;unsigned long size; +if (initrd_start) + goto found; +if (__initramfs_size >0 ) { initrd_start = (unsigned long )(&__initramfs_start); initrd_end = initrd_start + __initramfs_size; } + initrd_below_start_ok =1 ;if (initrd_start >= initrd_end) {printk (KERN_INFO "initrd not found or empty" ); goto disable; } +found:if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) {printk (KERN_ERR "initrd extends beyond end of memory" ); goto disable;
@@ -104,13 +109,13 @@ static void __init setup_initrd(void) size = initrd_end - initrd_start;memblock_reserve (__pa (initrd_start), size); - initrd_below_start_ok =1 ;printk (KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n" , (void *)(initrd_start), size);return ; disable:pr_cont (" - disabling initrd\n" ); + initrd_below_start_ok =0 ; initrd_start =0 ; initrd_end =0 ; }
Signature · 1 line
2.16.1
PATCH 1/1 riscv: Respect the initrd found in the dt, if any.
Quoted 35 lines · shea at shealevy.com
Signed-off-by Shea Levy <[email protected]>--- arch/riscv/kernel/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/riscv/kernel/setup.c +5
-1@@ -88,15 +88,20 @@ static void __init setup_initrd(void)extern unsigned long __initramfs_size;unsigned long size; +if (initrd_start) + goto found; +if (__initramfs_size >0 ) { initrd_start = (unsigned long )(&__initramfs_start); initrd_end = initrd_start + __initramfs_size; } + initrd_below_start_ok =1 ;if (initrd_start >= initrd_end) {printk (KERN_INFO "initrd not found or empty" ); goto disable; } +found:if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) {printk (KERN_ERR "initrd extends beyond end of memory" ); goto disable;@@ -104,13 +109,13 @@ static void __init setup_initrd(void) size = initrd_end - initrd_start;memblock_reserve (__pa (initrd_start), size); - initrd_below_start_ok =1 ;
arch/riscv/kernel/setup.c static void __init setup_initrd(void) · line 121
Quoted 10 lines
arch/riscv/kernel/setup.c +1
-0printk (KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n" , (void *)(initrd_start), size);return ; disable:pr_cont (" - disabling initrd\n" ); + initrd_below_start_ok =0 ; initrd_start =0 ; initrd_end =0 ; }
It looks like there's some amount of generic support in __early_init_dt_declare_initrd(), can we just use that?
PATCH 1/1 riscv: Respect the initrd found in the dt, if any.
It doesn't look like that generic support handles the case where the initrd is compiled into the kernel and not passed in the devicetree, which setup_initrd already did before this
patch. __early_init_dt_delcare_initrd is only called when the devicetree properties are found.
Quoted 37 lines · Palmer Dabbelt
Quoted 36 lines · shea at shealevy.com
Signed-off-by Shea Levy <[email protected]>--- arch/riscv/kernel/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/riscv/kernel/setup.c +5
-1@@ -88,15 +88,20 @@ static void __init setup_initrd(void)extern unsigned long __initramfs_size;unsigned long size; +if (initrd_start) + goto found; +if (__initramfs_size >0 ) { initrd_start = (unsigned long )(&__initramfs_start); initrd_end = initrd_start + __initramfs_size; } + initrd_below_start_ok =1 ;if (initrd_start >= initrd_end) {printk (KERN_INFO "initrd not found or empty" ); goto disable; } +found:if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) {printk (KERN_ERR "initrd extends beyond end of memory" ); goto disable;@@ -104,13 +109,13 @@ static void __init setup_initrd(void) size = initrd_end - initrd_start;memblock_reserve (__pa (initrd_start), size); - initrd_below_start_ok =1 ;
Quoted 12 lines
arch/riscv/kernel/setup.c static void __init setup_initrd(void) · line 121
Quoted 9 lines
arch/riscv/kernel/setup.c +1
-0printk (KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n" , (void *)(initrd_start), size);return ; disable:pr_cont (" - disabling initrd\n" ); + initrd_below_start_ok =0 ; initrd_start =0 ; initrd_end =0 ; }It looks like there's some amount of generic support in
__early_init_dt_declare_initrd(), can we just use that?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20180222/cd0252b4/attachment.sig>
PATCH 1/1 riscv: Respect the initrd found in the dt, if any.
Hi Palmer,
Any further thoughts on this?
Thanks,
Shea
Quoted 6 lines · Shea Levy
It doesn't look like that generic support handles the case where the initrd is compiled into the kernel and not passed in the devicetree, which
setup_initrdalready did before this
patch.__early_init_dt_delcare_initrdis only called when the devicetree properties are found.
Quoted 51 lines
Quoted 49 lines · Palmer Dabbelt
Quoted 35 lines · shea at shealevy.com
Signed-off-by Shea Levy <[email protected]>--- arch/riscv/kernel/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/riscv/kernel/setup.c +5
-1@@ -88,15 +88,20 @@ static void __init setup_initrd(void)extern unsigned long __initramfs_size;unsigned long size; +if (initrd_start) + goto found; +if (__initramfs_size >0 ) { initrd_start = (unsigned long )(&__initramfs_start); initrd_end = initrd_start + __initramfs_size; } + initrd_below_start_ok =1 ;if (initrd_start >= initrd_end) {printk (KERN_INFO "initrd not found or empty" ); goto disable; } +found:if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) {printk (KERN_ERR "initrd extends beyond end of memory" ); goto disable;@@ -104,13 +109,13 @@ static void __init setup_initrd(void) size = initrd_end - initrd_start;memblock_reserve (__pa (initrd_start), size); - initrd_below_start_ok =1 ;arch/riscv/kernel/setup.c static void __init setup_initrd(void) · line 121
Quoted 10 lines
arch/riscv/kernel/setup.c +1
-0printk (KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n" , (void *)(initrd_start), size);return ; disable:pr_cont (" - disabling initrd\n" ); + initrd_below_start_ok =0 ; initrd_start =0 ; initrd_end =0 ; }It looks like there's some amount of generic support in
__early_init_dt_declare_initrd(), can we just use that?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20180308/d90fd7c1/attachment.sig>
PATCH 1/1 riscv: Respect the initrd found in the dt, if any.
Thanks for the ping, I must have missed your response. I've added this to our for-next branch.
Quoted 66 lines · shea at shealevy.com
Hi Palmer,
Any further thoughts on this?
Thanks,
SheaQuoted 57 lines · Shea Levy
It doesn't look like that generic support handles the case where the initrd is compiled into the kernel and not passed in the devicetree, which
setup_initrdalready did before this
patch.__early_init_dt_delcare_initrdis only called when the devicetree properties are found.Quoted 49 lines · Palmer Dabbelt
Quoted 35 lines · shea at shealevy.com
Signed-off-by Shea Levy <[email protected]>--- arch/riscv/kernel/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/riscv/kernel/setup.c +5
-1@@ -88,15 +88,20 @@ static void __init setup_initrd(void)extern unsigned long __initramfs_size;unsigned long size; +if (initrd_start) + goto found; +if (__initramfs_size >0 ) { initrd_start = (unsigned long )(&__initramfs_start); initrd_end = initrd_start + __initramfs_size; } + initrd_below_start_ok =1 ;if (initrd_start >= initrd_end) {printk (KERN_INFO "initrd not found or empty" ); goto disable; } +found:if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) {printk (KERN_ERR "initrd extends beyond end of memory" ); goto disable;@@ -104,13 +109,13 @@ static void __init setup_initrd(void) size = initrd_end - initrd_start;memblock_reserve (__pa (initrd_start), size); - initrd_below_start_ok =1 ;arch/riscv/kernel/setup.c static void __init setup_initrd(void) · line 121
Quoted 10 lines
arch/riscv/kernel/setup.c +1
-0printk (KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n" , (void *)(initrd_start), size);return ; disable:pr_cont (" - disabling initrd\n" ); + initrd_below_start_ok =0 ; initrd_start =0 ; initrd_end =0 ; }It looks like there's some amount of generic support in
__early_init_dt_declare_initrd(), can we just use that?