Skip to content

Commit 723c47a

Browse files
praveen-pkliuw
authored andcommitted
mshv: Add definitions for MSHV sleep state configuration
Add the definitions required to configure sleep states in mshv hypervsior. Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com> Co-developed-by: Anatol Belski <anbelski@linux.microsoft.com> Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com> Reviewed-by: Easwar Hariharan <easwar.hariharan@linux.microsoft.com> Reviewed-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> Acked-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent b9a66cd commit 723c47a

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

include/hyperv/hvgdk_mini.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,19 +465,21 @@ union hv_vp_assist_msr_contents { /* HV_REGISTER_VP_ASSIST_PAGE */
465465
#define HVCALL_RESET_DEBUG_SESSION 0x006b
466466
#define HVCALL_MAP_STATS_PAGE 0x006c
467467
#define HVCALL_UNMAP_STATS_PAGE 0x006d
468+
#define HVCALL_SET_SYSTEM_PROPERTY 0x006f
468469
#define HVCALL_ADD_LOGICAL_PROCESSOR 0x0076
469470
#define HVCALL_GET_SYSTEM_PROPERTY 0x007b
470471
#define HVCALL_MAP_DEVICE_INTERRUPT 0x007c
471472
#define HVCALL_UNMAP_DEVICE_INTERRUPT 0x007d
472473
#define HVCALL_RETARGET_INTERRUPT 0x007e
473474
#define HVCALL_NOTIFY_PARTITION_EVENT 0x0087
475+
#define HVCALL_ENTER_SLEEP_STATE 0x0084
474476
#define HVCALL_NOTIFY_PORT_RING_EMPTY 0x008b
475477
#define HVCALL_REGISTER_INTERCEPT_RESULT 0x0091
476478
#define HVCALL_ASSERT_VIRTUAL_INTERRUPT 0x0094
477479
#define HVCALL_CREATE_PORT 0x0095
478480
#define HVCALL_CONNECT_PORT 0x0096
479481
#define HVCALL_START_VP 0x0099
480-
#define HVCALL_GET_VP_INDEX_FROM_APIC_ID 0x009a
482+
#define HVCALL_GET_VP_INDEX_FROM_APIC_ID 0x009a
481483
#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
482484
#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
483485
#define HVCALL_SIGNAL_EVENT_DIRECT 0x00c0

include/hyperv/hvhdk_mini.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ enum hv_snp_status {
140140

141141
enum hv_system_property {
142142
/* Add more values when needed */
143+
HV_SYSTEM_PROPERTY_SLEEP_STATE = 3,
143144
HV_SYSTEM_PROPERTY_SCHEDULER_TYPE = 15,
144145
HV_DYNAMIC_PROCESSOR_FEATURE_PROPERTY = 21,
145146
HV_SYSTEM_PROPERTY_CRASHDUMPAREA = 47,
@@ -155,6 +156,19 @@ union hv_pfn_range { /* HV_SPA_PAGE_RANGE */
155156
} __packed;
156157
};
157158

159+
enum hv_sleep_state {
160+
HV_SLEEP_STATE_S1 = 1,
161+
HV_SLEEP_STATE_S2 = 2,
162+
HV_SLEEP_STATE_S3 = 3,
163+
HV_SLEEP_STATE_S4 = 4,
164+
HV_SLEEP_STATE_S5 = 5,
165+
/*
166+
* After hypervisor has received this, any follow up sleep
167+
* state registration requests will be rejected.
168+
*/
169+
HV_SLEEP_STATE_LOCK = 6
170+
};
171+
158172
enum hv_dynamic_processor_feature_property {
159173
/* Add more values when needed */
160174
HV_X64_DYNAMIC_PROCESSOR_FEATURE_MAX_ENCRYPTED_PARTITIONS = 13,
@@ -184,6 +198,32 @@ struct hv_output_get_system_property {
184198
};
185199
} __packed;
186200

201+
struct hv_sleep_state_info {
202+
u32 sleep_state; /* enum hv_sleep_state */
203+
u8 pm1a_slp_typ;
204+
u8 pm1b_slp_typ;
205+
} __packed;
206+
207+
struct hv_input_set_system_property {
208+
u32 property_id; /* enum hv_system_property */
209+
u32 reserved;
210+
union {
211+
/* More fields to be filled in when needed */
212+
struct hv_sleep_state_info set_sleep_state_info;
213+
214+
/*
215+
* Add a reserved field to ensure the union is 8-byte aligned as
216+
* existing members may not be. This is a temporary measure
217+
* until all remaining members are added.
218+
*/
219+
u64 reserved0[8];
220+
};
221+
} __packed;
222+
223+
struct hv_input_enter_sleep_state { /* HV_INPUT_ENTER_SLEEP_STATE */
224+
u32 sleep_state; /* enum hv_sleep_state */
225+
} __packed;
226+
187227
struct hv_input_map_stats_page {
188228
u32 type; /* enum hv_stats_object_type */
189229
u32 padding;

0 commit comments

Comments
 (0)