Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226029/?format=api
{ "id": 2226029, "url": "http://patchwork.ozlabs.org/api/patches/2226029/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-8-mrathor@linux.microsoft.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": "<20260422023239.1171963-8-mrathor@linux.microsoft.com>", "list_archive_url": null, "date": "2026-04-22T02:32:33", "name": "[V1,07/13] mshv: Add ioctl support for MSHV-VFIO bridge device", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "645b971b908a7c9682a1d0ff50d7d75f27ef09ab", "submitter": { "id": 91512, "url": "http://patchwork.ozlabs.org/api/people/91512/?format=api", "name": "Mukesh R", "email": "mrathor@linux.microsoft.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-8-mrathor@linux.microsoft.com/mbox/", "series": [ { "id": 500915, "url": "http://patchwork.ozlabs.org/api/series/500915/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=500915", "date": "2026-04-22T02:32:26", "name": "PCI passthru on Hyper-V (Part I)", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500915/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226029/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226029/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-52902-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 (1024-bit key;\n unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com\n header.a=rsa-sha256 header.s=default header.b=Vr2BHVut;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-52902-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.microsoft.com\n header.i=@linux.microsoft.com header.b=\"Vr2BHVut\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=13.77.154.182", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.microsoft.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.microsoft.com" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\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 4g0k1935yBz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 12:38:21 +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 7A118308F77D\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 02:34:45 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 1C44B382F1C;\n\tWed, 22 Apr 2026 02:34:08 +0000 (UTC)", "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id BD1053822AA;\n\tWed, 22 Apr 2026 02:33:50 +0000 (UTC)", "from mrdev.corp.microsoft.com\n (192-184-212-33.fiber.dynamic.sonic.net [192.184.212.33])\n\tby linux.microsoft.com (Postfix) with ESMTPSA id B043720B6F20;\n\tTue, 21 Apr 2026 19:33:45 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776825241; cv=none;\n b=l1JwkynXCuM+du2XKxDcIhz1QOFvgh4DJfBasm+GcYpryATm419TpnfshZJgcwdgErvYQyS6iLUPO23t5hznyPrwA60RqwvA6iy3MhlaR1gIjgjlY0hXNvewtWp4QNj9UCqg2NW9kePBmGWuFUdxh30vg5wUWLkspY86JrG59O4=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776825241; c=relaxed/simple;\n\tbh=C8TsFVJy+pAFOBhAef081HD3HUSmaQJnLst8p/bA8vk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=gO9M8NdemE4bh2vq280HWycHd5xjyErF0mgzi8B2ZLvmpKgkWRsqZBfedCtAoWD1MzoiKsTjq/iNRbDX1RwSmcrP3LfNDZgjJrI7wQfuXHRgwjubLTOGk7KpTPGcfOYMQByAafKjjXap7FUTX5O2XJeA7u3fA73Ihz6EPp/oGD0=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.microsoft.com;\n spf=pass smtp.mailfrom=linux.microsoft.com;\n dkim=pass (1024-bit key) header.d=linux.microsoft.com\n header.i=@linux.microsoft.com header.b=Vr2BHVut;\n arc=none smtp.client-ip=13.77.154.182", "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com B043720B6F20", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n\ts=default; t=1776825226;\n\tbh=torw1rFNIs6S4jLC1p2Rij05fcbQgV06MR8D7ovym88=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Vr2BHVutj1SgonSfVzqIBGit/CYCrmt3i9EL9E7s+WEPffaoxJUZmaOLtA8+8mV/B\n\t cnEX+hEifNEQiJZ7pjhLzeAUZ0zf05/SqosiNGnUJfE+/b5B0XthWnEBi9S35jsAHm\n\t VD3COLKj2+sN5CiLmOzyPdgQQCROIoyojZE+N5+w=", "From": "Mukesh R <mrathor@linux.microsoft.com>", "To": "hpa@zytor.com,\n\trobin.murphy@arm.com,\n\trobh@kernel.org,\n\twei.liu@kernel.org,\n\tmrathor@linux.microsoft.com,\n\tmhklinux@outlook.com,\n\tmuislam@microsoft.com,\n\tnamjain@linux.microsoft.com,\n\tmagnuskulke@linux.microsoft.com,\n\tanbelski@linux.microsoft.com,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-hyperv@vger.kernel.org,\n\tiommu@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tlinux-arch@vger.kernel.org", "Cc": "kys@microsoft.com,\n\thaiyangz@microsoft.com,\n\tdecui@microsoft.com,\n\tlongli@microsoft.com,\n\ttglx@kernel.org,\n\tmingo@redhat.com,\n\tbp@alien8.de,\n\tdave.hansen@linux.intel.com,\n\tx86@kernel.org,\n\tjoro@8bytes.org,\n\twill@kernel.org,\n\tlpieralisi@kernel.org,\n\tkwilczynski@kernel.org,\n\tbhelgaas@google.com,\n\tarnd@arndb.de", "Subject": "[PATCH V1 07/13] mshv: Add ioctl support for MSHV-VFIO bridge device", "Date": "Tue, 21 Apr 2026 19:32:33 -0700", "Message-ID": "<20260422023239.1171963-8-mrathor@linux.microsoft.com>", "X-Mailer": "git-send-email 2.51.2.vfs.0.1", "In-Reply-To": "<20260422023239.1171963-1-mrathor@linux.microsoft.com>", "References": "<20260422023239.1171963-1-mrathor@linux.microsoft.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", "Content-Transfer-Encoding": "8bit" }, "content": "Add ioctl support for creating MSHV devices for a partition. At\npresent only VFIO device types are supported, but more could be\nadded. At a high level, a partition ioctl to create device verifies\nit is of type VFIO and does some setup for bridge code in mshv_vfio.c.\nAdapted from KVM device ioctls.\n\nCo-developed-by: Wei Liu <wei.liu@kernel.org>\nSigned-off-by: Wei Liu <wei.liu@kernel.org>\nSigned-off-by: Mukesh R <mrathor@linux.microsoft.com>\n---\n drivers/hv/mshv_root_main.c | 116 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 116 insertions(+)", "diff": "diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c\nindex 02c107458be9..6ceb5f608589 100644\n--- a/drivers/hv/mshv_root_main.c\n+++ b/drivers/hv/mshv_root_main.c\n@@ -1625,6 +1625,119 @@ mshv_partition_ioctl_initialize(struct mshv_partition *partition)\n \treturn ret;\n }\n \n+static long mshv_device_attr_ioctl(struct mshv_device *mshv_dev, int cmd,\n+\t\t\t\t ulong uarg)\n+{\n+\tstruct mshv_device_attr attr;\n+\tconst struct mshv_device_ops *devops = mshv_dev->device_ops;\n+\n+\tif (copy_from_user(&attr, (void __user *)uarg, sizeof(attr)))\n+\t\treturn -EFAULT;\n+\n+\tswitch (cmd) {\n+\tcase MSHV_SET_DEVICE_ATTR:\n+\t\tif (devops->device_set_attr)\n+\t\t\treturn devops->device_set_attr(mshv_dev, &attr);\n+\t\tbreak;\n+\tcase MSHV_HAS_DEVICE_ATTR:\n+\t\tif (devops->device_has_attr)\n+\t\t\treturn devops->device_has_attr(mshv_dev, &attr);\n+\t\tbreak;\n+\t}\n+\n+\treturn -EPERM;\n+}\n+\n+static long mshv_device_fop_ioctl(struct file *filp, unsigned int cmd,\n+\t\t\t\t ulong uarg)\n+{\n+\tstruct mshv_device *mshv_dev = filp->private_data;\n+\n+\tswitch (cmd) {\n+\tcase MSHV_SET_DEVICE_ATTR:\n+\tcase MSHV_HAS_DEVICE_ATTR:\n+\t\treturn mshv_device_attr_ioctl(mshv_dev, cmd, uarg);\n+\t}\n+\n+\treturn -ENOTTY;\n+}\n+\n+static int mshv_device_fop_release(struct inode *inode, struct file *filp)\n+{\n+\tstruct mshv_device *mshv_dev = filp->private_data;\n+\tstruct mshv_partition *partition = mshv_dev->device_pt;\n+\n+\tif (mshv_dev->device_ops->device_release) {\n+\t\tmutex_lock(&partition->pt_mutex);\n+\t\thlist_del(&mshv_dev->device_ptnode);\n+\t\tmshv_dev->device_ops->device_release(mshv_dev);\n+\t\tmutex_unlock(&partition->pt_mutex);\n+\t}\n+\n+\tmshv_partition_put(partition);\n+\treturn 0;\n+}\n+\n+static const struct file_operations mshv_device_fops = {\n+\t.owner = THIS_MODULE,\n+\t.unlocked_ioctl = mshv_device_fop_ioctl,\n+\t.release = mshv_device_fop_release,\n+};\n+\n+static long mshv_partition_ioctl_create_device(struct mshv_partition *partition,\n+\t\t\t\t\t void __user *uarg)\n+{\n+\tlong rc;\n+\tstruct mshv_create_device devargk;\n+\tstruct mshv_device *mshv_dev;\n+\tconst struct mshv_device_ops *vfio_ops;\n+\n+\tif (copy_from_user(&devargk, uarg, sizeof(devargk)))\n+\t\treturn -EFAULT;\n+\n+\t/* At present, only VFIO is supported */\n+\tif (devargk.type != MSHV_DEV_TYPE_VFIO)\n+\t\treturn -ENODEV;\n+\n+\tif (devargk.flags & MSHV_CREATE_DEVICE_TEST)\n+\t\treturn 0;\n+\n+\t/* This is freed later by mshv_vfio_release_device() */\n+\tmshv_dev = kzalloc(sizeof(*mshv_dev), GFP_KERNEL_ACCOUNT);\n+\tif (mshv_dev == NULL)\n+\t\treturn -ENOMEM;\n+\n+\tvfio_ops = &mshv_vfio_device_ops;\n+\tmshv_dev->device_ops = vfio_ops;\n+\tmshv_dev->device_pt = partition;\n+\n+\trc = vfio_ops->device_create(mshv_dev);\n+\tif (rc < 0) {\n+\t\tkfree(mshv_dev);\n+\t\treturn rc;\n+\t}\n+\n+\thlist_add_head(&mshv_dev->device_ptnode, &partition->pt_devices);\n+\n+\tmshv_partition_get(partition);\n+\trc = anon_inode_getfd(vfio_ops->device_name, &mshv_device_fops,\n+\t\t\t mshv_dev, O_RDWR | O_CLOEXEC);\n+\tif (rc < 0)\n+\t\tgoto undo_out;\n+\n+\tdevargk.fd = rc;\n+\tif (copy_to_user(uarg, &devargk, sizeof(devargk)))\n+\t\treturn -EFAULT; /* cleanup in mshv_device_fop_release() */\n+\n+\treturn 0;\n+\n+undo_out:\n+\thlist_del(&mshv_dev->device_ptnode);\n+\tvfio_ops->device_release(mshv_dev); /* will kfree(mshv_dev) */\n+\tmshv_partition_put(partition);\n+\treturn rc;\n+}\n+\n static long\n mshv_partition_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)\n {\n@@ -1661,6 +1774,9 @@ mshv_partition_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)\n \tcase MSHV_ROOT_HVCALL:\n \t\tret = mshv_ioctl_passthru_hvcall(partition, true, uarg);\n \t\tbreak;\n+\tcase MSHV_CREATE_DEVICE:\n+\t\tret = mshv_partition_ioctl_create_device(partition, uarg);\n+\t\tbreak;\n \tdefault:\n \t\tret = -ENOTTY;\n \t}\n", "prefixes": [ "V1", "07/13" ] }