Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2227522/?format=api
{ "id": 2227522, "url": "http://patchwork.ozlabs.org/api/patches/2227522/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260423212316.3431746-6-dmatlack@google.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260423212316.3431746-6-dmatlack@google.com>", "list_archive_url": null, "date": "2026-04-23T21:23:09", "name": "[v4,05/11] PCI: liveupdate: Inherit bus numbers during Live Update", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d090f9b706d5a360d72844cbe38d718b00559ed8", "submitter": { "id": 69449, "url": "http://patchwork.ozlabs.org/api/people/69449/?format=api", "name": "David Matlack", "email": "dmatlack@google.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260423212316.3431746-6-dmatlack@google.com/mbox/", "series": [ { "id": 501248, "url": "http://patchwork.ozlabs.org/api/series/501248/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=501248", "date": "2026-04-23T21:23:04", "name": "PCI: liveupdate: PCI core support for Live Update", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/501248/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227522/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227522/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-53072-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256\n header.s=20251104 header.b=Sq2TNcpG;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-53072-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=google.com header.i=@google.com\n header.b=\"Sq2TNcpG\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.215.201", "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=google.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1pzW0d5zz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 07:25:43 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id A34F53037666\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 21:24:22 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 8C0F53BED5C;\n\tThu, 23 Apr 2026 21:23:38 +0000 (UTC)", "from mail-pg1-f201.google.com (mail-pg1-f201.google.com\n [209.85.215.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D86553B95FF\n\tfor <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 21:23:30 +0000 (UTC)", "by mail-pg1-f201.google.com with SMTP id\n 41be03b00d2f7-b630b4d8d52so4113160a12.3\n for <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 14:23:30 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776979416; cv=none;\n b=ioGDGpwNEu8kElxzp7RHKQ4b4Uod/r0sg+4vDhVmKvVXMru25Vm2CzrcnTojXs+XGurdyAwuZo0XBwmq3yqfjupyf1EAlGBwYh7Iym/jLTOn4N4Kuu/E3gjIkGwKggsm63OvmbwJoTOQw4h30YMOIhZtyTLfxQfJYvy6UZEzeS4=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776979416; c=relaxed/simple;\n\tbh=7EFFL8rzwwkNs2VFh7UxqjTSTsZEbT6FDog+Mkn6Mnc=;\n\th=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:\n\t To:Cc:Content-Type;\n b=gOVF00QpTGSWwaAlXD7PzyYIS3EpiApTXvKDP46ulvxPL1sW76ecKpH4lRx+ecpR43xBTUg+2soKsNrxMU+pd5YEACN4iUEwFqqLdo5biEO8SWRYCgZkEQdjOWRC8QntSdrYjNl5c4B9qkrA2LhCOfekBtRE4kqcjWVYxcDS0KY=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=google.com;\n spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com;\n dkim=pass (2048-bit key) header.d=google.com header.i=@google.com\n header.b=Sq2TNcpG; arc=none smtp.client-ip=209.85.215.201", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=google.com; s=20251104; t=1776979409; x=1777584209;\n darn=vger.kernel.org;\n h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n :date:from:to:cc:subject:date:message-id:reply-to;\n bh=hfzU9SNjvxnnqDKncwfyemtEYZFu8CMxXPZg5kqrMR0=;\n b=Sq2TNcpGCGiGCFgdGA72+Q/PWdzrkQ6vC1dD7Tv+NEMfhQdJW0cqAXNNBOkIdUp08/\n IucsfPwVoSFCb9VSQKxRz1+1G7zMFK0CLc1+fIOJnfyv9hfpU7eK4StvFM7HGQRiA3pB\n /z84SiYjOh0ejQaGspmV/wAuSGLJwpt6tJVE6Ztd0JmCFUjQGLt3wQPIQ0Al3dNRrou6\n DKRxCBQrn2xnNUkIvLWZmNUy3crfqRKIO/HyB8kh6nVf7zjq4mLbrWLZFjpziTUv/pof\n D2Pc5wQLOexIWr9ma1wcqINFSk2US7xqqye7kq+D0rWYNqsOhj5gnCK20Sk8duPAYAqT\n KARA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776979409; x=1777584209;\n h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=hfzU9SNjvxnnqDKncwfyemtEYZFu8CMxXPZg5kqrMR0=;\n b=mVnDsLBy/RglS+isgcDgyduG4AeTNFAPB71mtqHaVZWPdT2kjyuNIeEnyvlNc62qpr\n BnzEUI7qpDI/R7IuPVmFp8+kHEnLu/glQI6oGGNePzSrG4RG1PX5Yw2/xuDZWyNGadIa\n MDWw6niRg93g50hAODi8eqmnb9R682+SBYZNL9GXCGMiYOhmpWt0gx7A5OEfryLFZ9aL\n RpxgbOumdFeWzykdw2bN4bqVG+ktzWwXFer2dzXvZ5+0+926umr49ssZzGjm93kz9qdc\n 8I2V3huhPX5/TNUuJ5gq1mCdvtdHs/js7WPtCmeB8kkRPPFfklmbVjgW8d7OvDiCxaNX\n gIFg==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ/zs3UWQvdcSC37RfTYUVR7N5hKrWhc4f2FwmJa/JiNj/TWzW/tHQG5qcLrbiIfKlSRigfZ0q7AtWM=@vger.kernel.org", "X-Gm-Message-State": "AOJu0YzU6WS0+sahYqe8YOn5jVr1Nw8O8oQEjymydreXuiQnZFEYA+jj\n\t4JUy/aY0oEytATVgc+Ynox+8NnERPuS+7qGWn43x5fcXpNHpUSoS5//SdKH7Czj0xPmzoUYBY5t\n\tsp6UtaFPYhkcd9Q==", "X-Received": "from pgbcw1.prod.google.com\n ([2002:a05:6a02:4281:b0:c76:8acb:773d])\n (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by\n 2002:a05:6a21:6d9c:b0:3a3:17f8:bedd with SMTP id\n adf61e73a8af0-3a317f8cbb2mr6879688637.17.1776979408708;\n Thu, 23 Apr 2026 14:23:28 -0700 (PDT)", "Date": "Thu, 23 Apr 2026 21:23:09 +0000", "In-Reply-To": "<20260423212316.3431746-1-dmatlack@google.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "Mime-Version": "1.0", "References": "<20260423212316.3431746-1-dmatlack@google.com>", "X-Mailer": "git-send-email 2.54.0.rc2.544.gc7ae2d5bb8-goog", "Message-ID": "<20260423212316.3431746-6-dmatlack@google.com>", "Subject": "[PATCH v4 05/11] PCI: liveupdate: Inherit bus numbers during Live\n Update", "From": "David Matlack <dmatlack@google.com>", "To": "iommu@lists.linux.dev, kexec@lists.infradead.org,\n\tlinux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org,\n\tlinux-pci@vger.kernel.org", "Cc": "Adithya Jayachandran <ajayachandra@nvidia.com>,\n Alexander Graf <graf@amazon.com>,\n\tAlex Williamson <alex@shazbot.org>, Bjorn Helgaas <bhelgaas@google.com>,\n Chris Li <chrisl@kernel.org>,\n\tDavid Matlack <dmatlack@google.com>, David Rientjes <rientjes@google.com>,\n\tJacob Pan <jacob.pan@linux.microsoft.com>, Jason Gunthorpe <jgg@nvidia.com>,\n\tJoerg Roedel <joro@8bytes.org>, Jonathan Corbet <corbet@lwn.net>,\n Josh Hilke <jrhilke@google.com>,\n\tLeon Romanovsky <leonro@nvidia.com>, Lukas Wunner <lukas@wunner.de>,\n Mike Rapoport <rppt@kernel.org>,\n\tParav Pandit <parav@nvidia.com>, Pasha Tatashin <pasha.tatashin@soleen.com>,\n\tPranjal Shrivastava <praan@google.com>, Pratyush Yadav <pratyush@kernel.org>,\n\tRobin Murphy <robin.murphy@arm.com>, Saeed Mahameed <saeedm@nvidia.com>,\n\tSamiullah Khawaja <skhawaja@google.com>,\n Shuah Khan <skhan@linuxfoundation.org>,\n\tWill Deacon <will@kernel.org>, William Tu <witu@nvidia.com>,\n Yi Liu <yi.l.liu@intel.com>", "Content-Type": "text/plain; charset=\"UTF-8\"" }, "content": "Inherit bus numbers from the previous kernel during a Live Update when\none or more PCI devices are being preserved.\n\nDuring a Live Update, preserved devices must be allowed to continue\nperforming memory transactions so the kernel cannot change the fabric\ntopology, including bus numbers, since that would require disabling\nand flushing any memory transactions first.\n\nTo keep things simple, inherit the secondary and subordinate bus numbers\non all bridges if any PCI devices were preserved (i.e. even bridges\nwithout any downstream endpoints that were preserved). This avoids\naccidentally assigning a bridge a new window that overlaps with a\npreserved device that is downstream of a different bridge.\n\nIf a bridge is enumerated with a broken topology or has no bus numbers\nset during a Live Update, refuse to assign it new bus numbers and refuse\nto enumerate devices below it. This is a safety measure to prevent\ntopology conflicts.\n\nRequire that CONFIG_CARDBUS is not enabled to enable\nCONFIG_PCI_LIVEUPDATE since inheriting bus numbers on PCI-to-CardBus\nbridges requires additional work but is not a priority at the moment.\n\nSigned-off-by: David Matlack <dmatlack@google.com>\n---\n .../admin-guide/kernel-parameters.txt | 6 +++-\n drivers/pci/Kconfig | 2 +-\n drivers/pci/liveupdate.c | 28 +++++++++++++++++++\n drivers/pci/probe.c | 21 +++++++++++---\n include/linux/pci.h | 1 +\n 5 files changed, 52 insertions(+), 6 deletions(-)", "diff": "diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt\nindex cf3807641d89..f412a4b77fb7 100644\n--- a/Documentation/admin-guide/kernel-parameters.txt\n+++ b/Documentation/admin-guide/kernel-parameters.txt\n@@ -5156,7 +5156,11 @@ Kernel parameters\n \t\t\t\texplicitly which ones they are.\n \t\tassign-busses\t[X86] Always assign all PCI bus\n \t\t\t\tnumbers ourselves, overriding\n-\t\t\t\twhatever the firmware may have done.\n+\t\t\t\twhatever the firmware may have done. Ignored\n+\t\t\t\tduring a Live Update, where the kernel must\n+\t\t\t\tinherit the PCI topology (including bus numbers)\n+\t\t\t\tto avoid interrupting ongoing memory\n+\t\t\t\ttransactions of preserved devices.\n \t\tusepirqmask\t[X86] Honor the possible IRQ mask stored\n \t\t\t\tin the BIOS $PIR table. This is needed on\n \t\t\t\tsome systems with broken BIOSes, notably\ndiff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig\nindex 08398cbe970c..6ef457ff9d08 100644\n--- a/drivers/pci/Kconfig\n+++ b/drivers/pci/Kconfig\n@@ -330,7 +330,7 @@ config VGA_ARB_MAX_GPUS\n \n config PCI_LIVEUPDATE\n \tbool \"PCI Live Update Support (EXPERIMENTAL)\"\n-\tdepends on PCI && LIVEUPDATE\n+\tdepends on PCI && LIVEUPDATE && !CARDBUS\n \thelp\n \t Enable PCI core support for preserving PCI devices across Live\n \t Update. This, in combination with support in a device's driver,\ndiff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c\nindex c0a30d16d9b8..cf8cff134a75 100644\n--- a/drivers/pci/liveupdate.c\n+++ b/drivers/pci/liveupdate.c\n@@ -93,6 +93,19 @@\n * bound to the correct driver. i.e. The PCI core does not protect against a\n * device getting preserved by driver A in the outgoing kernel and then getting\n * bound to driver B in the incoming kernel.\n+ *\n+ * BDF Stability\n+ * =============\n+ *\n+ * The PCI core guarantees that incoming preserved devices can be identified by\n+ * the same bus, device, and function numbers as prior to kexec. To accomplish\n+ * this, the PCI core always inherits the secondary and subordinate bus numbers\n+ * assigned to bridges during enumeration, rather than assigning new ones (the\n+ * PCI core assumes that the previous kernel established a sane topology).\n+ *\n+ * If a misconfigured or unconfigured bridge is encountered during enumeration\n+ * while there are incoming preserved devices, it's secondary and subordinate\n+ * bus numbers will be cleared and devices below it will not be enumerated.\n */\n \n #define pr_fmt(fmt) \"PCI: liveupdate: \" fmt\n@@ -354,6 +367,21 @@ void pci_liveupdate_setup_device(struct pci_dev *dev)\n \tif (!xa)\n \t\treturn;\n \n+\t/*\n+\t * During a Live Update, preserved devices are allowed to continue\n+\t * performing memory transactions. The kernel must not change the fabric\n+\t * topology, including bus numbers, since that would require disabling\n+\t * and flushing any memory transactions first.\n+\t *\n+\t * To keep things simple, inherit the secondary and subordinate bus\n+\t * numbers on _all_ bridges if _any_ PCI devices were preserved (i.e.\n+\t * even bridges without any downstream endpoints that were preserved).\n+\t * This avoids accidentally assigning a bridge a new window that\n+\t * overlaps with a preserved device that is downstream of a different\n+\t * bridge.\n+\t */\n+\tdev->liveupdate_inherit_buses = true;\n+\n \tkey = pci_ser_xa_key(pci_domain_nr(dev->bus), pci_dev_id(dev));\n \tdev_ser = xa_load(xa, key);\n \ndiff --git a/drivers/pci/probe.c b/drivers/pci/probe.c\nindex 938a28e4a7a0..fa26f4170add 100644\n--- a/drivers/pci/probe.c\n+++ b/drivers/pci/probe.c\n@@ -1374,6 +1374,14 @@ bool pci_ea_fixed_busnrs(struct pci_dev *dev, u8 *sec, u8 *sub)\n \treturn true;\n }\n \n+static bool pci_should_assign_new_buses(struct pci_dev *dev)\n+{\n+\tif (dev->liveupdate_inherit_buses)\n+\t\treturn false;\n+\n+\treturn pcibios_assign_all_busses();\n+}\n+\n /*\n * pci_scan_bridge_extend() - Scan buses behind a bridge\n * @bus: Parent bus the bridge is on\n@@ -1401,6 +1409,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,\n \t\t\t\t int max, unsigned int available_buses,\n \t\t\t\t int pass)\n {\n+\tconst bool assign_new_buses = pci_should_assign_new_buses(dev);\n \tstruct pci_bus *child;\n \tu32 buses;\n \tu16 bctl;\n@@ -1453,8 +1462,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,\n \t\tgoto out;\n \t}\n \n-\tif ((secondary || subordinate) &&\n-\t !pcibios_assign_all_busses() && !broken) {\n+\tif ((secondary || subordinate) && !assign_new_buses && !broken) {\n \t\tunsigned int cmax, buses;\n \n \t\t/*\n@@ -1496,8 +1504,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,\n \t\t * do in the second pass.\n \t\t */\n \t\tif (!pass) {\n-\t\t\tif (pcibios_assign_all_busses() || broken)\n-\n+\t\t\tif (assign_new_buses || broken)\n \t\t\t\t/*\n \t\t\t\t * Temporarily disable forwarding of the\n \t\t\t\t * configuration cycles on all bridges in\n@@ -1511,6 +1518,12 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,\n \t\t\tgoto out;\n \t\t}\n \n+\t\tif (dev->liveupdate_inherit_buses) {\n+\t\t\tpci_err(dev, \"Cannot reconfigure bridge during Live Update!\\n\");\n+\t\t\tpci_err(dev, \"Downstream devices will not be enumerated!\\n\");\n+\t\t\tgoto out;\n+\t\t}\n+\n \t\t/* Clear errors */\n \t\tpci_write_config_word(dev, PCI_STATUS, 0xffff);\n \ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex dd6b26ca9462..9a602b322e3c 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -511,6 +511,7 @@ struct pci_dev {\n \tunsigned int\trom_bar_overlap:1;\t/* ROM BAR disable broken */\n \tunsigned int\trom_attr_enabled:1;\t/* Display of ROM attribute enabled? */\n \tunsigned int\tnon_mappable_bars:1;\t/* BARs can't be mapped to user-space */\n+\tunsigned int\tliveupdate_inherit_buses:1; /* Inherit bus numbers due to Live Update */\n \tpci_dev_flags_t dev_flags;\n \tatomic_t\tenable_cnt;\t/* pci_enable_device has been called */\n \n", "prefixes": [ "v4", "05/11" ] }