mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hardik Garg <hargar@linux.microsoft.com>
To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, krzk+dt@kernel.org, robh@kernel.org,
	conor+dt@kernel.org, mhklinux@outlook.com
Cc: devicetree@vger.kernel.org, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, ssengar@linux.microsoft.com,
	longli@microsoft.com, Naman Jain <namjain@linux.microsoft.com>,
	hargar@microsoft.com
Subject: [PATCH v5 2/2] Drivers: hv: vmbus: retrieve connection-id from DeviceTree
Date: Tue, 23 Dec 2025 15:09:24 -0800	[thread overview]
Message-ID: <10482c90-50c8-4e72-ba40-1d0e6e722128@linux.microsoft.com> (raw)
In-Reply-To: <58cb22cb-b0c8-4694-b9e4-971aa7f0f972@linux.microsoft.com>

The connection-id determines which hypervisor communication channel
the guest should use to talk to the VMBus host. Add steps to read
this value from the DeviceTree. When this property is not present,
the driver selects the connection ID based on the protocol version
(4 for VERSION_WIN10_V5 and newer, or 1 for older versions).

Signed-off-by: Hardik Garg <hargar@linux.microsoft.com>
---
v4:
https://lore.kernel.org/all/1750374395-14615-3-git-send-email-hargar@linux.microsoft.com
v3:
https://lore.kernel.org/all/6a92ca86-ad6b-4d49-af6e-1ed7651b8ab8@linux.microsoft.com
v2:
https://lore.kernel.org/all/096edaf7-cc90-42b6-aff4-c5f088574e1e@linux.microsoft.com
v1:
https://lore.kernel.org/all/6acee4bf-cb04-43b9-9476-e8d811d26dfd@linux.microsoft.com
---
 drivers/hv/connection.c |  7 +++++--
 drivers/hv/vmbus_drv.c  |  8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 5d9cb5bf2d62..660cad3886f5 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -100,12 +100,15 @@ int vmbus_negotiate_version(struct
vmbus_channel_msginfo *msginfo, u32 version)
     if (version >= VERSION_WIN10_V5) {
         msg->msg_sint = VMBUS_MESSAGE_SINT;
         msg->msg_vtl = ms_hyperv.vtl;
-        vmbus_connection.msg_conn_id = VMBUS_MESSAGE_CONNECTION_ID_4;
     } else {
         msg->interrupt_page = virt_to_phys(vmbus_connection.int_page);
-        vmbus_connection.msg_conn_id = VMBUS_MESSAGE_CONNECTION_ID;
     }
 
+    /* Set default connection ID if not provided via DeviceTree */
+    if (!vmbus_connection.msg_conn_id)
+        vmbus_connection.msg_conn_id = (version >= VERSION_WIN10_V5) ?
+            VMBUS_MESSAGE_CONNECTION_ID_4 : VMBUS_MESSAGE_CONNECTION_ID;
+
     if (vmbus_is_confidential() && version >= VERSION_WIN10_V6_0)
         msg->feature_flags = VMBUS_FEATURE_FLAG_CONFIDENTIAL_CHANNELS;
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 47fcab38398a..f8c0594ab85f 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2600,10 +2600,18 @@ static int vmbus_device_add(struct
platform_device *pdev)
     struct of_range range;
     struct of_range_parser parser;
     struct device_node *np = pdev->dev.of_node;
+   unsigned int conn_id;
     int ret;
 
     vmbus_root_device = &pdev->dev;
 
+    /* Read connection ID from DeviceTree */
+    if (!of_property_read_u32(np, "microsoft,message-connection-id",
+                  &conn_id)) {
+        pr_info("VMBus message connection ID: %u\n", conn_id);
+        vmbus_connection.msg_conn_id = conn_id;
+    }
+
     ret = of_range_parser_init(&parser, np);
     if (ret)
         return ret;
-- 
2.34.1



  parent reply	other threads:[~2025-12-23 23:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 23:05 [PATCH v5 0/2] Add VMBus message connection ID support via DeviceTree Hardik Garg
2025-12-23 23:07 ` [PATCH v5 1/2] dt-bindings: microsoft: Add vmbus message-connection-id property Hardik Garg
2025-12-23 23:09 ` Hardik Garg [this message]
2026-01-27  0:12 ` [PATCH v5 0/2] Add VMBus message connection ID support via DeviceTree Hardik Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10482c90-50c8-4e72-ba40-1d0e6e722128@linux.microsoft.com \
    --to=hargar@linux.microsoft.com \
    --cc=conor+dt@kernel.org \
    --cc=decui@microsoft.com \
    --cc=devicetree@vger.kernel.org \
    --cc=haiyangz@microsoft.com \
    --cc=hargar@microsoft.com \
    --cc=krzk+dt@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=mhklinux@outlook.com \
    --cc=namjain@linux.microsoft.com \
    --cc=robh@kernel.org \
    --cc=ssengar@linux.microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®