Lines Matching +full:16 +full:- +full:channel
1 // SPDX-License-Identifier: GPL-2.0-only
28 #define SD_VERSION_3_1 (SD_MAJOR << 16 | SD_MINOR_1)
29 #define SD_VERSION_3_2 (SD_MAJOR << 16 | SD_MINOR_2)
30 #define SD_VERSION (SD_MAJOR << 16 | SD_MINOR)
33 #define SD_VERSION_1 (SD_MAJOR_1 << 16 | SD_MINOR)
37 #define TS_VERSION (TS_MAJOR << 16 | TS_MINOR)
40 #define TS_VERSION_1 (TS_MAJOR_1 << 16 | TS_MINOR)
43 #define TS_VERSION_3 (TS_MAJOR_3 << 16 | TS_MINOR)
47 #define HB_VERSION (HB_MAJOR << 16 | HB_MINOR)
50 #define HB_VERSION_1 (HB_MAJOR_1 << 16 | HB_MINOR)
101 kobject_uevent_env(&ctx->dev->device.kobj, KOBJ_CHANGE, uevent_env); in send_hibernate_uevent()
108 struct vmbus_channel *channel = srv->channel; in hv_shutdown_init() local
111 hibernate_context.dev = channel->device_obj; in hv_shutdown_init()
181 struct vmbus_channel *channel = context; in shutdown_onchannelcallback() local
191 if (vmbus_recvpacket(channel, shut_txf_buf, HV_HYP_PAGE_SIZE, &recvlen, &requestid)) { in shutdown_onchannelcallback()
208 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { in shutdown_onchannelcallback()
215 sd_srv_version >> 16, in shutdown_onchannelcallback()
218 } else if (icmsghdrp->icmsgtype == ICMSGTYPE_SHUTDOWN) { in shutdown_onchannelcallback()
229 * shutdown_msg->flags can be 0(shut down), 2(reboot), in shutdown_onchannelcallback()
230 * or 4(hibernate). It may bitwise-OR 1, which means in shutdown_onchannelcallback()
234 switch (shutdown_msg->flags) { in shutdown_onchannelcallback()
237 icmsghdrp->status = HV_S_OK; in shutdown_onchannelcallback()
239 pr_info("Shutdown request received - graceful shutdown initiated\n"); in shutdown_onchannelcallback()
243 icmsghdrp->status = HV_S_OK; in shutdown_onchannelcallback()
245 pr_info("Restart request received - graceful restart initiated\n"); in shutdown_onchannelcallback()
250 icmsghdrp->status = hibernation_supported ? in shutdown_onchannelcallback()
256 icmsghdrp->status = HV_E_FAIL; in shutdown_onchannelcallback()
257 pr_info("Shutdown request received - Invalid request\n"); in shutdown_onchannelcallback()
261 icmsghdrp->status = HV_E_FAIL; in shutdown_onchannelcallback()
263 icmsghdrp->icmsgtype); in shutdown_onchannelcallback()
266 icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION in shutdown_onchannelcallback()
269 vmbus_sendpacket(channel, shut_txf_buf, in shutdown_onchannelcallback()
284 * requests by using this data and the current partition-wide time reference
300 return (reftime - WLTIMEDELTA) * 100; in reftime_to_ns()
323 timediff_adj = reftime - host_ts.ref_time; in hv_get_adj_host_time()
327 ret = -ESTALE; in hv_get_adj_host_time()
347 * Due to a bug on Hyper-V hosts, the sync flag may not always be sent on resume.
374 * message after the timesync channel is opened. Since the hv_utils module is
398 * TimeSync v4 messages contain reference time (guest's Hyper-V in adj_guesttime()
404 host_ts.host_time += (cur_reftime - reftime); in adj_guesttime()
415 * Time Sync Channel message handler.
419 struct vmbus_channel *channel = context; in timesync_onchannelcallback() local
432 int ret = vmbus_recvpacket(channel, time_txf_buf, in timesync_onchannelcallback()
454 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { in timesync_onchannelcallback()
461 ts_srv_version >> 16, in timesync_onchannelcallback()
464 } else if (icmsghdrp->icmsgtype == ICMSGTYPE_TIMESYNC) { in timesync_onchannelcallback()
474 adj_guesttime(refdata->parenttime, in timesync_onchannelcallback()
475 refdata->vmreferencetime, in timesync_onchannelcallback()
476 refdata->flags); in timesync_onchannelcallback()
486 adj_guesttime(timedatap->parenttime, in timesync_onchannelcallback()
488 timedatap->flags); in timesync_onchannelcallback()
491 icmsghdrp->status = HV_E_FAIL; in timesync_onchannelcallback()
493 icmsghdrp->icmsgtype); in timesync_onchannelcallback()
496 icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION in timesync_onchannelcallback()
499 vmbus_sendpacket(channel, time_txf_buf, in timesync_onchannelcallback()
507 * Every two seconds, Hyper-V send us a heartbeat request message.
508 * we respond to this message, and Hyper-V knows we are alive.
512 struct vmbus_channel *channel = context; in heartbeat_onchannelcallback() local
521 if (vmbus_recvpacket(channel, hbeat_txf_buf, HV_HYP_PAGE_SIZE, in heartbeat_onchannelcallback()
540 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { in heartbeat_onchannelcallback()
548 hb_srv_version >> 16, in heartbeat_onchannelcallback()
551 } else if (icmsghdrp->icmsgtype == ICMSGTYPE_HEARTBEAT) { in heartbeat_onchannelcallback()
563 heartbeat_msg->seq_num += 1; in heartbeat_onchannelcallback()
565 icmsghdrp->status = HV_E_FAIL; in heartbeat_onchannelcallback()
567 icmsghdrp->icmsgtype); in heartbeat_onchannelcallback()
570 icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION in heartbeat_onchannelcallback()
573 vmbus_sendpacket(channel, hbeat_txf_buf, in heartbeat_onchannelcallback()
586 (struct hv_util_service *)dev_id->driver_data; in util_probe()
589 srv->recv_buffer = kmalloc(HV_HYP_PAGE_SIZE * 4, GFP_KERNEL); in util_probe()
590 if (!srv->recv_buffer) in util_probe()
591 return -ENOMEM; in util_probe()
592 srv->channel = dev->channel; in util_probe()
593 if (srv->util_init) { in util_probe()
594 ret = srv->util_init(srv); in util_probe()
604 * channel. in util_probe()
606 set_channel_read_mode(dev->channel, HV_CALL_DIRECT); in util_probe()
610 ret = vmbus_open(dev->channel, HV_UTIL_RING_SEND_SIZE, in util_probe()
611 HV_UTIL_RING_RECV_SIZE, NULL, 0, srv->util_cb, in util_probe()
612 dev->channel); in util_probe()
616 if (srv->util_init_transport) { in util_probe()
617 ret = srv->util_init_transport(); in util_probe()
619 vmbus_close(dev->channel); in util_probe()
626 if (srv->util_deinit) in util_probe()
627 srv->util_deinit(); in util_probe()
629 kfree(srv->recv_buffer); in util_probe()
637 if (srv->util_deinit) in util_remove()
638 srv->util_deinit(); in util_remove()
639 vmbus_close(dev->channel); in util_remove()
640 kfree(srv->recv_buffer); in util_remove()
645 * (refer to hibernate() -> freeze_processes()). The userspace is thawed only
653 if (srv->util_pre_suspend) { in util_suspend()
654 ret = srv->util_pre_suspend(); in util_suspend()
659 vmbus_close(dev->channel); in util_suspend()
669 if (srv->util_pre_resume) { in util_resume()
670 ret = srv->util_pre_resume(); in util_resume()
675 ret = vmbus_open(dev->channel, HV_UTIL_RING_SEND_SIZE, in util_resume()
676 HV_UTIL_RING_RECV_SIZE, NULL, 0, srv->util_cb, in util_resume()
677 dev->channel); in util_resume()
723 return -EOPNOTSUPP; in hv_ptp_enable()
728 return -EOPNOTSUPP; in hv_ptp_settime()
733 return -EOPNOTSUPP; in hv_ptp_adjfine()
737 return -EOPNOTSUPP; in hv_ptp_adjtime()
806 pr_info("De-Registered HyperV Utility Driver\n"); in exit_hyperv_utils()
814 MODULE_DESCRIPTION("Hyper-V Utilities");