All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Shannon Zhao <zhaoshenglong@huawei.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Drew Jones <drjones@redhat.com>,
	Andrea Bolognani <abologna@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] hw/arm/virt-acpi-build: Add second UART to ACPI tables
Date: Wed, 13 Dec 2017 16:46:46 +0000	[thread overview]
Message-ID: <CAKv+Gu-uPf9QLobM1Vqdek_rSPfZcAXV24Ybg83hZvHbH5LqHw@mail.gmail.com> (raw)
In-Reply-To: <0355e1ee-2f48-81ce-55e6-bed7bdeac771@redhat.com>

On 13 December 2017 at 16:01, Laszlo Ersek <lersek@redhat.com> wrote:
> On 12/13/17 14:56, Peter Maydell wrote:
>> On 12 December 2017 at 11:06, Laszlo Ersek <lersek@redhat.com> wrote:
>>> BTW, has anyone tested this with the ArmVirtQemu firmware? As far as I
>>> can see from the firmware code, the firmware will use the PL011 whose
>>> description comes first in the DTB (and ignore the other PL011), in an
>>> fdt_next_node() traversal. Is that OK for the intended use case?
>>
>> I have now tested this,
>
> Thank you!
>
>> and annoyingly UEFI and the kernel seem
>> to disagree about enumeration order. That is, if QEMU creates
>> them in the code in the order 0x09050000 (uart 2), 0x09000000 (uart 1),
>> then they appear in the dtb with uart 1 first, and the kernel enumerates
>> them as ttyAMA0 being uart 1 and ttyAMA1 being uart 2, but UEFI
>> outputs to uart 2...
>
> Ouch. This reminds me (remotely) of QEMU commit 587078f0ed63
> ("hw/arm/virt: explain device-to-transport mapping in
> create_virtio_devices()", 2015-02-05).
>
> I'd still like to avoid the "sophisticated" /chosen lookup (the lookup
> itself is not too complex, but evaluating whatever we find there against
> each of the scanned UART nodes appears difficult, if I'm to understand
> Ard's earlier point correctly).

This may be a lot simpler than I originally thought. stdout-path
contains a string of the from

<nodename-or-alias>[:<baudrate[<parity>[<data-bits>[<flow-control>]]]]

where nodename-or-alias can be resolved into a path via fdt_get_alias
(), or used directly as a path otherwise.

> I hope that we can match the kernel's
> logic with simple modifications to our scanning loops, e.g. we could
> simply pick the last UART rather than the first, or else do a maximum
> (or minimum) search for the UART base, and stick with the maximum (or
> minimum) found.
>
> However, for that, we first have to understand what the kernel does. Can
> someone explain that? (I tried taking a look, but it's turtles all the
> way down.)
>

The kernel uses the contents of the SPCR table or /chosen/stdout-path
as the console unless overridden on the kernel command line. This is
independent of enumeration order.

  reply	other threads:[~2017-12-13 16:46 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
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 [this message]
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=CAKv+Gu-uPf9QLobM1Vqdek_rSPfZcAXV24Ybg83hZvHbH5LqHw@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=Jason@zx2c4.com \
    --cc=abologna@redhat.com \
    --cc=drjones@redhat.com \
    --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.