{"id":2227516,"url":"http://patchwork.ozlabs.org/api/1.1/covers/2227516/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/cover/20260423212242.3431136-1-dmatlack@google.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.1/projects/28/?format=json","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":"<20260423212242.3431136-1-dmatlack@google.com>","date":"2026-04-23T21:22:31","name":"[v4,00/11] PCI: liveupdate: PCI core support for Live Update","submitter":{"id":69449,"url":"http://patchwork.ozlabs.org/api/1.1/people/69449/?format=json","name":"David Matlack","email":"dmatlack@google.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-pci/cover/20260423212242.3431136-1-dmatlack@google.com/mbox/","series":[{"id":501247,"url":"http://patchwork.ozlabs.org/api/1.1/series/501247/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=501247","date":"2026-04-23T21:22:31","name":"PCI: liveupdate: PCI core support for Live Update","version":4,"mbox":"http://patchwork.ozlabs.org/series/501247/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2227516/comments/","headers":{"Return-Path":"\n <linux-pci+bounces-53066-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=mbdpiwSs;\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-53066-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=\"mbdpiwSs\"","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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1pwF4Kz3z1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 07:22:53 +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 130F5301945A\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 21:22:51 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 55CAC3BC68A;\n\tThu, 23 Apr 2026 21:22:48 +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 BF8143BD648\n\tfor <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 21:22:44 +0000 (UTC)","by mail-pl1-f202.google.com with SMTP id\n d9443c01a7336-2b461b36990so76308595ad.3\n        for <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 14:22:44 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776979367; cv=none;\n b=Uc1YzhIBzqHDk+WoXks99rZyYPuq3LNPw6rn26fcvsY0kC6U6Gs8gpHXp9l7gVrFB+sk8E5/Efm2OZJlb0klxLCb91kg46XijHzleEQOTCnC1Syhc5Y116g8cxSTuA+jejkl8Hw7Oop3j8kVeUByH3QI3j8yF4Qbvm9j44D6KxY=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776979367; c=relaxed/simple;\n\tbh=VEr3YGdqak3FVQ9/ao+xXZ+w5i00Ao9Ssj4jC1ZGrN4=;\n\th=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type;\n b=SNdHImCloQ3NAJ2814WAaPljjyrgV0B/vC+sXVJl5rWRurmoCl6LCkLnYdygAOhl1hiVGTjIAPNA+Z0R4diX33IeSI6ye7d5OXLxlweb2hvZ+tBTn1KC23crdlhxPN7mKedSN5N0mEoN+z2s3cT6fRMpdfeg/LupTAbkkkfRV7M=","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=mbdpiwSs; 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=1776979364; x=1777584164;\n darn=vger.kernel.org;\n        h=to:from:subject:message-id:mime-version:date:from:to:cc:subject\n         :date:message-id:reply-to;\n        bh=kl+pv05082o4iUYPTAspfzDZexWtIImSBuw1JtCkgoE=;\n        b=mbdpiwSsOjUrW5IGSArA8vhCsSEPPwz2w+bbEWubZTO96PjGKHHS5tMk5qhx652vy6\n         +awzGC6QYXoiKEy35HALvsrTZ/vVlQiEzQHSBIl3IWjUMJ1JieM9EC/kNtUZ8XDtbD/h\n         aqbTKe7/kqhyarZfTJTVM7vO+SD1uwLNLfTH8Sr50+aMHJtTvW3EAtOrmNEE9IZuetBh\n         /oZIXW7tuOe//zpx2YeccBk1FwckkFk37JYnTgTWdFcvVZYNx5oBphjWv44q6rSfN3uZ\n         28jC2Fc4/nupjzq5lk9ZL4gzkKCqY9IgCUfqgh31qC2rvAoe2jpoKWs4lzzy68DJ2Qs5\n         hfKg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776979364; x=1777584164;\n        h=to:from:subject:message-id:mime-version:date:x-gm-message-state\n         :from:to:cc:subject:date:message-id:reply-to;\n        bh=kl+pv05082o4iUYPTAspfzDZexWtIImSBuw1JtCkgoE=;\n        b=cXV3WuDbYsV4T/GbtkAWzh0ULHlcf1RYqwxlhjackN+nBF55QgBs205z8wqPcyf3RK\n         8v9FGHDBhWVRoOknLC17nf3Lrto58/XhlesRiaduzTAFzeLXR6A5Qku8gSGHOBixQbGC\n         r9Jk/jMqwS8RGKZhBO5GFQ4++3PEuOolPoVJ40RkS9xFnWfsxaTqWzgwdq+9uTf/tlFa\n         EB9nvuCNmT/qtPZMENF7+Q2SdxliglqwOvGaFRPDTo8Ha1oUdLVeJ6Rdk52FCazOUnRK\n         YyaTmLzXTMmGz6e+M4JJMKF0vOW14B7RvDaRZAJeF4EZ0AkVPZKOLxzN9isptVyJEIs9\n         oCBw==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9lG/HC+t/ctM+SJxLus9cvfNWKnNz4ArML+cOD970jDYmYf4R3wgsv+BaITY+B+mflSVTyKfO3ACM=@vger.kernel.org","X-Gm-Message-State":"AOJu0YySlI7gnnWldkcWNvakKGOt7YP8hgi4tATA5xNNTe5FVgfRbTLV\n\tzsKiDxm6/9UcqFfHHQEICUk8YoiCmw6AdJH+c2xnbgVrGNRFgGKJEGavZY4bP6uvRO5a855HFsK\n\tbAqh72v6lanZwMQ==","X-Received":"from plnx22.prod.google.com ([2002:a17:902:8216:b0:2ae:ce70:7c80])\n (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by\n 2002:a17:902:7d8c:b0:2b4:604c:ec6f with SMTP id\n d9443c01a7336-2b5f9f86840mr213628685ad.32.1776979363647;\n Thu, 23 Apr 2026 14:22:43 -0700 (PDT)","Date":"Thu, 23 Apr 2026 21:22:31 +0000","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","X-Mailer":"git-send-email 2.54.0.rc2.544.gc7ae2d5bb8-goog","Message-ID":"<20260423212242.3431136-1-dmatlack@google.com>","Subject":"[PATCH v4 00/11] PCI: liveupdate: PCI core support for Live Update","From":"David Matlack <dmatlack@google.com>","To":"dmatlack@google.com, 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","Content-Type":"text/plain; charset=\"UTF-8\""},"content":"This series can be found on GitHub:\n\n  https://github.com/dmatlack/linux/tree/liveupdate/pci/base/v4\n\nThis patch series introduces support in the PCI core for Live Update,\nenabling drivers to preserve PCI devices across a kexec-based kernel\nupdate without interrupting the device. This functionality is critical\nfor minimizing downtime in environments where PCI devices (e.g., those\nassigned to VMs via VFIO) must continue operating or maintain state\nacross a host kernel upgrade.\n\nThis series was split off from the the VFIO driver series [1] to enable\nmore rapid iteration on the PCI core changes, add breathing room to\nsplit changes into smaller patches, and add some more functionality.\n\nSeries Overview\n---------------\n\nThis series implements the following to support PCI device preservation\nacross Live Update:\n\n  1. Set up a File-Lifecycle-Bound (FLB) handler to track and preserve\n     PCI-specific state (struct pci_ser) across Live Update using Kexec\n     Handover (KHO).\n\n  2. Add APIs for drivers to register \"outgoing\" devices for\n     preservation and for the PCI core to identify \"incoming\" preserved\n     devices during enumeration.\n\n  3. Automatically preserve all upstream bridges for any preserved\n     endpoint. Use reference counting to ensure bridges remain preserved\n     as long as any downstream device is preserved.\n\n  4. Inherit secondary/subordinate bus numbers, ARI Forwarding Enable,\n     and Access Control Services (ACS) flags from the previous kernel to\n     ensure a stable routing fabric and consistent IOMMU group\n     assignments during Live Update.\n\n  5. Restrict preservation to devices in immutable singleton IOMMU\n     groups. Require that all upstream bridges have the necessary ACS\n     features enabled to prevent IOMMU group changes across the update.\n\n  6. Modify the PCI shutdown path to avoid disabling bus mastering on\n     preserved devices and their upstream bridges, allowing memory\n     transactions to continue uninterrupted.\n\n  7. Provide comprehensive documentation for the FLB API, device\n     tracking mechanisms, and the division of responsibilities between\n     the PCI core, drivers, and userspace.\n\nThis series could be simplified down to fewer patches by limiting\npreservation support to only devices on a root bus. Supporting devices\ndownstream of bridges could be split off into a follow-up series.\nHowever since I got bridge preservation working and the series was less\nthan 15 patches I opted to include it for now.\n\nDependencies\n------------\n\nThis series depends on 2 LUO patches to enable refcounting of the\nincoming FLB so that it is safe for the PCI core to use\nliveupdate_flb_get_incoming() during enumeration.\n\n  https://lore.kernel.org/lkml/20260423174032.3140399-1-dmatlack@google.com/\n\nVFIO support for PCI device preservation is built on top of this series.\nThe following branch on GitHub contains all the patches together to\nenable testing (the LUO FLB changes, this series, and the VFIO patches):\n\n  https://github.com/dmatlack/linux/tree/liveupdate/pci/base/v4-with-vfio\n\nTesting\n-------\n\nThis series was tested in combination with the VFIO patches mentioned in\nthe previous section using the the new VFIO selftests:\n\n  - vfio_pci_liveupdate_uapi_test\n  - vfio_pci_liveupdate_kexec_test\n\nBoth tests were ran in ran in a QEMU-based VM environment, using a\nsingle virtio-net PCIe device behind a PCI-to-PCI bridge as the test\ndevice, and in a baremetal environment on an Intel EMR server, using 8x\nIntel DSA PCIe devices (each on a host bridge).\n\nFuture Work\n-----------\n\nAfter this series we expect to make further improvements to the PCI core\nsupport for Live Update. Once these are done we plan to drop the\n\"experimental\" verbiage from PCI_LIVEUPDATE Kconfig help message and\ndocumentation.\n\n  - Ensure bridges with downstream preserved devices stay in D0 across\n    Live Update in case preserved endpoints are doing memory\n    transactions.\n  - Preserve BARs of all preserved devices to avoid disrupting P2P\n\nBeyond that we also plan to add support for preserving Virtual Functions\nsince that is a major use-case for Cloud environments. This will require\nkeeping SR-IOV enabled on the partent PF across a Live Update.\n\nChangelog\n---------\n\nv4:\n\n Enhancements on top of previous series:\n\n - Split \"PCI: Add API to track PCI devices preserved across Live\n   Update\" from v3 into 4 separate commits to make reviewing easier (FLB\n   setup, outgoing device tracking, incoming device tracking, and\n   documentation for driver binding)\n - Use new incoming FLB refcounting to avoid use-after-free bugs during\n   enumeration\n - Use an xarray to speed up looking up of incoming preserved devices\n   during enumeration\n - Use a per-device bit to indicate when secondary and subordinate bus\n   numbers should be inherited on bridges instead of global data to\n   avoid races between the 2 passes\n - Inherit ARI enablement across Live Update\n - Automatically preserve bridges upstream of preserved endpoints so\n   so that ACS flags, ARI enablement, and bus mastering can be kept\n   constant on bridges across Live Update\n - Avoid clearing bus mastering during shutdown on outgoing preserved\n   device to avoid disrupting memory transcations being performed by\n   preserved devices\n - Add a MAINTAINERS entry for the new files to support Live Update in\n   the PCI core\n - Add info and debug level logging for various events throughout device\n   preservation\n\n Changes based on review feedback on v3:\n\n - Fix up typos, wording, documentation gaps, and code style (Bjorn)\n - Use pci_WARN_ONCE() where possible (Bjorn)\n - Require ACS flags to preserve devices behind bridges so that\n   singleton IOMMU group topology is guaranteed to remain across Live\n   Update (Yi)\n - Preserve ACS flags (Jason, Alex)\n\nv3: https://lore.kernel.org/kvm/20260323235817.1960573-1-dmatlack@google.com/\n\nv2: https://lore.kernel.org/kvm/20260129212510.967611-1-dmatlack@google.com/\n\nv1: https://lore.kernel.org/kvm/20251126193608.2678510-1-dmatlack@google.com/\n\nrfc: https://lore.kernel.org/kvm/20251018000713.677779-1-vipinsh@google.com/\n\n\n[1] https://lore.kernel.org/kvm/20260323235817.1960573-1-dmatlack@google.com/\n\nDavid Matlack (11):\n  PCI: liveupdate: Set up FLB handler for the PCI core\n  PCI: liveupdate: Track outgoing preserved PCI devices\n  PCI: liveupdate: Track incoming preserved PCI devices\n  PCI: liveupdate: Document driver binding responsibilities\n  PCI: liveupdate: Inherit bus numbers during Live Update\n  PCI: liveupdate: Auto-preserve upstream bridges across Live Update\n  PCI: liveupdate: Inherit ACS flags in incoming preserved devices\n  PCI: liveupdate: Require preserved devices are in immutable singleton\n    IOMMU groups\n  PCI: liveupdate: Inherit ARI Forwarding Enable on preserved bridges\n  PCI: liveupdate: Do not disable bus mastering on preserved devices\n    during kexec\n  Documentation: PCI: Add documentation for Live Update\n\n Documentation/PCI/index.rst                   |   1 +\n Documentation/PCI/liveupdate.rst              |  23 +\n .../admin-guide/kernel-parameters.txt         |   6 +-\n Documentation/core-api/liveupdate.rst         |   1 +\n MAINTAINERS                                   |  13 +\n drivers/iommu/iommu.c                         |  35 ++\n drivers/pci/Kconfig                           |  14 +\n drivers/pci/Makefile                          |   1 +\n drivers/pci/liveupdate.c                      | 562 ++++++++++++++++++\n drivers/pci/pci-driver.c                      |  31 +-\n drivers/pci/pci.c                             |  22 +-\n drivers/pci/pci.h                             |  13 +\n drivers/pci/probe.c                           |  25 +-\n include/linux/iommu.h                         |   7 +\n include/linux/kho/abi/pci.h                   |  62 ++\n include/linux/pci.h                           |  58 ++\n 16 files changed, 858 insertions(+), 16 deletions(-)\n create mode 100644 Documentation/PCI/liveupdate.rst\n create mode 100644 drivers/pci/liveupdate.c\n create mode 100644 include/linux/kho/abi/pci.h\n\n\nbase-commit: a13f7eb5b2d5bef886659768680093bec1c0470d"}