Use input-device and output-device

Message ID 20170926160201.28817-1-lvivier@redhat.com
State Accepted
Headers show
Series
  • Use input-device and output-device
Related show

Commit Message

Laurent Vivier Sept. 26, 2017, 4:02 p.m.
QEMU can now set environment variables from the command line (with -prom-env).
By this means, we can set the output-device and input-device variables,
and SLOF can read it and set stdout and stdin accordingly.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 board-qemu/slof/OF.fs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Laurent Vivier Sept. 27, 2017, 8:01 a.m. | #1
On 26/09/2017 18:02, Laurent Vivier wrote:
> QEMU can now set environment variables from the command line (with -prom-env).
> By this means, we can set the output-device and input-device variables,
> and SLOF can read it and set stdout and stdin accordingly.

An example:

qemu-system-ppc64 -nodefaults -nographic \
    -chardev socket,id=serial_id_serial0,host=localhost,port=4441,telnet,server,wait \
    -device spapr-vty,chardev=serial_id_serial0 \
    -chardev socket,id=serial_id_serial1,host=localhost,port=4442,telnet,server,wait \
    -device spapr-vty,chardev=serial_id_serial1 \
    -monitor stdio \
    -prom-env "input-device=/vdevice/vty@71000002" \
    -prom-env "output-device=/vdevice/vty@71000002"

Then "telnet localhost 4441" and "telnet localhost 4442" and you will see SLOF 
logs in the second telnet.

> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  board-qemu/slof/OF.fs | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs
> index 0169c35..4e04b84 100644
> --- a/board-qemu/slof/OF.fs
> +++ b/board-qemu/slof/OF.fs
> @@ -257,6 +257,20 @@ romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
>              THEN
>          THEN
>      THEN
> +
> +    s" input-device" evaluate dup IF
> +        ." User selected input-device console: " 2dup type cr
> +        input
> +    ELSE
> +        2drop
> +    THEN
> +
> +    s" output-device" evaluate dup IF
> +        ." User selected output-device console: " 2dup type cr
> +        output
> +    ELSE
> +        2drop
> +    THEN
>  ;
>  set-default-console
>  
>
Nikunj A Dadhania Sept. 27, 2017, 8:44 a.m. | #2
Laurent Vivier <lvivier@redhat.com> writes:

> QEMU can now set environment variables from the command line (with -prom-env).
> By this means, we can set the output-device and input-device variables,
> and SLOF can read it and set stdout and stdin accordingly.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Tested-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

> ---
>  board-qemu/slof/OF.fs | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs
> index 0169c35..4e04b84 100644
> --- a/board-qemu/slof/OF.fs
> +++ b/board-qemu/slof/OF.fs
> @@ -257,6 +257,20 @@ romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
>              THEN
>          THEN
>      THEN
> +
> +    s" input-device" evaluate dup IF
> +        ." User selected input-device console: " 2dup type cr
> +        input
> +    ELSE
> +        2drop
> +    THEN
> +
> +    s" output-device" evaluate dup IF
> +        ." User selected output-device console: " 2dup type cr
> +        output
> +    ELSE
> +        2drop
> +    THEN
>  ;
>  set-default-console
>  
> -- 
> 2.13.5
>
> _______________________________________________
> SLOF mailing list
> SLOF@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof
Alexey Kardashevskiy Oct. 4, 2017, 8:23 a.m. | #3
On 27/09/17 02:02, Laurent Vivier wrote:
> QEMU can now set environment variables from the command line (with -prom-env).
> By this means, we can set the output-device and input-device variables,
> and SLOF can read it and set stdout and stdin accordingly.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---

Thanks, applied.

>  board-qemu/slof/OF.fs | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs
> index 0169c35..4e04b84 100644
> --- a/board-qemu/slof/OF.fs
> +++ b/board-qemu/slof/OF.fs
> @@ -257,6 +257,20 @@ romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
>              THEN
>          THEN
>      THEN
> +
> +    s" input-device" evaluate dup IF
> +        ." User selected input-device console: " 2dup type cr
> +        input
> +    ELSE
> +        2drop
> +    THEN
> +
> +    s" output-device" evaluate dup IF
> +        ." User selected output-device console: " 2dup type cr
> +        output
> +    ELSE
> +        2drop
> +    THEN
>  ;
>  set-default-console
>  
>

Patch

diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs
index 0169c35..4e04b84 100644
--- a/board-qemu/slof/OF.fs
+++ b/board-qemu/slof/OF.fs
@@ -257,6 +257,20 @@  romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
             THEN
         THEN
     THEN
+
+    s" input-device" evaluate dup IF
+        ." User selected input-device console: " 2dup type cr
+        input
+    ELSE
+        2drop
+    THEN
+
+    s" output-device" evaluate dup IF
+        ." User selected output-device console: " 2dup type cr
+        output
+    ELSE
+        2drop
+    THEN
 ;
 set-default-console