Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2227519/?format=api
{ "id": 2227519, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2227519/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260423212316.3431746-3-dmatlack@google.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.1/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 }, "msgid": "<20260423212316.3431746-3-dmatlack@google.com>", "date": "2026-04-23T21:23:06", "name": "[v4,02/11] PCI: liveupdate: Track outgoing preserved PCI devices", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6f868cdf40ae96119780f22c9ae5af7f04fcd2ff", "submitter": { "id": 69449, "url": "http://patchwork.ozlabs.org/api/1.1/people/69449/?format=api", "name": "David Matlack", "email": "dmatlack@google.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260423212316.3431746-3-dmatlack@google.com/mbox/", "series": [ { "id": 501248, "url": "http://patchwork.ozlabs.org/api/1.1/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/2227519/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227519/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-53068-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=ZXw1eTm1;\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-53068-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=\"ZXw1eTm1\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.202", "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 4g1pxK3pCXz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 07:23:49 +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 6E570301CDB3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 21:23:41 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 913FB3BADBA;\n\tThu, 23 Apr 2026 21:23:30 +0000 (UTC)", "from mail-pl1-f202.google.com (mail-pl1-f202.google.com\n [209.85.214.202])\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 C16263AEF2E\n\tfor <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 21:23:24 +0000 (UTC)", "by mail-pl1-f202.google.com with SMTP id\n d9443c01a7336-2b2ecc96a9aso63416155ad.1\n for <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 14:23:24 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776979409; cv=none;\n b=HegJsWmJsbrMgPgyPSTY0ouG6qNtI20P+hcPyQCHKaQTnb3eD/BmOAWhzwar2hSFmncg62WXK4eKDZIOCwLFzCJyrZR9hMcMQpiVtE9TUoAB0G4REV/KzRkdYMFzpirYzL302dn71d1Shi6o/rFiNtgRd69G5fSWM2cun6sVNmQ=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776979409; c=relaxed/simple;\n\tbh=wvsl+lqCx3435FNXLJ3KqBDnB6oUV04ymFGLbModbqM=;\n\th=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:\n\t To:Cc:Content-Type;\n b=IcVRQMkdg1DyStEdN226BKsjT7iCiKaR3M7He/LFFE14RCJQmxeUH13eANLyILQz3UCk/PweynfeVgi1fv0dshMWBXqRjAT9TmXr2lYZrdlA4RSL3RxWAUJiUPgumoOQNzi468AdJUwO1MNjnaFTOwDvXx8c66SUUTnvlAkSlO8=", "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=ZXw1eTm1; arc=none smtp.client-ip=209.85.214.202", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=google.com; s=20251104; t=1776979403; x=1777584203;\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=LW56WQ/GxI9kfbfGRUP82x0Orz5k50krThArcWSM6yc=;\n b=ZXw1eTm1GkaSUJBpbeGOgR1rZBpPCCkIVCDrclpF6t26EmHwoJvyeOcm0aPN59CRtd\n WmqKhLD8ZGBCx2PSAPOrVXLSo6D26/VXcW8/iNOmuyk5/12Jvc9ntaeEJnSLjPV6lw7s\n CjEHNPdws/jhhgE9CSRkS5xOA1EU1Y6FlqCjly5wsO/Hbn7ff/+1ZQ+QWLqsVqrXHxmJ\n f4AeRP8AHjcJ6vAW23FRHyP270+MHrlrVfSjlUWRpsZhmqFeQgKWslIw4XzVwScUqnDw\n enAKqFyyCykwQCm5uwS5A9y+RijlUbVKPW/bGYphbTcnikkMwzgLbsQgVPYi4IwhALfd\n NSIA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776979403; x=1777584203;\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=LW56WQ/GxI9kfbfGRUP82x0Orz5k50krThArcWSM6yc=;\n b=RgysmYRjrGRGuB3DHUhQZhSnhsQ7n5PeDV8JVos15SHb7fc4SUY5J4dvetVF1Sw5jy\n zb00j1BfARx8xRcpRll/ru3lFz8Fyeidshe2qPoIGTVCgogkx/JaWCaSth/ZrjF51JKP\n afgDK8JrnvGwQNahrj8pGcfo+5oBNCyB1cug4Ap+hzhBraEjZiXY2UZwos6Dh0+qhVOw\n O6YjcXHvWpjZf3bnQn6nafxwYRbH1CaISGrD7p02ULBuBBCFoEz8YzxtCfhQ2Dee9FRX\n F4eLfIbKhlm3H+TGx/x1R1RvL5i2lRQb9zbT7exAhn+umtz3FWPGDfR28I+8+XKRkXJ3\n TomQ==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ/uA1wA3Ymg6KK4tJ789z0pBzd/ERzHPh7qhh2fbQBfsogCo64G4JYa7akBDVXKYzQ698wnXChjnSc=@vger.kernel.org", "X-Gm-Message-State": "AOJu0Yy+xoxBk6nqqY83oOOGfc4X0XII7Vi/63DZHF6oSZ8YZ6yAyGCu\n\tmjNtbgD2kUJn9FCb8xRAxDGVz9f5a4nMWJPeddRRJX7s6x+Z4dygej4JYMxWuD7Mjxpb2Zdv1JN\n\tSM2MJSy4BoYW0EA==", "X-Received": "from plai2.prod.google.com ([2002:a17:902:c942:b0:2b3:2649:c9c1])\n (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by\n 2002:a17:902:930b:b0:2b2:67ca:5fff with SMTP id\n d9443c01a7336-2b5f9fd24b7mr208541215ad.28.1776979403289;\n Thu, 23 Apr 2026 14:23:23 -0700 (PDT)", "Date": "Thu, 23 Apr 2026 21:23:06 +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-3-dmatlack@google.com>", "Subject": "[PATCH v4 02/11] PCI: liveupdate: Track outgoing preserved PCI\n devices", "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": "Add APIs to allow drivers to notify the PCI core of which devices are\nbeing preserved across a Live Update for the next kernel, i.e.\n\"outgoing\" devices.\n\nDrivers must notify the PCI core when devices are preserved so that the\nPCI core can update its FLB data (struct pci_ser) and track the list of\noutgoing devices. pci_liveupdate_preserve() notifies the PCI core that a\ndevice must be preserved across Live Update. pci_liveupdate_unpreserve()\nreverses this (cancels the preservation of the device).\n\nThis tracking ensures the PCI core is fully aware of which devices may\nneed special handling during shutdown and kexec, and so that it can be\nhanded off to the next kernel.\n\nSigned-off-by: David Matlack <dmatlack@google.com>\n---\n drivers/pci/liveupdate.c | 101 ++++++++++++++++++++++++++++++++++++\n include/linux/kho/abi/pci.h | 7 +--\n include/linux/pci.h | 26 ++++++++++\n 3 files changed, 131 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c\nindex d4fa61625d56..2dd8daa2f17c 100644\n--- a/drivers/pci/liveupdate.c\n+++ b/drivers/pci/liveupdate.c\n@@ -43,6 +43,26 @@\n *\n * * ``pci_liveupdate_register_flb(driver_file_handler)``\n * * ``pci_liveupdate_unregister_flb(driver_file_handler)``\n+ *\n+ * Device Tracking\n+ * ===============\n+ *\n+ * Drivers must notify the PCI core when specific devices are preserved or\n+ * unpreserved with the following APIs:\n+ *\n+ * * ``pci_liveupdate_preserve(pci_dev)``\n+ * * ``pci_liveupdate_unpreserve(pci_dev)``\n+ *\n+ * This allows the PCI core to keep it's FLB data (struct pci_ser) up to date\n+ * with the list of **outgoing** preserved devices for the next kernel.\n+ *\n+ * Restrictions\n+ * ============\n+ *\n+ * The PCI core enforces the following restrictions on which devices can be\n+ * preserved. These may be relaxed in the future:\n+ *\n+ * * The device cannot be a Virtual Function (VF).\n */\n \n #define pr_fmt(fmt) \"PCI: liveupdate: \" fmt\n@@ -57,6 +77,8 @@\n #include <linux/pci.h>\n #include <linux/sort.h>\n \n+static DEFINE_MUTEX(pci_flb_outgoing_lock);\n+\n static int pci_flb_preserve(struct liveupdate_flb_op_args *args)\n {\n \tstruct pci_dev *dev = NULL;\n@@ -124,6 +146,85 @@ static struct liveupdate_flb pci_liveupdate_flb = {\n \t.compatible = PCI_LUO_FLB_COMPATIBLE,\n };\n \n+int pci_liveupdate_preserve(struct pci_dev *dev)\n+{\n+\tstruct pci_ser *ser;\n+\tint i, ret;\n+\n+\tguard(mutex)(&pci_flb_outgoing_lock);\n+\n+\tret = liveupdate_flb_get_outgoing(&pci_liveupdate_flb, (void **)&ser);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (!ser)\n+\t\treturn -ENOENT;\n+\n+\tif (dev->is_virtfn)\n+\t\treturn -EINVAL;\n+\n+\tif (dev->liveupdate_outgoing)\n+\t\treturn -EBUSY;\n+\n+\tif (ser->nr_devices == ser->max_nr_devices)\n+\t\treturn -ENOSPC;\n+\n+\tfor (i = 0; i < ser->max_nr_devices; i++) {\n+\t\t/*\n+\t\t * Start searching at index ser->nr_devices. This should result\n+\t\t * in a constant time search under expected conditions (devices\n+\t\t * are not getting unpreserved).\n+\t\t */\n+\t\tint index = (ser->nr_devices + i) % ser->max_nr_devices;\n+\t\tstruct pci_dev_ser *dev_ser = &ser->devices[index];\n+\n+\t\tif (dev_ser->refcount)\n+\t\t\tcontinue;\n+\n+\t\tpci_info(dev, \"Device will be preserved across next Live Update\\n\");\n+\t\tser->nr_devices++;\n+\n+\t\tdev_ser->domain = pci_domain_nr(dev->bus);\n+\t\tdev_ser->bdf = pci_dev_id(dev);\n+\t\tdev_ser->refcount = 1;\n+\n+\t\tdev->liveupdate_outgoing = dev_ser;\n+\t\treturn 0;\n+\t}\n+\n+\treturn -ENOSPC;\n+}\n+EXPORT_SYMBOL_GPL(pci_liveupdate_preserve);\n+\n+void pci_liveupdate_unpreserve(struct pci_dev *dev)\n+{\n+\tstruct pci_dev_ser *dev_ser;\n+\tstruct pci_ser *ser = NULL;\n+\tint ret;\n+\n+\tguard(mutex)(&pci_flb_outgoing_lock);\n+\n+\tret = liveupdate_flb_get_outgoing(&pci_liveupdate_flb, (void **)&ser);\n+\n+\tif (ret || !ser) {\n+\t\tpci_warn(dev, \"Cannot unpreserve device without outgoing Live Update state\\n\");\n+\t\treturn;\n+\n+\t}\n+\n+\tdev_ser = dev->liveupdate_outgoing;\n+\tif (!dev_ser) {\n+\t\tpci_warn(dev, \"Cannot unpreserve device that is not preserved\\n\");\n+\t\treturn;\n+\t}\n+\n+\tpci_info(dev, \"Device will no longer be preserved across next Live Update\\n\");\n+\tser->nr_devices--;\n+\tmemset(dev_ser, 0, sizeof(*dev_ser));\n+\tdev->liveupdate_outgoing = NULL;\n+}\n+EXPORT_SYMBOL_GPL(pci_liveupdate_unpreserve);\n+\n int pci_liveupdate_register_flb(struct liveupdate_file_handler *fh)\n {\n \tpr_debug(\"Registering file handler \\\"%s\\\"\\n\", fh->compatible);\ndiff --git a/include/linux/kho/abi/pci.h b/include/linux/kho/abi/pci.h\nindex 5c0e92588c00..5b4c8d9e462c 100644\n--- a/include/linux/kho/abi/pci.h\n+++ b/include/linux/kho/abi/pci.h\n@@ -23,19 +23,20 @@\n * incrementing the version number in the PCI_LUO_FLB_COMPATIBLE string.\n */\n \n-#define PCI_LUO_FLB_COMPATIBLE \"pci-v1\"\n+#define PCI_LUO_FLB_COMPATIBLE \"pci-v2\"\n \n /**\n * struct pci_dev_ser - Serialized state about a single PCI device.\n *\n * @domain: The device's PCI domain number (segment).\n * @bdf: The device's PCI bus, device, and function number.\n- * @reserved: Reserved (to naturally align struct pci_dev_ser).\n+ * @refcount: Reference count used by the PCI core to keep track of whether it\n+ * is done using a device's struct pci_dev_ser.\n */\n struct pci_dev_ser {\n \tu32 domain;\n \tu16 bdf;\n-\tu16 reserved;\n+\tu16 refcount;\n } __packed;\n \n /**\ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex d70080babd52..eb94cbd8ab9d 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -41,6 +41,7 @@\n #include <linux/msi_api.h>\n #include <uapi/linux/pci.h>\n #include <linux/liveupdate.h>\n+#include <linux/kho/abi/pci.h>\n \n #include <linux/pci_ids.h>\n \n@@ -594,6 +595,9 @@ struct pci_dev {\n \tu8\t\ttph_mode;\t/* TPH mode */\n \tu8\t\ttph_req_type;\t/* TPH requester type */\n #endif\n+#ifdef CONFIG_PCI_LIVEUPDATE\n+\tstruct pci_dev_ser *liveupdate_outgoing; /* State preserved for next kernel */\n+#endif\n };\n \n static inline struct pci_dev *pci_physfn(struct pci_dev *dev)\n@@ -2880,6 +2884,14 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type);\n #ifdef CONFIG_PCI_LIVEUPDATE\n int pci_liveupdate_register_flb(struct liveupdate_file_handler *fh);\n void pci_liveupdate_unregister_flb(struct liveupdate_file_handler *fh);\n+\n+int pci_liveupdate_preserve(struct pci_dev *dev);\n+void pci_liveupdate_unpreserve(struct pci_dev *dev);\n+\n+static inline struct pci_dev_ser *pci_liveupdate_outgoing(struct pci_dev *dev)\n+{\n+\treturn dev->liveupdate_outgoing;\n+}\n #else\n static inline int pci_liveupdate_register_flb(struct liveupdate_file_handler *fh)\n {\n@@ -2889,6 +2901,20 @@ static inline int pci_liveupdate_register_flb(struct liveupdate_file_handler *fh\n static inline void pci_liveupdate_unregister_flb(struct liveupdate_file_handler *fh)\n {\n }\n+\n+static inline int pci_liveupdate_preserve(struct pci_dev *dev)\n+{\n+\treturn -EOPNOTSUPP;\n+}\n+\n+static inline void pci_liveupdate_unpreserve(struct pci_dev *dev)\n+{\n+}\n+\n+static inline struct pci_dev_ser *pci_liveupdate_outgoing(struct pci_dev *dev)\n+{\n+\treturn NULL;\n+}\n #endif\n \n #endif /* LINUX_PCI_H */\n", "prefixes": [ "v4", "02/11" ] }