diff --git a/MSFT-Merge/commit-log b/MSFT-Merge/commit-log index 9eb768e5932ab..5f623860a4e36 100644 --- a/MSFT-Merge/commit-log +++ b/MSFT-Merge/commit-log @@ -119,7 +119,6 @@ c630cc37901b 2026-08-14 x86/apic/savic: get GPA for SAVIC page using per_cpu_ Patch series in progress ------------------------ 6fd11a76911a 2024-04-17 PCI: Add a mutex to protect the global list pci_domain_busn_res_list (Status: Sent V1; Approx LOC: 25; Reference: https://lore.kernel.org/lkml/20240419015302.13871-1-decui@microsoft.com/; Testing: Tested on AH24) [Dexuan] -995392d1b714 2024-01-22 Drivers: hv: Add connection id support (Status: In review; Approx LOC: 8; Testing: Tested on AH27) [Hardik] 31a427ddeaf1 2025-02-11 vfio/pci: Continue to refactor vfio_pci_core_do_io_rw (Status: In review; Approx LOC: 30; Reference: https://lore.kernel.org/all/20240425165604.899447-4-gbayer@linux.ibm.com/) [Gerd Bayer (IBM)] 3dcb6050cf8b 2024-05-17 drivers/vmbus: Enhance Interrupt Management (Status: In review; Approx LOC: 850; Reference: [PATCH v2 00/15] Add arm64 support in MSHV_VTL - Naman Jain) [Naman] e3d9aa18101a 2024-05-17 drivers/hv: Enable MSHV_VTL_MODE for arm64 [-] @@ -131,4 +130,14 @@ f1bc8fdb27b1 2025-12-04 Fix x86 compilation errors [-] 1ada4de76a9f 2026-02-26 vtl: Fixes for compilation errors and warnings [-] cff21e6cb023 2025-04-22 hv: mshv: vtl: Allow aarch64 to use the Hyper-V VTL register page when available. (#53) [-] f701d02a32b1 2024-06-05 hyperv/arm64: Use PSCI to start processors. [-] -f6c55e5bec93 2023-02-16 x86/build: Only align ENTRY_TEXT to PMD_SIZE on x86 if PTI or SRSO is enabled. (Status: In review v4; Approx LOC: 10) [Hamza] \ No newline at end of file +f6c55e5bec93 2023-02-16 x86/build: Only align ENTRY_TEXT to PMD_SIZE on x86 if PTI or SRSO is enabled. (Status: In review v4; Approx LOC: 10) [Hamza] + + +Retired / superseded OOT commits +-------------------------------- +995392d1b714 2024-01-22 Drivers: hv: Add connection id support [Hardik] + Status: RETIRED - superseded by upstream + Revert: 1fad9da94612 + Replacement: ceb19f46e475 (6.18 stable); 92d059312802 (mainline) + Upgrade policy: Never replay the original or its revert. + Backport the replacement only if the target base lacks an equivalent fix. \ No newline at end of file diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index f10f18f884e9c..9be2af772867d 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -71,17 +71,8 @@ module_param(max_version, uint, S_IRUGO); MODULE_PARM_DESC(max_version, "Maximal VMBus protocol version which can be negotiated"); -/* - * User requested connection id used to connect to the host. Useful for testing - * or when running a vmbus server on a non-standard connection id. - */ -static uint message_connection_id; - -module_param(message_connection_id, uint, 0444); -MODULE_PARM_DESC(message_connection_id, - "The VMBus message connection id used to communicate with the Host"); - -int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) +static int vmbus_try_connection_id(struct vmbus_channel_msginfo *msginfo, + u32 version, u32 connection_id) { int ret = 0; struct vmbus_channel_initiate_contact *msg; @@ -96,28 +87,25 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) msg->vmbus_version_requested = version; /* - * VMBus protocol 5.0 (VERSION_WIN10_V5) and higher require that we must - * use VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message, - * and for subsequent messages, we must use the Message Connection ID - * field in the host-returned Version Response Message. And, with - * VERSION_WIN10_V5 and higher, we don't use msg->interrupt_page, but we - * tell the host explicitly that we still use VMBUS_MESSAGE_SINT(2) for - * compatibility. + * For VMBus protocol 5.0 (VERSION_WIN10_V5) and higher, use the + * caller-supplied connection_id for the Initiate Contact message so + * the caller can implement the required retry scheme. For subsequent + * messages, use the Message Connection ID field in the host-returned + * Version Response message. With VERSION_WIN10_V5 and higher, we don't + * use msg->interrupt_page, but tell the host explicitly that we still + * use VMBUS_MESSAGE_SINT(2) for compatibility. * * On old hosts, we should always use VMBUS_MESSAGE_CONNECTION_ID (1). */ 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; + vmbus_connection.msg_conn_id = connection_id; } else { msg->interrupt_page = virt_to_phys(vmbus_connection.int_page); vmbus_connection.msg_conn_id = VMBUS_MESSAGE_CONNECTION_ID; } - if (message_connection_id > 0) - vmbus_connection.msg_conn_id = message_connection_id; - /* * shared_gpa_boundary is zero in non-SNP VMs, so it's safe to always * bitwise OR it @@ -174,6 +162,22 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) return ret; } +int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) +{ + int ret; + + /* Try the redirect ID first for VTL2 with VMBus protocol 5.0+. */ + if (version >= VERSION_WIN10_V5 && ms_hyperv.vtl == 2) { + ret = vmbus_try_connection_id(msginfo, version, + VMBUS_MESSAGE_CONNECTION_ID_REDIRECT); + if (ret != -ENXIO) + return ret; + } + + return vmbus_try_connection_id(msginfo, version, + VMBUS_MESSAGE_CONNECTION_ID_4); +} + /* * vmbus_connect - Sends a connect request on the partition service connection */ @@ -467,18 +471,10 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep) switch (ret) { case HV_STATUS_INVALID_CONNECTION_ID: - /* - * See vmbus_negotiate_version(): VMBus protocol 5.0 - * and higher require that we must use - * VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate - * Contact message, but on old hosts that only - * support VMBus protocol 4.0 or lower, here we get - * HV_STATUS_INVALID_CONNECTION_ID and we should - * return an error immediately without retrying. - */ + /* Allow INITIATE_CONTACT to try another connection ID. */ hdr = buffer; if (hdr->msgtype == CHANNELMSG_INITIATE_CONTACT) - return -EINVAL; + return -ENXIO; /* * We could get this if we send messages too * frequently. diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 49a72a4f3f6a7..9c0b006b7f21a 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -109,6 +109,8 @@ struct hv_input_post_message { enum { VMBUS_MESSAGE_CONNECTION_ID = 1, VMBUS_MESSAGE_CONNECTION_ID_4 = 4, + /* VTL2 redirect connection ID for INITIATE_CONTACT. */ + VMBUS_MESSAGE_CONNECTION_ID_REDIRECT = 0x800074, VMBUS_MESSAGE_PORT_ID = 1, VMBUS_EVENT_CONNECTION_ID = 2, VMBUS_EVENT_PORT_ID = 2,