public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* implement about virtio-keyboard
@ 2021-02-23  8:48 Zhu Yijun
  2021-02-23 14:46 ` Laszlo Ersek
  0 siblings, 1 reply; 5+ messages in thread
From: Zhu Yijun @ 2021-02-23  8:48 UTC (permalink / raw)
  To: devel; +Cc: Laszlo Ersek, Ruiyu Ni, Ard Biesheuvel

Hi all,
    I boot vm with the virtio keyboard on aarch64. It looks UEFI lacks
support for the virtio keyboard, so I can't do any keyboard input
before the linux kernel driver loads, i.e. edit the grub boot menu. Is
there any plan to support it?
    I find UsbKeyboardDevice attach on UsbIO which implements its
protocol interface structure(such as UsbGetInterfaceDescriptor,
UsbAsyncInterruptTransfer) defined by UEFI spec, but virtio not. So is
there some way to implement similar interfaces?

Best regards,
Cheng Mao

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

* Re: implement about virtio-keyboard
  2021-02-23  8:48 implement about virtio-keyboard Zhu Yijun
@ 2021-02-23 14:46 ` Laszlo Ersek
  2021-02-24  2:55   ` Zhu Yijun
  0 siblings, 1 reply; 5+ messages in thread
From: Laszlo Ersek @ 2021-02-23 14:46 UTC (permalink / raw)
  To: Zhu Yijun, devel; +Cc: Ruiyu Ni, Ard Biesheuvel

On 02/23/21 09:48, Zhu Yijun wrote:
> Hi all,
>     I boot vm with the virtio keyboard on aarch64. It looks UEFI lacks
> support for the virtio keyboard, so I can't do any keyboard input
> before the linux kernel driver loads, i.e. edit the grub boot menu. Is
> there any plan to support it?

Not on my side.

My team discussed virtio-input's relevance for ArmVirtQemu in September
2016.

We decided not to bother about it, because:

(1) XHCI was virtualization-friendly, both performance-wise and
configuration-wise (unlike EHCI),

(2) QEMU and libvirt were going to gain (... or had just gained ...)
XHCI support, on aarch64 / "virt".


So today, just use a "qemu-xhci" controller in your domain config
please, in combination with a USB keyboard. (If you define a new aarch64
domain with libvirt, this should happen out of the box for you.)

ArmVirtQemu includes all the edk2 drivers necessary for driving those
devices, and ArmVirtQemu's PlatformBootManagerLib instance will connect
the USB keyboard automatically. There shouldn't be a problem when typing
in "grub".

Thanks
Laszlo

>     I find UsbKeyboardDevice attach on UsbIO which implements its
> protocol interface structure(such as UsbGetInterfaceDescriptor,
> UsbAsyncInterruptTransfer) defined by UEFI spec, but virtio not. So is
> there some way to implement similar interfaces?
> 
> Best regards,
> Cheng Mao
> 


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

* Re: implement about virtio-keyboard
  2021-02-23 14:46 ` Laszlo Ersek
@ 2021-02-24  2:55   ` Zhu Yijun
  2021-02-25 18:54     ` Laszlo Ersek
  0 siblings, 1 reply; 5+ messages in thread
From: Zhu Yijun @ 2021-02-24  2:55 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: devel, Ruiyu Ni, Ard Biesheuvel

Thanks for the update.

Now the usb tablet and keyboard are the only two usb devices on
aarch64, so I want to eliminate the "qemu-xhci" controller.

I even think the situation that something more lightweight VMM instead
of QEMU may not support any USB controller, then virtio-input support
in UEFI is necessary.

So if I want to implement this feature, can you give me some advice? I
see there are several keyboards in edk2,
VirtualKeyboardDxe/VirtualKeyboard.c looks more simple than usbkbd,

can it be used as an example for reference?

