From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web10.523.1615581771087136644 for ; Fri, 12 Mar 2021 12:42:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VThUjGMu; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615581770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kUOUdj6qk2rn9VYAGDsIDqlFCD4f+zHWU8C7xlx3asY=; b=VThUjGMutlBiW1SFY+AoGT5chb5/v5n1zTjsZpzcqT7/z21VVZq6jm5AJeGCVw3Ifbl24N 2+Xex0kn/cVZuOp3Iw39UKQMH+64h1brNBGy48YUoMZ3SniYNdg7ANTQ98zuW4YeRKnGXr 7L3WddzxHaUZ+/yUvfnVpf53kvxq19U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-526-n76mSXO2POqBPj8HBRPqUQ-1; Fri, 12 Mar 2021 15:42:48 -0500 X-MC-Unique: n76mSXO2POqBPj8HBRPqUQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6925D80006E; Fri, 12 Mar 2021 20:42:47 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-80.ams2.redhat.com [10.36.112.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7E175D760; Fri, 12 Mar 2021 20:42:46 +0000 (UTC) Subject: Re: [edk2-devel] How does EDK2 detect virtio-blk-pci device as a boot device To: devel@edk2.groups.io, xh_young@163.com References: From: "Laszlo Ersek" Message-ID: <472bcdc2-ed67-c01b-8d9b-c0afd93f6c3c@redhat.com> Date: Fri, 12 Mar 2021 21:42:45 +0100 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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