Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226033/?format=api
{ "id": 2226033, "url": "http://patchwork.ozlabs.org/api/patches/2226033/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-11-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-11-mrathor@linux.microsoft.com>", "list_archive_url": null, "date": "2026-04-22T02:32:36", "name": "[V1,10/13] PCI: hv: Build device id for a VMBus device, export PCI devid function", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "1421577f699ec550a9ed8fd650915470c3b43c89", "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-11-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/2226033/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226033/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-52905-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=Ic1yo5q3;\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-52905-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=\"Ic1yo5q3\"", "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 [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 4g0k3r3cMNz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 12:40:40 +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 890F33074CF0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 02:35:47 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5F6D8389110;\n\tWed, 22 Apr 2026 02:34:17 +0000 (UTC)", "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id EFBC7383C78;\n\tWed, 22 Apr 2026 02:33:56 +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 4179320B6F22;\n\tTue, 21 Apr 2026 19:33:50 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776825253; cv=none;\n b=oIlZFYsFIShaO5roZr5r6mhp16S+/hWb/fCRYXmZgYk8iuxRrtPFfQ5ZxvyExBmCBJoSo24YNcy4d3i3j4rWGnQAoYxrhstSoZVTZUS2TrZsMA/+qt6j9GVnkffUolVA5zI2JXkgaqtqPYDJSibSxlesuRtLg+UfxbvXwT2pA6c=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776825253; c=relaxed/simple;\n\tbh=/Lw+KcSgHoHzffRnhyMXmnV0XRzyqvf5vEVQCn2n6FQ=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=WVC760ZKSE0i22YCsCDqrjzT8ZJpmQyPe0XFxWmVlsstHs9mLq2iZBvSIM3I2xkB0wi4ECROGJ5MvoLTtgWxXLpm9Nt/B9T7Kv9dCxGjyJi9niDEIyzj3WJonxIU8ohTft/D3fkMrtNi4G6MfEV3CN8wwWT94YlhAOV7E+KbEYg=", "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=Ic1yo5q3;\n arc=none smtp.client-ip=13.77.154.182", "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 4179320B6F22", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n\ts=default; t=1776825231;\n\tbh=gW30GO/QQW7nzaJ7Yfwf+7LrHlL5wIbU4fBiOZJvGkU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ic1yo5q3LYqOj6CnC5HptX8+MMhLYozrXi4UCdgjcq6buP3vSBaLinIDDMLVshfP6\n\t CvEOskA5omxJw3fPoBPqwFFgnaHHNWpdi/V0GU4w8DMm9dy88Dzw+z1L5QFx4h7vfS\n\t AKa7sd938DsJ/ipTBUDb9aIMj1Sr1zH2tafiVPNk=", "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 10/13] PCI: hv: Build device id for a VMBus device,\n export PCI devid function", "Date": "Tue, 21 Apr 2026 19:32:36 -0700", "Message-ID": "<20260422023239.1171963-11-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": "On Hyper-V, most hypercalls related to PCI passthru to map/unmap regions,\ninterrupts, etc need a device id as a parameter. This device id refers\nto that specific device during the lifetime of passthru.\n\nAn L1VH VM only contains VMBus based devices. A device id for a VMBus\ndevice is slightly different in that it uses the hv_pcibus_device info\nfor building it to make sure it matches exactly what the hypervisor\nexpects. This VMBus based device id is needed when attaching devices in\nan L1VH based guest VM. Before building it, a check is done to make sure\nthe device is a valid VMBus device.\n\nIn remaining cases, PCI device id is used. So, also make pci device\nid build function public.\n\nSigned-off-by: Mukesh R <mrathor@linux.microsoft.com>\n---\n arch/x86/hyperv/irqdomain.c | 9 +++++----\n arch/x86/include/asm/mshyperv.h | 4 ++++\n drivers/pci/controller/pci-hyperv.c | 25 +++++++++++++++++++++++++\n include/asm-generic/mshyperv.h | 7 +++++++\n 4 files changed, 41 insertions(+), 4 deletions(-)", "diff": "diff --git a/arch/x86/hyperv/irqdomain.c b/arch/x86/hyperv/irqdomain.c\nindex 229f986e08ea..527835b99a70 100644\n--- a/arch/x86/hyperv/irqdomain.c\n+++ b/arch/x86/hyperv/irqdomain.c\n@@ -137,7 +137,7 @@ static int get_rid_cb(struct pci_dev *pdev, u16 alias, void *data)\n \treturn 0;\n }\n \n-static union hv_device_id hv_build_devid_type_pci(struct pci_dev *pdev)\n+u64 hv_build_devid_type_pci(struct pci_dev *pdev)\n {\n \tint pos;\n \tunion hv_device_id hv_devid;\n@@ -197,8 +197,9 @@ static union hv_device_id hv_build_devid_type_pci(struct pci_dev *pdev)\n \t}\n \n out:\n-\treturn hv_devid;\n+\treturn hv_devid.as_uint64;\n }\n+EXPORT_SYMBOL_GPL(hv_build_devid_type_pci);\n \n /*\n * hv_map_msi_interrupt() - Map the MSI IRQ in the hypervisor.\n@@ -221,7 +222,7 @@ int hv_map_msi_interrupt(struct irq_data *data,\n \n \tmsidesc = irq_data_get_msi_desc(data);\n \tpdev = msi_desc_to_pci_dev(msidesc);\n-\thv_devid = hv_build_devid_type_pci(pdev);\n+\thv_devid.as_uint64 = hv_build_devid_type_pci(pdev);\n \tcpu = cpumask_first(irq_data_get_effective_affinity_mask(data));\n \n \treturn hv_map_interrupt(hv_current_partition_id, hv_devid, false, cpu,\n@@ -296,7 +297,7 @@ static int hv_unmap_msi_interrupt(struct pci_dev *pdev,\n {\n \tunion hv_device_id hv_devid;\n \n-\thv_devid = hv_build_devid_type_pci(pdev);\n+\thv_devid.as_uint64 = hv_build_devid_type_pci(pdev);\n \treturn hv_unmap_interrupt(hv_devid.as_uint64, irq_entry);\n }\n \ndiff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h\nindex f64393e853ee..039e8a986be3 100644\n--- a/arch/x86/include/asm/mshyperv.h\n+++ b/arch/x86/include/asm/mshyperv.h\n@@ -271,6 +271,10 @@ static inline u64 hv_get_non_nested_msr(unsigned int reg) { return 0; }\n static inline int hv_apicid_to_vp_index(u32 apic_id) { return -EINVAL; }\n #endif /* CONFIG_HYPERV */\n \n+#if IS_ENABLED(CONFIG_HYPERV_IOMMU)\n+u64 hv_build_devid_type_pci(struct pci_dev *pdev);\n+#endif /* IS_ENABLED(CONFIG_HYPERV_IOMMU) */\n+\n struct mshv_vtl_cpu_context {\n \tunion {\n \t\tstruct {\ndiff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c\nindex ed6b399afc80..8f6b818ee09b 100644\n--- a/drivers/pci/controller/pci-hyperv.c\n+++ b/drivers/pci/controller/pci-hyperv.c\n@@ -578,6 +578,8 @@ static void hv_pci_onchannelcallback(void *context);\n #define DELIVERY_MODE\t\tAPIC_DELIVERY_MODE_FIXED\n #define HV_MSI_CHIP_FLAGS\tMSI_CHIP_FLAG_SET_ACK\n \n+static bool hv_vmbus_pci_device(struct pci_bus *pbus);\n+\n static int hv_pci_irqchip_init(void)\n {\n \treturn 0;\n@@ -1005,6 +1007,24 @@ static struct irq_domain *hv_pci_get_root_domain(void)\n static void hv_arch_irq_unmask(struct irq_data *data) { }\n #endif /* CONFIG_ARM64 */\n \n+u64 hv_pci_vmbus_device_id(struct pci_dev *pdev)\n+{\n+\tstruct hv_pcibus_device *hbus;\n+\tstruct pci_bus *pbus = pdev->bus;\n+\n+\tif (!hv_vmbus_pci_device(pbus))\n+\t\treturn 0;\n+\n+\thbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata);\n+\n+\treturn\t(hbus->hdev->dev_instance.b[5] << 24) |\n+\t\t(hbus->hdev->dev_instance.b[4] << 16) |\n+\t\t(hbus->hdev->dev_instance.b[7] << 8) |\n+\t\t(hbus->hdev->dev_instance.b[6] & 0xf8) |\n+\t\tPCI_FUNC(pdev->devfn);\n+}\n+EXPORT_SYMBOL_GPL(hv_pci_vmbus_device_id);\n+\n /**\n * hv_pci_generic_compl() - Invoked for a completion packet\n * @context:\t\tSet up by the sender of the packet.\n@@ -1403,6 +1423,11 @@ static struct pci_ops hv_pcifront_ops = {\n \t.write = hv_pcifront_write_config,\n };\n \n+static bool hv_vmbus_pci_device(struct pci_bus *pbus)\n+{\n+\treturn pbus->ops == &hv_pcifront_ops;\n+}\n+\n /*\n * Paravirtual backchannel\n *\ndiff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h\nindex e8cbc4e3f7ad..fe5ddd1c43ff 100644\n--- a/include/asm-generic/mshyperv.h\n+++ b/include/asm-generic/mshyperv.h\n@@ -329,6 +329,13 @@ static inline enum hv_isolation_type hv_get_isolation_type(void)\n }\n #endif /* CONFIG_HYPERV */\n \n+#if IS_ENABLED(CONFIG_PCI_HYPERV)\n+u64 hv_pci_vmbus_device_id(struct pci_dev *pdev);\n+#else /* IS_ENABLED(CONFIG_PCI_HYPERV) */\n+static inline u64 hv_pci_vmbus_device_id(struct pci_dev *pdev)\n+{ return 0; }\n+#endif /* IS_ENABLED(CONFIG_PCI_HYPERV) */\n+\n #if IS_ENABLED(CONFIG_MSHV_ROOT)\n static inline bool hv_root_partition(void)\n {\n", "prefixes": [ "V1", "10/13" ] }