All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Andrea Bolognani <abologna@redhat.com>,
	Shannon Zhao <zhaoshenglong@huawei.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] hw/arm/virt-acpi-build: Add second UART to ACPI tables
Date: Tue, 12 Dec 2017 15:18:32 +0100	[thread overview]
Message-ID: <20171212141832.gsvlcm77cxg7zbhc@kamzik.brq.redhat.com> (raw)
In-Reply-To: <CAKv+Gu9e6qwJ4=t=UHHGsVs1XM26agh17Mgy0ckAvUsy+2xi2A@mail.gmail.com>

On Tue, Dec 12, 2017 at 01:56:44PM +0000, Ard Biesheuvel wrote:
> On 12 December 2017 at 13:28, Laszlo Ersek <lersek@redhat.com> wrote:
> > On 12/12/17 13:47, Peter Maydell wrote:
> >> On 12 December 2017 at 12:41, Laszlo Ersek <lersek@redhat.com> wrote:
> >>> I agree. There's one user-visible complication: while with one UART,
> >>> it's not possible to mix things up, with two UARTs, users will
> >>> inevitably want to assign inverse roles to them, relative to what QEMU /
> >>> the firmware assigns originally.
> >>>
> >>> E.g. if one PL011 is redirected to a regular file (debug messages) and
> >>> the other one to stdio (console), there will be complaints that "I
> >>> wanted it the other way around". The redirection happens on the backend
> >>> (chardev) level, but the firmware won't see the difference on the
> >>> frontend (PL011) level.
> >>>
> >>> Is it possible to add a new property to the UART nodes in the DTB, like
> >>> "purpose"?
> >>
> >> This is what the "chosen" stdout-path node in the DTB is for,
> >> but you said you didn't want to look at that :-) (it means
> >> "device to be used for boot console output".)
> >
> > :(
> >
> > Ard is right that we really shouldn't do that kind of parsing magic in
> > very early UEFI stuff.
> >
> >
> >>> Or can we make a virt-arm policy that "first -serial is always ...,
> >>> second -serial is always ..."?
> >>
> >> Well, the first -serial will always be the 0x09000000 one
> >> that we have today, and the second -serial will be the other
> >> one (unless you have -machine secure=yes, in which case
> >> second -serial is the secure-only UART and third -serial is
> >> the second NS UART).
> >>
> >> Is this any different to the x86 case, where there are two
> >> UARTs at different IO port/IRQ locations?
> >
> > OVMF (x86) uses two distinct devices for the two purposes discussed.
> >
> > * It uses the "debug console device" for debug message output, at
> > hard-coded IO port 0x402; so if you'd like to capture those messages,
> > then you have to add:
> >
> >   -chardev file,id=debugfile,path=debug.log \
> >   -device isa-debugcon,iobase=0x402,chardev=debugfile \
> >
> > (or the more traditional
> >
> >   -debugcon file:debug.log \
> >   -global isa-debugcon.iobase=0x402 \
> > )
> >
> > * For console I/O, it uses the first serial port. (I think I have once
> > investigated what it takes to use other serial ports for console I/O --
> > I'm no longer sure if "it happens to be impossible in OVMF", or just
> > "nobody ever does that".)
> >
> >
> > The important distinction (on the UEFI level anyway) is that the debug
> > messages need to go to a super dumb device, while console I/O can use a
> > much higher-level serial IO abstraction ("protocol").
> >
> >
> >> I think the only thing users really expect is that if you're
> >> using just the one serial port for anything then it's the
> >> first one.
> >
> > You are right -- we've never had two (non-secure) UARTs on virt-arm, so
> > we can invent whatever assignment, as long as:
> >
> > - the single UART case doesn't break (keeps receiving both debug output
> > and console IO),
> >
> > - whatever we invent for the two UARTs case now, it remains consistent
> > over time. I think this implies we can rely on the FDT node ordering in
> > the firmware (if we want to use the 2nd UART at all, that is), and then
> > QEMU shouldn't change the serial_hds[] <-> FDT node mapping in the
> > future, in machvirt_init() and the callees thereof.
> >
> 
> Given that the DEBUG output is only produced on DEBUG builds, couldn't
> we simply stipulate that DEBUG output appears on the PL011 with the
> lowest physical address? That keeps the current status quo, and is
> probably sufficient for 99% of the use cases of people using the DEBUG
> builds.

