From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796140787; b=I07aCr0IqUHnOdBhwuiXKIQfk+h40MYfgEMlcbXe1FiQSxFodpiiXGIc3xW3UMRjbXwj 06vUJsjOLvaCFO/bxQMqquFYkCuWeS9Fj/xo1c5NFwgUCeOKBcCwB5dErQwXEebM5pc9W n5CLJ/6Fo/xFN8MfMFHruXMzrQY5fLZFNWF6p/TB7MEIUZj63iN7f1vEWqWXv4uLZVOUn tFZ3bfDaYIrC2upxF8Jty5VF8Xm+E9JLppRuFZzoGNlvCgEPx1K4d2FhSnGOttBkJ1fyb 0VAJpRyJ+/C1b1JhZzlPAp9Qb7rrOzaAEu4tPkK2T1B4x7HDl2jAbmuqOYZYz63/qYg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796140787; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=laMkgkaD5ccHfqqHsbZVa1yx6zJjVDMUSW9uJbHO1hQ=; b=Kh3oYCAiO2ZvC/NjuirZQj4hITY06OU87LxpNouaa0DrxCMJJOL6aoF5YeMog1Q/y7Qr godp9QyujlCbyQsY4Vg+RViC3RDolKGWvtK896DikIjnQ/wmUbaLgAFPDBulaDPLUDV3V 7UxWhiQcTdZ8XyxvWJU/sZWDwxwHXC+vitpWEvBL9xkL5MWXGRkuW17vhxQ1ML6qJ8l+3 5UO30GuOis1j4VAbe0Hw8LpWYqdyPSV5lyhsQBcn5LGGTyKg9tUxFju+Da5lmlTGQnAYZ 72JucWuDdxk5RZJG/qcOsMEevolUCQD+7KZnkPVa/bfTJCBPa3V1XCsLEvkB7+KZwvg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=EbYO1nuZ; arc=none smtp.remote-ip=192.198.163.18 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62865606A325; Tue, 1 Dec 2026 15:59:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 62865606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=EbYO1nuZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796140786; x=1827676786; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=laMkgkaD5ccHfqqHsbZVa1yx6zJjVDMUSW9uJbHO1hQ=; b=EbYO1nuZhWajxeuung6MBa0TjVLnbObri+Ui38vGevG9m28SzEDzp+Nz SbW4gfJ8M8L+BMl73itNScnfJkoqKJfOr+Tulrd0zVCpTDiKEVqET4BXQ oaDcroao6Jel3b79PA1A72tQ/tHOl3Ir8OyvNTmpaYI08FDZww/2FNG0S 6u2DLx1wqbUVoQVf/M31dBEr2nwH+dmPN350oQ+c00AmNSJlSCK6dcsRk jdRR+1j4W/rK/M043BMktsbWUdItGc5v09gi4XdctnAwi1jd8AcI3OcMK GtfLi+PL+/bBiqfRr/AdrFUB0dHdQJEbSQL0ljDpzw3UtS+LmW5in1/Mp g==; X-CSE-ConnectionGUID: jLVnHLArSP2EaSYFHP2+NQ== X-CSE-MsgGUID: k+odkXvrSA2PssVguC/p6g== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5031496" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5031496" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 07:59:38 -0800 X-CSE-ConnectionGUID: 12uo3kl4SZyfyoUvJBSZwQ== X-CSE-MsgGUID: paQOD3tlT3KF7PS29gWUAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13506713" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO localhost) ([10.245.245.21]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 07:59:31 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Matthew Brost , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Micha=C5=82=20Winiarski?= , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 03/15] PCI: Abort BAR resize only if saving the resized BAR fails Date: Tue, 1 Dec 2026 17:58:27 +0200 Message-ID: <20261201155844.2278-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201155844.2278-1-ilpo.jarvinen@linux.intel.com> References: <20261201155844.2278-1-ilpo.jarvinen@linux.intel.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pci_do_resource_release_and_resize() saves and releases the BARs of the device that share the bridge window with the BAR being resized, and rolls back if saving any of them fails. Only the resized BAR has to be saved and released for the resize to be possible. Another BAR that cannot be saved remains assigned, which may prevent the bridge window from being adjusted, but resize may succeed in some cases despite it. Roll back only if saving the resized BAR fails. Leave the other BARs that cannot be saved in place and continue. Signed-off-by: Ilpo Järvinen --- drivers/pci/setup-bus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 608ca7afbfb8..ea0039fb6ad0 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -2407,8 +2407,11 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size continue; ret = pci_dev_res_add_to_list(&saved, pdev, r, 0, 0); - if (ret) - goto restore; + if (ret) { + if (i == resno) + goto restore; + continue; + } pci_release_resource(pdev, i); } -- 2.47.3