Drivers: hv: Make portions of Hyper-V init code be arch neutral
The code to allocate and initialize the hv_vp_index array is architecture neutral. Similarly, the code to allocate and populate the hypercall input and output arg pages is architecture neutral. Move both sets of code out from arch/x86 and into utility functions in drivers/hv/hv_common.c that can be shared by Hyper-V initialization on ARM64. No functional changes. However, the allocation of the hypercall input and output arg pages is done differently so that the size is always the Hyper-V page size, even if not the same as the guest page size (such as with ARM64's 64K page size). Signed-off-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/1626287687-2045-2-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
@@ -39,6 +39,9 @@ struct ms_hyperv_info {
|
||||
};
|
||||
extern struct ms_hyperv_info ms_hyperv;
|
||||
|
||||
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);
|
||||
|
||||
@@ -152,6 +155,8 @@ void hv_remove_crash_handler(void);
|
||||
extern int vmbus_interrupt;
|
||||
extern int vmbus_irq;
|
||||
|
||||
extern bool hv_root_partition;
|
||||
|
||||
#if IS_ENABLED(CONFIG_HYPERV)
|
||||
/*
|
||||
* Hypervisor's notion of virtual processor ID is different from
|
||||
@@ -165,6 +170,11 @@ extern u32 hv_max_vp_index;
|
||||
/* Sentinel value for an uninitialized entry in hv_vp_index array */
|
||||
#define VP_INVAL U32_MAX
|
||||
|
||||
int __init hv_common_init(void);
|
||||
void __init hv_common_free(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(unsigned long addr);
|
||||
|
||||
Reference in New Issue
Block a user