#ifndef _ASM_GENERIC_MSHYPERV_H
#define _ASM_GENERIC_MSHYPERV_H
#include <linux/types.h>
#include <linux/atomic.h>
#include <linux/bitops.h>
#include <acpi/acpi_numa.h>
#include <linux/cpumask.h>
#include <linux/nmi.h>
#include <asm/ptrace.h>
#include <asm/hyperv-tlfs.h>
#define VTPM_BASE_ADDRESS …
struct ms_hyperv_info { … };
extern struct ms_hyperv_info ms_hyperv;
extern bool hv_nested;
extern void * __percpu *hyperv_pcpu_input_arg;
extern void * __percpu *hyperv_pcpu_output_arg;
extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr);
extern u64 hv_do_fast_hypercall8(u16 control, u64 input8);
bool hv_isolation_type_snp(void);
bool hv_isolation_type_tdx(void);
static inline struct hv_proximity_domain_info hv_numa_node_to_pxm_info(int node)
{ … }
static inline int hv_result(u64 status)
{ … }
static inline bool hv_result_success(u64 status)
{ … }
static inline unsigned int hv_repcomp(u64 status)
{ … }
static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
void *input, void *output)
{ … }
static inline u64 hv_generate_guest_id(u64 kernel_version)
{ … }
static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type)
{ … }
int hv_get_hypervisor_version(union hv_hypervisor_version_info *info);
void hv_setup_vmbus_handler(void (*handler)(void));
void hv_remove_vmbus_handler(void);
void hv_setup_stimer0_handler(void (*handler)(void));
void hv_remove_stimer0_handler(void);
void hv_setup_kexec_handler(void (*handler)(void));
void hv_remove_kexec_handler(void);
void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs));
void hv_remove_crash_handler(void);
extern int vmbus_interrupt;
extern int vmbus_irq;
extern bool hv_root_partition;
#if IS_ENABLED(CONFIG_HYPERV)
extern u32 *hv_vp_index;
extern u32 hv_max_vp_index;
extern u64 (*hv_read_reference_counter)(void);
#define VP_INVAL …
int __init hv_common_init(void);
void __init hv_common_free(void);
void __init ms_hyperv_late_init(void);
int hv_common_cpu_init(unsigned int cpu);
int hv_common_cpu_die(unsigned int cpu);
void *hv_alloc_hyperv_page(void);
void *hv_alloc_hyperv_zeroed_page(void);
void hv_free_hyperv_page(void *addr);
static inline int hv_cpu_number_to_vp_number(int cpu_number)
{ … }
static inline int __cpumask_to_vpset(struct hv_vpset *vpset,
const struct cpumask *cpus,
bool (*func)(int cpu))
{ … }
static inline int cpumask_to_vpset(struct hv_vpset *vpset,
const struct cpumask *cpus)
{ … }
static inline int cpumask_to_vpset_skip(struct hv_vpset *vpset,
const struct cpumask *cpus,
bool (*func)(int cpu))
{ … }
void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
bool hv_is_hyperv_initialized(void);
bool hv_is_hibernation_supported(void);
enum hv_isolation_type hv_get_isolation_type(void);
bool hv_is_isolation_supported(void);
bool hv_isolation_type_snp(void);
u64 hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_size);
u64 hv_tdx_hypercall(u64 control, u64 param1, u64 param2);
void hyperv_cleanup(void);
bool hv_query_ext_cap(u64 cap_query);
void hv_setup_dma_ops(struct device *dev, bool coherent);
#else
static inline bool hv_is_hyperv_initialized(void) { return false; }
static inline bool hv_is_hibernation_supported(void) { return false; }
static inline void hyperv_cleanup(void) {}
static inline void ms_hyperv_late_init(void) {}
static inline bool hv_is_isolation_supported(void) { return false; }
static inline enum hv_isolation_type hv_get_isolation_type(void)
{
return HV_ISOLATION_TYPE_NONE;
}
#endif
#endif