From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69474606A32E for ; Wed, 2 Dec 2026 00:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bksoAhIr; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=CRXwg5iz; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Lo9UAp92 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Unsubscribe-Post:List-Owner; bh=vHMT2cgmMOD1udaDUwHhe1V6x5Ste6W5x2m4Xsl4qN8=; b=bksoAhIrSMJU+tei9g5ctMfdHH pqN4dKjpIQInmIvHjzNW2d3e60015RBUB35bJpzslWpSUj3V9ZGxzdY7gHnIE8HvMeP02xUXL2Bic RX65jrk7T6D8/k7dCxw4hX3Ii/WO7vRBb3sjULjDzDHP5HzE/QVuJrh9bdnbm4GYXiqwR+84/XWjR gkXrJH428g46qM792kYKVAm8eGZRgI03s19LVOBdXx2pqEC6hes/wtIctgHp8IcgNTwRifuE/Ro5x Aj0CeXLmxqKhCWupIpZpOBYaCaGbN32yYNBVBnQyRfQSvigVHrlJ5/BUaII6lwv7zjVkXHTw1nwB/ Ww8TpQqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOV-00000009mRI-3n2z; Wed, 02 Dec 2026 00:40:23 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOO-00000009m7W-2hj8 for linux-riscv@bombadil.infradead.org; Wed, 02 Dec 2026 00:40:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: Message-ID:References:Mime-Version:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bd+HvVQtnsLSkOpb9xsNUpo6bGcW9+ZavNP3z2AVSB4=; b=CRXwg5iz05s2T5XfbARMszcALj WjohSgfWiOgan94iqJHkt591J4vZLVkCfV/gZx8gQNWCY8lE9H4ftqgVXmczkUcdUbmNeYUMcvfbU 7xQdTBBS8jzs8CHMHf02TmUkZIwwg2trEsSdldETlsHR7ZcRopAwQWHuc81jkM69mDhbKt9U0Cs/I jmgz5/xHk/dyb3sVSWPZc+q/97X+t3QVVgUsr0AOiKj667WSCq+RF3dg75aVttSAOjZmHWewFypKR 87+oeQskwg49cPAfd8J0cGvJpnmaTA51Xt/G1JVAY+8rNcE5vHRrXZpi06zd+xcBAJfQBCzg+JUU/ 7th8CXUA==; Received: from mail-oi1-x246.google.com ([2607:f8b0:4864:20::246]) by casper.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOK-0000000HKeg-3kBM for linux-riscv@lists.infradead.org; Wed, 02 Dec 2026 00:40:15 +0000 Received: by mail-oi1-x246.google.com with SMTP id 5614622812f47-4ab4f652f9bso8166190b6e.0 for ; Tue, 01 Dec 2026 16:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172010; x=1796776810; darn=lists.infradead.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=bd+HvVQtnsLSkOpb9xsNUpo6bGcW9+ZavNP3z2AVSB4=; b=Lo9UAp92TrtHpZb4K8E6HnVdO17JA+AjFT4g5TDYjeOoK9Oljk1/Gi66FSwwdaJtk8 tELef/9M1UCm9oBonUPgAJF0DTiKvbH07M/XRsnh86W5uDdgp8mtbnGEjbshngIENMyR 9qFkdrbnzNv6kMG3bq/95H51dI91LVQyE13cpYkuUggQuzEMeybpdAx0zHTiYpxuzZi1 vUj8mYm3nzfQ0rrh1ve9ae8HzoMKGGq66YN3VUdVxWlFmEb3HPCx8CbGxWcOWjPomuPm zTirmiUCODpaJKjf+vNoMv+44iaDpoQrNNSL8idPjbzauWG57y7mI/s2grB6DqkoTSbY aw8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172010; x=1796776810; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bd+HvVQtnsLSkOpb9xsNUpo6bGcW9+ZavNP3z2AVSB4=; b=u+nWqkq8F2xU7fMWhX9Ckz4PVF3+jxLgkXishwTSjXPnPeWs946JdSlOJEtdXuIwmW +2YY69oqXY/Ln1NEgnU2J41O6wxPwezZpFcuT4ZgxESX5fGUhB4osvxeePHrikEGf1yj Ge05ZkckyGpJv5PY2qhTuXZV93UwImc7c4eO1kLii2nr+t64QQTwLYHwuh+YagcBt7eu KZHJxgvEwHThvgR1ZxMC/1Mhfds8GwthKuZLIDMlaDQI1iYupX44gVFlWNEyphNinxHw nmO0Aw1j0/5oyMMbYegJF17ZP4MJq6/HaPOKIg+M73GuNIBUEFXf1fR8Nf1gV3aRjYLY JpxA== X-Forwarded-Encrypted: i=1; AL+hErHPyy86Xb3FeqL78Tix6eSA45B7K/TSg1Jvpg1Ca2KAZ93MGChx7av4dHsrlnHGEnJxYBKxMxmZEQvXjw==@lists.infradead.org X-Gm-Message-State: APuU4Z/Y9WToW1fy5Ttw4vzggCY9cCukek/ZNjMrWQS3zPCP0z+Xqa0Y 5k0/6v6wV5ZAzMhpR7J8208F1mpvb6AJZF2oc0bBDgnh/ANxaSLK6LuUxiRQOrgAP8UKrO9g+cj wlrwiHzivOxfwEA== X-Received: from iocrb10-n2.prod.google.com ([2002:a05:6602:a58a:20b0:9c7:4d20:1320]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:1314:b0:53d:c86f:d331 with SMTP id 5614622812f47-57a06b2181bmr37361651b6e.5.1796172009877; Tue, 01 Dec 2026 16:40:09 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:47 +0000 In-Reply-To: <20261202003955.3607156-1-dmatlack@google.com> X-Archived-By: Mime-Version: 1.0 References: <20261202003955.3607156-1-dmatlack@google.com> X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202003955.3607156-11-dmatlack@google.com> Subject: [PATCH 10/18] selftests/liveupdate: Add a test driver for PCI Live Update From: David Matlack To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Albert Ou , Alexandre Ghiti , Alex Williamson , Bjorn Helgaas , David Matlack , Jacob Pan , Jason Gunthorpe , Josh Hilke , Lukas Wunner , Mike Rapoport , Palmer Dabbelt , Parav Pandit , Pasha Tatashin , Paul Walmsley , Pranjal Shrivastava , Pratyush Yadav , Samiullah Khawaja , Shuah Khan , Vipin Sharma X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_004013_045912_E9EC5E43 X-CRM114-Status: GOOD ( 28.16 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Add luo_pci_test_driver.ko, a test-only PCI driver that the PCI Live Update selftests use to preserve PCI devices. The driver binds to Intel 82576 (IGB) devices, such as QEMU's igb device, and hands out a file for each of its devices through /dev/luo_pci_test_driver. Userspace can preserve these files in a Live Update session, and the driver's Live Update file handler then preserves, unpreserves, retrieves and finishes the device with the PCI Live Update APIs. Other than enabling the device and bus mastering, the driver leaves the device alone, so that tests can check how the PCI core treats it. The driver lives in modules/, a directory for the kernel modules used by the Live Update selftests, which the selftests build through TEST_GEN_MODS_DIR. Add the driver, and tools/testing/selftests/liveupdate/pci/ where its interface header lives, to the PCI LIVE UPDATE entry in MAINTAINERS. Signed-off-by: David Matlack --- MAINTAINERS | 2 + tools/testing/selftests/liveupdate/.gitignore | 3 + tools/testing/selftests/liveupdate/Makefile | 2 + .../selftests/liveupdate/modules/Makefile | 20 ++ .../liveupdate/modules/luo_pci_test_driver.c | 279 ++++++++++++++++++ .../liveupdate/pci/luo_pci_test_driver.h | 52 ++++ 6 files changed, 358 insertions(+) create mode 100644 tools/testing/selftests/liveupdate/modules/Makefile create mode 100644 tools/testing/selftests/liveupdate/modules/luo_pci_test_driver.c create mode 100644 tools/testing/selftests/liveupdate/pci/luo_pci_test_driver.h diff --git a/MAINTAINERS b/MAINTAINERS index ea273cec96e9..f704877b8a38 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21652,6 +21652,8 @@ F: drivers/pci/liveupdate.c F: drivers/pci/liveupdate.h F: include/linux/kho/abi/pci.h F: include/linux/pci_liveupdate.h +F: tools/testing/selftests/liveupdate/modules/luo_pci_test_driver.c +F: tools/testing/selftests/liveupdate/pci/ PCI MSI DRIVER FOR ALTERA MSI IP L: linux-pci@vger.kernel.org diff --git a/tools/testing/selftests/liveupdate/.gitignore b/tools/testing/selftests/liveupdate/.gitignore index 47c670bf532b..9bf744e4f138 100644 --- a/tools/testing/selftests/liveupdate/.gitignore +++ b/tools/testing/selftests/liveupdate/.gitignore @@ -9,3 +9,6 @@ !config !config.* !Makefile + +# Generated by kbuild when building modules/ in place +*.mod.c diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/selftests/liveupdate/Makefile index df0567e8ca15..2547af3c5353 100644 --- a/tools/testing/selftests/liveupdate/Makefile +++ b/tools/testing/selftests/liveupdate/Makefile @@ -16,6 +16,8 @@ TEST_GEN_PROGS_EXTENDED += luo_stress_files TEST_FILES += do_kexec.sh +TEST_GEN_MODS_DIR := modules + include ../lib.mk include lib/libliveupdate.mk diff --git a/tools/testing/selftests/liveupdate/modules/Makefile b/tools/testing/selftests/liveupdate/modules/Makefile new file mode 100644 index 000000000000..6efbbd21ecc5 --- /dev/null +++ b/tools/testing/selftests/liveupdate/modules/Makefile @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Kernel modules used by the Live Update selftests. + +TESTMODS_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +KDIR ?= /lib/modules/$(shell uname -r)/build + +obj-m += luo_pci_test_driver.o + +# Ensure that KDIR exists, otherwise skip the compilation +modules: +ifneq ("$(wildcard $(KDIR))", "") + $(Q)$(MAKE) -C $(KDIR) modules M=$(TESTMODS_DIR) +endif + +# Ensure that KDIR exists, otherwise skip the clean target +clean: +ifneq ("$(wildcard $(KDIR))", "") + $(Q)$(MAKE) -C $(KDIR) clean M=$(TESTMODS_DIR) +endif diff --git a/tools/testing/selftests/liveupdate/modules/luo_pci_test_driver.c b/tools/testing/selftests/liveupdate/modules/luo_pci_test_driver.c new file mode 100644 index 000000000000..7c595c9b4653 --- /dev/null +++ b/tools/testing/selftests/liveupdate/modules/luo_pci_test_driver.c @@ -0,0 +1,279 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Test-only PCI driver for the PCI Live Update selftests. + * + * Binds to Intel 82576 (IGB) devices and lets userspace preserve them across a + * Live Update. Userspace gets a file for a bound device from the + * /dev/luo_pci_test_driver misc device, and preserves that file in a Live + * Update session. Other than enabling the device and bus mastering, the driver + * leaves the device alone so that the selftests can check how the PCI core + * treats it. + * + * Copyright (c) 2026, Google LLC. + * David Matlack + */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../pci/luo_pci_test_driver.h" + +#define LUPT_FILE_NAME "[luo_pci_test_driver]" + +struct lupt_device { + bool incoming_at_probe; +}; + +static struct pci_driver lupt_driver; + +/* Returns a reference to a device bound to this driver, or NULL. */ +static struct pci_dev *lupt_get_bound_device(u32 domain, u16 bdf) +{ + struct pci_dev *pdev; + + pdev = pci_get_domain_bus_and_slot(domain, PCI_BUS_NUM(bdf), bdf & 0xff); + if (!pdev) + return NULL; + + if (READ_ONCE(pdev->driver) != &lupt_driver) { + pci_dev_put(pdev); + return NULL; + } + + return pdev; +} + +static long lupt_device_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct luo_pci_test_device dev = {}; + struct pci_dev *pdev = file->private_data; + struct lupt_device *ldev; + + if (cmd != LUO_PCI_TEST_GET_STATUS) + return -ENOTTY; + + dev.domain = pci_domain_nr(pdev->bus); + dev.bdf = pci_dev_id(pdev); + + device_lock(&pdev->dev); + if (pdev->driver == &lupt_driver) { + ldev = pci_get_drvdata(pdev); + if (ldev->incoming_at_probe) + dev.flags |= LUO_PCI_TEST_INCOMING_AT_PROBE; + } + device_unlock(&pdev->dev); + + if (pci_liveupdate_is_incoming(pdev)) + dev.flags |= LUO_PCI_TEST_INCOMING; + + if (copy_to_user((void __user *)arg, &dev, sizeof(dev))) + return -EFAULT; + + return 0; +} + +static int lupt_device_release(struct inode *inode, struct file *file) +{ + pci_dev_put(file->private_data); + return 0; +} + +static const struct file_operations lupt_device_fops = { + .owner = THIS_MODULE, + .unlocked_ioctl = lupt_device_ioctl, + .release = lupt_device_release, +}; + +static long lupt_ctl_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct luo_pci_test_device dev; + struct pci_dev *pdev; + int fd; + + if (cmd != LUO_PCI_TEST_GET_DEVICE_FD) + return -ENOTTY; + + if (copy_from_user(&dev, (void __user *)arg, sizeof(dev))) + return -EFAULT; + + pdev = lupt_get_bound_device(dev.domain, dev.bdf); + if (!pdev) + return -ENODEV; + + /* On success, releasing the file drops the reference to pdev. */ + fd = anon_inode_getfd(LUPT_FILE_NAME, &lupt_device_fops, pdev, + O_RDWR | O_CLOEXEC); + if (fd < 0) + pci_dev_put(pdev); + + return fd; +} + +static const struct file_operations lupt_ctl_fops = { + .owner = THIS_MODULE, + .unlocked_ioctl = lupt_ctl_ioctl, +}; + +static struct miscdevice lupt_miscdev = { + .minor = MISC_DYNAMIC_MINOR, + .name = "luo_pci_test_driver", + .fops = &lupt_ctl_fops, +}; + +static bool lupt_can_preserve(struct liveupdate_file_handler *handler, + struct file *file) +{ + return file->f_op == &lupt_device_fops; +} + +static int lupt_preserve(struct liveupdate_file_op_args *args) +{ + struct pci_dev *pdev = args->file->private_data; + int ret; + + ret = pci_liveupdate_preserve(pdev); + if (ret) + return ret; + + args->serialized_data = (u64)pci_domain_nr(pdev->bus) << 16 | pci_dev_id(pdev); + return 0; +} + +static void lupt_unpreserve(struct liveupdate_file_op_args *args) +{ + pci_liveupdate_unpreserve(args->file->private_data); +} + +static int lupt_retrieve(struct liveupdate_file_op_args *args) +{ + u32 domain = args->serialized_data >> 16; + u16 bdf = args->serialized_data & 0xffff; + struct pci_dev *pdev; + struct file *file; + + /* Userspace must load this driver before retrieving the device. */ + pdev = lupt_get_bound_device(domain, bdf); + if (!pdev) + return -ENODEV; + + file = anon_inode_getfile(LUPT_FILE_NAME, &lupt_device_fops, pdev, O_RDWR); + if (IS_ERR(file)) { + pci_dev_put(pdev); + return PTR_ERR(file); + } + + args->file = file; + return 0; +} + +static bool lupt_can_finish(struct liveupdate_file_op_args *args) +{ + return args->retrieve_status > 0; +} + +static void lupt_finish(struct liveupdate_file_op_args *args) +{ + pci_liveupdate_finish(args->file->private_data); +} + +static const struct liveupdate_file_ops lupt_file_ops = { + .can_preserve = lupt_can_preserve, + .preserve = lupt_preserve, + .unpreserve = lupt_unpreserve, + .retrieve = lupt_retrieve, + .can_finish = lupt_can_finish, + .finish = lupt_finish, + .owner = THIS_MODULE, +}; + +static struct liveupdate_file_handler lupt_fh = { + .ops = &lupt_file_ops, + .compatible = "luo-pci-test-driver-v1", +}; + +static int lupt_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + struct lupt_device *ldev; + int ret; + + ldev = devm_kzalloc(&pdev->dev, sizeof(*ldev), GFP_KERNEL); + if (!ldev) + return -ENOMEM; + + ldev->incoming_at_probe = pci_liveupdate_is_incoming(pdev); + + ret = pcim_enable_device(pdev); + if (ret) + return ret; + + pci_set_master(pdev); + pci_set_drvdata(pdev, ldev); + + pci_info(pdev, "Bound to %s device\n", + ldev->incoming_at_probe ? "incoming-preserved" : "non-preserved"); + return 0; +} + +static const struct pci_device_id lupt_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x10c9) }, /* 82576 (QEMU igb) */ + {} +}; + +static struct pci_driver lupt_driver = { + .name = "luo_pci_test_driver", + .id_table = lupt_ids, + .probe = lupt_probe, +}; + +static int __init lupt_init(void) +{ + int ret; + + ret = liveupdate_register_file_handler(&lupt_fh); + if (ret) + return ret; + + ret = pci_liveupdate_register_flb(&lupt_fh); + if (ret) + goto err_unregister_fh; + + ret = misc_register(&lupt_miscdev); + if (ret) + goto err_unregister_flb; + + ret = pci_register_driver(&lupt_driver); + if (ret) + goto err_deregister_misc; + + return 0; + +err_deregister_misc: + misc_deregister(&lupt_miscdev); +err_unregister_flb: + pci_liveupdate_unregister_flb(&lupt_fh); +err_unregister_fh: + liveupdate_unregister_file_handler(&lupt_fh); + return ret; +} +module_init(lupt_init); + +static void __exit lupt_exit(void) +{ + pci_unregister_driver(&lupt_driver); + misc_deregister(&lupt_miscdev); + pci_liveupdate_unregister_flb(&lupt_fh); + liveupdate_unregister_file_handler(&lupt_fh); +} +module_exit(lupt_exit); + +MODULE_DESCRIPTION("Test-only PCI driver for the PCI Live Update selftests"); +MODULE_LICENSE("GPL"); diff --git a/tools/testing/selftests/liveupdate/pci/luo_pci_test_driver.h b/tools/testing/selftests/liveupdate/pci/luo_pci_test_driver.h new file mode 100644 index 000000000000..c5c00e4eda02 --- /dev/null +++ b/tools/testing/selftests/liveupdate/pci/luo_pci_test_driver.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Interface between the PCI Live Update selftests and the luo_pci_test_driver + * kernel module. + * + * Copyright (c) 2026, Google LLC. + * David Matlack + */ +#ifndef SELFTESTS_LIVEUPDATE_PCI_LUO_PCI_TEST_DRIVER_H +#define SELFTESTS_LIVEUPDATE_PCI_LUO_PCI_TEST_DRIVER_H + +#include +#include + +#define LUO_PCI_TEST_DEVICE "/dev/luo_pci_test_driver" +#define LUO_PCI_TEST_MODULE "/luo_pci_test_driver.ko" + +/* The device was incoming-preserved when the driver probed it. */ +#define LUO_PCI_TEST_INCOMING_AT_PROBE (1 << 0) +/* The device is currently incoming-preserved. */ +#define LUO_PCI_TEST_INCOMING (1 << 1) + +/** + * struct luo_pci_test_device - A PCI device and its status + * @domain: PCI domain (segment) number + * @bdf: PCI bus, device and function number + * @flags: LUO_PCI_TEST_* flags, set by LUO_PCI_TEST_GET_STATUS + */ +struct luo_pci_test_device { + __u32 domain; + __u16 bdf; + __u16 flags; +}; + +#define LUO_PCI_TEST_IOC_TYPE 0xB8 + +/* + * Issued on LUO_PCI_TEST_DEVICE. Returns a new file descriptor for a + * device bound to luo_pci_test_driver, which can be preserved in a Live + * Update session. + */ +#define LUO_PCI_TEST_GET_DEVICE_FD \ + _IOW(LUO_PCI_TEST_IOC_TYPE, 0, struct luo_pci_test_device) + +/* + * Issued on a device file descriptor. Returns the device's domain, BDF and + * LUO_PCI_TEST_* flags. + */ +#define LUO_PCI_TEST_GET_STATUS \ + _IOR(LUO_PCI_TEST_IOC_TYPE, 1, struct luo_pci_test_device) + +#endif /* SELFTESTS_LIVEUPDATE_PCI_LUO_PCI_TEST_DRIVER_H */ -- 2.56.1.911.g883d8bcb20-goog _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv