The following commit has been merged in the master branch: commit 0e0073eb1b60f4ec6faecea034a6772fe1409a88 Merge: aa512c115a09d9133dcb09466e39f93f99a82fdb 154fb14df7a3c81dea82eca7c0c46590f5ffc3d2 Author: Linus Torvalds torvalds@linux-foundation.org Date: Mon Oct 10 13:59:01 2022 -0700
Merge tag 'hyperv-next-signed-20221009' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull hyperv updates from Wei Liu:
- Remove unnecessary delay while probing for VMBus (Stanislav Kinsburskiy)
- Optimize vmbus_on_event (Saurabh Sengar)
- Fix a race in Hyper-V DRM driver (Saurabh Sengar)
- Miscellaneous clean-up patches from various people
* tag 'hyperv-next-signed-20221009' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: x86/hyperv: Replace kmap() with kmap_local_page() drm/hyperv: Add ratelimit on error message hyperv: simplify and rename generate_guest_id Drivers: hv: vmbus: Split memcpy of flex-array scsi: storvsc: remove an extraneous "to" in a comment Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization Drivers: hv: vmbus: Use PCI_VENDOR_ID_MICROSOFT for better discoverability Drivers: hv: vmbus: Fix kernel-doc drm/hyperv: Don't overwrite dirt_needed value set by host Drivers: hv: vmbus: Optimize vmbus_on_event
diff --combined drivers/hv/vmbus_drv.c index 7b9f3fc3adf7,bbbc92994e94..8b2e413bf19c --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@@ -46,8 -46,6 +46,6 @@@ struct vmbus_dynid
static struct acpi_device *hv_acpi_dev;
- static struct completion probe_event; - static int hyperv_cpuhp_online;
static void *hv_panic_page; @@@ -1132,7 -1130,8 +1130,8 @@@ void vmbus_on_msg_dpc(unsigned long dat return;
INIT_WORK(&ctx->work, vmbus_onmessage_work); - memcpy(&ctx->msg, &msg_copy, sizeof(msg->header) + payload_size); + ctx->msg.header = msg_copy.header; + memcpy(&ctx->msg.payload, msg_copy.u.payload, payload_size);
/* * The host can generate a rescind message while we @@@ -1573,7 -1572,7 +1572,7 @@@ err_setup }
/** - * __vmbus_child_driver_register() - Register a vmbus's driver + * __vmbus_driver_register() - Register a vmbus's driver * @hv_driver: Pointer to driver structure you want to register * @owner: owner module of the drv * @mod_name: module name string @@@ -2052,7 -2051,7 +2051,7 @@@ struct hv_device *vmbus_device_create(c child_device_obj->channel = channel; guid_copy(&child_device_obj->dev_type, type); guid_copy(&child_device_obj->dev_instance, instance); - child_device_obj->vendor_id = 0x1414; /* MSFT vendor ID */ + child_device_obj->vendor_id = PCI_VENDOR_ID_MICROSOFT;
return child_device_obj; } @@@ -2453,8 -2452,7 +2452,8 @@@ static int vmbus_acpi_add(struct acpi_d * Some ancestor of the vmbus acpi device (Gen1 or Gen2 * firmware) is the VMOD that has the mmio ranges. Get that. */ - for (ancestor = device->parent; ancestor; ancestor = ancestor->parent) { + for (ancestor = acpi_dev_parent(device); ancestor; + ancestor = acpi_dev_parent(ancestor)) { result = acpi_walk_resources(ancestor->handle, METHOD_NAME__CRS, vmbus_walk_resources, NULL);
@@@ -2468,7 -2466,6 +2467,6 @@@ ret_val = 0;
acpi_walk_err: - complete(&probe_event); if (ret_val) vmbus_acpi_remove(device); return ret_val; @@@ -2647,6 -2644,7 +2645,7 @@@ static struct acpi_driver vmbus_acpi_dr .remove = vmbus_acpi_remove, }, .drv.pm = &vmbus_bus_pm, + .drv.probe_type = PROBE_FORCE_SYNCHRONOUS, };
static void hv_kexec_handler(void) @@@ -2719,7 -2717,7 +2718,7 @@@ static struct syscore_ops hv_synic_sysc
static int __init hv_acpi_init(void) { - int ret, t; + int ret;
if (!hv_is_hyperv_initialized()) return -ENODEV; @@@ -2727,8 -2725,6 +2726,6 @@@ if (hv_root_partition) return 0;
- init_completion(&probe_event); - /* * Get ACPI resources first. */ @@@ -2737,9 -2733,8 +2734,8 @@@ if (ret) return ret;
- t = wait_for_completion_timeout(&probe_event, 5*HZ); - if (t == 0) { - ret = -ETIMEDOUT; + if (!hv_acpi_dev) { + ret = -ENODEV; goto cleanup; }
diff --combined drivers/scsi/storvsc_drv.c index 573f89eade3b,a60808bb4064..bc46721aa01c --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@@ -60,6 -60,9 +60,9 @@@ #define VMSTOR_PROTO_VERSION_WIN8_1 VMSTOR_PROTO_VERSION(6, 0) #define VMSTOR_PROTO_VERSION_WIN10 VMSTOR_PROTO_VERSION(6, 2)
+ /* channel callback timeout in ms */ + #define CALLBACK_TIMEOUT 2 + /* Packet structure describing virtual storage requests. */ enum vstor_packet_operation { VSTOR_OPERATION_COMPLETE_IO = 1, @@@ -1029,7 -1032,7 +1032,7 @@@ do_work */ wrk = kmalloc(sizeof(struct storvsc_scan_work), GFP_ATOMIC); if (!wrk) { - set_host_byte(scmnd, DID_TARGET_FAILURE); + set_host_byte(scmnd, DID_BAD_TARGET); return; }
@@@ -1204,6 -1207,7 +1207,7 @@@ static void storvsc_on_channel_callback struct hv_device *device; struct storvsc_device *stor_device; struct Scsi_Host *shost; + unsigned long time_limit = jiffies + msecs_to_jiffies(CALLBACK_TIMEOUT);
if (channel->primary_channel != NULL) device = channel->primary_channel->device_obj; @@@ -1224,6 -1228,11 +1228,11 @@@ u32 minlen = rqst_id ? sizeof(struct vstor_packet) : sizeof(enum vstor_packet_operation);
+ if (unlikely(time_after(jiffies, time_limit))) { + hv_pkt_iter_close(channel); + return; + } + if (pktlen < minlen) { dev_err(&device->device, "Invalid pkt: id=%llu, len=%u, minlen=%u\n", @@@ -2059,7 -2068,7 +2068,7 @@@ err_out3 err_out2: /* * Once we have connected with the host, we would need to - * to invoke storvsc_dev_remove() to rollback this state and + * invoke storvsc_dev_remove() to rollback this state and * this call also frees up the stor_device; hence the jump around * err_out1 label. */