Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195946/?format=api
{ "id": 2195946, "url": "http://patchwork.ozlabs.org/api/patches/2195946/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260212-vfio_pci_ism-v1-2-333262ade074@linux.ibm.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": "<20260212-vfio_pci_ism-v1-2-333262ade074@linux.ibm.com>", "list_archive_url": null, "date": "2026-02-12T14:02:16", "name": "[2/3] vfio/ism: Implement vfio_pci driver for ISM devices", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b2a94b5db4816af8905ad90fd59ebf9ff2a8dbb2", "submitter": { "id": 91782, "url": "http://patchwork.ozlabs.org/api/people/91782/?format=api", "name": "Julian Ruess", "email": "julianr@linux.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260212-vfio_pci_ism-v1-2-333262ade074@linux.ibm.com/mbox/", "series": [ { "id": 491980, "url": "http://patchwork.ozlabs.org/api/series/491980/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=491980", "date": "2026-02-12T14:02:17", "name": "vfio/pci: Introduce vfio_pci driver for ISM devices", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491980/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195946/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195946/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-47208-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=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=L3AM24ab;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-47208-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com\n header.b=\"L3AM24ab\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=148.163.156.1", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.ibm.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\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 4fBcWT4ftPz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 01:05:09 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id F173931430B6\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 14:02:47 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id EE1AF35CB7C;\n\tThu, 12 Feb 2026 14:02:43 +0000 (UTC)", "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D13D2253FF;\n\tThu, 12 Feb 2026 14:02:42 +0000 (UTC)", "from pps.filterd (m0356517.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 61C5IqVt4037824;\n\tThu, 12 Feb 2026 14:02:37 GMT", "from ppma21.wdc07v.mail.ibm.com\n (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4c696upcmq-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 12 Feb 2026 14:02:36 +0000 (GMT)", "from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1])\n\tby ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 61CDSXvF001427;\n\tThu, 12 Feb 2026 14:02:35 GMT", "from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227])\n\tby ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4c6gqnapm3-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 12 Feb 2026 14:02:35 +0000", "from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com\n [10.20.54.103])\n\tby smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 61CE2Vnc61735332\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tThu, 12 Feb 2026 14:02:31 GMT", "from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 7474420043;\n\tThu, 12 Feb 2026 14:02:31 +0000 (GMT)", "from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 1BA3C2004E;\n\tThu, 12 Feb 2026 14:02:31 +0000 (GMT)", "from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9])\n\tby smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP;\n\tThu, 12 Feb 2026 14:02:31 +0000 (GMT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1770904963; cv=none;\n b=TeKSKUhArUioBnpMQGDgdhzad7N39A/2+pChQ5jaMbVu23XTSiKSXs5l0wd6Kn+HnwrwSSQcE0MzQVIiDKDyi+EItF9IesXS10lOs+uBVhOEnQu7SpoM0vrZEOpfoD5BQxL8cG+Xk/UjCeNzLkSBPrIaAlKZ3GtwsRjcwxqBXqk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1770904963; c=relaxed/simple;\n\tbh=5AZMm4V6MtU6MB8nUvcHN5TD1MVWJkjfvrL/N7CjmDw=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=WgkX+s6n0PnV9cNWIW61OuDzdw/xPB/fiiIEiCv+WYRCBRT44DdRrP2o1sDcZ5xv3PWdqsDawypKFu2tnSWApOM+BO4oA+T7Bz4GJ2bVQGML8lUxEx3WD3DX+bdHJc81GUuQYF8qw4VXr/TPORRO9jxw7n3banGKGYftdekNmz0=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com;\n spf=pass smtp.mailfrom=linux.ibm.com;\n dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com\n header.b=L3AM24ab; arc=none smtp.client-ip=148.163.156.1", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n\t:content-transfer-encoding:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to; s=pp1; bh=qrHuk3\n\tGbFygxKt4he95bkyIYcNIcfCPYj1UQM6zkk6s=; b=L3AM24ab4hArYKgkIdokMb\n\tTt2hSNS2bVZpyZJH48STxoAzR/2/JA6jxBwITxwDaN2cRuzWBEYt+RdrBtkQ6ddz\n\tzvEF9VCicdla5yD7hdFuMgZcFSJKCJmUE8Fbr0uH+0hwoaKRxIW+32/YjPdeuaYx\n\tHHunxKFppuTCzpEGRySUeIvS30Juf8C8N6qil3DUy+ffbZNRJ2zjdhY+EPbuhuOH\n\tKihyLC0B89roJyzLO+S9VUAzkpxxbEE24Ac9wBhMny3akkVDVYXI/3FSjLdMV5BA\n\tOIIsBT+Zyx7D5FDj5h+I/dL5TOIyDjSytVYlQQ7zOk8moplMojvS7fVCLhBXGYVQ\n\t==", "From": "Julian Ruess <julianr@linux.ibm.com>", "Date": "Thu, 12 Feb 2026 15:02:16 +0100", "Subject": "[PATCH 2/3] vfio/ism: Implement vfio_pci driver for ISM devices", "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", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260212-vfio_pci_ism-v1-2-333262ade074@linux.ibm.com>", "References": "<20260212-vfio_pci_ism-v1-0-333262ade074@linux.ibm.com>", "In-Reply-To": "<20260212-vfio_pci_ism-v1-0-333262ade074@linux.ibm.com>", "To": "schnelle@linux.ibm.com, wintera@linux.ibm.com, ts@linux.ibm.com,\n oberpar@linux.ibm.com, gbayer@linux.ibm.com,\n Alex Williamson <alex@shazbot.org>, Jason Gunthorpe <jgg@ziepe.ca>,\n Yishai Hadas <yishaih@nvidia.com>,\n Shameer Kolothum <skolothumtho@nvidia.com>,\n Kevin Tian <kevin.tian@intel.com>", "Cc": "mjrosato@linux.ibm.com, alifm@linux.ibm.com, raspl@linux.ibm.com,\n hca@linux.ibm.com, agordeev@linux.ibm.com, gor@linux.ibm.com,\n julianr@linux.ibm.com, kvm@vger.kernel.org,\n linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,\n linux-pci@vger.kernel.org", "X-Mailer": "b4 0.14.2", "X-TM-AS-GCONF": "00", "X-Authority-Analysis": "v=2.4 cv=YZiwJgRf c=1 sm=1 tr=0 ts=698ddd7c cx=c_pps\n a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17\n a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22\n a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=VnNF1IyMAAAA:8\n a=BIpM-4bQ8UbgmxpNPDoA:9 a=QEXdDO2ut3YA:10", "X-Proofpoint-ORIG-GUID": "ERovvUeSskgStJB7PvHRZFCqwA69ZSIP", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMjEyMDEwNCBTYWx0ZWRfX/L09TJyZBo0q\n Cd2jH2HAjI0Hlpw8gj/8NTDXrHPlyLWjiTBBjmxSDQFFfFubwbky9Tv4U4NFBsVHVvJUGmSJeaO\n SuEgGoktfmDVfW1SGzUrbvv1lpkBZLqvJ5GmQO6f6WILUrEKRqv5VYlSt6l5rVk/L0DlqsHtf73\n Cd0tZ2q+XwTZixt4p8W/f144VL4ybYgkSJKp2J7Q4bFwJ4z2iLPS2H01fEDUKKr6O/5NtxMwlMy\n uBi2f98rX3Si5sVVc7rNBzold2vTWs/xIRyjgYHPTSF00FuyexofqKBs2tW3B6JrXKg1nlCH5hU\n Sqg8FPKpM3ywwLDf/TjYiqLABDmL5AqBCHhDw2WRNaumztZrL1s3oAnLNHCkq1Nn8yEth/CJcLg\n 9CURfoPNQ5vlqlc5IqzhbEg6Uf3oZqfaglAx9DKhHBwm27qQjver0524W3VPw5pFIZZDmJUbJCU\n 1Iqgu5q2R7fId3J1k/Q==", "X-Proofpoint-GUID": "ERovvUeSskgStJB7PvHRZFCqwA69ZSIP", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-02-12_04,2026-02-12_02,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n priorityscore=1501 spamscore=0 impostorscore=0 suspectscore=0 malwarescore=0\n phishscore=0 bulkscore=0 adultscore=0 clxscore=1011 lowpriorityscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602120104" }, "content": "Add a vfio_pci variant driver for the s390-specific Internal Shared\nMemory (ISM) devices used for inter-VM communication.\n\nThis enables the development of vfio-pci-based user space drivers for\nISM devices.\n\nOn s390, kernel primitives such as ioread() and iowrite() are switched\nover from function handle based PCI load/stores instructions to PCI\nmemory-I/O (MIO) loads/stores when these are available and not\nexplicitly disabled. Since these instructions cannot be used with ISM\ndevices, ensure that classic function handle-based PCI instructions are\nused instead.\n\nThe driver is still required even when MIO instructions are disabled, as\nthe ISM device relies on the PCI store block (PCISTB) instruction to\nperform write operations.\n\nStores are not fragmented, therefore one ioctl corresponds to exactly\none PCISTB instruction. User space must ensure to not write more than\n4096 bytes at once to an ISM BAR which is the maximum payload of the\nPCISTB instruction\n\nExport vfio_pci_config_rw() for config space accesses that do not rely\non s390 MIO instructions.\n\nAcked-by: Alexandra Winter <wintera@linux.ibm.com>\nSigned-off-by: Julian Ruess <julianr@linux.ibm.com>\n---\n drivers/vfio/pci/Kconfig | 2 +\n drivers/vfio/pci/Makefile | 2 +\n drivers/vfio/pci/ism/Kconfig | 11 ++\n drivers/vfio/pci/ism/Makefile | 3 +\n drivers/vfio/pci/ism/main.c | 227 +++++++++++++++++++++++++++++++++++++\n drivers/vfio/pci/vfio_pci_config.c | 1 +\n 6 files changed, 246 insertions(+)", "diff": "diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig\nindex 1e82b44bda1a0a544e1add7f4b06edecf35aaf81..296bf01e185ecacc388ebc69e92706c99e47c814 100644\n--- a/drivers/vfio/pci/Kconfig\n+++ b/drivers/vfio/pci/Kconfig\n@@ -60,6 +60,8 @@ config VFIO_PCI_DMABUF\n \n source \"drivers/vfio/pci/mlx5/Kconfig\"\n \n+source \"drivers/vfio/pci/ism/Kconfig\"\n+\n source \"drivers/vfio/pci/hisilicon/Kconfig\"\n \n source \"drivers/vfio/pci/pds/Kconfig\"\ndiff --git a/drivers/vfio/pci/Makefile b/drivers/vfio/pci/Makefile\nindex e0a0757dd1d2b0bc69b7e4d79441d5cacf4e1cd8..6138f1bf241df04e7419f196b404abdf9b194050 100644\n--- a/drivers/vfio/pci/Makefile\n+++ b/drivers/vfio/pci/Makefile\n@@ -11,6 +11,8 @@ obj-$(CONFIG_VFIO_PCI) += vfio-pci.o\n \n obj-$(CONFIG_MLX5_VFIO_PCI) += mlx5/\n \n+obj-$(CONFIG_ISM_VFIO_PCI) += ism/\n+\n obj-$(CONFIG_HISI_ACC_VFIO_PCI) += hisilicon/\n \n obj-$(CONFIG_PDS_VFIO_PCI) += pds/\ndiff --git a/drivers/vfio/pci/ism/Kconfig b/drivers/vfio/pci/ism/Kconfig\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..2db6c9327980827bf617afb9a82b1d1928868d42\n--- /dev/null\n+++ b/drivers/vfio/pci/ism/Kconfig\n@@ -0,0 +1,11 @@\n+# SPDX-License-Identifier: GPL-2.0\n+config ISM_VFIO_PCI\n+\ttristate \"VFIO support for ISM devices\"\n+\tdepends on ISM\n+\tselect VFIO_PCI_CORE\n+\thelp\n+\t This provides user space support for\n+\t IBM Internal Shared Memory (ISM) Adapter devices\n+\t using the VFIO framework.\n+\n+\t If you don't know what to do here, say N.\ndiff --git a/drivers/vfio/pci/ism/Makefile b/drivers/vfio/pci/ism/Makefile\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..32cc3c66dd11395da85a2b6f05b3d97036ed8a35\n--- /dev/null\n+++ b/drivers/vfio/pci/ism/Makefile\n@@ -0,0 +1,3 @@\n+# SPDX-License-Identifier: GPL-2.0\n+obj-$(CONFIG_ISM_VFIO_PCI) += ism-vfio-pci.o\n+ism-vfio-pci-y := main.o\ndiff --git a/drivers/vfio/pci/ism/main.c b/drivers/vfio/pci/ism/main.c\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..99f27682ec16ec855ae12ff87059dbb1bc18c586\n--- /dev/null\n+++ b/drivers/vfio/pci/ism/main.c\n@@ -0,0 +1,227 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * vfio-ISM driver for s390\n+ *\n+ * Copyright IBM Corp. 2026\n+ */\n+\n+#include \"../vfio_pci_priv.h\"\n+\n+struct ism_vfio_pci_core_device {\n+\tstruct vfio_pci_core_device core_device;\n+};\n+\n+static int ism_pci_open_device(struct vfio_device *core_vdev)\n+{\n+\tstruct ism_vfio_pci_core_device *mvdev = container_of(\n+\t\tcore_vdev, struct ism_vfio_pci_core_device, core_device.vdev);\n+\tstruct vfio_pci_core_device *vdev = &mvdev->core_device;\n+\tint ret;\n+\n+\tret = vfio_pci_core_enable(vdev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tvfio_pci_core_finish_enable(vdev);\n+\treturn 0;\n+}\n+\n+static ssize_t ism_vfio_pci_do_io_r(struct vfio_pci_core_device *vdev,\n+\t\t\t\t char __user *buf, loff_t off, size_t count,\n+\t\t\t\t int bar)\n+{\n+\tstruct zpci_dev *zdev = to_zpci(vdev->pdev);\n+\tssize_t ret, done = 0;\n+\tu64 req, length, tmp;\n+\n+\twhile (count) {\n+\t\tif (count >= 8 && IS_ALIGNED(off, 8))\n+\t\t\tlength = 8;\n+\t\telse if (count >= 4 && IS_ALIGNED(off, 4))\n+\t\t\tlength = 4;\n+\t\telse if (count >= 2 && IS_ALIGNED(off, 2))\n+\t\t\tlength = 2;\n+\t\telse\n+\t\t\tlength = 1;\n+\t\treq = ZPCI_CREATE_REQ(READ_ONCE(zdev->fh), bar, length);\n+\t\t/* use pcilg to prevent using MIO instructions */\n+\t\tret = __zpci_load(&tmp, req, off);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t\tif (copy_to_user(buf, &tmp, length))\n+\t\t\treturn -EFAULT;\n+\t\tcount -= length;\n+\t\tdone += length;\n+\t\toff += length;\n+\t\tbuf += length;\n+\t}\n+\treturn done;\n+}\n+\n+static ssize_t ism_vfio_pci_do_io_w(struct vfio_pci_core_device *vdev,\n+\t\t\t\t char __user *buf, loff_t off, size_t count,\n+\t\t\t\t int bar)\n+{\n+\tstruct zpci_dev *zdev = to_zpci(vdev->pdev);\n+\tvoid *data __free(kfree) = NULL;\n+\tssize_t ret;\n+\tu64 req;\n+\n+\tif (count > ZPCI_BOUNDARY_SIZE)\n+\t\treturn -EINVAL;\n+\tdata = kzalloc(ZPCI_BOUNDARY_SIZE, GFP_KERNEL);\n+\tif (!data)\n+\t\treturn -ENOMEM;\n+\tif (copy_from_user(data, buf, count))\n+\t\treturn -EFAULT;\n+\treq = ZPCI_CREATE_REQ(READ_ONCE(zdev->fh), bar, count);\n+\tret = __zpci_store_block(data, req, off);\n+\tif (ret)\n+\t\treturn ret;\n+\treturn count;\n+}\n+\n+static ssize_t ism_vfio_pci_bar_rw(struct vfio_pci_core_device *vdev,\n+\t\t\t\t char __user *buf, size_t count, loff_t *ppos,\n+\t\t\t\t bool iswrite)\n+{\n+\tint bar = VFIO_PCI_OFFSET_TO_INDEX(*ppos);\n+\tloff_t pos = *ppos & VFIO_PCI_OFFSET_MASK;\n+\tresource_size_t end;\n+\tssize_t done = 0;\n+\n+\tif (pci_resource_start(vdev->pdev, bar))\n+\t\tend = pci_resource_len(vdev->pdev, bar);\n+\telse\n+\t\treturn -EINVAL;\n+\n+\tif (pos >= end)\n+\t\treturn -EINVAL;\n+\n+\tcount = min(count, (size_t)(end - pos));\n+\n+\tif (iswrite)\n+\t\tdone = ism_vfio_pci_do_io_w(vdev, buf, pos, count, bar);\n+\telse\n+\t\tdone = ism_vfio_pci_do_io_r(vdev, buf, pos, count, bar);\n+\n+\tif (done >= 0)\n+\t\t*ppos += done;\n+\n+\treturn done;\n+}\n+\n+static ssize_t ism_vfio_pci_rw(struct vfio_device *core_vdev, char __user *buf,\n+\t\t\t size_t count, loff_t *ppos, bool iswrite)\n+{\n+\tunsigned int index = VFIO_PCI_OFFSET_TO_INDEX(*ppos);\n+\tstruct vfio_pci_core_device *vdev;\n+\tint ret;\n+\n+\tvdev = container_of(core_vdev, struct vfio_pci_core_device, vdev);\n+\n+\tif (!count)\n+\t\treturn 0;\n+\n+\tswitch (index) {\n+\tcase VFIO_PCI_CONFIG_REGION_INDEX:\n+\t\tret = vfio_pci_config_rw(vdev, buf, count, ppos, iswrite);\n+\t\tbreak;\n+\n+\tcase VFIO_PCI_BAR0_REGION_INDEX ... VFIO_PCI_BAR5_REGION_INDEX:\n+\t\tret = ism_vfio_pci_bar_rw(vdev, buf, count, ppos, iswrite);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static ssize_t ism_vfio_pci_read(struct vfio_device *core_vdev,\n+\t\t\t\t char __user *buf, size_t count, loff_t *ppos)\n+{\n+\treturn ism_vfio_pci_rw(core_vdev, buf, count, ppos, false);\n+}\n+\n+static ssize_t ism_vfio_pci_write(struct vfio_device *core_vdev,\n+\t\t\t\t const char __user *buf, size_t count,\n+\t\t\t\t loff_t *ppos)\n+{\n+\treturn ism_vfio_pci_rw(core_vdev, (char __user *)buf, count, ppos,\n+\t\t\t true);\n+}\n+\n+static const struct vfio_device_ops ism_pci_ops = {\n+\t.name = \"ism-vfio-pci\",\n+\t.init = vfio_pci_core_init_dev,\n+\t.release = vfio_pci_core_release_dev,\n+\t.open_device = ism_pci_open_device,\n+\t.close_device = vfio_pci_core_close_device,\n+\t.ioctl = vfio_pci_core_ioctl,\n+\t.get_region_info_caps = vfio_pci_ioctl_get_region_info,\n+\t.device_feature = vfio_pci_core_ioctl_feature,\n+\t.read = ism_vfio_pci_read,\n+\t.write = ism_vfio_pci_write,\n+\t.request = vfio_pci_core_request,\n+\t.match = vfio_pci_core_match,\n+\t.match_token_uuid = vfio_pci_core_match_token_uuid,\n+\t.bind_iommufd = vfio_iommufd_physical_bind,\n+\t.unbind_iommufd = vfio_iommufd_physical_unbind,\n+\t.attach_ioas = vfio_iommufd_physical_attach_ioas,\n+\t.detach_ioas = vfio_iommufd_physical_detach_ioas,\n+\n+};\n+\n+static int ism_vfio_pci_probe(struct pci_dev *pdev,\n+\t\t\t const struct pci_device_id *id)\n+{\n+\tstruct ism_vfio_pci_core_device *ivpcd;\n+\tint ret;\n+\n+\tivpcd = vfio_alloc_device(ism_vfio_pci_core_device, core_device.vdev,\n+\t\t\t\t &pdev->dev, &ism_pci_ops);\n+\tif (IS_ERR(ivpcd))\n+\t\treturn PTR_ERR(ivpcd);\n+\n+\tdev_set_drvdata(&pdev->dev, &ivpcd->core_device);\n+\tret = vfio_pci_core_register_device(&ivpcd->core_device);\n+\tif (ret)\n+\t\tvfio_put_device(&ivpcd->core_device.vdev);\n+\treturn ret;\n+}\n+\n+static void ism_vfio_pci_remove(struct pci_dev *pdev)\n+{\n+\tstruct vfio_pci_core_device *core_device;\n+\tstruct ism_vfio_pci_core_device *ivpcd;\n+\n+\tcore_device = dev_get_drvdata(&pdev->dev);\n+\tivpcd = container_of(core_device, struct ism_vfio_pci_core_device,\n+\t\t\t core_device);\n+\n+\tvfio_pci_core_unregister_device(&ivpcd->core_device);\n+\tvfio_put_device(&ivpcd->core_device.vdev);\n+}\n+\n+static const struct pci_device_id ism_device_table[] = {\n+\t{ PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_IBM,\n+\t\t\t\t\t PCI_DEVICE_ID_IBM_ISM) },\n+\t{}\n+};\n+MODULE_DEVICE_TABLE(pci, ism_device_table);\n+\n+static struct pci_driver ism_vfio_pci_driver = {\n+\t.name = KBUILD_MODNAME,\n+\t.id_table = ism_device_table,\n+\t.probe = ism_vfio_pci_probe,\n+\t.remove = ism_vfio_pci_remove,\n+\t.driver_managed_dma = true,\n+};\n+\n+module_pci_driver(ism_vfio_pci_driver);\n+\n+MODULE_LICENSE(\"GPL\");\n+MODULE_DESCRIPTION(\"vfio-pci variant driver for the IBM Internal Shared Memory (ISM) device\");\n+MODULE_AUTHOR(\"IBM Corporation\");\ndiff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c\nindex dc4e510e6e1bf4753e1d9005e0054399a639ea12..c7341a2d072b058965135a3d225894d74379e12e 100644\n--- a/drivers/vfio/pci/vfio_pci_config.c\n+++ b/drivers/vfio/pci/vfio_pci_config.c\n@@ -1995,6 +1995,7 @@ ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf,\n \n \treturn done;\n }\n+EXPORT_SYMBOL(vfio_pci_config_rw);\n \n /**\n * vfio_pci_core_range_intersect_range() - Determine overlap between a buffer\n", "prefixes": [ "2/3" ] }