Laszlo Ersek <lersek@redhat.com> 于2021年2月23日周二 下午10:47写道:
>
> On 02/23/21 09:48, Zhu Yijun wrote:
> > Hi all,
> >     I boot vm with the virtio keyboard on aarch64. It looks UEFI lacks
> > support for the virtio keyboard, so I can't do any keyboard input
> > before the linux kernel driver loads, i.e. edit the grub boot menu. Is
> > there any plan to support it?
>
> Not on my side.
>
> My team discussed virtio-input's relevance for ArmVirtQemu in September
> 2016.
>
> We decided not to bother about it, because:
>
> (1) XHCI was virtualization-friendly, both performance-wise and
> configuration-wise (unlike EHCI),
>
> (2) QEMU and libvirt were going to gain (... or had just gained ...)
> XHCI support, on aarch64 / "virt".
>
>
> So today, just use a "qemu-xhci" controller in your domain config
> please, in combination with a USB keyboard. (If you define a new aarch64
> domain with libvirt, this should happen out of the box for you.)
>
> ArmVirtQemu includes all the edk2 drivers necessary for driving those
> devices, and ArmVirtQemu's PlatformBootManagerLib instance will connect
> the USB keyboard automatically. There shouldn't be a problem when typing
> in "grub".
>
> Thanks
> Laszlo
>
> >     I find UsbKeyboardDevice attach on UsbIO which implements its
> > protocol interface structure(such as UsbGetInterfaceDescriptor,
> > UsbAsyncInterruptTransfer) defined by UEFI spec, but virtio not. So is
> > there some way to implement similar interfaces?
> >
> > Best regards,
> > Cheng Mao
> >
>

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

* Re: implement about virtio-keyboard
  2021-02-24  2:55   ` Zhu Yijun
@ 2021-02-25 18:54     ` Laszlo Ersek
  2021-02-26  7:59       ` Zhu Yijun
  0 siblings, 1 reply; 5+ messages in thread
From: Laszlo Ersek @ 2021-02-25 18:54 UTC (permalink / raw)
  To: Zhu Yijun; +Cc: devel, Ruiyu Ni, Ard Biesheuvel

On 02/24/21 03:55, Zhu Yijun wrote:
> Thanks for the update.
> 
> Now the usb tablet and keyboard are the only two usb devices on
> aarch64, so I want to eliminate the "qemu-xhci" controller.
> 
> I even think the situation that something more lightweight VMM instead
> of QEMU may not support any USB controller, then virtio-input support
> in UEFI is necessary.

It's not necessary for me. It may be necessary for you. Feel free to
contribute a virtio-input driver.

> So if I want to implement this feature, can you give me some advice? I
> see there are several keyboards in edk2,
> VirtualKeyboardDxe/VirtualKeyboard.c looks more simple than usbkbd,
> 
> can it be used as an example for reference?

I've not dealt with EmbeddedPkg/Drivers/VirtualKeyboardDxe before. I
don't know what kind of device this driver works with. The only
commonality that VirtualKeyboardDxe might have with a possible
virtio-input driver is that both of these drivers would be expected to
produce EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

The virtio-input device is described in the virtio spec.

You can see some virtio drivers under OvmfPkg. One of the simpler
drivers there is VirtioRngDxe.

Note that virtio-input, somewhat similarly to virtio-net, allows the
host (= the device) to send events "asynchronously" to the guest (= the
driver). This means that, because virtio is a request-response protocol,
the driver would keep the virtio-input "eventq" populated with
"requests" at all times. When there is an input event, the device
"completes" a request with a "response", to inform the driver of a new
input event. Anyhow, the virtio spec does explain this.

Thanks,
Laszlo

> 
> Laszlo Ersek <lersek@redhat.com> 于2021年2月23日周二 下午10:47写道:
>>
>> On 02/23/21 09:48, Zhu Yijun wrote:
>>> Hi all,
>>>     I boot vm with the virtio keyboard on aarch64. It looks UEFI lacks
>>> support for the virtio keyboard, so I can't do any keyboard input
>>> before the linux kernel driver loads, i.e. edit the grub boot menu. Is
>>> there any plan to support it?
>>
>> Not on my side.
>>
>> My team discussed virtio-input's relevance for ArmVirtQemu in September
>> 2016.
>>
>> We decided not to bother about it, because:
>>
>> (1) XHCI was virtualization-friendly, both performance-wise and
>> configuration-wise (unlike EHCI),
>>
>> (2) QEMU and libvirt were going to gain (... or had just gained ...)
>> XHCI support, on aarch64 / "virt".
>>
>>
>> So today, just use a "qemu-xhci" controller in your domain config
>> please, in combination with a USB keyboard. (If you define a new aarch64
>> domain with libvirt, this should happen out of the box for you.)
>>
>> ArmVirtQemu includes all the edk2 drivers necessary for driving those
>> devices, and ArmVirtQemu's PlatformBootManagerLib instance will connect
>> the USB keyboard automatically. There shouldn't be a problem when typing
>> in "grub".
>>
>> Thanks
>> Laszlo
>>
>>>     I find UsbKeyboardDevice attach on UsbIO which implements its
>>> protocol interface structure(such as UsbGetInterfaceDescriptor,
>>> UsbAsyncInterruptTransfer) defined by UEFI spec, but virtio not. So is
>>> there some way to implement similar interfaces?
>>>
>>> Best regards,
>>> Cheng Mao
>>>
>>
> 


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

* Re: implement about virtio-keyboard
  2021-02-25 18:54     ` Laszlo Ersek