I was thinking that if AAVMF learned to use a second UART for debug
output, that the debug builds could go away, as they have for x86 (IIUC).
If a user wires up a second UART, then AAVMF could unconditionally
output debug messages to it. Not wiring it up would lose the messages,
which is no different than the non-verbose build we have today. It
would be nice if could tell AAVMF not to use a second UART for debug
messages too, though, as the debug messages make AAVMF quite slow, and
the user may want to provide the guest a second UART.

> 
> Then, we can introduce some code to decode stdout-path in FdtClientDxe
> (a higher level DT parsing driver) so that the actual serial console
> gets installed onto whichever UART is described as the system console.
> Also, given that ArmVirtQemu is tightly coupled to QEMU/mach-virt, we
> could decide to only use node names in stdout-path (as we do
> currently) to simplify the parsing logic.
>

That sounds reasonable and would only require adding a comment above
the setting of stdout-path in the QEMU code to formalize it.

Thanks,
drew

  parent reply	other threads:[~2017-12-12 14:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 15:02 [Qemu-devel] [PATCH 0/3] hw/arm/virt: Add another UART Peter Maydell
2017-12-08 15:02 ` [Qemu-devel] [PATCH 1/3] hw/arm/virt: Add virt-2.12 machine type Peter Maydell
2017-12-12 14:39   ` Andrew Jones
2018-01-15 12:00     ` Peter Maydell
2017-12-08 15:02 ` [Qemu-devel] [PATCH 2/3] hw/arm/virt: Add another UART to the virt board Peter Maydell
2017-12-12  5:55   ` Shannon Zhao
2017-12-12 10:45     ` Peter Maydell
2017-12-12 14:25       ` Jason A. Donenfeld
2017-12-12 14:45   ` Andrew Jones
2017-12-12 14:50     ` Peter Maydell
2017-12-12 15:16       ` Andrew Jones
2017-12-12 15:51         ` Peter Maydell
2018-05-31  2:12           ` Jason A. Donenfeld
2018-05-31  8:32             ` Peter Maydell
2018-05-31 11:48               ` Jason A. Donenfeld
2018-05-31 11:57                 ` Peter Maydell
2017-12-12 15:16   ` Andrew Jones
2017-12-08 15:02 ` [Qemu-devel] [PATCH 3/3] hw/arm/virt-acpi-build: Add second UART to ACPI tables Peter Maydell
2017-12-12  5:53   ` Shannon Zhao
2017-12-12 11:06     ` Laszlo Ersek
2017-12-12 11:11       ` Peter Maydell
2017-12-12 11:33         ` Laszlo Ersek
2017-12-12 11:44           ` Ard Biesheuvel
2017-12-12 11:59             ` Laszlo Ersek
2017-12-12 12:07               ` Peter Maydell
2017-12-12 12:41                 ` Laszlo Ersek
2017-12-12 12:47                   ` Peter Maydell
2017-12-12 13:28                     ` Laszlo Ersek
2017-12-12 13:56                       ` Ard Biesheuvel
2017-12-12 14:10                         ` Peter Maydell
2017-12-12 14:12                           ` Ard Biesheuvel
2017-12-12 14:13                             ` Peter Maydell
2017-12-12 14:16                               ` Ard Biesheuvel
2017-12-12 14:17                                 ` Peter Maydell
2017-12-12 14:31                                   ` Ard Biesheuvel
2017-12-12 14:51                                     ` Andrew Jones
2017-12-12 16:38                                       ` Laszlo Ersek
2017-12-12 14:18                         ` Andrew Jones [this message]
2017-12-12 14:10                       ` Andrew Jones
2017-12-12 15:09       ` Andrew Jones
2017-12-13 13:56       ` Peter Maydell
2017-12-13 16:01         ` Laszlo Ersek
2017-12-13 16:46           ` Ard Biesheuvel
2017-12-13 16:48             ` Peter Maydell
2017-12-08 15:10 ` [Qemu-devel] [Qemu-arm] [PATCH 0/3] hw/arm/virt: Add another UART 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=20171212141832.gsvlcm77cxg7zbhc@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=abologna@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=lersek@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhaoshenglong@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.