From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1897721E781F2 for ; Tue, 3 Oct 2017 07:06:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E62CC641DF; Tue, 3 Oct 2017 14:10:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E62CC641DF Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-122-192.rdu2.redhat.com [10.10.122.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB3ED4DA61; Tue, 3 Oct 2017 14:09:50 +0000 (UTC) From: Laszlo Ersek To: edk2-devel-01 Cc: Marcel Apfelbaum , Jordan Justen , Michael D Kinney , Ruiyu Ni , Liming Gao References: <20170925195824.10866-1-lersek@redhat.com> Message-ID: <0483db69-735b-fce7-587c-cb694074ee30@redhat.com> Date: Tue, 3 Oct 2017 16:09:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170925195824.10866-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 03 Oct 2017 14:10:11 +0000 (UTC) Subject: Re: [PATCH 0/7] OvmfPkg/PciHotPlugInitDxe: obey PCI resource reservation hints from QEMU X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Oct 2017 14:06:51 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/25/17 21:58, Laszlo Ersek wrote: > Repo: https://github.com/lersek/edk2.git > Branch: pci_resource_reserve > > "OvmfPkg/PciHotPlugInitDxe" implements EFI_PCI_HOT_PLUG_INIT_PROTOCOL > from the PI spec. Currently it returns fixed resource reservations (512B > IO space and 2MB non-prefetchable 32-bit MMIO space) for all bridges. > This is not flexible enough: > > (1) For PCI Express bridges (such as root ports and downstream ports), > reserving any IO space is wasteful, and limits the number of ports. > (This is because each such port can only accept one (multi-function) > device, and because the 512B reservation is rounded up to 4KB, and > because the IO space under OVMF/Q35 consists of 10 * 4KB.) > > (2) For hot-plugging PCI Express devices with large MMIO BARs into such > ports, the reservation of only 2MB MMIO (and even that limited to > non-prefetchable, hence 32-bit, address space) is insufficient. > > QEMU has recently gained the ability to control these reservation sizes > on the command line. At this point the hints are only supported for the > "pcie-root-port" device -- which implies the Q35 machine type, given > that i440fx only supports conventional PCI, not PCI Express --, with the > following properties: > > - pcie-root-port.bus-reserve=uint32 > - pcie-root-port.io-reserve=size > - pcie-root-port.mem-reserve=size > - pcie-root-port.pref32-reserve=size > - pcie-root-port.pref64-reserve=size > > The hints are exposed to the guest in the conventional config space of > the device, using a vendor-specific capability (which is documented in > the QEMU source tree; see all references in the individual patches). It > is expected that, if any future hotplug controllers in QEMU gain the > same ability, they will reuse the mechanism identically. > > This series generally implements the parsing of this capability in > OvmfPkg/PciHotPlugInitDxe, and the translation thereof to the ACPI > address space descriptor format that the Platform Init spec defines for > EFI_PCI_HOT_PLUG_INIT_PROTOCOL.GetResourcePadding(). > > The first patch is for "MdePkg/IndustryStandard"; it introduces the > vendor-specific capability header, from the PCI 2.3 spec. The rest of > the patches is for OvmfPkg. > > Cc: Jordan Justen > Cc: Liming Gao > Cc: Marcel Apfelbaum > Cc: Michael D Kinney > Cc: Ruiyu Ni > > Thanks > Laszlo > > Laszlo Ersek (7): > MdePkg/IndustryStandard/Pci23: add vendor-specific capability header > OvmfPkg/IndustryStandard: define PCI Capabilities for QEMU's PCI > Bridges > OvmfPkg/PciHotPlugInitDxe: clean up protocol usage comment > OvmfPkg/PciHotPlugInitDxe: clean up addr. range for non-prefetchable > MMIO > OvmfPkg/PciHotPlugInitDxe: generalize RESOURCE_PADDING composition > OvmfPkg/PciHotPlugInitDxe: add helper functions for setting up > paddings > OvmfPkg/PciHotPlugInitDxe: translate QEMU's resource reservation hints > > MdePkg/Include/IndustryStandard/Pci23.h | 10 + > OvmfPkg/Include/IndustryStandard/QemuPciBridgeCapabilities.h | 60 ++ > OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c | 661 ++++++++++++++++++-- > OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf | 6 +- > 4 files changed, 674 insertions(+), 63 deletions(-) > create mode 100644 OvmfPkg/Include/IndustryStandard/QemuPciBridgeCapabilities.h > Thanks All for the feedback, pushed as commit range 9425b34925d0..fe4049471bdf. Laszlo