From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=daniil.egranov@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 107BF224DCA54 for ; Thu, 8 Mar 2018 00:15:08 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 451341435; Thu, 8 Mar 2018 00:21:24 -0800 (PST) Received: from [10.118.34.22] (dbox2.austin.arm.com [10.118.34.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 017303F25C; Thu, 8 Mar 2018 00:21:23 -0800 (PST) From: Daniil Egranov To: Ard Biesheuvel , Laszlo Ersek Cc: "edk2-devel@lists.01.org" , Leif Lindholm References: <20180307013637.16462-1-daniil.egranov@arm.com> Message-ID: Date: Thu, 8 Mar 2018 02:21:22 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Re: [PATCH 0/4] Virtio non-discoverable devices X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 08:15:09 -0000 Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello Ard, Thanks for reply. Please see my comments below. On 03/07/2018 02:03 AM, Ard Biesheuvel wrote: > (+ Laszlo) > > Hello Daniil, > > On 7 March 2018 at 01:36, Daniil Egranov wrote: >> This is an attempt to add MMIO Virtio devices into the >> non-discoverable device registration procedure and allow >> Virtio PCI drivers to recognize and program such devices >> correctly. > Why? The purpose of the non-discoverable device layer is to make > non-PCI controllers that can be driven by PCI class drivers appear as > PCI devices. We have started using the base non-discoverable device > protocol for other devices as well, but the PCI wrapper is really only > intended for PCI class drivers. I am looking for a proper way to handle multiple MMIO Virtio devices on a single platform. As both PCI and MMIO types of Virtio device programmed in about the same way, non-discoverable devices approach was looking valid. I understand you point. Correct me if I am wrong but all non-discoverable devices are MMIO devices so if there is PCI version of the device exists, PCI wrapper can be used. The Virtio PCI class devices are using VirtioPciDeviceDxe driver. Is this driver not fitting to the category of PCI class drivers? > For VirtIO MMIO, we already have a driver model driver, and given that > you need to patch up differences between MMIO and PCI based virtio in > your code, I am reluctant to incorporate modifications in to the PCI > driver to support MMIO devices. There is no problem with using this driver model. I was interested to check if using unified access for both types of Virtio devices through the PCI driver is a right thing. Regarding MMIO devices support in PCI driver. It's an additional MemIo call and it's is part of PC IO protocol interface. Is there a concern to call it from the PCI driver? It's up to the protocol provider to implement it or keep it empty. > Is this related to virtio 1.0 support? No it's 0.9.5. > > Also, could you please ensure next time that you cc all the relevant > people? (Please check the Maintainers file) Sorry, missed that part. Thanks, Daniil >> The main issue is that the set of MMIO registers is different >> from PCI, plus the width of similar registers are not >> always the same. The code implements the translation of >> the PCI IO registers to MMIO registers. >> Another difference between PCI and MMIO Virtio devices found >> during the testing is that MMIO devices may require more >> registers to be programmed compared to PCI. The VirtioPciDeviceDxe >> was patched to detect non-discoverable MMIO devices and allow >> calling a PCI MemIo protocol function. >> >> This set of patches was tested with MMIO Virtio Block and >> Virtio Net devices. >> >> Daniil Egranov (4): >> MdeModulePkg: Added new Virtio non-discoverable type and GUID >> NonDiscoverableDeviceRegistrationLib: Added Virtio support >> NonDiscoverablePciDeviceDxe: Added MMIO Virtio support >> VirtioPciDeviceDxe: Added non-discoverable Virtio support >> >> .../NonDiscoverablePciDeviceDxe.c | 3 +- >> .../NonDiscoverablePciDeviceDxe.inf | 5 +- >> .../NonDiscoverablePciDeviceIo.c | 240 ++++++++++++++++++++- >> MdeModulePkg/Include/Guid/NonDiscoverableDevice.h | 3 + >> .../Library/NonDiscoverableDeviceRegistrationLib.h | 1 + >> .../NonDiscoverableDeviceRegistrationLib.c | 3 + >> .../NonDiscoverableDeviceRegistrationLib.inf | 1 + >> MdeModulePkg/MdeModulePkg.dec | 1 + >> OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c | 143 +++++++++++- >> OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h | 21 +- >> OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf | 4 +- >> OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c | 117 +++++++++- >> 12 files changed, 528 insertions(+), 14 deletions(-) >> >> -- >> 2.11.0 >> > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel