From nobody Thu Oct 9 04:43:22 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CFD52673AA; Thu, 19 Jun 2025 23:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750374440; cv=none; b=cjOkFAxW6urDl4/s4M99jwTiSdu3+5snzlMOREBN0cCZlmb6xjQ1l3esN1hS/a5ClBtQxonUdrvxcJhoF5PYNb3kjTZwiPGS9BY7+V42BwqwwslTrRyyIlWMNshh9zKIg4E/+7PItvt5UGMi8IxnIMwUxgZtAxAFkH8YTFCat9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750374440; c=relaxed/simple; bh=p7pAlPmMB/gvfRpS1D9ARYqS1/tXZtp/xSZNtxetRQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=BPJDJ/iy06HH8Oe+YzIxj1RpsQJfettOjR58qAOA2ZuupMp+mDx+s5LoJ8EuaVOQTBg1IoAMNJdcAcyzPTlDho/mPPodQwb+dbINy5fPwLWQYpaQqEosTd8ea9rVlvq4r1fquuBwO1Nxiwp7yRlQGVv+QZ2DQyJcnOSRQfTtY4M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=oj/SXPx+; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="oj/SXPx+" Received: by linux.microsoft.com (Postfix, from userid 1158) id 3637E201C768; Thu, 19 Jun 2025 16:07:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3637E201C768 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1750374439; bh=cXGJWrpYn8fTcAHe48jOe5AVDF7Ze1gV6pAIwUYIgDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oj/SXPx+I0DRqJiejCLDPp3EXIPif8ief+NIm3uPH5paIJF8vcrjSqRUp/SXqhefy kA8OK7uNKOfIufiky4ixyFRSi/ko7yCtWxnKqXdUTbABEVO11HaBU3qi9JXGeYTrch Cx2x2hVIzGYcpkBpMOj6Xc9CANMUkkxR+BJh85u0= From: Hardik Garg To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: devicetree@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, ssengar@linux.microsoft.com, hargar@microsoft.com, apais@microsoft.com, Hardik Garg Subject: [PATCH v4 1/2] dt-bindings: microsoft: Add vmbus message-connection-id property Date: Thu, 19 Jun 2025 16:06:34 -0700 Message-Id: <1750374395-14615-2-git-send-email-hargar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1750374395-14615-1-git-send-email-hargar@linux.microsoft.com> References: <1750374395-14615-1-git-send-email-hargar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Document the microsoft,message-connection-id property for VMBus DeviceTree node. This property allows specifying the connection ID used for communication between host and guest. Signed-off-by: Hardik Garg --- 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 --- Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml b/D= ocumentation/devicetree/bindings/bus/microsoft,vmbus.yaml index 0bea4f5287ce..615b48bd6a8b 100644 --- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml +++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml @@ -17,6 +17,14 @@ properties: compatible: const: microsoft,vmbus =20 + microsoft,message-connection-id: + description: | + VMBus message connection ID to be used for communication between hos= t and + guest. If not specified, defaults to VMBUS_MESSAGE_CONNECTION_ID_4 (= 4) for + protocol version VERSION_WIN10_V5 and above, or VMBUS_MESSAGE_CONNEC= TION_ID + (1) for older versions. + $ref: /schemas/types.yaml#/definitions/uint32 + ranges: true =20 '#address-cells': @@ -55,6 +63,7 @@ examples: =20 vmbus@ff0000000 { compatible =3D "microsoft,vmbus"; + microsoft,message-connection-id =3D <4>; #address-cells =3D <2>; #size-cells =3D <1>; ranges =3D <0x0f 0xf0000000 0x0f 0xf0000000 0x10000000>; --=20 2.40.4 From nobody Thu Oct 9 04:43:22 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6735D28DF32; Thu, 19 Jun 2025 23:07:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750374443; cv=none; b=kEeMh0vBwETiqLn4szvknPezX+Lu9cvhP/JAZjo9UdGyw4Irwc86xHmc9xCUzQBrQRRk1nGk03spdYuicoJ7R+p3rkJM6tMl+P+Mj0jmVqv7pkjbvxH7278AlCOS56/jodpRLEdzO9a1bjk4JngixOWY1JGticH7cN32iwNHUH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750374443; c=relaxed/simple; bh=/sOaS+hbkequcuE8aG0SsZSgDJ3nCjqOHEY1BGDzuFc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ZmMA70/k9sscXfTjg1/o/JyxCckvoX8gCRQmE7iZqgMa/CGGMTdx4iMQHsg1WsQ04dMXfbHw+4SnCNiQJJpL8tmwur3o0dYFV46u13pO4zMp1WNDz4mEq2SixPOYBu0oIvdqNMFkZtYKgnhPZHpFgJHMjWLpK20iGZIeIX5jPp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=B9SuDABR; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="B9SuDABR" Received: by linux.microsoft.com (Postfix, from userid 1158) id 142F9201C74B; Thu, 19 Jun 2025 16:07:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 142F9201C74B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1750374442; bh=0xy7llJQ1xMXfeeDPMOG3Jf8ypWlDPfWsIqQcRypAm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9SuDABRolltD+vDbDtKifeG5Q4jkTN+pNSKimAJ4ZrFFfuukgqh/5Wudt0JzpQg/ yN8/IPrITqUECV/94x1geaT5cWnOy17MNeP4FSP+O+58oAW4Y8iufMn/mAD2o6mYrk HmrRzGbkfa7u6p+4as7KWrytyK8z2kmCH6OnqcTA= From: Hardik Garg To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: devicetree@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, ssengar@linux.microsoft.com, hargar@microsoft.com, apais@microsoft.com, Hardik Garg Subject: [PATCH v4 2/2] vmbus: retrieve connection-id from DeviceTree Date: Thu, 19 Jun 2025 16:06:35 -0700 Message-Id: <1750374395-14615-3-git-send-email-hargar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1750374395-14615-1-git-send-email-hargar@linux.microsoft.com> References: <1750374395-14615-1-git-send-email-hargar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 DeviceTree where it exists as a property under the vmbus node with the compatible ID "microsoft,message-connection-id". The property name follows the format , where "vendor": "microsoft" and "field": "message-connection-id" Reading from DeviceTree allows platforms to specify their preferred communication channel, making it more flexible. If the property is not found in the DeviceTree, use the default connection ID (VMBUS_MESSAGE_CONNECTION_ID or VMBUS_MESSAGE_CONNECTION_ID_4 based on protocol version). Signed-off-by: Hardik Garg --- 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 | 6 ++++-- drivers/hv/vmbus_drv.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index be490c598785..15d2b652783d 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -99,11 +99,13 @@ int vmbus_negotiate_version(struct vmbus_channel_msginf= o *msginfo, u32 version) if (version >=3D VERSION_WIN10_V5) { msg->msg_sint =3D VMBUS_MESSAGE_SINT; msg->msg_vtl =3D ms_hyperv.vtl; - vmbus_connection.msg_conn_id =3D VMBUS_MESSAGE_CONNECTION_ID_4; } else { msg->interrupt_page =3D virt_to_phys(vmbus_connection.int_page); - vmbus_connection.msg_conn_id =3D VMBUS_MESSAGE_CONNECTION_ID; } + /* Set default connection ID if not provided via DeviceTree */ + if (!vmbus_connection.msg_conn_id) + vmbus_connection.msg_conn_id =3D (version >=3D VERSION_WIN10_V5) ? + VMBUS_MESSAGE_CONNECTION_ID_4 : VMBUS_MESSAGE_CONNECTION_ID; =20 /* * shared_gpa_boundary is zero in non-SNP VMs, so it's safe to always diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index c236081d0a87..b78d5499e4bc 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2541,10 +2541,23 @@ static int vmbus_device_add(struct platform_device = *pdev) struct of_range range; struct of_range_parser parser; struct device_node *np =3D pdev->dev.of_node; + unsigned int conn_id; int ret; =20 vmbus_root_device =3D &pdev->dev; =20 + /* + * Read connection ID from DeviceTree. The property name follows the + * format , where: + * - vendor: "microsoft" + * - field: "message-connection-id" + */ + ret =3D 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 =3D conn_id; + } + ret =3D of_range_parser_init(&parser, np); if (ret) return ret; --=20 2.40.4