^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * This file contains definitions from Hyper-V Hypervisor Top-Level Functional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Specification (TLFS):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef _ASM_GENERIC_HYPERV_TLFS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _ASM_GENERIC_HYPERV_TLFS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/bits.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/time64.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * While not explicitly listed in the TLFS, Hyper-V always runs with a page size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * of 4096. These definitions are used when communicating with Hyper-V using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * guest physical pages and guest physical page addresses, since the guest page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * size may not be 4096 on all architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define HV_HYP_PAGE_SHIFT 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define HV_HYP_PAGE_SIZE BIT(HV_HYP_PAGE_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define HV_HYP_PAGE_MASK (~(HV_HYP_PAGE_SIZE - 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * Hyper-V provides two categories of flags relevant to guest VMs. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * "Features" category indicates specific functionality that is available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * to guests on this particular instance of Hyper-V. The "Features"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * are presented in four groups, each of which is 32 bits. The group A
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * and B definitions are common across architectures and are listed here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * However, not all flags are relevant on all architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * Groups C and D vary across architectures and are listed in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * architecture specific portion of hyperv-tlfs.h. Some of these flags exist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * on multiple architectures, but the bit positions are different so they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * cannot appear in the generic portion of hyperv-tlfs.h.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * The "Enlightenments" category provides recommendations on whether to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * specific enlightenments that are available. The Enlighenments are a single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * group of 32 bits, but they vary across architectures and are listed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * the architecture specific portion of hyperv-tlfs.h.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * Group A Features.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* VP Runtime register available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define HV_MSR_VP_RUNTIME_AVAILABLE BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* Partition Reference Counter available*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define HV_MSR_TIME_REF_COUNT_AVAILABLE BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* Basic SynIC register available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define HV_MSR_SYNIC_AVAILABLE BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* Synthetic Timer registers available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define HV_MSR_SYNTIMER_AVAILABLE BIT(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* Virtual APIC assist and VP assist page registers available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define HV_MSR_APIC_ACCESS_AVAILABLE BIT(4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* Hypercall and Guest OS ID registers available*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define HV_MSR_HYPERCALL_AVAILABLE BIT(5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* Access virtual processor index register available*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define HV_MSR_VP_INDEX_AVAILABLE BIT(6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* Virtual system reset register available*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define HV_MSR_RESET_AVAILABLE BIT(7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /* Access statistics page registers available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define HV_MSR_STAT_PAGES_AVAILABLE BIT(8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /* Partition reference TSC register is available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define HV_MSR_REFERENCE_TSC_AVAILABLE BIT(9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /* Partition Guest IDLE register is available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define HV_MSR_GUEST_IDLE_AVAILABLE BIT(10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* Partition local APIC and TSC frequency registers available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define HV_ACCESS_FREQUENCY_MSRS BIT(11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /* AccessReenlightenmentControls privilege */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define HV_ACCESS_REENLIGHTENMENT BIT(13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /* AccessTscInvariantControls privilege */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define HV_ACCESS_TSC_INVARIANT BIT(15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * Group B features.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define HV_CREATE_PARTITIONS BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define HV_ACCESS_PARTITION_ID BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define HV_ACCESS_MEMORY_POOL BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define HV_ADJUST_MESSAGE_BUFFERS BIT(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define HV_POST_MESSAGES BIT(4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define HV_SIGNAL_EVENTS BIT(5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define HV_CREATE_PORT BIT(6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define HV_CONNECT_PORT BIT(7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define HV_ACCESS_STATS BIT(8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define HV_DEBUGGING BIT(11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define HV_CPU_POWER_MANAGEMENT BIT(12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * TSC page layout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct ms_hyperv_tsc_page {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) volatile u32 tsc_sequence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) u32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) volatile u64 tsc_scale;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) volatile s64 tsc_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * The guest OS needs to register the guest ID with the hypervisor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * The guest ID is a 64 bit entity and the structure of this ID is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * specified in the Hyper-V specification:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * msdn.microsoft.com/en-us/library/windows/hardware/ff542653%28v=vs.85%29.aspx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * While the current guideline does not specify how Linux guest ID(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * need to be generated, our plan is to publish the guidelines for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * Linux and other guest operating systems that currently are hosted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * on Hyper-V. The implementation here conforms to this yet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * unpublished guidelines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * Bit(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * 63 - Indicates if the OS is Open Source or not; 1 is Open Source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * 62:56 - Os Type; Linux is 0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * 55:48 - Distro specific identification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * 47:16 - Linux kernel version number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * 15:0 - Distro specific identification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define HV_LINUX_VENDOR_ID 0x8100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * Crash notification flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define HV_CRASH_CTL_CRASH_NOTIFY_MSG BIT_ULL(62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define HV_CRASH_CTL_CRASH_NOTIFY BIT_ULL(63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /* Declare the various hypercall operations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST 0x0003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define HVCALL_NOTIFY_LONG_SPIN_WAIT 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define HVCALL_SEND_IPI 0x000b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX 0x0014
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define HVCALL_SEND_IPI_EX 0x0015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #define HVCALL_GET_VP_REGISTERS 0x0050
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define HVCALL_SET_VP_REGISTERS 0x0051
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define HVCALL_POST_MESSAGE 0x005c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define HVCALL_SIGNAL_EVENT 0x005d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define HVCALL_POST_DEBUG_DATA 0x0069
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) #define HVCALL_RETRIEVE_DEBUG_DATA 0x006a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define HVCALL_RESET_DEBUG_SESSION 0x006b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define HVCALL_RETARGET_INTERRUPT 0x007e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define HV_FLUSH_ALL_PROCESSORS BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #define HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #define HV_FLUSH_USE_EXTENDED_RANGE_FORMAT BIT(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) enum HV_GENERIC_SET_FORMAT {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) HV_GENERIC_SET_SPARSE_4K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) HV_GENERIC_SET_ALL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #define HV_PARTITION_ID_SELF ((u64)-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define HV_VP_INDEX_SELF ((u32)-2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #define HV_HYPERCALL_FAST_BIT BIT(16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #define HV_HYPERCALL_VARHEAD_OFFSET 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define HV_HYPERCALL_REP_COMP_OFFSET 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #define HV_HYPERCALL_REP_COMP_1 BIT_ULL(32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) #define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define HV_HYPERCALL_REP_START_OFFSET 48
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* hypercall status code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define HV_STATUS_SUCCESS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #define HV_STATUS_INVALID_HYPERCALL_CODE 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) #define HV_STATUS_INVALID_HYPERCALL_INPUT 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #define HV_STATUS_INVALID_ALIGNMENT 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) #define HV_STATUS_INVALID_PARAMETER 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #define HV_STATUS_OPERATION_DENIED 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) #define HV_STATUS_INSUFFICIENT_MEMORY 11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define HV_STATUS_INVALID_PORT_ID 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) #define HV_STATUS_INVALID_CONNECTION_ID 18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) #define HV_STATUS_INSUFFICIENT_BUFFERS 19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * The Hyper-V TimeRefCount register and the TSC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * page provide a guest VM clock with 100ns tick rate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #define HV_CLOCK_HZ (NSEC_PER_SEC/100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /* Define the number of synthetic interrupt sources. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #define HV_SYNIC_SINT_COUNT (16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /* Define the expected SynIC version. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define HV_SYNIC_VERSION_1 (0x1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /* Valid SynIC vectors are 16-255. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define HV_SYNIC_FIRST_VALID_VECTOR (16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define HV_SYNIC_CONTROL_ENABLE (1ULL << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #define HV_SYNIC_SIMP_ENABLE (1ULL << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #define HV_SYNIC_SIEFP_ENABLE (1ULL << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #define HV_SYNIC_SINT_MASKED (1ULL << 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) #define HV_SYNIC_SINT_AUTO_EOI (1ULL << 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) #define HV_SYNIC_SINT_VECTOR_MASK (0xFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) #define HV_SYNIC_STIMER_COUNT (4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* Define synthetic interrupt controller message constants. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) #define HV_MESSAGE_SIZE (256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) #define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) #define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) /* Define synthetic interrupt controller message flags. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) union hv_message_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) __u8 asu8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) __u8 msg_pending:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) __u8 reserved:7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) /* Define port identifier type. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) union hv_port_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) __u32 asu32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) __u32 id:24;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) __u32 reserved:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) } __packed u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /* Define synthetic interrupt controller message header. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct hv_message_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) __u32 message_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) __u8 payload_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) union hv_message_flags message_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) __u8 reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) __u64 sender;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) union hv_port_id port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) /* Define synthetic interrupt controller message format. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) struct hv_message {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) struct hv_message_header header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) __u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) /* Define the synthetic interrupt message page layout. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct hv_message_page {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) struct hv_message sint_message[HV_SYNIC_SINT_COUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) /* Define timer message payload structure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) struct hv_timer_message_payload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) __u32 timer_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) __u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) __u64 expiration_time; /* When the timer expired */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) __u64 delivery_time; /* When the message was delivered */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) /* Define synthetic interrupt controller flag constants. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #define HV_EVENT_FLAGS_COUNT (256 * 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define HV_EVENT_FLAGS_LONG_COUNT (256 / sizeof(unsigned long))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) * Synthetic timer configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) union hv_stimer_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) u64 as_uint64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) u64 enable:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) u64 periodic:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) u64 lazy:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) u64 auto_enable:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) u64 apic_vector:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) u64 direct_mode:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) u64 reserved_z0:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) u64 sintx:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) u64 reserved_z1:44;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /* Define the synthetic interrupt controller event flags format. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) union hv_synic_event_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) unsigned long flags[HV_EVENT_FLAGS_LONG_COUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) /* Define SynIC control register. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) union hv_synic_scontrol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) u64 as_uint64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) u64 enable:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) u64 reserved:63;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /* Define synthetic interrupt source. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) union hv_synic_sint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) u64 as_uint64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) u64 vector:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) u64 reserved1:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) u64 masked:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) u64 auto_eoi:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) u64 polling:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) u64 reserved2:45;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /* Define the format of the SIMP register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) union hv_synic_simp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) u64 as_uint64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) u64 simp_enabled:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) u64 preserved:11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) u64 base_simp_gpa:52;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) /* Define the format of the SIEFP register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) union hv_synic_siefp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) u64 as_uint64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) u64 siefp_enabled:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) u64 preserved:11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) u64 base_siefp_gpa:52;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct hv_vpset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) u64 format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) u64 valid_bank_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) u64 bank_contents[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) /* HvCallSendSyntheticClusterIpi hypercall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) struct hv_send_ipi {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) u32 vector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) u64 cpu_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) /* HvCallSendSyntheticClusterIpiEx hypercall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) struct hv_send_ipi_ex {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) u32 vector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) struct hv_vpset vp_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) /* HvFlushGuestPhysicalAddressSpace hypercalls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) struct hv_guest_mapping_flush {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) u64 address_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) u64 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) * HV_MAX_FLUSH_PAGES = "additional_pages" + 1. It's limited
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) * by the bitwidth of "additional_pages" in union hv_gpa_page_range.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) #define HV_MAX_FLUSH_PAGES (2048)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /* HvFlushGuestPhysicalAddressList hypercall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) union hv_gpa_page_range {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) u64 address_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) u64 additional_pages:11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) u64 largepage:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) u64 basepfn:52;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) } page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) * All input flush parameters should be in single page. The max flush
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * count is equal with how many entries of union hv_gpa_page_range can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * be populated into the input parameter page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) #define HV_MAX_FLUSH_REP_COUNT ((HV_HYP_PAGE_SIZE - 2 * sizeof(u64)) / \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) sizeof(union hv_gpa_page_range))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) struct hv_guest_mapping_flush_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) u64 address_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) u64 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) union hv_gpa_page_range gpa_list[HV_MAX_FLUSH_REP_COUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) /* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) struct hv_tlb_flush {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) u64 address_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) u64 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) u64 processor_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) u64 gva_list[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) /* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) struct hv_tlb_flush_ex {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) u64 address_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) u64 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) struct hv_vpset hv_vp_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) u64 gva_list[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) /* HvRetargetDeviceInterrupt hypercall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) union hv_msi_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) u64 as_uint64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) u32 address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) u32 data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) struct hv_interrupt_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) u32 source; /* 1 for MSI(-X) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) u32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) union hv_msi_entry msi_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) * flags for hv_device_interrupt_target.flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) #define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) #define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) struct hv_device_interrupt_target {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) u32 vector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) u64 vp_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) struct hv_vpset vp_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) struct hv_retarget_device_interrupt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) u64 partition_id; /* use "self" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) u64 device_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) struct hv_interrupt_entry int_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) u64 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) struct hv_device_interrupt_target int_target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) } __packed __aligned(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) /* HvGetVpRegisters hypercall input with variable size reg name list*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) struct hv_get_vp_registers_input {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) u64 partitionid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) u32 vpindex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) u8 inputvtl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) u8 padding[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) } header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) struct input {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) u32 name0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) u32 name1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) } element[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) /* HvGetVpRegisters returns an array of these output elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) struct hv_get_vp_registers_output {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) u32 a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) u32 b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) u32 c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) u32 d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) } as32 __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) u64 low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) u64 high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) } as64 __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) /* HvSetVpRegisters hypercall with variable size reg name/value list*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) struct hv_set_vp_registers_input {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) u64 partitionid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) u32 vpindex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) u8 inputvtl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) u8 padding[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) } header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) u32 name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) u32 padding1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) u64 padding2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) u64 valuelow;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) u64 valuehigh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) } element[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) #endif