diff mbox series

[v2] client: Load initramdisk location

Message ID 20191113062939.63861-1-aik@ozlabs.ru
State Accepted
Headers show
Series [v2] client: Load initramdisk location | expand

Commit Message

Alexey Kardashevskiy Nov. 13, 2019, 6:29 a.m. UTC
For ages both vmlinux and zImage accepted the initramdisk location
in r3/r4 [1] [2]. If r3==r4==0, vmlinux looks at the device tree for
/chosen/linux,initrd-{start|end} but zImage does not so the QEMU user
can only pass vmlinux via -kernel if -initrd is passed as well.

This initializes r3/r4 to point to the initramdisk location when present.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kernel/prom_init.c?h=v5.3#n3230
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/boot/of.c?h=v5.3#n89

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* improved readability
---
 slof/fs/client.fs | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alexey Kardashevskiy Nov. 20, 2019, 1:26 a.m. UTC | #1
On 13/11/2019 17:29, Alexey Kardashevskiy wrote:
> For ages both vmlinux and zImage accepted the initramdisk location
> in r3/r4 [1] [2]. If r3==r4==0, vmlinux looks at the device tree for
> /chosen/linux,initrd-{start|end} but zImage does not so the QEMU user
> can only pass vmlinux via -kernel if -initrd is passed as well.
> 
> This initializes r3/r4 to point to the initramdisk location when present.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kernel/prom_init.c?h=v5.3#n3230
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/boot/of.c?h=v5.3#n89
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Pushed out.


> ---
> Changes:
> v2:
> * improved readability
> ---
>  slof/fs/client.fs | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/slof/fs/client.fs b/slof/fs/client.fs
> index 8a7f6ac4326d..db7a1925792c 100644
> --- a/slof/fs/client.fs
> +++ b/slof/fs/client.fs
> @@ -45,6 +45,14 @@ VARIABLE  client-callback \ Address of client's callback function
>    >r  ciregs >r7 !  ciregs >r6 !  client-entry-point @ ciregs >r5 !
>    \ Initialise client-stack-pointer
>    cistack ciregs >r1 !
> +
> +  s" linux,initrd-end" get-chosen IF decode-int nip nip ELSE 0 THEN
> +  s" linux,initrd-start" get-chosen IF decode-int nip nip ELSE 0 THEN
> +		    ( end start )
> +  tuck -	    ( start len )
> +  ciregs >r4 !
> +  ciregs >r3 !
> +
>    \ jump-client maps to call_client in slof/entry.S
>    \ When jump-client returns, R3 holds the address of a NUL-terminated string
>    \ that holds the client interface word the client wants to call, R4 holds
>
diff mbox series

Patch

diff --git a/slof/fs/client.fs b/slof/fs/client.fs
index 8a7f6ac4326d..db7a1925792c 100644
--- a/slof/fs/client.fs
+++ b/slof/fs/client.fs
@@ -45,6 +45,14 @@  VARIABLE  client-callback \ Address of client's callback function
   >r  ciregs >r7 !  ciregs >r6 !  client-entry-point @ ciregs >r5 !
   \ Initialise client-stack-pointer
   cistack ciregs >r1 !
+
+  s" linux,initrd-end" get-chosen IF decode-int nip nip ELSE 0 THEN
+  s" linux,initrd-start" get-chosen IF decode-int nip nip ELSE 0 THEN
+		    ( end start )
+  tuck -	    ( start len )
+  ciregs >r4 !
+  ciregs >r3 !
+
   \ jump-client maps to call_client in slof/entry.S
   \ When jump-client returns, R3 holds the address of a NUL-terminated string
   \ that holds the client interface word the client wants to call, R4 holds