For the irq map/remap hypercalls, copy relevant data structures from hypervisor public headers into Linux equivalents. Also, update Kconfig and mshv_irqfd for irqbypass. Please note, irqbypass is required for doing passthru on MSHV. This because there is really no way of knowing the linux irq in the mshv_irqfd_assign and mshv_irqfd_update paths without it. The linux irq is setup upfront by VFIO before irqfd assign/update happens.
Signed-off-by: Mukesh R <[email protected]> --- drivers/hv/Kconfig | 1 + drivers/hv/mshv_eventfd.h | 3 +++ include/hyperv/hvgdk_mini.h | 3 +++ include/hyperv/hvhdk.h | 17 +++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 7937ac0cbd0f..c831fe25ca2b 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -75,6 +75,7 @@ config MSHV_ROOT # no particular order, making it impossible to reassemble larger pages depends on PAGE_SIZE_4KB select EVENTFD + select IRQ_BYPASS_MANAGER select VIRT_XFER_TO_GUEST_WORK select HMM_MIRROR select MMU_NOTIFIER diff --git a/drivers/hv/mshv_eventfd.h b/drivers/hv/mshv_eventfd.h index 464c6b81ab33..ff4dd24b8ad4 100644 --- a/drivers/hv/mshv_eventfd.h +++ b/drivers/hv/mshv_eventfd.h @@ -9,6 +9,7 @@ #define __LINUX_MSHV_EVENTFD_H #include <linux/poll.h> +#include <linux/irqbypass.h> #include "mshv.h" #include "mshv_root.h" @@ -37,6 +38,8 @@ struct mshv_irqfd { struct mshv_irqfd_resampler *irqfd_resampler; struct eventfd_ctx *irqfd_resamplefd; struct hlist_node irqfd_resampler_hnode; + struct irq_bypass_consumer irqfd_bypass_cons; + struct irq_bypass_producer *irqfd_bypass_prod; }; void mshv_eventfd_init(struct mshv_partition *partition); diff --git a/include/hyperv/hvgdk_mini.h b/include/hyperv/hvgdk_mini.h index da622fb06440..1ef480825705 100644 --- a/include/hyperv/hvgdk_mini.h +++ b/include/hyperv/hvgdk_mini.h @@ -59,6 +59,8 @@ struct hv_u128 { #define HV_PARTITION_ID_INVALID ((u64)0) #define HV_PARTITION_ID_SELF ((u64)-1) +#define HV_MAX_VPS 256 /* HV_MAXIMUM_PROCESSORS */ + /* Hyper-V specific model specific registers (MSRs) */ #if defined(CONFIG_X86) @@ -508,6 +510,7 @@ union hv_vp_assist_msr_contents { /* HV_REGISTER_VP_ASSIST_PAGE */ #define HVCALL_UNMAP_VP_STATE_PAGE 0x00e2 #define HVCALL_GET_VP_STATE 0x00e3 #define HVCALL_SET_VP_STATE 0x00e4 +#define HVCALL_GET_VPSET_FROM_MDA 0x00e5 #define HVCALL_GET_VP_CPUID_VALUES 0x00f4 #define HVCALL_GET_PARTITION_PROPERTY_EX 0x0101 #define HVCALL_MMIO_READ 0x0106 diff --git a/include/hyperv/hvhdk.h b/include/hyperv/hvhdk.h index 5e83d3714966..d0a892347ab1 100644 --- a/include/hyperv/hvhdk.h +++ b/include/hyperv/hvhdk.h @@ -952,4 +952,21 @@ struct hv_input_modify_sparse_spa_page_host_access { #define HV_MODIFY_SPA_PAGE_HOST_ACCESS_LARGE_PAGE 0x4 #define HV_MODIFY_SPA_PAGE_HOST_ACCESS_HUGE_PAGE 0x8 +#ifdef CONFIG_X86 + +struct hv_input_get_vp_set_from_mda { /* HV_OUTPUT_GET_VP_SET_FROM_MDA */ + u64 target_partid; + u64 dest_address; + u8 input_vtl; + u8 destmode_logical; /* true => mode is logical */ + u16 reserved0; /* mbz */ + u32 reserved1; /* mbz */ +} __packed; + +union hv_output_get_vp_set_from_mda { /* HV_OUTPUT_GET_VP_SET_FROM_MDA */ + struct hv_vpset target_vpset; + u64 bitset_buffer[HV_GENERIC_SET_QWORD_COUNT(HV_MAX_VPS)]; +} __packed; + +#endif /* CONFIG_X86 */ #endif /* _HV_HVHDK_H */ -- 2.51.2.vfs.0.1

