From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796431253; b=p1sLrcFy1lvCHBK+GLknBY9ASh70W3+pd55zA0bMIKsxYKSQYimtbqbquAjGeDW/phCW 8G4Lrhww+BdARinhfRgdpUjglaT8GWq5sxvw6js9PbQ1xZy1JNzhOzfYC6hub6NY3LIbu Pxcf5gFRzPXRYIfImLY4npyvZZdBxDxDE82RF9g0PjyJDf9aKj7CW8q/21ZHStdHRwur8 qGQIchr+yKRpii5+O4oIjhW7YMHStlVQazFt6DJcoOwbUG7+FnehF0jLu+WRjcNwGB4rz u96ltNtXdt7QzdngP+6Qwj7nId22I2v8ysjyxrnfJPOeYjtJbOJ4OrNtXtqMC5iz/fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796431253; 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=ZDtS/hmuPU8ivN+GI07v2nsq1uuWuY5jAjXdABkcw7I=; b=kM+IPh5+8BCyEPJX7bBccF96qtfpNyJnpvczAsnuVXDP5amOdcx1IY72QTLKWrC3MVxW waN9xKXsPUqLa9gR8CPSDHVn2aLULjO+aykuTlDHBYuGD3fPUbytFkHyA8LsqkxZ1fjls 7zFE9f8JfgnWlY3VhmS9/TFEGG5Fz1ekyH5F2NEUx+5sRrd09e1RyZ51W7FoGpdtzrxlh QEjTj9bdyKYjE5GT/iPU6ADwuDKnqk8kX0HKaIGGS9Z9+do3j3pc4SZ1nFGe1eZiVPofZ AlUZabjXkgCsj8pC+ZDa8wPPzVKTAork5DbBJKq/ZlMh64kTGhYY45v7dXpDvOyO+GQ== 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=XYlldztx; arc=none smtp.remote-ip=198.175.65.15 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 2C558606A322; Sat, 5 Dec 2026 00:40:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2C558606A322 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=XYlldztx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796431253; x=1827967253; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZDtS/hmuPU8ivN+GI07v2nsq1uuWuY5jAjXdABkcw7I=; b=XYlldztxGLZMSG02yjOtjNfWpmzoCJNP3CEZJTfhFRpWuwVzw+lvDUrV qmyZza6354kFkgIxIf9dNjWbK61neqE2+INhPcyEcpCroOdnihOVgaJRW Cw7bi0arYWjCm4Pe7tceKFieLMJ4nAOe0bWQOXtiia/hbYqibVq9jw9Lz IEuy3U9xn4l+Pxy5ieZ66O1O7czXb9Ut6ivBwlJB6TaBjM+F8t/2LFpe7 30Y3yyQN0nYEgF/eY0qQJHIbEZ6kFhpvqTW9L3sEaM/N1OOTaiv867dqn UJyAUyM1XB83FfrSrgZEf6fCsZigN6pr/BDfl4B5FNGUCu1+OJkv7zRja Q==; X-CSE-ConnectionGUID: IapzrSfrTcOiVF7FRTcPdg== X-CSE-MsgGUID: 4W4W1tNfRUWftxp4v0yJTw== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5424596" X-IronPort-AV: E=Sophos;i="6.29,79,1794902400"; d="scan'208";a="5424596" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 16:40:52 -0800 X-CSE-ConnectionGUID: Lu4X/j0RTIueYy21obe1wg== X-CSE-MsgGUID: Kh51ArioTx2wwD0a45Hhcw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,79,1794902400"; d="scan'208";a="14196724" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.47]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 16:40:45 -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, Anthony Pighin , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v2 03/16] PCI: Abort BAR resize only if saving the resized BAR fails Date: Sat, 5 Dec 2026 02:39:38 +0200 Message-ID: <20261205003957.3304-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261205003957.3304-1-ilpo.jarvinen@linux.intel.com> References: <20261205003957.3304-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 db16c8c2913d..c18664b5e5a2 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