diff mbox series

[v1,1/2] semihosting: defer connect_chardevs a little more to use serialx

Message ID 1592215252-26742-1-git-send-email-frederic.konrad@adacore.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/2] semihosting: defer connect_chardevs a little more to use serialx | expand

Commit Message

Frederic Konrad June 15, 2020, 10 a.m. UTC
From: KONRAD Frederic <frederic.konrad@adacore.com>

With that we can just use chardev=serial0.

Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---
 softmmu/vl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Alex Bennée June 16, 2020, 2:52 p.m. UTC | #1
konrad@adacore.com writes:

> From: KONRAD Frederic <frederic.konrad@adacore.com>
>
> With that we can just use chardev=serial0.

I don't quite follow what this means.

./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev=serial0: invalid option

./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev id=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backend

The run:

./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory

works fine without this patch.

>
> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
> ---
>  softmmu/vl.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index f669c06..9b8b48a 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)
>  
>      qemu_opts_foreach(qemu_find_opts("chardev"),
>                        chardev_init_func, NULL, &error_fatal);
> -    /* now chardevs have been created we may have semihosting to connect */
> -    qemu_semihosting_connect_chardevs();
>  
>  #ifdef CONFIG_VIRTFS
>      qemu_opts_foreach(qemu_find_opts("fsdev"),
> @@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)
>      if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
>          exit(1);
>  
> +    /* now chardevs have been created we may have semihosting to connect */
> +    qemu_semihosting_connect_chardevs();
> +
>      /* If no default VGA is requested, the default is "none".  */
>      if (default_vga) {
>          vga_model = get_default_vga_model(machine_class);
Frederic Konrad June 26, 2020, 10:06 a.m. UTC | #2
Le 6/16/20 à 4:52 PM, Alex Bennée a écrit :
> 
> konrad@adacore.com writes:
> 
>> From: KONRAD Frederic <frederic.konrad@adacore.com>
>>
>> With that we can just use chardev=serial0.
> 
> I don't quite follow what this means.
> 
> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
> qemu-system-aarch64: -chardev=serial0: invalid option
> 
> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev id=serial0 -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
> qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backend
> 
> The run:
> 
> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
> 
> works fine without this patch.

Hi Alex, and sorry for the delay,

I meant `-semihosting-config chardev=serial0`.  I suspect your last command-line
will print any string sent to semihosting to stderr by default.

> 
>>
>> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
>> ---
>>   softmmu/vl.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/softmmu/vl.c b/softmmu/vl.c
>> index f669c06..9b8b48a 100644
>> --- a/softmmu/vl.c
>> +++ b/softmmu/vl.c
>> @@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)
>>   
>>       qemu_opts_foreach(qemu_find_opts("chardev"),
>>                         chardev_init_func, NULL, &error_fatal);
>> -    /* now chardevs have been created we may have semihosting to connect */
>> -    qemu_semihosting_connect_chardevs();
>>   
>>   #ifdef CONFIG_VIRTFS
>>       qemu_opts_foreach(qemu_find_opts("fsdev"),
>> @@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)
>>       if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
>>           exit(1);
>>   
>> +    /* now chardevs have been created we may have semihosting to connect */
>> +    qemu_semihosting_connect_chardevs();
>> +
>>       /* If no default VGA is requested, the default is "none".  */
>>       if (default_vga) {
>>           vga_model = get_default_vga_model(machine_class);
> 
>
Frederic Konrad July 15, 2020, 11:04 a.m. UTC | #3
Le 6/26/20 à 12:06 PM, Fred Konrad a écrit :
> 
> 
> Le 6/16/20 à 4:52 PM, Alex Bennée a écrit :
>>
>> konrad@adacore.com writes:
>>
>>> From: KONRAD Frederic <frederic.konrad@adacore.com>
>>>
>>> With that we can just use chardev=serial0.
>>
>> I don't quite follow what this means.
>>
>> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 
>> -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
>> qemu-system-aarch64: -chardev=serial0: invalid option
>>
>> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev 
>> id=serial0 -M virt -display none -semihosting -kernel 
>> ./tests/tcg/aarch64-softmmu/memory
>> qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backend
>>
>> The run:
>>
>> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt 
>> -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
>>
>> works fine without this patch.
> 
> Hi Alex, and sorry for the delay,
> 
> I meant `-semihosting-config chardev=serial0`.  I suspect your last command-line
> will print any string sent to semihosting to stderr by default.

Does that make sense?  BTW the second patch fixes a bug, it might be interesting
to have it in 5.1.

Cheers,
Fred

> 
>>
>>>
>>> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
>>> ---
>>>   softmmu/vl.c | 5 +++--
>>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/softmmu/vl.c b/softmmu/vl.c
>>> index f669c06..9b8b48a 100644
>>> --- a/softmmu/vl.c
>>> +++ b/softmmu/vl.c
>>> @@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)
>>>       qemu_opts_foreach(qemu_find_opts("chardev"),
>>>                         chardev_init_func, NULL, &error_fatal);
>>> -    /* now chardevs have been created we may have semihosting to connect */
>>> -    qemu_semihosting_connect_chardevs();
>>>   #ifdef CONFIG_VIRTFS
>>>       qemu_opts_foreach(qemu_find_opts("fsdev"),
>>> @@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)
>>>       if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
>>>           exit(1);
>>> +    /* now chardevs have been created we may have semihosting to connect */
>>> +    qemu_semihosting_connect_chardevs();
>>> +
>>>       /* If no default VGA is requested, the default is "none".  */
>>>       if (default_vga) {
>>>           vga_model = get_default_vga_model(machine_class);
>>
>>
Alex Bennée July 16, 2020, 10:14 a.m. UTC | #4
Fred Konrad <konrad@adacore.com> writes:

> Le 6/26/20 à 12:06 PM, Fred Konrad a écrit :
>> 
>> 
>> Le 6/16/20 à 4:52 PM, Alex Bennée a écrit :
>>>
>>> konrad@adacore.com writes:
>>>
>>>> From: KONRAD Frederic <frederic.konrad@adacore.com>
>>>>
>>>> With that we can just use chardev=serial0.
>>>
>>> I don't quite follow what this means.
>>>
>>> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev=serial0 
>>> -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
>>> qemu-system-aarch64: -chardev=serial0: invalid option
>>>
>>> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -monitor none -chardev 
>>> id=serial0 -M virt -display none -semihosting -kernel 
>>> ./tests/tcg/aarch64-softmmu/memory
>>> qemu-system-aarch64: -chardev id=serial0: chardev: "serial0" missing backend
>>>
>>> The run:
>>>
>>> ./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt 
>>> -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory
>>>
>>> works fine without this patch.
>> 
>> Hi Alex, and sorry for the delay,
>> 
>> I meant `-semihosting-config chardev=serial0`.  I suspect your last command-line
>> will print any string sent to semihosting to stderr by default.
>
> Does that make sense?  BTW the second patch fixes a bug, it might be interesting
> to have it in 5.1.

Right - can confirm the difference between:

  ./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting -kernel ./tests/tcg/aarch64-softmmu/memory

and

  ./aarch64-softmmu/qemu-system-aarch64 -cpu max -serial mon:stdio -M virt -display none -semihosting-config chardev=serial0 -kernel ./tests/tcg/aarch64-softmmu/memory

is where the data ends up. I've slightly amended the commit message for
the 1/1 to make it clearer.

Queued to for-5.1/fixes-for-rc1, thanks.

>
> Cheers,
> Fred
>
>> 
>>>
>>>>
>>>> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
>>>> ---
>>>>   softmmu/vl.c | 5 +++--
>>>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/softmmu/vl.c b/softmmu/vl.c
>>>> index f669c06..9b8b48a 100644
>>>> --- a/softmmu/vl.c
>>>> +++ b/softmmu/vl.c
>>>> @@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp)
>>>>       qemu_opts_foreach(qemu_find_opts("chardev"),
>>>>                         chardev_init_func, NULL, &error_fatal);
>>>> -    /* now chardevs have been created we may have semihosting to connect */
>>>> -    qemu_semihosting_connect_chardevs();
>>>>   #ifdef CONFIG_VIRTFS
>>>>       qemu_opts_foreach(qemu_find_opts("fsdev"),
>>>> @@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp)
>>>>       if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
>>>>           exit(1);
>>>> +    /* now chardevs have been created we may have semihosting to connect */
>>>> +    qemu_semihosting_connect_chardevs();
>>>> +
>>>>       /* If no default VGA is requested, the default is "none".  */
>>>>       if (default_vga) {
>>>>           vga_model = get_default_vga_model(machine_class);
>>>
>>>
diff mbox series

Patch

diff --git a/softmmu/vl.c b/softmmu/vl.c
index f669c06..9b8b48a 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -4123,8 +4123,6 @@  void qemu_init(int argc, char **argv, char **envp)
 
     qemu_opts_foreach(qemu_find_opts("chardev"),
                       chardev_init_func, NULL, &error_fatal);
-    /* now chardevs have been created we may have semihosting to connect */
-    qemu_semihosting_connect_chardevs();
 
 #ifdef CONFIG_VIRTFS
     qemu_opts_foreach(qemu_find_opts("fsdev"),
@@ -4271,6 +4269,9 @@  void qemu_init(int argc, char **argv, char **envp)
     if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
         exit(1);
 
+    /* now chardevs have been created we may have semihosting to connect */
+    qemu_semihosting_connect_chardevs();
+
     /* If no default VGA is requested, the default is "none".  */
     if (default_vga) {
         vga_model = get_default_vga_model(machine_class);