public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* How does EDK2 detect virtio-blk-pci device as a boot device
@ 2021-03-11 14:48 Xiaohe Yang
  2021-03-12 20:42 ` [edk2-devel] " Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaohe Yang @ 2021-03-11 14:48 UTC (permalink / raw)
  To: devel

Hello, I am using EDK2  OvmfPkgX64 at commit 37568365, and have a 
problem. The following is the detail.


The Image disk that I use has EFI system partition, and is configured as 
a virtio-blk-pci device. Bootorder file-entry is not added in fw_cfg 
device. The log of EDK2 shows that

(1)  VirtioBlkDxe.efi is successfully loaded at DXE stage. 
BootScriptExecutorDxe drivers "was discovered but not loaded".

(2) PCI enumeration has finished at the start of BDS stage, 
virtio-blk-pci device is discovered. And one Option Rom's address is 0/0.

(3) Before entering Shell, log shows "map: No mapping found".

(4) After entering Shell, I choose “Boot From File”, the virtio-blk-pci 
device is not displayed.


So I wonder what are the requirements for UEFI to detect the 
virtio-blk-pci device as a boot device, except having EFI system partition?


Thanks,

Xiaohe.



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

* Re: [edk2-devel] How does EDK2 detect virtio-blk-pci device as a boot device
  2021-03-11 14:48 How does EDK2 detect virtio-blk-pci device as a boot device Xiaohe Yang
@ 2021-03-12 20:42 ` Laszlo Ersek
  2021-03-17 11:10   ` xh_young
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2021-03-12 20:42 UTC (permalink / raw)
  To: devel, xh_young

On 03/11/21 15:48, Xiaohe Yang wrote:
> Hello, I am using EDK2  OvmfPkgX64 at commit 37568365, and have a
> problem. The following is the detail.
> 
> 
> The Image disk that I use has EFI system partition, and is configured as
> a virtio-blk-pci device. Bootorder file-entry is not added in fw_cfg
> device. The log of EDK2 shows that
> 
> (1)  VirtioBlkDxe.efi is successfully loaded at DXE stage.
> BootScriptExecutorDxe drivers "was discovered but not loaded".
> 
> (2) PCI enumeration has finished at the start of BDS stage,
> virtio-blk-pci device is discovered. And one Option Rom's address is 0/0.
> 
> (3) Before entering Shell, log shows "map: No mapping found".
> 
> (4) After entering Shell, I choose “Boot From File”, the virtio-blk-pci
> device is not displayed.
> 
> 
> So I wonder what are the requirements for UEFI to detect the
> virtio-blk-pci device as a boot device, except having EFI system partition?

If you have a firmware log with DEBUG_VERBOSE enabled, I could take a look.

Assuming you are *not* on QEMU (e.g., you are developing a new
virtio-blk device, and running OVMF on your non-QEMU emulator), it could
be anything, really. Try to add DEBUG messages to the following drivers
/ functions:

- VirtioPciDeviceDxe
  - VirtioPciDeviceBindingSupported
  - VirtioPciDeviceBindingStart

- Virtio10Dxe
  - Virtio10BindingSupported
  - Virtio10BindingStart

- VirtioBlkDxe
  - VirtioBlkDriverBindingSupported
  - VirtioBlkDriverBindingStart

These drivers all follow the UEFI driver model. So, if you find no
mapping for the virtio-blk-pci device in the UEFI shell, then they fail
to bind your device implementation for some reason.

You mention that there is no "bootorder" fw_cfg file, so
PlatformBdsConnectSequence() will see ConnectDevicesFromQemu() fail, and
then EfiBootManagerConnectAll() will be called. If the virtio-blk-pci
devices are not connected under those circumstances, then they don't do
something that the virtio PCI transport drivers (0.9.5 or 1.0) expect,
or the virtio-blk device driver expects. There's no silver bullet, you
may have to add DEBUGs to various spots in these drivers, to see what fails.

Thanks
Laszlo


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

* Re: [edk2-devel] How does EDK2 detect virtio-blk-pci device as a boot device
  2021-03-12 20:42 ` [edk2-devel] " Laszlo Ersek
@ 2021-03-17 11:10   ` xh_young
  0 siblings, 0 replies; 3+ messages in thread
From: xh_young @ 2021-03-17 11:10 UTC (permalink / raw)
  To: devel, lersek


在 2021/3/13 上午4:42, Laszlo Ersek 写道:
> On 03/11/21 15:48, Xiaohe Yang wrote:
>> Hello, I am using EDK2  OvmfPkgX64 at commit 37568365, and have a
>> problem. The following is the detail.
>>
>>
>> The Image disk that I use has EFI system partition, and is configured as
>> a virtio-blk-pci device. Bootorder file-entry is not added in fw_cfg
>> device. The log of EDK2 shows that
>>
>> (1)  VirtioBlkDxe.efi is successfully loaded at DXE stage.
>> BootScriptExecutorDxe drivers "was discovered but not loaded".
>>
>> (2) PCI enumeration has finished at the start of BDS stage,
>> virtio-blk-pci device is discovered. And one Option Rom's address is 0/0.
>>
>> (3) Before entering Shell, log shows "map: No mapping found".
>>
>> (4) After entering Shell, I choose “Boot From File”, the virtio-blk-pci
>> device is not displayed.
>>
>>
>> So I wonder what are the requirements for UEFI to detect the
>> virtio-blk-pci device as a boot device, except having EFI system partition?
> If you have a firmware log with DEBUG_VERBOSE enabled, I could take a look.
>
> Assuming you are *not* on QEMU (e.g., you are developing a new
> virtio-blk device, and running OVMF on your non-QEMU emulator), it could
> be anything, really. Try to add DEBUG messages to the following drivers
> / functions:


Yes, I am developing a new virtio-blk device on my non-QEMU emulator.


> - VirtioPciDeviceDxe
>    - VirtioPciDeviceBindingSupported
>    - VirtioPciDeviceBindingStart
>
> - Virtio10Dxe
>    - Virtio10BindingSupported
>    - Virtio10BindingStart
>
> - VirtioBlkDxe
>    - VirtioBlkDriverBindingSupported
>    - VirtioBlkDriverBindingStart
>
> These drivers all follow the UEFI driver model. So, if you find no
> mapping for the virtio-blk-pci device in the UEFI shell, then they fail
> to bind your device implementation for some reason.
>
> You mention that there is no "bootorder" fw_cfg file, so
> PlatformBdsConnectSequence() will see ConnectDevicesFromQemu() fail, and
> then EfiBootManagerConnectAll() will be called. If the virtio-blk-pci
> devices are not connected under those circumstances, then they don't do
> something that the virtio PCI transport drivers (0.9.5 or 1.0) expect,
> or the virtio-blk device driver expects. There's no silver bullet, you
> may have to add DEBUGs to various spots in these drivers, to see what fails.
>
> Thanks
> Laszlo

I follow your suggestions and add more debug infos, and the problem is 
fixed.


Thanks for your help.

Xiaohe Yang



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

end of thread, other threads:[~2021-03-17 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-11 14:48 How does EDK2 detect virtio-blk-pci device as a boot device Xiaohe Yang
2021-03-12 20:42 ` [edk2-devel] " Laszlo Ersek
2021-03-17 11:10   ` xh_young

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