From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m12-17.163.com (m12-17.163.com [220.181.12.17]) by mx.groups.io with SMTP id smtpd.web08.4865.1615979725883499197 for ; Wed, 17 Mar 2021 04:15:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@163.com header.s=s110527 header.b=Q5L5Qx/h; spf=pass (domain: 163.com, ip: 220.181.12.17, mailfrom: xh_young@163.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=qabh/ A3ACz9x0go4QpApWYifC1wsXihjqYX11j1mVfE=; b=Q5L5Qx/hEqGcFN7FS9jmB 0CWe+zIAbOJ0wjhEV9PISrlpduMrJPI9fIDXI9IYFo2l5jI4iVRV7YzbYEHhuyup wJXFbwfWkFt4yWeObYdAK1kPzl3Sp2L1hlO6eNpSGhYIzlWtROLN7boxpsD7a9pl v+JG02dUpDoT0OzIKVKah4= Received: from xiaohedeMacBook-Pro.local (unknown [125.122.210.21]) by smtp13 (Coremail) with SMTP id EcCowAAHD5_H5FFgE4XxqQ--.20296S2; Wed, 17 Mar 2021 19:15:20 +0800 (CST) Subject: Re: [edk2-devel] How does EDK2 detect virtio-blk-pci device as a boot device To: devel@edk2.groups.io, lersek@redhat.com References: <472bcdc2-ed67-c01b-8d9b-c0afd93f6c3c@redhat.com> From: xh_young@163.com Message-ID: Date: Wed, 17 Mar 2021 19:10:57 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <472bcdc2-ed67-c01b-8d9b-c0afd93f6c3c@redhat.com> X-CM-TRANSID: EcCowAAHD5_H5FFgE4XxqQ--.20296S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7urWrtryfAFykCr4UWw1fXrb_yoW5JrWkpF ZxWFyIkr1kGFnrKF1xXF47CayfArWqka4fJFZ8X3s09wn8WF93tr1fKr15Aa4DGryUGayI yrZYgry2k3sYvaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jmsjUUUUUU= X-Originating-IP: [125.122.210.21] X-CM-SenderInfo: 50kb50xxqjqiywtou0bp/1tbiLgNYxVSIsowMOAABsn Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 在 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