From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1F47C77B75 for ; Tue, 18 Apr 2023 14:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbjDROSJ (ORCPT ); Tue, 18 Apr 2023 10:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbjDROSI (ORCPT ); Tue, 18 Apr 2023 10:18:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1E6311A for ; Tue, 18 Apr 2023 07:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681827442; 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=D7E0f97enKWeGm4kBxYLE/5HBvfl7WhJLhN+ZbF/ZnM=; b=V7mLYTSSd/zZi4GtNkM5ACmgJfdrKTgwdTqmPYCPiWB/yvh2GU8Vd+JpafmHKgYVyKKeku at8+AzKbwHUOuLKHvWiOnclez4kqCcga1l7qvyW5Q3LhVpm5MPSuyBZAKLfnQ2LF5kY1RY aMBxeliHbcIGdC4QQceyyEJElRDpg6s= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-zrp91appPreSjCgpUQ3dmA-1; Tue, 18 Apr 2023 10:17:20 -0400 X-MC-Unique: zrp91appPreSjCgpUQ3dmA-1 Received: by mail-wm1-f70.google.com with SMTP id l32-20020a05600c1d2000b003f17b89ddfcso349403wms.1 for ; Tue, 18 Apr 2023 07:17:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681827423; x=1684419423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D7E0f97enKWeGm4kBxYLE/5HBvfl7WhJLhN+ZbF/ZnM=; b=bxjF3t44Pn5q1SfiQDl3LBkDfhrfvxBtBglIC1WKomwHI7uj83Jdx3wL3ls9OgkW0o tygXD5bj1P0xn0HK4C8aEoUUt+QHqOnWFJi0PR1gE1p1KL4y/M8W0wGDGTMZWgBVRpzx vGuiPCO4VA1b0sgtTB26g+X8D9SsvL7TsfkKoq1cXaYukjaj3w6S4HhNhvmT6YufJ4v5 PgL7pbyFWwN1a5Nw6/sATW0bUMQdxd4cfuOnPOHU9ne099mu2aO3vxjshDl0Reugq4ly UCw24cvKgXOscwE1KneLxbI30IJXZ0DVIAu+Y4WOyp72K2tDEAc4BbrxQFmUgYYzbQts +jUg== X-Gm-Message-State: AAQBX9fMPxlCm8WNiNkJ3qS693xGuXWGitnpi88H9iR7KLiT4T07hAdi US5aZy8NEIohrGmZrl1H76rTTPD8AyeP6mzjRAcWBYTXfjIFYQ5opdjrPLBM2EdPHD2eFxUsGBG BOBetc2LRHKo+SvRnh6vE8w== X-Received: by 2002:a05:600c:24e:b0:3ef:71d5:41d8 with SMTP id 14-20020a05600c024e00b003ef71d541d8mr14882514wmj.32.1681827423682; Tue, 18 Apr 2023 07:17:03 -0700 (PDT) X-Google-Smtp-Source: AKy350Z4k5mZUQ0YlvrUPDg3GmVXRk4kB6wqO8dr86TybU23pVcwkwl7iUHnmRW6t9oXDtel+NfwTA== X-Received: by 2002:a05:600c:24e:b0:3ef:71d5:41d8 with SMTP id 14-20020a05600c024e00b003ef71d541d8mr14882495wmj.32.1681827423366; Tue, 18 Apr 2023 07:17:03 -0700 (PDT) Received: from imammedo.users.ipa.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b003ee74c25f12sm18904809wms.35.2023.04.18.07.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 07:17:02 -0700 (PDT) Date: Tue, 18 Apr 2023 16:17:02 +0200 From: Igor Mammedov To: "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, mst@redhat.com, lenb@kernel.org, bhelgaas@google.com, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH] pci: acpiphp: try to reassign resources on bridge if necessary Message-ID: <20230418161702.0945fc67@imammedo.users.ipa.redhat.com> In-Reply-To: References: <20230418085030.2154918-1-imammedo@redhat.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Tue, 18 Apr 2023 14:55:29 +0200 "Rafael J. Wysocki" wrote: > On Tue, Apr 18, 2023 at 10:50=E2=80=AFAM Igor Mammedov wrote: > > > > When using ACPI PCI hotplug, hotplugging a device with > > large BARs may fail if bridge windows programmed by > > firmware are not large enough. > > > > Reproducer: > > $ qemu-kvm -monitor stdio -M q35 -m 4G \ > > -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=3Don \ > > -device id=3Drp1,pcie-root-port,bus=3Dpcie.0,chassis=3D4 \ > > disk_image > > > > wait till linux guest boots, then hotplug device > > (qemu) device_add qxl,bus=3Drp1 > > > > hotplug on guest side fails with: > > pci 0000:01:00.0: [1b36:0100] type 00 class 0x038000 > > pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x03ffffff] > > pci 0000:01:00.0: reg 0x14: [mem 0x00000000-0x03ffffff] > > pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00001fff] > > pci 0000:01:00.0: reg 0x1c: [io 0x0000-0x001f] > > pci 0000:01:00.0: BAR 0: no space for [mem size 0x04000000] > > pci 0000:01:00.0: BAR 0: failed to assign [mem size 0x04000000] > > pci 0000:01:00.0: BAR 1: no space for [mem size 0x04000000] > > pci 0000:01:00.0: BAR 1: failed to assign [mem size 0x04000000] > > pci 0000:01:00.0: BAR 2: assigned [mem 0xfe800000-0xfe801fff] > > pci 0000:01:00.0: BAR 3: assigned [io 0x1000-0x101f] > > qxl 0000:01:00.0: enabling device (0000 -> 0003) > > Unable to create vram_mapping > > qxl: probe of 0000:01:00.0 failed with error -12 > > > > However when using native PCIe hotplug > > '-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=3Doff' > > it works fine, since kernel attempts to reassign unused resources. > > Use the same machinery as native PCIe hotplug to (re)assign resources. > > > > Signed-off-by: Igor Mammedov =20 >=20 > Acked-by: Rafael J. Wysocki >=20 > or please let me know if you want me to pick this up. It would be nice if you could pick it up. Thanks! >=20 > > --- > > tested in QEMU with Q35 machine on PCIE root port and also > > with nested conventional bridge attached to root port. > > --- > > drivers/pci/hotplug/acpiphp_glue.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/a= cpiphp_glue.c > > index 5b1f271c6034..9aebde28a92f 100644 > > --- a/drivers/pci/hotplug/acpiphp_glue.c > > +++ b/drivers/pci/hotplug/acpiphp_glue.c > > @@ -517,7 +517,7 @@ static void enable_slot(struct acpiphp_slot *slot, = bool bridge) > > } > > } > > } > > - __pci_bus_assign_resources(bus, &add_list, NULL); > > + pci_assign_unassigned_bridge_resources(bus->self); > > } > > > > acpiphp_sanitize_bus(bus); > > -- > > 2.39.1 > > =20 >=20