diff mbox series

[kvm-unit-tests,RFC,2/3] lib: s390x: sclp: Clear ASCII screen on setup

Message ID 20230630145449.2312-3-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Improve console handling | expand

Commit Message

Janosch Frank June 30, 2023, 2:54 p.m. UTC
In contrast to the line-mode console the ASCII console will retain
previously written text on a reboot. So let's clear the console on
setup so only our text will be displayed. To not clear the whole
screen when running under QEMU we switch the run command to the line
mode console.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 lib/s390x/sclp-console.c | 2 ++
 s390x/run                | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Claudio Imbrenda June 30, 2023, 3:25 p.m. UTC | #1
On Fri, 30 Jun 2023 14:54:48 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> In contrast to the line-mode console the ASCII console will retain

what's the problem with that?

> previously written text on a reboot. So let's clear the console on
> setup so only our text will be displayed. To not clear the whole
> screen when running under QEMU we switch the run command to the line
> mode console.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  lib/s390x/sclp-console.c | 2 ++
>  s390x/run                | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/sclp-console.c b/lib/s390x/sclp-console.c
> index 384080b0..534d3443 100644
> --- a/lib/s390x/sclp-console.c
> +++ b/lib/s390x/sclp-console.c
> @@ -233,6 +233,8 @@ void sclp_console_setup(void)
>  {
>  	/* We send ASCII and line mode. */
>  	sclp_write_event_mask(0, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG);
> +	/* Hard terminal reset to clear screen */
> +	sclp_print_ascii("\ec");
>  }
>  
>  void sclp_print(const char *str)
> diff --git a/s390x/run b/s390x/run
> index f1111dbd..68f8e733 100755
> --- a/s390x/run
> +++ b/s390x/run
> @@ -28,7 +28,7 @@ fi
>  M='-machine s390-ccw-virtio'
>  M+=",accel=$ACCEL"
>  command="$qemu -nodefaults -nographic $M"
> -command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
> +command+=" -chardev stdio,id=con0 -device sclplmconsole,chardev=con0"
>  command+=" -kernel"
>  command="$(panic_cmd) $(migration_cmd) $(timeout_cmd) $command"
>
Janosch Frank July 3, 2023, 11:36 a.m. UTC | #2
On 6/30/23 17:25, Claudio Imbrenda wrote:
> On Fri, 30 Jun 2023 14:54:48 +0000
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> In contrast to the line-mode console the ASCII console will retain
> 
> what's the problem with that?

It can be a bit hard to read since you need to find the line where the 
old output ends and the new one starts.


I don't insist on this patch being included, the \r and sclp line mode 
input patches give me enough usability.
Claudio Imbrenda July 3, 2023, 11:57 a.m. UTC | #3
On Mon, 3 Jul 2023 13:36:05 +0200
Janosch Frank <frankja@linux.ibm.com> wrote:

> On 6/30/23 17:25, Claudio Imbrenda wrote:
> > On Fri, 30 Jun 2023 14:54:48 +0000
> > Janosch Frank <frankja@linux.ibm.com> wrote:
> >   
> >> In contrast to the line-mode console the ASCII console will retain  
> > 
> > what's the problem with that?  
> 
> It can be a bit hard to read since you need to find the line where the 
> old output ends and the new one starts.
> 
> 
> I don't insist on this patch being included, the \r and sclp line mode 
> input patches give me enough usability.

make it a compile-time option? (default off)

then you won't need to change the run script, and you can still clear
the console when you need it (HMC)
Janosch Frank July 3, 2023, 12:30 p.m. UTC | #4
On 7/3/23 13:57, Claudio Imbrenda wrote:
> On Mon, 3 Jul 2023 13:36:05 +0200
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> On 6/30/23 17:25, Claudio Imbrenda wrote:
>>> On Fri, 30 Jun 2023 14:54:48 +0000
>>> Janosch Frank <frankja@linux.ibm.com> wrote:
>>>    
>>>> In contrast to the line-mode console the ASCII console will retain
>>>
>>> what's the problem with that?
>>
>> It can be a bit hard to read since you need to find the line where the
>> old output ends and the new one starts.
>>
>>
>> I don't insist on this patch being included, the \r and sclp line mode
>> input patches give me enough usability.
> 
> make it a compile-time option? (default off)
> 
> then you won't need to change the run script, and you can still clear
> the console when you need it (HMC)

Well, the compile-time check made me remember that we have 
lib/s390x/hardware.c. We can simply check for HOST_IS_LPAR and clear 
accordingly.
diff mbox series

Patch

diff --git a/lib/s390x/sclp-console.c b/lib/s390x/sclp-console.c
index 384080b0..534d3443 100644
--- a/lib/s390x/sclp-console.c
+++ b/lib/s390x/sclp-console.c
@@ -233,6 +233,8 @@  void sclp_console_setup(void)
 {
 	/* We send ASCII and line mode. */
 	sclp_write_event_mask(0, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG);
+	/* Hard terminal reset to clear screen */
+	sclp_print_ascii("\ec");
 }
 
 void sclp_print(const char *str)
diff --git a/s390x/run b/s390x/run
index f1111dbd..68f8e733 100755
--- a/s390x/run
+++ b/s390x/run
@@ -28,7 +28,7 @@  fi
 M='-machine s390-ccw-virtio'
 M+=",accel=$ACCEL"
 command="$qemu -nodefaults -nographic $M"
-command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
+command+=" -chardev stdio,id=con0 -device sclplmconsole,chardev=con0"
 command+=" -kernel"
 command="$(panic_cmd) $(migration_cmd) $(timeout_cmd) $command"