Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6122171rdb; Thu, 14 Dec 2023 08:52:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPsqye+7R/a9GOXi1MU5X8dM8VE39M2B0rU9WHZcRBG2biV1Gk6dLhg3FqNP0hQZkiVeFu X-Received: by 2002:a17:90a:6fc5:b0:28a:f2cc:e008 with SMTP id e63-20020a17090a6fc500b0028af2cce008mr1424927pjk.54.1702572754956; Thu, 14 Dec 2023 08:52:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702572754; cv=none; d=google.com; s=arc-20160816; b=ZC6jttpVbLs+ZZ9iN+X8jdMcvQOw5wUlPCgAcJOB/gN1XupcCkY94vrPaYf149nRtP BjcN7q+Z0DZYX26iETNHuyvTjxZtjeVDKsTWUXqm+PIebUQeEZzwIltQQ/j/8FSBGYXj VfEeKxbt10hEY7N/A2tegGGidfaoxm3YesI7m047VW1lPshTxXbb2M8QcIoFz1gTKacb xEfPGJ+u8c105Wv3c9WA/OZReMjPk48euH2ekyznHMHUgqglDokB4Xy8lq/PlfHWB2l1 ak6Sojz4eRVVUHAjj90lOzL5m0ofyB+0Ex2lKLDW8CxoUOfVQxDGpMSWVJYfzbq13Xbb 8wtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WzMaZDF2kQUgnCOIgoWoItovs9/bQZPAorrDQ2b63tc=; fh=w3azHG0UEQvqUMASpxQAAF4fpQlRKzrO4KsVwZe3aFY=; b=YjbUoBIEcqDyE/1k730XlcLwkjX+S7wXDT/okIKTvj1lQsG+sd8eYRWkv2suxSKT/k hXfz0DYYfanXjggF/BDW2l/E6rq8v5jg9C+re+JltqhOHdEpTXQyBxK9+W6JAOBhPsaE c8LKzMqpi5mZCSK7hYoSXfPoPIeekBB9AFTxGOsArrxZ3ohM5nVsH5l8NAWPiUdRdAfk VQRJFTOqJ3yf8LUWrb4GJchW5t7pWB4y3fCIIDCUxdiEJpNIj/g9VBKZBbaOYQKn/Kf7 0MqmSHLfUpSLvCC2zbAgj8v5GfKKtYP41uRFwM5BlJZNT6bI17qZIbuhfeC1ursFCxci 4peA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rw4g39EK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bk4-20020a17090b080400b0028b054de82bsi1636931pjb.168.2023.12.14.08.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 08:52:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rw4g39EK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3631385A6CD9; Thu, 14 Dec 2023 08:52:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbjLNQv7 (ORCPT + 99 others); Thu, 14 Dec 2023 11:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjLNQvm (ORCPT ); Thu, 14 Dec 2023 11:51:42 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3924D66 for ; Thu, 14 Dec 2023 08:51:11 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D7C4C433C8; Thu, 14 Dec 2023 16:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702572671; bh=/Qylc2+JKzSkPgqtG0O15AfjjZ9hpoVXvrfTV9+uIPA=; h=From:To:Cc:Subject:Date:From; b=Rw4g39EK4Oz975BOvXZXh6h9gnLJDQFsGE9qj6QwJbbXn59dZWCY2oC+Jm3rfAJry poOCUcsm5X+40s3GlTO52kgrnj8YITcOc8xNYA9lzI3rzVZ48/So37jLNPuXi5sbOq C9jCLamZVMBCmLWwVCTl68hCpTqTisLsU5MO2FEQKSAeRPPYCq2oxJopZKk4ICoOn3 dxaryI8HdITj+XGWhhuItNYvo/lJfoUbElVMMu5siFy2DptQgaaeVuPYyUIn8rvo4g Buom6W9VT0cFvLFIF6fUTqIM4NPW1TL3yfM7JrlklrOCfbQzj3yVFllQeMbtzQxG/l AxXqeB39K3a6A== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Igor Mammedov , Fiona Ebner , Dongli Zhang , Jonathan Woithe , "Rafael J . Wysocki" , "Michael S . Tsirkin" , Bjorn Helgaas , stable@vger.kernel.org Subject: [PATCH] Revert "PCI: acpiphp: Reassign resources on bridge if necessary" Date: Thu, 14 Dec 2023 10:51:02 -0600 Message-Id: <20231214165102.1093961-1-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 08:52:30 -0800 (PST) From: Bjorn Helgaas This reverts commit 40613da52b13fb21c5566f10b287e0ca8c12c4e9 and the subsequent fix to it: cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus") 40613da52b13 fixed a problem where hot-adding a device with large BARs failed if the bridge windows programmed by firmware were not large enough. cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus") fixed a problem with 40613da52b13: an ACPI hot-add of a device on a PCI root bus (common in the virt world) or firmware sending ACPI Bus Check to non-existent Root Ports (e.g., on Dell Inspiron 7352/0W6WV0) caused a NULL pointer dereference and suspend/resume hangs. Unfortunately the combination of 40613da52b13 and cc22522fd55e caused other problems: - Fiona reported that hot-add of SCSI disks in QEMU virtual machine fails sometimes. - Dongli reported a similar problem with hot-add of SCSI disks. - Jonathan reported a console freeze during boot on bare metal due to an error in radeon GPU initialization. Revert both patches to avoid adding these problems. This means we will again see the problems with hot-adding devices with large BARs and the NULL pointer dereferences and suspend/resume issues that 40613da52b13 and cc22522fd55e were intended to fix. Fixes: 40613da52b13 ("PCI: acpiphp: Reassign resources on bridge if necessary") Fixes: cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus") Reported-by: Fiona Ebner Closes: https://lore.kernel.org/r/9eb669c0-d8f2-431d-a700-6da13053ae54@proxmox.com Reported-by: Dongli Zhang Closes: https://lore.kernel.org/r/3c4a446a-b167-11b8-f36f-d3c1b49b42e9@oracle.com Reported-by: Jonathan Woithe Closes: https://lore.kernel.org/r/ZXpaNCLiDM+Kv38H@marvin.atrad.com.au Signed-off-by: Bjorn Helgaas Cc: Cc: Igor Mammedov --- drivers/pci/hotplug/acpiphp_glue.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 601129772b2d..5b1f271c6034 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -512,15 +512,12 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge) if (pass && dev->subordinate) { check_hotplug_bridge(slot, dev); pcibios_resource_survey_bus(dev->subordinate); - if (pci_is_root_bus(bus)) - __pci_bus_size_bridges(dev->subordinate, &add_list); + __pci_bus_size_bridges(dev->subordinate, + &add_list); } } } - if (pci_is_root_bus(bus)) - __pci_bus_assign_resources(bus, &add_list, NULL); - else - pci_assign_unassigned_bridge_resources(bus->self); + __pci_bus_assign_resources(bus, &add_list, NULL); } acpiphp_sanitize_bus(bus); -- 2.34.1