public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH 0/9] ArmVirtPkg: support two PL011 UARTs
@ 2023-10-08 15:39 Laszlo Ersek
  2023-10-08 15:39 ` [edk2-devel] [PATCH 1/9] ArmVirtPkg: introduce FdtSerialPortAddressLib Laszlo Ersek
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Laszlo Ersek @ 2023-10-08 15:39 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Gerd Hoffmann, Julien Grall, Leif Lindholm,
	Peter Maydell, Sami Mujawar

This ArmVirtPkg series can be fetched from:

  repo:   https://pagure.io/lersek/edk2.git
  branch: armvirt-dual-serial @ 65ee08413595

The series does the following:

- It centralizes (and cleans up) two FDT parsing actions, namely looking
  up all serial ports, and looking up the /chosen "stdout-path" serial
  port, in a new library class and instance.

- It rebases Fdt16550SerialPortHookLib, EarlyFdtPL011SerialPortLib and
  PlatformPeiLib to the new library.

- If QEMU specifies just one PL011 UART, then this patch set is
  unobservable from the outside.

- If QEMU specifies (at least) two PL011 UARTs, then we distinguish a
  "chosen" one, and a (first) "non-chosen" one:

  - Both EarlyFdtPL011SerialPortLib, and (PlatformPeiLib +
    FdtPL011SerialPortLib), target the "chosen" PL011. The consequence
    of this is that (a) direct SerialPortLib traffic, (b) the dependent
    SerialIo (SerialDxe) protocol traffic, and (c) the dependent UEFI
    console traffic, all occcur on the same PL011, and do so regardless
    of the firmware phase. Furthermore, (d) the Linux serial console
    traffic is directed to the same PL011 as well. In total, the
    "chosen" PL011 UART becomes "the console", covering both firmware
    and Linux.

  - Three new DebugLib instances -- namely Flash, RAM, and DXE Runtime
    instances of "DebugLibFdtPL011Uart" -- target the (first)
    "non-chosen" PL011. The consequence is that DebugLib output is
    hermetically separated from the above-mentioned console, mirroring
    the isa-debugcon situation with x86 OVMF.

Peter's QEMU patch set that this series interoperates with is at:

  repo:   https://git.linaro.org/people/pmaydell/qemu-arm.git
  branch: uart-edk-investigation @ 66bff4241bf8

See the larger background, and my detailed test results -- using
"ArmVirtQemu.dsc" -- in the following thread:

  EDK2 ArmVirtQemu behaviour with multiple UARTs
  http://mid.mail-archive.com/CAFEAcA_P5aOTQnM2ARYgR5WvKouvndMbX95XNmDsS0KTxMkMMw@mail.gmail.com
  https://listman.redhat.com/archives/edk2-devel-archive/2023-September/068241.html
  https://edk2.groups.io/g/devel/message/108941

For my testing, I rebased Peter's set on more recent QEMU commit
36e9aab3c569. Also, importantly, Peter's last patch 66bff4241bf8 ("virt:
Reverse order of UART dtb nodes", 2023-09-21) is *indifferent* regarding
my test results (which shows that the ordering of the two PL011 UARTs in
the DTB does not matter, with this edk2 series applied). See more on
that in the above-noted thread.

"ArmVirtKvmTool.dsc" and "ArmVirtXen.dsc" are not supposed to be visibly
affected by this series; I test-built them, and checked the library
resolutions before/after in their build report files (no change).
Runtime regression testing with these platforms would be welcome.

I also test-built "ArmVirtCloudHv.dsc" and "ArmVirtQemuKernel.dsc".
Those *are* supposed to receive the same feature, but I couldn't /
didn't boot them, respectively.

I've formatted the patches with "--find-copies-harder", because (a) that
makes for an easier reading, and (b) leaves the patches applicable from
the list. The base commit is noted at the end of this message.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Julien Grall <julien@xen.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>

(I've not Cc'd Peter on the patches themselves, but I'm Cc'ing him on
the cover letter.)

Thanks,
Laszlo

Laszlo Ersek (9):
  ArmVirtPkg: introduce FdtSerialPortAddressLib
  ArmVirtPkg/Fdt16550SerialPortHookLib: rebase to
    FdtSerialPortAddressLib
  ArmVirtPkg: adjust whitespace in block scope declarations
  ArmVirtPkg: adhere to the serial port selected by /chosen
    "stdout-path"
  ArmVirtPkg: store separate console and debug PL011 addresses in GUID
    HOB
  ArmVirtPkg: introduce DebugLibFdtPL011Uart Flash instance
  ArmVirtPkg: introduce DebugLibFdtPL011Uart RAM instance
  ArmVirtPkg: introduce DebugLibFdtPL011Uart DXE Runtime instance
  ArmVirtPkg: steer DebugLib output away from SerialPortLib+console
    traffic

 ArmVirtPkg/ArmVirt.dsc.inc                                                                    |  14 +-
 ArmVirtPkg/ArmVirtKvmTool.dsc                                                                 |  11 +
 ArmVirtPkg/ArmVirtPkg.dec                                                                     |   1 +
 ArmVirtPkg/ArmVirtXen.dsc                                                                     |  11 +
 ArmVirtPkg/Include/Guid/EarlyPL011BaseAddress.h                                               |  15 +-
 ArmVirtPkg/Include/Library/FdtSerialPortAddressLib.h                                          |  83 +++++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLibFdtPL011UartFlash.inf                         |  54 +++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLibFdtPL011UartRam.inf                           |  60 +++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/DxeRuntimeDebugLibFdtPL011Uart.inf                    |  61 +++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Flash.c                                               | 107 ++++++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Ram.c                                                 | 124 ++++++++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Ram.h                                                 |  18 ++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/RamNonRuntime.c                                       |  27 +++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Runtime.c                                             |  88 +++++++
 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Write.h                                               |  39 +++
 ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c                 |  88 +------
 ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf               |   3 +-
 ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c                         |  90 +++----
 ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf                       |   3 +-
 ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c                              |  20 +-
 ArmVirtPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c                          | 256 ++++++++++++++++++++
 ArmVirtPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf                        |  27 +++
 ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c                                            | 108 ++++++---
 ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf                                          |   2 +
 {MdePkg/Library/BaseDebugLibSerialPort => ArmVirtPkg/Library/DebugLibFdtPL011Uart}/DebugLib.c |  41 ++--
 25 files changed, 1128 insertions(+), 223 deletions(-)
 copy {MdePkg/Library/BaseDebugLibSerialPort => ArmVirtPkg/Library/DebugLibFdtPL011Uart}/DebugLib.c (89%)
 create mode 100644 ArmVirtPkg/Include/Library/FdtSerialPortAddressLib.h
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLibFdtPL011UartFlash.inf
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLibFdtPL011UartRam.inf
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/DxeRuntimeDebugLibFdtPL011Uart.inf
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Flash.c
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Ram.c
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Ram.h
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/RamNonRuntime.c
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Runtime.c
 create mode 100644 ArmVirtPkg/Library/DebugLibFdtPL011Uart/Write.h
 create mode 100644 ArmVirtPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c
 create mode 100644 ArmVirtPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf


base-commit: 4ddd8ac3a29d9c5974a19f36c1dc5896d813dc6e


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109394): https://edk2.groups.io/g/devel/message/109394
Mute This Topic: https://groups.io/mt/101834880/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-10-27 10:57 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-08 15:39 [edk2-devel] [PATCH 0/9] ArmVirtPkg: support two PL011 UARTs Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 1/9] ArmVirtPkg: introduce FdtSerialPortAddressLib Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 2/9] ArmVirtPkg/Fdt16550SerialPortHookLib: rebase to FdtSerialPortAddressLib Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 3/9] ArmVirtPkg: adjust whitespace in block scope declarations Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 4/9] ArmVirtPkg: adhere to the serial port selected by /chosen "stdout-path" Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 5/9] ArmVirtPkg: store separate console and debug PL011 addresses in GUID HOB Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 6/9] ArmVirtPkg: introduce DebugLibFdtPL011Uart Flash instance Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 7/9] ArmVirtPkg: introduce DebugLibFdtPL011Uart RAM instance Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 8/9] ArmVirtPkg: introduce DebugLibFdtPL011Uart DXE Runtime instance Laszlo Ersek
2023-10-08 15:39 ` [edk2-devel] [PATCH 9/9] ArmVirtPkg: steer DebugLib output away from SerialPortLib+console traffic Laszlo Ersek
2023-10-10  7:43 ` [edk2-devel] [PATCH 0/9] ArmVirtPkg: support two PL011 UARTs Ard Biesheuvel
2023-10-10 15:33   ` Laszlo Ersek
2023-10-26 14:21     ` Peter Maydell
2023-10-26 14:46       ` Julien Grall
2023-10-26 14:55         ` Ard Biesheuvel
2023-10-26 15:36           ` Laszlo Ersek
2023-10-26 15:30         ` Laszlo Ersek
2023-10-26 15:19       ` Laszlo Ersek
2023-10-26 15:21         ` Ard Biesheuvel
2023-10-26 19:00           ` Laszlo Ersek
2023-10-27 10:57         ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox