From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796364113; b=P2yS7xfss0yv4/gfbdOGy2SzlW2gRLPmIhDYdWa/7qJomfgSSY4pIpKpzLDaHjA+diiX PyNf5kNf1uky25ABGpcp5S3MciVK9bHYfZmB4PMAoxmYCNaJfQv2AYY8O5zMbyZhtMnq6 YJFD2aCnXXJcj3aWm3f1be2NyCDvpm+Pku8iodam+RjizeTv//aMxDGGQ4cXcBXhoK7oy aqaGPGOH/azZ6u4dHKpj6eZwdW5e9/DvUul9M+cCGQbbhiQMPsI5yQRrx1N+Vea2qRhTS VqppKaeidG/BCXo263thMdK64Elm8xRBodFEU5TSm9tyVv+6jRqH/YLr1rZfZ20DXog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796364113; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=rviuJr81fB8YrDEIdDAHXadlnbeOZZaoQuc2wqegeP0=; b=EYJrII1nstudGSuvSD2RA1n4K2+bDtK+XTe9DXe4Wku1VKajcRfsViqo1DQMxjFwR4mA jy288xIjnF+v40RYzKloI51tiU0AsX/PQUvjilxTh9WvdhStHSgqF3kIMcz90T3giJchl +GPgI5ueYmF8PwIBSPaUvNCiwOepzjgU+WfB1ROj2x0/ndSHI4kd8bhb9ac6kTdjA5NJp ZzI7kIS/XN479vmNx/kUieRbM/eHYFeEVkRsUIaJIoSwF225RuX7pcuE+ILH+zvmC1p3L pQEO/QnPpwXcJs/n1aAgjmTrGUKLvzoBwcp31sfhnM9YGncFykSEKvNs6hgOPZhiiGw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="hu/esdi6"; arc=none smtp.remote-ip=209.85.216.44 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14013606A322 for ; Fri, 4 Dec 2026 06:01:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 14013606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hu/esdi6 Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-3b439e37813so416887a91.3 for ; Thu, 03 Dec 2026 22:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796364112; x=1796968912; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=rviuJr81fB8YrDEIdDAHXadlnbeOZZaoQuc2wqegeP0=; b=hu/esdi60WLaHbLClBNUmZ3GiEPOCFKrMUt0yxKT+LDa5c1MCHY0H4u7NBfDQwO/ru rVfrc+8zUGR8UPRRP5e6jXlhf571nC17i8vZ3ATD7suVUgUtkcmC7t+Ij+eQeCqnbkhb jGZn4mhG8JnwxOx7gNTQoD5BSk4uyWraLKdqTgxzb+LF8oaxPtSnTkwzaXlfzutvwltW W2MNPV3mjed0P6jVfxhc3E+6ZIy40U4Lm0sBK+O3bdV7k9zFtMe8rxoCrWI7mMel0iVL fIlVh3mVMIKsDVanhgWAetZyyHxmRXbjv2DNRsCjUb95YjbovDvtXGxY62RgYRJyj0kt jCNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796364112; x=1796968912; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rviuJr81fB8YrDEIdDAHXadlnbeOZZaoQuc2wqegeP0=; b=SkDDOBq9GT6THs4TlJcdkYYQFqeIKgfup3OjAdNuBzqzvsBIHr4zazO4FABO63R4jw f0ouvhTCXBUDls1ZUt8ConBYIK7Pvp3ZNxN/YLzDx5JYUXQc1BlSJx72kd3ywfNjaZJC AGZ+DNMxIGQZGJ6cCJXoYz0k+18zqnVCokR56tokDmYTOUcVUGQ9xoPlT5uqY5eEXOE9 AgayqbT4I8VFGzrt1BNE2MCxi0/KUcI4qcs0jCmCqr4/TQ40kELvo+kYKOIYl2ikhtPw VgmrqUdboCgpv7NXSXFPkEgpeXwLqeMuMh79duS0yv6LLtArWVJJaEZbLt3ASmnIoQpB hwzQ== X-Gm-Message-State: APuU4Z/U7ZBNKFBQ/7C1lUBHSdwTmlCeIqvnmcyiuU/WmjaiQpEdHb40 F/Jc8W5/6N8Fcdy5T2UIvHA6iRIEaDBfz0BM2+UCD1HR3GKMxobGSwULnahTjA== X-Gm-Gg: AZFdTZc10oHGh2Uolo5ZMUX9ELd/RJoqoVomnsvsoP2of5Po/FyH2HWeQ7WidJYZa5b hREkuNXzqHX/UjMD6E9nlb7wqfC2Loxuqzux7Q41GQ/JhjB9fd4NuYrpJDudnWubT/u9uAWN2zc MOGcWBuNxHdZNz6hjY8ZUmfYgb3oq2C3VRpznFH1mS688V6UKFZB5+X/O18hhhn92pTk9G4lPj9 00Gy0ULFq0FyW9jRqzwPinrlPJ6N9WFjj99EvDx7wCJXMivvzRnWEVM0CCxh4755TCe84UuCcB2 O3dpw67VqHwnAm3gr02EAoCBAX6nwurDW963Uvr/bgJDyhh2NzqGzJlKWj+TKDrR6+ekHiPGIVi qrlb3bqkuwiJTTvfOtpQenjQkU6AI1GV+z0ZGdWliO16OxGyqQiYtt/iOWCHiDxrRDO/C3v7bW8 oNyQIBW4d3fwIKX35fM8fhCHvt1IVj+YzV12nwTC1ITr8aycn1LC7bNwBhF/z5K4JkYdEP5/Dyu E0iUCGTF6Mqp7Xtht5Yaj7nOUvskh1QBqKKMFfGF8BuY7AWXXc8nXq+uTygxsJdGI6CVQgRP6Vu TuCtNRHuEeBHj7KWk3gA+23vki+zB70cPOuREupaWm71G9l17jVFBkPZmvwE6wnyxxu8WP0XRdp Z/k4GboNwfZsAs7t7Tq33Tafp6nwCZWbQOqUDfDCviPjtpcbbegqXDIMwEdYfmbfvwQ+XNgtLg8 EaOg== X-Received: by 2002:a17:90b:55c8:b0:3ac:fe93:a731 with SMTP id 98e67ed59e1d1-3b5e064f801mr727137a91.56.1796364112209; Thu, 03 Dec 2026 22:01:52 -0800 (PST) Received: from ryzen.lan ([2601:644:8000:37f::e34]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5ddc15bc2sm2078344a91.3.2026.12.03.22.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 22:01:51 -0800 (PST) From: Rosen Penev To: linux-pci@vger.kernel.org Cc: Bjorn Helgaas , Manivannan Sadhasivam , Frank Li Subject: [PATCH] PCI: Save Root Port state before resetting it with reset_root_port() Date: Thu, 3 Dec 2026 22:01:50 -0800 Message-ID: <20261204060150.1239223-1-rosenp@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit pcibios_reset_secondary_bus() restores the Root Port's config space after host->reset_root_port(), but doesn't save it first, so it restores whatever was saved last. For a Root Port that is the state saved when portdrv probed it, before a device below it was enabled, which turns memory decoding and bus mastering of the port off again: a function reset of the device through its parent bus (e.g. pci_reset_function() on a device whose only reset method is "bus") leaves the device unreachable. Save the Root Port's state right before resetting it. Fixes: 3fc686d550f6 ("PCI/ERR: Add support for resetting the Root Ports in a platform-specific way") Signed-off-by: Rosen Penev --- drivers/pci/pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e2607cc84ff1..50e8e248058a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5100,6 +5100,12 @@ void __weak pcibios_reset_secondary_bus(struct pci_dev *dev) int ret; if (pci_is_root_bus(dev->bus) && host->reset_root_port) { + /* + * The state saved when the port was enumerated or probed may + * predate changes made since, e.g. memory decoding enabled + * once a device below the port was enabled. + */ + pci_save_state(dev); ret = host->reset_root_port(host, dev); if (ret) pci_err(dev, "Failed to reset Root Port: %d\n", ret); -- 2.56.1