Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2231632/?format=api
{ "id": 2231632, "url": "http://patchwork.ozlabs.org/api/patches/2231632/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260501004157.3108202-9-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": "<20260501004157.3108202-9-mrathor@linux.microsoft.com>", "list_archive_url": null, "date": "2026-05-01T00:41:54", "name": "[V2,08/11] PCI: hv: Build device id for a VMBus device, export PCI devid function", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3909fd2292d94c56cd10036fd5f66e77aeafe7b2", "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/20260501004157.3108202-9-mrathor@linux.microsoft.com/mbox/", "series": [ { "id": 502410, "url": "http://patchwork.ozlabs.org/api/series/502410/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=502410", "date": "2026-05-01T00:41:46", "name": "PCI passthru on Hyper-V (Part I)", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/502410/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2231632/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2231632/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-53566-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=K3UGl4tS;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-53566-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=\"K3UGl4tS\"", "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 sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::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 4g6C3d2lLJz1y1d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 10:44:29 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 4656A300EB67\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 1 May 2026 00:43:05 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 1CE852E2EF9;\n\tFri, 1 May 2026 00:42:24 +0000 (UTC)", "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id A5CEF286881;\n\tFri, 1 May 2026 00:42:22 +0000 (UTC)", "from mrdev.corp.microsoft.com (unknown [40.86.183.173])\n\tby linux.microsoft.com (Postfix) with ESMTPSA id 994D220B7167;\n\tThu, 30 Apr 2026 17:42:20 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777596144; cv=none;\n b=oInLzuKiJmpnn3iRGrnLXxUBWvTVDUGlgYC8c4qMEXUpzFlUojT/3nlvRsQbp7GNxsHgbwfLoptumJYVsy52Oqy9H838JvTvvdtEJ/MooN09rAZFWz/xgKHM387yRxiEs9MtKWnWmLmPztHhYxpVVkS3DlTDUoaTu7IXS0FgvOM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777596144; c=relaxed/simple;\n\tbh=qaurpRd8Y2igcv7snLsj0uGGPBOguOYIkeyt5vMtkvE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=c9YmnvY4rv44onbidEO52pUOwx6gtzB39GxwuEOraUP0fPCxCsydVIAVwDHkJyCpGQEBvAYWd4e48wQGM4ORZeahr+U/DsHOG8fi+4aKCk/1Qv8SrX/l26ZsD3EapHOSInvQ16lutHVVjqFxoQDSQxVgjATDW6Fcf7iIFZmPENg=", "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=K3UGl4tS;\n arc=none smtp.client-ip=13.77.154.182", "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 994D220B7167", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n\ts=default; t=1777596141;\n\tbh=aBz7LjJu5NDw3Qs+wKs6ePt7vFQDMj33A9lKJKqgo80=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=K3UGl4tSOrF5961qTUw0A4+YYkSgTeO9mRByOjLn0hD3oAudCRPjHdudBlDrJ7sTH\n\t 1Utr3VC+vLT7fK0fqPBxjwFj9cQUglz78Ac+NyWVy3gxa9WNJSBVDimXrSc4lHzpZJ\n\t 5U4CxiuWbxGGN4r/BdfhYEQUCNJZGYnEplg6nbcQ=", "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 V2 08/11] PCI: hv: Build device id for a VMBus device,\n export PCI devid function", "Date": "Thu, 30 Apr 2026 17:41:54 -0700", "Message-ID": "<20260501004157.3108202-9-mrathor@linux.microsoft.com>", "X-Mailer": "git-send-email 2.51.2.vfs.0.1", "In-Reply-To": "<20260501004157.3108202-1-mrathor@linux.microsoft.com>", "References": "<20260501004157.3108202-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 ID\nbuild function hv_build_devid_type_pci() 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 | 6 ++++++\n drivers/pci/controller/pci-hyperv.c | 24 ++++++++++++++++++++++++\n include/asm-generic/mshyperv.h | 8 ++++++++\n 4 files changed, 43 insertions(+), 4 deletions(-)", "diff": "diff --git a/arch/x86/hyperv/irqdomain.c b/arch/x86/hyperv/irqdomain.c\nindex b3ad50a874dc..8780573a4332 100644\n--- a/arch/x86/hyperv/irqdomain.c\n+++ b/arch/x86/hyperv/irqdomain.c\n@@ -112,7 +112,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@@ -172,8 +172,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@@ -196,7 +197,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_devid, false, cpu, cfg->vector,\n@@ -271,7 +272,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..9d24cafed657 100644\n--- a/arch/x86/include/asm/mshyperv.h\n+++ b/arch/x86/include/asm/mshyperv.h\n@@ -271,6 +271,12 @@ 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+#else\n+u64 hv_build_devid_type_pci(struct pci_dev *pdev) { return 0; }\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 cfc8fa403dad..50d793ca8f31 100644\n--- a/drivers/pci/controller/pci-hyperv.c\n+++ b/drivers/pci/controller/pci-hyperv.c\n@@ -573,6 +573,7 @@ struct hv_pci_compl {\n };\n \n static void hv_pci_onchannelcallback(void *context);\n+static bool hv_vmbus_pci_device(struct pci_bus *pbus);\n \n #ifdef CONFIG_X86\n #define DELIVERY_MODE\t\tAPIC_DELIVERY_MODE_FIXED\n@@ -1005,6 +1006,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 +1422,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..a6878ab685e7 100644\n--- a/include/asm-generic/mshyperv.h\n+++ b/include/asm-generic/mshyperv.h\n@@ -23,6 +23,7 @@\n #include <acpi/acpi_numa.h>\n #include <linux/cpumask.h>\n #include <linux/nmi.h>\n+#include <linux/pci.h>\n #include <asm/ptrace.h>\n #include <hyperv/hvhdk.h>\n \n@@ -329,6 +330,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\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": [ "V2", "08/11" ] }