[edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver

Gerd Hoffmann posted 4 patches 1 year ago
Failed in applying to current master (apply log)
There is a newer version of this series
OvmfPkg/Microvm/MicrovmX64.dsc                |   1 +
OvmfPkg/OvmfPkgIa32.dsc                       |   1 +
OvmfPkg/OvmfPkgIa32X64.dsc                    |   1 +
OvmfPkg/OvmfPkgX64.dsc                        |   1 +
OvmfPkg/Microvm/MicrovmX64.fdf                |   1 +
OvmfPkg/OvmfPkgIa32.fdf                       |   1 +
OvmfPkg/OvmfPkgIa32X64.fdf                    |   1 +
OvmfPkg/OvmfPkgX64.fdf                        |   1 +
OvmfPkg/VirtioSerialDxe/VirtioSerial.inf      |  40 +
.../Include/IndustryStandard/VirtioSerial.h   |  64 ++
OvmfPkg/VirtioSerialDxe/VirtioSerial.h        | 226 +++++
.../PlatformBootManagerLib/BdsPlatform.c      |  47 ++
OvmfPkg/VirtioSerialDxe/VirtioSerial.c        | 789 ++++++++++++++++++
OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c    | 443 ++++++++++
OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c    | 345 ++++++++
15 files changed, 1962 insertions(+)
create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
create mode 100644 OvmfPkg/Include/IndustryStandard/VirtioSerial.h
create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.h
create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.c
create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c
[edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver
Posted by Gerd Hoffmann 1 year ago

Gerd Hoffmann (4):
  OvmfPkg: add IndustryStandard/VirtioSerial.h
  OvmfPkg/VirtioSerialDxe: add driver
  OvmfPkg/VirtioSerialDxe: wire up in OvmfPkg*
  OvmfPkg/PlatformBootManagerLib: setup virtio serial console

 OvmfPkg/Microvm/MicrovmX64.dsc                |   1 +
 OvmfPkg/OvmfPkgIa32.dsc                       |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                    |   1 +
 OvmfPkg/OvmfPkgX64.dsc                        |   1 +
 OvmfPkg/Microvm/MicrovmX64.fdf                |   1 +
 OvmfPkg/OvmfPkgIa32.fdf                       |   1 +
 OvmfPkg/OvmfPkgIa32X64.fdf                    |   1 +
 OvmfPkg/OvmfPkgX64.fdf                        |   1 +
 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf      |  40 +
 .../Include/IndustryStandard/VirtioSerial.h   |  64 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerial.h        | 226 +++++
 .../PlatformBootManagerLib/BdsPlatform.c      |  47 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerial.c        | 789 ++++++++++++++++++
 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c    | 443 ++++++++++
 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c    | 345 ++++++++
 15 files changed, 1962 insertions(+)
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 create mode 100644 OvmfPkg/Include/IndustryStandard/VirtioSerial.h
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.h
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.c
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c

-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103076): https://edk2.groups.io/g/devel/message/103076
Mute This Topic: https://groups.io/mt/98315343/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver
Posted by Ard Biesheuvel 1 year ago
On Mon, 17 Apr 2023 at 11:03, Gerd Hoffmann <kraxel@redhat.com> wrote:
>


This seems useful - how do I use it?

>
>
> Gerd Hoffmann (4):
>   OvmfPkg: add IndustryStandard/VirtioSerial.h
>   OvmfPkg/VirtioSerialDxe: add driver
>   OvmfPkg/VirtioSerialDxe: wire up in OvmfPkg*
>   OvmfPkg/PlatformBootManagerLib: setup virtio serial console
>
>  OvmfPkg/Microvm/MicrovmX64.dsc                |   1 +
>  OvmfPkg/OvmfPkgIa32.dsc                       |   1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc                    |   1 +
>  OvmfPkg/OvmfPkgX64.dsc                        |   1 +
>  OvmfPkg/Microvm/MicrovmX64.fdf                |   1 +
>  OvmfPkg/OvmfPkgIa32.fdf                       |   1 +
>  OvmfPkg/OvmfPkgIa32X64.fdf                    |   1 +
>  OvmfPkg/OvmfPkgX64.fdf                        |   1 +
>  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf      |  40 +
>  .../Include/IndustryStandard/VirtioSerial.h   |  64 ++
>  OvmfPkg/VirtioSerialDxe/VirtioSerial.h        | 226 +++++
>  .../PlatformBootManagerLib/BdsPlatform.c      |  47 ++
>  OvmfPkg/VirtioSerialDxe/VirtioSerial.c        | 789 ++++++++++++++++++
>  OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c    | 443 ++++++++++
>  OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c    | 345 ++++++++
>  15 files changed, 1962 insertions(+)
>  create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
>  create mode 100644 OvmfPkg/Include/IndustryStandard/VirtioSerial.h
>  create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.h
>  create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.c
>  create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
>  create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c
>
> --
> 2.39.2
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103166): https://edk2.groups.io/g/devel/message/103166
Mute This Topic: https://groups.io/mt/98315343/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver
Posted by Gerd Hoffmann 1 year ago
On Tue, Apr 18, 2023 at 05:46:35PM +0200, Ard Biesheuvel wrote:
> 
> This seems useful - how do I use it?