@ 2021-02-26  7:59       ` Zhu Yijun
  0 siblings, 0 replies; 5+ messages in thread
From: Zhu Yijun @ 2021-02-26  7:59 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: devel, Ruiyu Ni, Ard Biesheuvel

Thanks for your explanation.

Laszlo Ersek <lersek@redhat.com> 于2021年2月26日周五 上午2:54写道:
>
> On 02/24/21 03:55, Zhu Yijun wrote:
> > Thanks for the update.
> >
> > Now the usb tablet and keyboard are the only two usb devices on
> > aarch64, so I want to eliminate the "qemu-xhci" controller.
> >
> > I even think the situation that something more lightweight VMM instead
> > of QEMU may not support any USB controller, then virtio-input support
> > in UEFI is necessary.
>
> It's not necessary for me. It may be necessary for you. Feel free to
> contribute a virtio-input driver.
>
> > So if I want to implement this feature, can you give me some advice? I
> > see there are several keyboards in edk2,
> > VirtualKeyboardDxe/VirtualKeyboard.c looks more simple than usbkbd,
> >
> > can it be used as an example for reference?
>
> I've not dealt with EmbeddedPkg/Drivers/VirtualKeyboardDxe before. I
> don't know what kind of device this driver works with. The only
> commonality that VirtualKeyboardDxe might have with a possible
> virtio-input driver is that both of these drivers would be expected to
> produce EFI_SIMPLE_TEXT_INPUT_PROTOCOL.
>
> The virtio-input device is described in the virtio spec.
>
> You can see some virtio drivers under OvmfPkg. One of the simpler
> drivers there is VirtioRngDxe.
>
> Note that virtio-input, somewhat similarly to virtio-net, allows the
> host (= the device) to send events "asynchronously" to the guest (= the
> driver). This means that, because virtio is a request-response protocol,
> the driver would keep the virtio-input "eventq" populated with
> "requests" at all times. When there is an input event, the device
> "completes" a request with a "response", to inform the driver of a new
> input event. Anyhow, the virtio spec does explain this.
>
> Thanks,
> Laszlo
>
> >
> > Laszlo Ersek <lersek@redhat.com> 于2021年2月23日周二 下午10:47写道:
> >>
> >> On 02/23/21 09:48, Zhu Yijun wrote:
> >>> Hi all,
> >>>     I boot vm with the virtio keyboard on aarch64. It looks UEFI lacks
> >>> support for the virtio keyboard, so I can't do any keyboard input
> >>> before the linux kernel driver loads, i.e. edit the grub boot menu. Is
> >>> there any plan to support it?
> >>
> >> Not on my side.
> >>
> >> My team discussed virtio-input's relevance for ArmVirtQemu in September
> >> 2016.
> >>
> >> We decided not to bother about it, because:
> >>
> >> (1) XHCI was virtualization-friendly, both performance-wise and
> >> configuration-wise (unlike EHCI),
> >>
> >> (2) QEMU and libvirt were going to gain (... or had just gained ...)
> >> XHCI support, on aarch64 / "virt".
> >>
> >>
> >> So today, just use a "qemu-xhci" controller in your domain config
> >> please, in combination with a USB keyboard. (If you define a new aarch64
> >> domain with libvirt, this should happen out of the box for you.)
> >>
> >> ArmVirtQemu includes all the edk2 drivers necessary for driving those
> >> devices, and ArmVirtQemu's PlatformBootManagerLib instance will connect
> >> the USB keyboard automatically. There shouldn't be a problem when typing
> >> in "grub".
> >>
> >> Thanks
> >> Laszlo
> >>
> >>>     I find UsbKeyboardDevice attach on UsbIO which implements its
> >>> protocol interface structure(such as UsbGetInterfaceDescriptor,
> >>> UsbAsyncInterruptTransfer) defined by UEFI spec, but virtio not. So is
> >>> there some way to implement similar interfaces?
> >>>
> >>> Best regards,
> >>> Cheng Mao
> >>>
> >>
> >
>

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

end of thread, other threads:[~2021-02-26  8:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-23  8:48 implement about virtio-keyboard Zhu Yijun
2021-02-23 14:46 ` Laszlo Ersek
2021-02-24  2:55   ` Zhu Yijun
2021-02-25 18:54     ` Laszlo Ersek
2021-02-26  7:59       ` Zhu Yijun

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