include/asm-generic/mshyperv.h

Source file repositories/reference/linux-study-clean/include/asm-generic/mshyperv.h

File Facts

System
Linux kernel
Corpus path
include/asm-generic/mshyperv.h
Extension
.h
Size
11814 bytes
Lines
397
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ms_hyperv_info {
	u32 features;
	u32 priv_high;
	u32 ext_features;
	u32 misc_features;
	u32 hints;
	u32 nested_features;
	u32 max_vp_index;
	u32 max_lp_index;
	u8 vtl;
	union {
		u32 isolation_config_a;
		struct {
			u32 paravisor_present : 1;
			u32 reserved_a1 : 31;
		};
	};
	union {
		u32 isolation_config_b;
		struct {
			u32 cvm_type : 4;
			u32 reserved_b1 : 1;
			u32 shared_gpa_boundary_active : 1;
			u32 shared_gpa_boundary_bits : 6;
			u32 reserved_b2 : 20;
		};
	};
	u64 shared_gpa_boundary;
	bool msi_ext_dest_id;
	bool confidential_vmbus_available;
};
extern struct ms_hyperv_info ms_hyperv;
extern bool hv_nested;
extern u64 hv_current_partition_id;
extern enum hv_partition_type hv_curr_partition_type;

extern void * __percpu *hyperv_pcpu_input_arg;
extern void * __percpu *hyperv_pcpu_output_arg;

u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr);
u64 hv_do_fast_hypercall8(u16 control, u64 input8);
u64 hv_do_fast_hypercall16(u16 control, u64 input1, u64 input2);

bool hv_isolation_type_snp(void);
bool hv_isolation_type_tdx(void);

/*
 * On architectures where Hyper-V doesn't support AEOI (e.g., ARM64),
 * it doesn't provide a recommendation flag and AEOI must be disabled.
 */
static inline bool hv_recommend_using_aeoi(void)
{
#ifdef HV_DEPRECATING_AEOI_RECOMMENDED
	return !(ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED);
#else
	return false;
#endif
}

static inline struct hv_proximity_domain_info hv_numa_node_to_pxm_info(int node)
{
	struct hv_proximity_domain_info pxm_info = {};

	if (node != NUMA_NO_NODE) {
		pxm_info.domain_id = node_to_pxm(node);
		pxm_info.flags.proximity_info_valid = 1;
		pxm_info.flags.proximity_preferred = 1;
	}

	return pxm_info;
}

/* Helper functions that provide a consistent pattern for checking Hyper-V hypercall status. */
static inline int hv_result(u64 status)
{
	return status & HV_HYPERCALL_RESULT_MASK;
}

static inline bool hv_result_success(u64 status)
{
	return hv_result(status) == HV_STATUS_SUCCESS;
}

static inline unsigned int hv_repcomp(u64 status)
{
	/* Bits [43:32] of status have 'Reps completed' data. */
	return (status & HV_HYPERCALL_REP_COMP_MASK) >>
			 HV_HYPERCALL_REP_COMP_OFFSET;
}

Annotation

Implementation Notes