From: Liam Merwick <liam.merwick@oracle.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Eduardo Habkost <ehabkost@redhat.com>,
Alistair Francis <alistair@alistair23.me>,
Andrew Baumann <Andrew.Baumann@microsoft.com>,
qemu-arm@nongnu.org, Cleber Rosa <crosa@redhat.com>,
Laurent Bonnans <laurent.bonnans@here.com>,
Cheng Xiang <ext-cheng.xiang@here.com>
Subject: Re: [PATCH v4 4/7] python/qemu/machine: Allow to use other serial consoles than default
Date: Tue, 28 Jan 2020 11:01:11 +0000 [thread overview]
Message-ID: <d9b078b4-dab7-da67-bb96-7b66c19d27a2@oracle.com> (raw)
In-Reply-To: <6542670c-341f-b259-5705-a5374c5b722d@redhat.com>
On 21/01/2020 08:20, Philippe Mathieu-Daudé wrote:
> On 1/21/20 12:51 AM, Philippe Mathieu-Daudé wrote:
>> Currently the QEMU Python module limits the QEMUMachine class to
>> use the first serial console.
>>
>> Some machines/guest might use another console than the first one as
>> the 'boot console'. For example the Raspberry Pi uses the second
>> (AUX) console.
>>
>> To be able to use the Nth console as default, we simply need to
>> connect all the N - 1 consoles to the null chardev.
>>
>> Add an index argument, so we can use a specific serial console as
>> default.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> v2:
>> - renamed 'console_index', added docstring (Cleber)
>> - reworded description (pm215)
>> ---
>> python/qemu/machine.py | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
>> index 734efd8536..ef9f5b213f 100644
>> --- a/python/qemu/machine.py
>> +++ b/python/qemu/machine.py
>> @@ -241,6 +241,8 @@ class QEMUMachine(object):
>> 'chardev=mon,mode=control'])
>> if self._machine is not None:
>> args.extend(['-machine', self._machine])
>> + for i in range(self._console_index):
>> + args.extend(['-serial', 'null'])
>
> This patch is not sufficient, we have to initialize _console_index in
> __init__():
>
with that fix applied
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Liam Merwick <liam.merwick@oracle.com>
> -- >8 --
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index ef9f5b213f..183d8f3d38 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -112,6 +112,7 @@ class QEMUMachine(object):
> self._sock_dir = sock_dir
> self._launched = False
> self._machine = None
> + self._console_index = 0
> self._console_set = False
> self._console_device_type = None
> self._console_address = None
> ---
>
> Else for tests not calling self.set_console() we get:
>
> 'QEMUMachine' object has no attribute '_console_index'
>
>> if self._console_set:
>> self._console_address = os.path.join(self._sock_dir,
>> self._name +
>> "-console.sock")
>> @@ -527,7 +529,7 @@ class QEMUMachine(object):
>> """
>> self._machine = machine_type
>> - def set_console(self, device_type=None):
>> + def set_console(self, device_type=None, console_index=0):
>> """
>> Sets the device type for a console device
>> @@ -548,9 +550,14 @@ class QEMUMachine(object):
>> chardev:console" command line argument will
>> be used instead, resorting to the machine's
>> default device type.
>> + @param console_index: the index of the console device to use.
>> + If not zero, the command line will create
>> + 'index - 1' consoles and connect them to
>> + the 'null' backing character device.
>> """
>> self._console_set = True
>> self._console_device_type = device_type
>> + self._console_index = console_index
>> @property
>> def console_socket(self):
>>
>
>
next prev parent reply other threads:[~2020-01-28 11:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 23:51 [PATCH v4 0/7] hw/arm/raspi: Run U-Boot on the raspi machines Philippe Mathieu-Daudé
2020-01-20 23:51 ` [PATCH v4 1/7] hw/arm/raspi: Remove obsolete use of -smp to set the soc 'enabled-cpus' Philippe Mathieu-Daudé
2020-01-21 2:34 ` Alistair Francis
2020-01-20 23:51 ` [PATCH v4 2/7] Acceptance tests: Extract _console_interaction() Philippe Mathieu-Daudé
2020-01-28 11:01 ` Liam Merwick
2020-01-28 19:34 ` Wainer dos Santos Moschetta
2020-01-28 19:58 ` Wainer dos Santos Moschetta
2020-01-30 22:18 ` Philippe Mathieu-Daudé
2020-01-20 23:51 ` [PATCH v4 3/7] Acceptance tests: Add interrupt_interactive_console_until_pattern() Philippe Mathieu-Daudé
2020-01-28 11:01 ` Liam Merwick
2020-01-28 19:59 ` Wainer dos Santos Moschetta
2020-01-30 22:19 ` Philippe Mathieu-Daudé
2020-01-20 23:51 ` [PATCH v4 4/7] python/qemu/machine: Allow to use other serial consoles than default Philippe Mathieu-Daudé
2020-01-21 8:20 ` Philippe Mathieu-Daudé
2020-01-28 11:01 ` Liam Merwick [this message]
2020-01-28 19:12 ` Wainer dos Santos Moschetta
2020-01-30 22:15 ` Philippe Mathieu-Daudé
2020-01-20 23:51 ` [PATCH v4 5/7] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2 Philippe Mathieu-Daudé
2020-01-21 6:57 ` Gerd Hoffmann
2020-01-21 8:32 ` Philippe Mathieu-Daudé
2020-01-27 16:02 ` Thomas Huth
2020-01-27 16:09 ` Philippe Mathieu-Daudé
2020-01-27 16:15 ` Thomas Huth
2020-01-28 20:08 ` Wainer dos Santos Moschetta
2020-01-20 23:51 ` [PATCH v4 6/7] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3 Philippe Mathieu-Daudé
2020-01-28 20:10 ` Wainer dos Santos Moschetta
2020-01-20 23:51 ` [PATCH v4 7/7] tests/boot_linux_console: Tag Emcraft Smartfusion2 as running 'u-boot' Philippe Mathieu-Daudé
2020-01-27 16:05 ` Thomas Huth
2020-01-28 20:23 ` Wainer dos Santos Moschetta
2020-01-31 2:10 ` Philippe Mathieu-Daudé
2020-01-28 6:53 ` [PATCH v4 0/7] hw/arm/raspi: Run U-Boot on the raspi machines Philippe Mathieu-Daudé
2020-01-30 13:43 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d9b078b4-dab7-da67-bb96-7b66c19d27a2@oracle.com \
--to=liam.merwick@oracle.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=alistair@alistair23.me \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=ext-cheng.xiang@here.com \
--cc=f4bug@amsat.org \
--cc=laurent.bonnans@here.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).