From nobody Mon Sep 16 19:06:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1638186564445116.73167078143922; Mon, 29 Nov 2021 03:49:24 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id F223C16E3DDC; Mon, 29 Nov 2021 11:49:20 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 8EC0B16E3DD7 for ; Mon, 29 Nov 2021 11:49:08 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-560-PuvviMuaOQmboFFVde_WUQ-1; Mon, 29 Nov 2021 06:49:06 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A92C19253C2; Mon, 29 Nov 2021 11:49:05 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CF0B60BF1; Mon, 29 Nov 2021 11:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638186547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cq+H20B0B6bPQ3DZ60IN0HJPVgEDX6wFHRspPBNX/ow=; b=W4mEk0iKKiMq8bEcubl5mLeZ5LMK+QgjRN2myTVPJiDEuR3cyL27uKa/i6zTxrflFLTNUo JngWWYPBEt0MEVouQqcMvbED0GCJAR3Bd/RqexGTP7RgePZAInE60hvfh8XSIBPGfRZsyU f3aeMmAmGTBaf0AjCNiW5NU4XAmCIx8= X-MC-Unique: PuvviMuaOQmboFFVde_WUQ-1 From: Igor Mammedov To: seabios@seabios.org Date: Mon, 29 Nov 2021 06:48:12 -0500 Message-Id: <20211129114812.231849-3-imammedo@redhat.com> In-Reply-To: <20211129114812.231849-1-imammedo@redhat.com> References: <20211129114812.231849-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: RQVWXS6UIESMJGB4CQD22E3FMG5TGNRB X-Message-ID-Hash: RQVWXS6UIESMJGB4CQD22E3FMG5TGNRB X-MailFrom: imammedo@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pmenzel@molgen.mpg.de, mapfelba@redhat.com, kraxel@redhat.com, mst@redhat.com, lvivier@redhat.com, jusual@redhat.com X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH v3 2/2] pci: let firmware reserve IO for pcie-pci-bridge List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ----- X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638186566170100001 Content-Type: text/plain; charset="utf-8" With [1] patch hotplug of rtl8139 succeeds, with caveat that it fails to initialize IO bar, which is caused by [2] that makes firmware skip IO reservation for any PCIe device, which isn't correct in case of pcie-pci-bridge. Fix it by exposing hotplug type and making IO resource optional only if PCIe hotplug is in use. [1] "pci: reserve resources for pcie-pci-bridge to fix regressed hotplug on q3= 5" [2] Fixes: 76327b9f32a ("fw/pci: do not automatically allocate IO region for PC= Ie bridges") Signed-off-by: Igor Mammedov imammedo@redhat.com CC: mapfelba@redhat.com CC: kraxel@redhat.com CC: mst@redhat.com CC: lvivier@redhat.com CC: jusual@redhat.com Acked-by: Michael S. Tsirkin Tested-by: Laurent Vivier --- src/fw/pciinit.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 7342d8d8..badf13d3 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -793,7 +793,13 @@ pci_region_create_entry(struct pci_bus *bus, struct pc= i_device *dev, return entry; } =20 -static int pci_bus_hotplug_support(struct pci_bus *bus, u8 pcie_cap) +typedef enum hotplug_type_t { + HOTPLUG_NO_SUPPORTED =3D 0, + HOTPLUG_PCIE, + HOTPLUG_SHPC +} hotplug_type_t; + +static hotplug_type_t pci_bus_hotplug_support(struct pci_bus *bus, u8 pcie= _cap) { u8 shpc_cap; =20 @@ -819,12 +825,13 @@ static int pci_bus_hotplug_support(struct pci_bus *bu= s, u8 pcie_cap) */ u16 slot_implemented =3D pcie_flags & PCI_EXP_FLAGS_SLOT; =20 - return downstream_port && slot_implemented; + return downstream_port && slot_implemented ? + HOTPLUG_PCIE : HOTPLUG_NO_SUPPORTED; } =20 check_shpc: shpc_cap =3D pci_find_capability(bus->bus_dev->bdf, PCI_CAP_ID_SHPC, 0= ); - return !!shpc_cap; + return !!shpc_cap ? HOTPLUG_SHPC : HOTPLUG_NO_SUPPORTED; } =20 /* Test whether bridge support forwarding of transactions @@ -909,7 +916,7 @@ static int pci_bios_check_devices(struct pci_bus *busse= s) u8 pcie_cap =3D pci_find_capability(bdf, PCI_CAP_ID_EXP, 0); u8 qemu_cap =3D pci_find_resource_reserve_capability(bdf); =20 - int hotplug_support =3D pci_bus_hotplug_support(s, pcie_cap); + hotplug_type_t hotplug_support =3D pci_bus_hotplug_support(s, pcie= _cap); for (type =3D 0; type < PCI_REGION_TYPE_COUNT; type++) { u64 align =3D (type =3D=3D PCI_REGION_TYPE_IO) ? PCI_BRIDGE_IO_MIN : PCI_BRIDGE_MEM_MIN; @@ -953,7 +960,9 @@ static int pci_bios_check_devices(struct pci_bus *busse= s) if (pci_region_align(&s->r[type]) > align) align =3D pci_region_align(&s->r[type]); u64 sum =3D pci_region_sum(&s->r[type]); - int resource_optional =3D pcie_cap && (type =3D=3D PCI_REGION_= TYPE_IO); + int resource_optional =3D 0; + if (hotplug_support =3D=3D HOTPLUG_PCIE) + resource_optional =3D pcie_cap && (type =3D=3D PCI_REGION_= TYPE_IO); if (!sum && hotplug_support && !resource_optional) sum =3D align; /* reserve min size for hot-plug */ if (size > sum) { --=20 2.27.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org