From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) by mx.groups.io with SMTP id smtpd.web08.6261.1614326424178032989 for ; Fri, 26 Feb 2021 00:00:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PyFdkVPc; spf=pass (domain: gmail.com, ip: 209.85.166.44, mailfrom: lovemrd@gmail.com) Received: by mail-io1-f44.google.com with SMTP id u8so8744714ior.13 for ; Fri, 26 Feb 2021 00:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/7h5kKRMy7FFD0J7W8z3Dswarmtb7eMDmueTtuoM2c8=; b=PyFdkVPcMYCOVQhtA0e+bY9lTAhH1sjxwNPNFggDCD/2UbcueN+gSAcHRJlcjg0cCP 4J1nC/hTqlloDUQKIVh6OThKNGiGsLrWiUQObAasSlxyDLx7A4QUZ/zqvhpD0HLGUURs +FoYZY3s1i2/2uQ+w5KI/nAFVGBwZf34yGsK2wkVr3a+sTrZsvDNrqJ2R6yIfCqDmVtB L2PwrvxWoJta4g+S0uIJSkNRfObqweME0FxSVYqIuVKH/qN57Hj6NH3SDScF5T/YClFZ LXloFnTd5TJ+n09DuPmxvWi30d64UMV9hTCXpxEZgt211PKRSkzwDPyPCB6VHXckfx5h dcnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=/7h5kKRMy7FFD0J7W8z3Dswarmtb7eMDmueTtuoM2c8=; b=YdjpYd0cnQV/SLHKrc7gQwqrw18UZbJ/SdtOcRmrPwM7dPiP0lzgGG7LROTffLyFGh Roz2byzA2/9O+WX6oGsdEGv/fSqdLEUxOuuFTVaevYBLDiYo+jvK/2av2NZPzHvzIpTR Nno3eaeg4fmOPkLlBuRVEoChWwn5pCzaYXtw6CCk4gBOZ/q/hcavgrE6JzPjUrXOxe1B waNpMI0GxRFpW9VlveN6C1k2K2SxG+fAT+1m19z4l0+K6JEN+krvHEyvLbxztQAnraP1 Ju0bNQvwZANsNRRp2R+jz//g5UlPCL3kpkZc1y2ONQ1LiOPy1TbMLn27kpmleKwXUqui +RIw== X-Gm-Message-State: AOAM533BZFEw1GV0LF/E5hVEIHFMcFRuzbEf3EyTHWHKpCUCDaq6Sxdu NaF0PskCVQuGzgR7zW0QrhW20ian1mmY9vnQyYA= X-Google-Smtp-Source: ABdhPJzaw3BoHcQEDV0NbMf5+tf7XnMivyAJk2ALw7jCJII0UEQSNssV7rke3l1P/n9MLdGTgSVdoVTpTwHjeTJ/H0E= X-Received: by 2002:a02:661c:: with SMTP id k28mr1793717jac.78.1614326423411; Fri, 26 Feb 2021 00:00:23 -0800 (PST) MIME-Version: 1.0 References: <81c4017a-ef40-f729-d304-956105910947@redhat.com> <7e60715f-7b06-9751-8efb-fffba363959b@redhat.com> In-Reply-To: <7e60715f-7b06-9751-8efb-fffba363959b@redhat.com> From: Zhu Yijun Date: Fri, 26 Feb 2021 15:59:36 +0800 Message-ID: Subject: Re: implement about virtio-keyboard To: Laszlo Ersek Cc: devel@edk2.groups.io, Ruiyu Ni , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for your explanation. Laszlo Ersek =E4=BA=8E2021=E5=B9=B42=E6=9C=8826=E6=97= =A5=E5=91=A8=E4=BA=94 =E4=B8=8A=E5=8D=882:54=E5=86=99=E9=81=93=EF=BC=9A > > 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 (=3D the device) to send events "asynchronously" to the guest (=3D t= he > 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 =E4=BA=8E2021=E5=B9=B42=E6=9C=8823=E6= =97=A5=E5=91=A8=E4=BA=8C =E4=B8=8B=E5=8D=8810:47=E5=86=99=E9=81=93=EF=BC=9A > >> > >> On 02/23/21 09:48, Zhu Yijun wrote: > >>> Hi all, > >>> I boot vm with the virtio keyboard on aarch64. It looks UEFI lack= s > >>> 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. I= s > >>> there any plan to support it? > >> > >> Not on my side. > >> > >> My team discussed virtio-input's relevance for ArmVirtQemu in Septembe= r > >> 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 aarch= 64 > >> 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 connec= t > >> the USB keyboard automatically. There shouldn't be a problem when typi= ng > >> 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 i= s > >>> there some way to implement similar interfaces? > >>> > >>> Best regards, > >>> Cheng Mao > >>> > >> > > >