* [PATCH] vmbus: retrieve connection-id from device tree
@ 2025-05-28 21:33 Hardik Garg
2025-05-29 5:43 ` Saurabh Singh Sengar
0 siblings, 1 reply; 2+ messages in thread
From: Hardik Garg @ 2025-05-28 21:33 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui
Cc: romank, linux-hyperv, linux-kernel, stable, ssengar, apais
The connection-id determines which hypervisor communication channel the
guest should use to talk to the VMBus host. This patch adds support to
read this value from the device tree where it exists as a property under
the vmbus node with the compatible ID "microsoft,message-connection-id".
Reading from device tree allows platforms to specify their preferred
communication channel, making it more flexible. If the property is
not found in the device tree, use the default connection ID
(VMBUS_MESSAGE_CONNECTION_ID or VMBUS_MESSAGE_CONNECTION_ID_4
based on protocol version).
Cc: <stable@kernel.org> # 6.14, 6.12
Signed-off-by: Hardik Garg <hargar@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 8351360bba16..f5acc4685981 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -99,12 +99,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 device tree */
+ if (!vmbus_connection.msg_conn_id)
+ vmbus_connection.msg_conn_id = (version >= VERSION_WIN10_V5) ?
+ VMBUS_MESSAGE_CONNECTION_ID_4 : VMBUS_MESSAGE_CONNECTION_ID;
+
/*
* shared_gpa_boundary is zero in non-SNP VMs, so it's safe to always
* bitwise OR it
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index e3d51a316316..a42ec7d499aa 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2471,10 +2471,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;
hv_dev = &pdev->dev;
+ /* Read connection ID from device tree */
+ ret = of_property_read_u32(np, "microsoft,message-connection-id",
&conn_id);
+ if (!ret) {
+ 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.40.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vmbus: retrieve connection-id from device tree
2025-05-28 21:33 [PATCH] vmbus: retrieve connection-id from device tree Hardik Garg
@ 2025-05-29 5:43 ` Saurabh Singh Sengar
0 siblings, 0 replies; 2+ messages in thread
From: Saurabh Singh Sengar @ 2025-05-29 5:43 UTC (permalink / raw)
To: Hardik Garg
Cc: kys, haiyangz, wei.liu, decui, romank, linux-hyperv, linux-kernel,
stable, ssengar, apais
On Wed, May 28, 2025 at 02:33:25PM -0700, Hardik Garg wrote:
> The connection-id determines which hypervisor communication channel the
> guest should use to talk to the VMBus host. This patch adds support to
> read this value from the device tree where it exists as a property under
> the vmbus node with the compatible ID "microsoft,message-connection-id".
Add Documentation for "microsoft,message-connection-id"
>
> Reading from device tree allows platforms to specify their preferred
> communication channel, making it more flexible. If the property is
> not found in the device tree, use the default connection ID
> (VMBUS_MESSAGE_CONNECTION_ID or VMBUS_MESSAGE_CONNECTION_ID_4
> based on protocol version).
>
> Cc: <stable@kernel.org> # 6.14, 6.12
I don't see it as as bug which needs to be backported on certain branches only.
You can rebase your changes on linux-next or hyperv-next and resend.
Also,
s/device tree/DeviceTree/g
- Saurabh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-29 5:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 21:33 [PATCH] vmbus: retrieve connection-id from device tree Hardik Garg
2025-05-29 5:43 ` Saurabh Singh Sengar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.