mshyperv.h (6523592cee4650c6aa997d69cd0045a01e07a1ef) | mshyperv.h (753ed9c95c37d058e50e7d42bbe296ee0bf6670d) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2 3/* 4 * Linux-specific definitions for managing interactions with Microsoft's 5 * Hyper-V hypervisor. The definitions in this file are architecture 6 * independent. See arch/<arch>/include/asm/mshyperv.h for definitions 7 * that are specific to architecture <arch>. 8 * --- 27 unchanged lines hidden (view full) --- 36 u32 isolation_config_a; 37 u32 isolation_config_b; 38}; 39extern struct ms_hyperv_info ms_hyperv; 40 41extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr); 42extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); 43 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2 3/* 4 * Linux-specific definitions for managing interactions with Microsoft's 5 * Hyper-V hypervisor. The definitions in this file are architecture 6 * independent. See arch/<arch>/include/asm/mshyperv.h for definitions 7 * that are specific to architecture <arch>. 8 * --- 27 unchanged lines hidden (view full) --- 36 u32 isolation_config_a; 37 u32 isolation_config_b; 38}; 39extern struct ms_hyperv_info ms_hyperv; 40 41extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr); 42extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); 43 |
44/* Helper functions that provide a consistent pattern for checking Hyper-V hypercall status. */ 45static inline int hv_result(u64 status) 46{ 47 return status & HV_HYPERCALL_RESULT_MASK; 48} 49 50static inline bool hv_result_success(u64 status) 51{ 52 return hv_result(status) == HV_STATUS_SUCCESS; 53} 54 55static inline unsigned int hv_repcomp(u64 status) 56{ 57 /* Bits [43:32] of status have 'Reps completed' data. */ 58 return (status & HV_HYPERCALL_REP_COMP_MASK) >> 59 HV_HYPERCALL_REP_COMP_OFFSET; 60} 61 |
|
44/* 45 * Rep hypercalls. Callers of this functions are supposed to ensure that 46 * rep_count and varhead_size comply with Hyper-V hypercall definition. 47 */ 48static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size, 49 void *input, void *output) 50{ 51 u64 control = code; 52 u64 status; 53 u16 rep_comp; 54 55 control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET; 56 control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET; 57 58 do { 59 status = hv_do_hypercall(control, input, output); | 62/* 63 * Rep hypercalls. Callers of this functions are supposed to ensure that 64 * rep_count and varhead_size comply with Hyper-V hypercall definition. 65 */ 66static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size, 67 void *input, void *output) 68{ 69 u64 control = code; 70 u64 status; 71 u16 rep_comp; 72 73 control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET; 74 control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET; 75 76 do { 77 status = hv_do_hypercall(control, input, output); |
60 if ((status & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS) | 78 if (!hv_result_success(status)) |
61 return status; 62 | 79 return status; 80 |
63 /* Bits 32-43 of status have 'Reps completed' data. */ 64 rep_comp = (status & HV_HYPERCALL_REP_COMP_MASK) >> 65 HV_HYPERCALL_REP_COMP_OFFSET; | 81 rep_comp = hv_repcomp(status); |
66 67 control &= ~HV_HYPERCALL_REP_START_MASK; 68 control |= (u64)rep_comp << HV_HYPERCALL_REP_START_OFFSET; 69 70 touch_nmi_watchdog(); 71 } while (rep_comp < rep_count); 72 73 return status; --- 8 unchanged lines hidden (view full) --- 82 guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48); 83 guest_id |= (d_info1 << 48); 84 guest_id |= (kernel_version << 16); 85 guest_id |= d_info2; 86 87 return guest_id; 88} 89 | 82 83 control &= ~HV_HYPERCALL_REP_START_MASK; 84 control |= (u64)rep_comp << HV_HYPERCALL_REP_START_OFFSET; 85 86 touch_nmi_watchdog(); 87 } while (rep_comp < rep_count); 88 89 return status; --- 8 unchanged lines hidden (view full) --- 98 guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48); 99 guest_id |= (d_info1 << 48); 100 guest_id |= (kernel_version << 16); 101 guest_id |= d_info2; 102 103 return guest_id; 104} 105 |
90 | |
91/* Free the message slot and signal end-of-message if required */ 92static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) 93{ 94 /* 95 * On crash we're reading some other CPU's message page and we need 96 * to be careful: this other CPU may already had cleared the header 97 * and the host may already had delivered some other message there. 98 * In case we blindly write msg->header.message_type we're going --- 122 unchanged lines hidden --- | 106/* Free the message slot and signal end-of-message if required */ 107static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) 108{ 109 /* 110 * On crash we're reading some other CPU's message page and we need 111 * to be careful: this other CPU may already had cleared the header 112 * and the host may already had delivered some other message there. 113 * In case we blindly write msg->header.message_type we're going --- 122 unchanged lines hidden --- |