bare qemu (with guest console on stdin/stdout):

qemu-system-x86_64 \
	-enable-kvm -nodefaults -display none \
	-bios Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd \
	-chardev stdio,id=hvc0 \
	-device virtio-serial-pci \
	-device virtconsole,chardev=hvc0

libvirt snippet (add to <devices>):

    <console type='pty'>
      <target type='virtio' port='0'/>
    </console>

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103210): https://edk2.groups.io/g/devel/message/103210
Mute This Topic: https://groups.io/mt/98315343/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver
Posted by Gupta, Pankaj via groups.io 1 year ago
Hi Gerd,

>> This seems useful - how do I use it?
> 
> bare qemu (with guest console on stdin/stdout):
> 
> qemu-system-x86_64 \
> 	-enable-kvm -nodefaults -display none \
> 	-bios Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd \
> 	-chardev stdio,id=hvc0 \
> 	-device virtio-serial-pci \
> 	-device virtconsole,chardev=hvc0
> 
> libvirt snippet (add to <devices>):
> 
>      <console type='pty'>
>        <target type='virtio' port='0'/>
>      </console>
Was thinking about the motivation to add the virtio serial device.

AFAIU this can provide a console in bios/early boot based on "virtio".
Currently we can only get it with emulated PTY device which is slow
because of frequent VMEXITS because of ioport write?

Or is there any other reason (e.g across the ARCH support) to add this 
support in UEFI ?

Thanks,
Pankaj




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103294): https://edk2.groups.io/g/devel/message/103294
Mute This Topic: https://groups.io/mt/98315343/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver
Posted by Gerd Hoffmann 1 year ago
  Hi,

> > libvirt snippet (add to <devices>):
> > 
> >      <console type='pty'>
> >        <target type='virtio' port='0'/>
> >      </console>
> Was thinking about the motivation to add the virtio serial device.
> 
> AFAIU this can provide a console in bios/early boot based on "virtio".
> Currently we can only get it with emulated PTY device which is slow
> because of frequent VMEXITS because of ioport write?

Yes, it has better performance because it wouldn't vmexit for every
single character.

Dawback is that it wouldn't work for early logging, the driver loads
relatively late because it depends on pci and virtio.  So if the
firmware panics in SEC or PEI you wouldn't see that.

So for debug logging it isn't the best choice, for efi shell and grub it
works fine.

> Or is there any other reason (e.g across the ARCH support) to add this
> support in UEFI ?

Should work on all architectures, although it needs some platform setup
code to have the firmware actually bind the firmware console to it (see
patch #4).

Another nice property of a virtio console is that systemd will spawn a
getty there even if it is not explicitly configured as console device.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103298): https://edk2.groups.io/g/devel/message/103298
Mute This Topic: https://groups.io/mt/98315343/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver
Posted by Gupta, Pankaj via groups.io 1 year ago
>>> libvirt snippet (add to <devices>):
>>>
>>>       <console type='pty'>
>>>         <target type='virtio' port='0'/>
>>>       </console>
>> Was thinking about the motivation to add the virtio serial device.
>>
>> AFAIU this can provide a console in bios/early boot based on "virtio".
>> Currently we can only get it with emulated PTY device which is slow
>> because of frequent VMEXITS because of ioport write?
> 
> Yes, it has better performance because it wouldn't vmexit for every
> single character.
> 
> Dawback is that it wouldn't work for early logging, the driver loads
> relatively late because it depends on pci and virtio.  So if the
> firmware panics in SEC or PEI you wouldn't see that.
> 
> So for debug logging it isn't the best choice, for efi shell and grub it
> works fine.

Sure.

> 
>> Or is there any other reason (e.g across the ARCH support) to add this
>> support in UEFI ?
> 
> Should work on all architectures, although it needs some platform setup
> code to have the firmware actually bind the firmware console to it (see
> patch #4). >
> Another nice property of a virtio console is that systemd will spawn a
> getty there even if it is not explicitly configured as console device.

Nice.

Thanks,
Pankaj



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103305): https://edk2.groups.io/g/devel/message/103305
Mute This Topic: https://groups.io/mt/98315343/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-