<span style="white-space: pre-wrap;">(Adding Ard, just in case -- the topic is set by the first quoted</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">question below)</span><br style="white-space: pre-wrap;" /><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">On 02/08/21 04:24, Ying Fang wrote:</span><br style="white-space: pre-wrap;" />
<blockquote style="white-space: pre-wrap;">Hi, Does anybody know whether the EDK2 ArmVirtPkg has support for a virtio-mmio-device ?</blockquote>
<span style="white-space: pre-wrap;">> virtio-mmio is a virtio transport type, not a particular device.<br /><br /></span>Sorry, the description is not that accurate. <br />I mean vritio-blk-device over virtio-mmio transport. Thanks for pointing it out.<br style="white-space: pre-wrap;" /><br /><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (1) ArmVirtPkg + OvmfPkg support the following three virtio transports:</span><br style="white-space: pre-wrap;" />> <br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (1a) Virtio PCI, virtio spec version 0.9.5,</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> [OvmfPkg/VirtioPciDeviceDxe]</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (1b) Virtio PCI, virtio spec version 1.0,</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> [OvmfPkg/Virtio10Dxe]</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (1c) Virtio MMIO, virtio spec version 0.9.5 *only*</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> [ArmVirtPkg/VirtioFdtDxe]</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> [OvmfPkg/Library/VirtioMmioDeviceLib]</span><br style="white-space: pre-wrap;" />> <br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (2) Additionally, OvmfPkg offers the following virtio device drivers:</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioBlkDxe</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioFsDxe [1.0 only]</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioGpuDxe [1.0 only]</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioNetDxe</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioRngDxe</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioScsiDxe</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (2a) The drivers marked "1.0 only" will only work on top of the</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> transport mentioned in point (1b).</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> Put differently, they will only drive the following virtio-1.0 QEMU</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> device models:</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioFsDxe: "vhost-user-fs-pci"</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioGpuDxe: "virtio-gpu-pci"</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> (2b) The drivers *not* marked "1.0 only" will work on top of *either*</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> virtio transport that's noted in (1a), (1b), (1c).</span><br style="white-space: pre-wrap;" /><br />Thanks so much for the information,  since i am a freshman to EDK2, it is really useful for us.<br /><br /><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> This implies that, using the ArmVirtQemu firmware platform, you can use</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> the following QEMU device models *too*:</span><br style="white-space: pre-wrap;" />> <br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioBlkDxe: "virtio-blk-device"</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioNetDxe: "virtio-net-device"</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioRngDxe: "virtio-rng-device"</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - VirtioScsiDxe: "virtio-scsi-device"</span><br style="white-space: pre-wrap;" /><br style="white-space: pre-wrap;" /><br style="white-space: pre-wrap;" />
<blockquote style="white-space: pre-wrap;">I am using EDK2 ArmVirtPkg v2.70 as the default UEFI for my devel program.</blockquote>
<span style="white-space: pre-wrap;">> A commit hash would be more useful (not sure if it matters for now, but</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> in case it does, a commit hash is best).</span><br style="white-space: pre-wrap;" /><br />I am using the EDK2 tag: edk2-stable202008.<br style="white-space: pre-wrap;" /><br style="white-space: pre-wrap;" />
<blockquote style="white-space: pre-wrap;">Since we have not implemented the PCI/PCIe suff, a virtio-mmio-blk device is used as the image disk.</blockquote>
<span style="white-space: pre-wrap;">> There is no such device model ("virtio-mmio-blk") in QEMU, as far as I</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> can tell.</span><br />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> Do you mean "virtio-blk-device"?<br /></span><br style="white-space: pre-wrap;" />yes you are right, I mean a virtio-blk-device over mmio transport instead of PCI.<br /><br style="white-space: pre-wrap;" />
<blockquote style="white-space: pre-wrap;">We can boot the EDK2 ArmVirtPkg into UEFI shell, and the Mapping table message shows<br /><br />Mapping table:<br />BLK0: Alias(s):<br />VenHw(xxx, 00)</blockquote>
<span style="white-space: pre-wrap;">> Do you have an EFI system partition on the virtio block device?</span><br style="white-space: pre-wrap;" />><br /><br />We do have a virtio-block-device with EFI system partition.<br /><br /><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> Because, the "map" UEFI shell command (executed automatically at shell</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> startup) should list such a filesystem as "FS0:" here.</span><br style="white-space: pre-wrap;" /><br />I did not see the "FS0:" flag.<br style="white-space: pre-wrap;" /><br style="white-space: pre-wrap;" />
<blockquote style="white-space: pre-wrap;">However when I chose the “Boot From File” menu item, I can not see the virtio-mmio-blk device.</blockquote>
<span style="white-space: pre-wrap;">> That's not surprising, minimally because the MAP command above does not</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> list "FS0:".<br /><br /></span>Yes.<br style="white-space: pre-wrap;" /><br style="white-space: pre-wrap;" />
<blockquote style="white-space: pre-wrap;">So does anybody know whether the EDK2 ArmVirtPkg has support for a virtio-mmio-device ?</blockquote>
<span style="white-space: pre-wrap;">> The virtio-blk-device is supported, yes, using the virtio-mmio (0.9.5)</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> transport type. But in order to actually boot from the device, you need</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> more things. Such as:<br /><br /></span>I now realize that we emulate the virtio-blk-device over mmio, and we only emulate virtio-1.0 spec.<br />As mentioned in <span style="white-space: pre-wrap;">(1c) , EDK2 only supports virtio-0.95 spec for now, so this maybe a big problem.</span><br style="white-space: pre-wrap;" />Since it may not handshake ok if we only emulate virtio-1.0.<br /><br />I will try to emulate the virtio-0.95 later to see if it is the root cause.<br /><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - an EFI system partition / FAT filesystem on the device,</span><br style="white-space: pre-wrap;" />> <br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - bootable UEFI binaries (matching the guest architecture),</span><br style="white-space: pre-wrap;" />> <br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> - a correctly populated "bootorder" fw_cfg file, so that the UEFI boot</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> order be updated as well. This "bootorder" fw_cfg file is created by</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> QEMU upon use of the "bootindex" device properties, and it is acted upon</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> by the following components:</span><br style="white-space: pre-wrap;" /><br />We do pass the "bootorder" via the fw_cfg interface to EDK2 and the log<br />says EDK2 has <span style="color: #434343; font-family: Arial, sans-serif; background-color: #fcfcfe;">recognized it.</span><br /><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> ArmVirtPkg/Library/PlatformBootManagerLib</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> OvmfPkg/Library/QemuBootOrderLib</span><br style="white-space: pre-wrap;" />><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> Thanks</span><br style="white-space: pre-wrap;" /><span style="white-space: pre-wrap;">> Laszlo<br /><br /><br /></span>Well, thanks so much for the reply.<br />The information provided is really helpfull for us.<br /><br />BTW, I found it really hard to read and understand the EDK2 code for me, there is a long way to go.<br /><br />Thanks.<br />Ying.


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/71498">View/Reply Online (#71498)</a> |    |  <a target="_blank" href="https://groups.io/mt/80471199/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>