1 1.1 cherry /* 2 1.1 cherry * Permission is hereby granted, free of charge, to any person obtaining a copy 3 1.1 cherry * of this software and associated documentation files (the "Software"), to 4 1.1 cherry * deal in the Software without restriction, including without limitation the 5 1.1 cherry * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 6 1.1 cherry * sell copies of the Software, and to permit persons to whom the Software is 7 1.1 cherry * furnished to do so, subject to the following conditions: 8 1.1 cherry * 9 1.1 cherry * The above copyright notice and this permission notice shall be included in 10 1.1 cherry * all copies or substantial portions of the Software. 11 1.1 cherry * 12 1.1 cherry * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 1.1 cherry * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 1.1 cherry * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 1.1 cherry * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 1.1 cherry * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 1.1 cherry * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 1.1 cherry * DEALINGS IN THE SOFTWARE. 19 1.1 cherry * 20 1.1 cherry * Copyright (c) 2007, Keir Fraser 21 1.1 cherry */ 22 1.1 cherry 23 1.1 cherry #ifndef __XEN_PUBLIC_HVM_PARAMS_H__ 24 1.1 cherry #define __XEN_PUBLIC_HVM_PARAMS_H__ 25 1.1 cherry 26 1.1 cherry #include "hvm_op.h" 27 1.1 cherry 28 1.1 cherry /* 29 1.1 cherry * Parameter space for HVMOP_{set,get}_param. 30 1.1 cherry */ 31 1.1 cherry 32 1.1 cherry #define HVM_PARAM_CALLBACK_IRQ 0 33 1.1 cherry #define HVM_PARAM_CALLBACK_IRQ_TYPE_MASK xen_mk_ullong(0xFF00000000000000) 34 1.1 cherry /* 35 1.1 cherry * How should CPU0 event-channel notifications be delivered? 36 1.1 cherry * 37 1.1 cherry * If val == 0 then CPU0 event-channel notifications are not delivered. 38 1.1 cherry * If val != 0, val[63:56] encodes the type, as follows: 39 1.1 cherry */ 40 1.1 cherry 41 1.1 cherry #define HVM_PARAM_CALLBACK_TYPE_GSI 0 42 1.1 cherry /* 43 1.1 cherry * val[55:0] is a delivery GSI. GSI 0 cannot be used, as it aliases val == 0, 44 1.1 cherry * and disables all notifications. 45 1.1 cherry */ 46 1.1 cherry 47 1.1 cherry #define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1 48 1.1 cherry /* 49 1.1 cherry * val[55:0] is a delivery PCI INTx line: 50 1.1 cherry * Domain = val[47:32], Bus = val[31:16] DevFn = val[15:8], IntX = val[1:0] 51 1.1 cherry */ 52 1.1 cherry 53 1.1 cherry #if defined(__i386__) || defined(__x86_64__) 54 1.1 cherry #define HVM_PARAM_CALLBACK_TYPE_VECTOR 2 55 1.1 cherry /* 56 1.1 cherry * val[7:0] is a vector number. Check for XENFEAT_hvm_callback_vector to know 57 1.1 cherry * if this delivery method is available. 58 1.1 cherry */ 59 1.1 cherry #elif defined(__arm__) || defined(__aarch64__) 60 1.1 cherry #define HVM_PARAM_CALLBACK_TYPE_PPI 2 61 1.1 cherry /* 62 1.1 cherry * val[55:16] needs to be zero. 63 1.1 cherry * val[15:8] is interrupt flag of the PPI used by event-channel: 64 1.1 cherry * bit 8: the PPI is edge(1) or level(0) triggered 65 1.1 cherry * bit 9: the PPI is active low(1) or high(0) 66 1.1 cherry * val[7:0] is a PPI number used by event-channel. 67 1.1 cherry * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to 68 1.1 cherry * the notification is handled by the interrupt controller. 69 1.1 cherry */ 70 1.1 cherry #define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK 0xFF00 71 1.1 cherry #define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2 72 1.1 cherry #endif 73 1.1 cherry 74 1.1 cherry /* 75 1.1 cherry * These are not used by Xen. They are here for convenience of HVM-guest 76 1.1 cherry * xenbus implementations. 77 1.1 cherry */ 78 1.1 cherry #define HVM_PARAM_STORE_PFN 1 79 1.1 cherry #define HVM_PARAM_STORE_EVTCHN 2 80 1.1 cherry 81 1.1 cherry #define HVM_PARAM_PAE_ENABLED 4 82 1.1 cherry 83 1.1 cherry #define HVM_PARAM_IOREQ_PFN 5 84 1.1 cherry 85 1.1 cherry #define HVM_PARAM_BUFIOREQ_PFN 6 86 1.1 cherry #define HVM_PARAM_BUFIOREQ_EVTCHN 26 87 1.1 cherry 88 1.1 cherry #if defined(__i386__) || defined(__x86_64__) 89 1.1 cherry 90 1.1 cherry /* 91 1.1 cherry * Viridian enlightenments 92 1.1 cherry * 93 1.1 cherry * (See http://download.microsoft.com/download/A/B/4/AB43A34E-BDD0-4FA6-BDEF-79EEF16E880B/Hypervisor%20Top%20Level%20Functional%20Specification%20v4.0.docx) 94 1.1 cherry * 95 1.1 cherry * To expose viridian enlightenments to the guest set this parameter 96 1.1 cherry * to the desired feature mask. The base feature set must be present 97 1.1 cherry * in any valid feature mask. 98 1.1 cherry */ 99 1.1 cherry #define HVM_PARAM_VIRIDIAN 9 100 1.1 cherry 101 1.1 cherry /* Base+Freq viridian feature sets: 102 1.1 cherry * 103 1.1 cherry * - Hypercall MSRs (HV_X64_MSR_GUEST_OS_ID and HV_X64_MSR_HYPERCALL) 104 1.1 cherry * - APIC access MSRs (HV_X64_MSR_EOI, HV_X64_MSR_ICR and HV_X64_MSR_TPR) 105 1.1 cherry * - Virtual Processor index MSR (HV_X64_MSR_VP_INDEX) 106 1.1 cherry * - Timer frequency MSRs (HV_X64_MSR_TSC_FREQUENCY and 107 1.1 cherry * HV_X64_MSR_APIC_FREQUENCY) 108 1.1 cherry */ 109 1.1 cherry #define _HVMPV_base_freq 0 110 1.1 cherry #define HVMPV_base_freq (1 << _HVMPV_base_freq) 111 1.1 cherry 112 1.1 cherry /* Feature set modifications */ 113 1.1 cherry 114 1.1 cherry /* Disable timer frequency MSRs (HV_X64_MSR_TSC_FREQUENCY and 115 1.1 cherry * HV_X64_MSR_APIC_FREQUENCY). 116 1.1 cherry * This modification restores the viridian feature set to the 117 1.1 cherry * original 'base' set exposed in releases prior to Xen 4.4. 118 1.1 cherry */ 119 1.1 cherry #define _HVMPV_no_freq 1 120 1.1 cherry #define HVMPV_no_freq (1 << _HVMPV_no_freq) 121 1.1 cherry 122 1.1 cherry /* Enable Partition Time Reference Counter (HV_X64_MSR_TIME_REF_COUNT) */ 123 1.1 cherry #define _HVMPV_time_ref_count 2 124 1.1 cherry #define HVMPV_time_ref_count (1 << _HVMPV_time_ref_count) 125 1.1 cherry 126 1.1 cherry /* Enable Reference TSC Page (HV_X64_MSR_REFERENCE_TSC) */ 127 1.1 cherry #define _HVMPV_reference_tsc 3 128 1.1 cherry #define HVMPV_reference_tsc (1 << _HVMPV_reference_tsc) 129 1.1 cherry 130 1.1 cherry /* Use Hypercall for remote TLB flush */ 131 1.1 cherry #define _HVMPV_hcall_remote_tlb_flush 4 132 1.1 cherry #define HVMPV_hcall_remote_tlb_flush (1 << _HVMPV_hcall_remote_tlb_flush) 133 1.1 cherry 134 1.1 cherry /* Use APIC assist */ 135 1.1 cherry #define _HVMPV_apic_assist 5 136 1.1 cherry #define HVMPV_apic_assist (1 << _HVMPV_apic_assist) 137 1.1 cherry 138 1.1 cherry /* Enable crash MSRs */ 139 1.1 cherry #define _HVMPV_crash_ctl 6 140 1.1 cherry #define HVMPV_crash_ctl (1 << _HVMPV_crash_ctl) 141 1.1 cherry 142 1.1 cherry #define HVMPV_feature_mask \ 143 1.1 cherry (HVMPV_base_freq | \ 144 1.1 cherry HVMPV_no_freq | \ 145 1.1 cherry HVMPV_time_ref_count | \ 146 1.1 cherry HVMPV_reference_tsc | \ 147 1.1 cherry HVMPV_hcall_remote_tlb_flush | \ 148 1.1 cherry HVMPV_apic_assist | \ 149 1.1 cherry HVMPV_crash_ctl) 150 1.1 cherry 151 1.1 cherry #endif 152 1.1 cherry 153 1.1 cherry /* 154 1.1 cherry * Set mode for virtual timers (currently x86 only): 155 1.1 cherry * delay_for_missed_ticks (default): 156 1.1 cherry * Do not advance a vcpu's time beyond the correct delivery time for 157 1.1 cherry * interrupts that have been missed due to preemption. Deliver missed 158 1.1 cherry * interrupts when the vcpu is rescheduled and advance the vcpu's virtual 159 1.1 cherry * time stepwise for each one. 160 1.1 cherry * no_delay_for_missed_ticks: 161 1.1 cherry * As above, missed interrupts are delivered, but guest time always tracks 162 1.1 cherry * wallclock (i.e., real) time while doing so. 163 1.1 cherry * no_missed_ticks_pending: 164 1.1 cherry * No missed interrupts are held pending. Instead, to ensure ticks are 165 1.1 cherry * delivered at some non-zero rate, if we detect missed ticks then the 166 1.1 cherry * internal tick alarm is not disabled if the VCPU is preempted during the 167 1.1 cherry * next tick period. 168 1.1 cherry * one_missed_tick_pending: 169 1.1 cherry * Missed interrupts are collapsed together and delivered as one 'late tick'. 170 1.1 cherry * Guest time always tracks wallclock (i.e., real) time. 171 1.1 cherry */ 172 1.1 cherry #define HVM_PARAM_TIMER_MODE 10 173 1.1 cherry #define HVMPTM_delay_for_missed_ticks 0 174 1.1 cherry #define HVMPTM_no_delay_for_missed_ticks 1 175 1.1 cherry #define HVMPTM_no_missed_ticks_pending 2 176 1.1 cherry #define HVMPTM_one_missed_tick_pending 3 177 1.1 cherry 178 1.1 cherry /* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */ 179 1.1 cherry #define HVM_PARAM_HPET_ENABLED 11 180 1.1 cherry 181 1.1 cherry /* Identity-map page directory used by Intel EPT when CR0.PG=0. */ 182 1.1 cherry #define HVM_PARAM_IDENT_PT 12 183 1.1 cherry 184 1.1 cherry /* Device Model domain, defaults to 0. */ 185 1.1 cherry #define HVM_PARAM_DM_DOMAIN 13 186 1.1 cherry 187 1.1 cherry /* ACPI S state: currently support S0 and S3 on x86. */ 188 1.1 cherry #define HVM_PARAM_ACPI_S_STATE 14 189 1.1 cherry 190 1.1 cherry /* TSS used on Intel when CR0.PE=0. */ 191 1.1 cherry #define HVM_PARAM_VM86_TSS 15 192 1.1 cherry 193 1.1 cherry /* Boolean: Enable aligning all periodic vpts to reduce interrupts */ 194 1.1 cherry #define HVM_PARAM_VPT_ALIGN 16 195 1.1 cherry 196 1.1 cherry /* Console debug shared memory ring and event channel */ 197 1.1 cherry #define HVM_PARAM_CONSOLE_PFN 17 198 1.1 cherry #define HVM_PARAM_CONSOLE_EVTCHN 18 199 1.1 cherry 200 1.1 cherry /* 201 1.1 cherry * Select location of ACPI PM1a and TMR control blocks. Currently two locations 202 1.1 cherry * are supported, specified by version 0 or 1 in this parameter: 203 1.1 cherry * - 0: default, use the old addresses 204 1.1 cherry * PM1A_EVT == 0x1f40; PM1A_CNT == 0x1f44; PM_TMR == 0x1f48 205 1.1 cherry * - 1: use the new default qemu addresses 206 1.1 cherry * PM1A_EVT == 0xb000; PM1A_CNT == 0xb004; PM_TMR == 0xb008 207 1.1 cherry * You can find these address definitions in <hvm/ioreq.h> 208 1.1 cherry */ 209 1.1 cherry #define HVM_PARAM_ACPI_IOPORTS_LOCATION 19 210 1.1 cherry 211 1.1 cherry /* Deprecated */ 212 1.1 cherry #define HVM_PARAM_MEMORY_EVENT_CR0 20 213 1.1 cherry #define HVM_PARAM_MEMORY_EVENT_CR3 21 214 1.1 cherry #define HVM_PARAM_MEMORY_EVENT_CR4 22 215 1.1 cherry #define HVM_PARAM_MEMORY_EVENT_INT3 23 216 1.1 cherry #define HVM_PARAM_MEMORY_EVENT_SINGLE_STEP 25 217 1.1 cherry #define HVM_PARAM_MEMORY_EVENT_MSR 30 218 1.1 cherry 219 1.1 cherry /* Boolean: Enable nestedhvm (hvm only) */ 220 1.1 cherry #define HVM_PARAM_NESTEDHVM 24 221 1.1 cherry 222 1.1 cherry /* Params for the mem event rings */ 223 1.1 cherry #define HVM_PARAM_PAGING_RING_PFN 27 224 1.1 cherry #define HVM_PARAM_MONITOR_RING_PFN 28 225 1.1 cherry #define HVM_PARAM_SHARING_RING_PFN 29 226 1.1 cherry 227 1.1 cherry /* SHUTDOWN_* action in case of a triple fault */ 228 1.1 cherry #define HVM_PARAM_TRIPLE_FAULT_REASON 31 229 1.1 cherry 230 1.1 cherry #define HVM_PARAM_IOREQ_SERVER_PFN 32 231 1.1 cherry #define HVM_PARAM_NR_IOREQ_SERVER_PAGES 33 232 1.1 cherry 233 1.1 cherry /* Location of the VM Generation ID in guest physical address space. */ 234 1.1 cherry #define HVM_PARAM_VM_GENERATION_ID_ADDR 34 235 1.1 cherry 236 1.1 cherry /* 237 1.1 cherry * Set mode for altp2m: 238 1.1 cherry * disabled: don't activate altp2m (default) 239 1.1 cherry * mixed: allow access to all altp2m ops for both in-guest and external tools 240 1.1 cherry * external: allow access to external privileged tools only 241 1.1 cherry * limited: guest only has limited access (ie. control VMFUNC and #VE) 242 1.1 cherry */ 243 1.1 cherry #define HVM_PARAM_ALTP2M 35 244 1.1 cherry #define XEN_ALTP2M_disabled 0 245 1.1 cherry #define XEN_ALTP2M_mixed 1 246 1.1 cherry #define XEN_ALTP2M_external 2 247 1.1 cherry #define XEN_ALTP2M_limited 3 248 1.1 cherry 249 1.1 cherry /* 250 1.1 cherry * Size of the x87 FPU FIP/FDP registers that the hypervisor needs to 251 1.1 cherry * save/restore. This is a workaround for a hardware limitation that 252 1.1 cherry * does not allow the full FIP/FDP and FCS/FDS to be restored. 253 1.1 cherry * 254 1.1 cherry * Valid values are: 255 1.1 cherry * 256 1.1 cherry * 8: save/restore 64-bit FIP/FDP and clear FCS/FDS (default if CPU 257 1.1 cherry * has FPCSDS feature). 258 1.1 cherry * 259 1.1 cherry * 4: save/restore 32-bit FIP/FDP, FCS/FDS, and clear upper 32-bits of 260 1.1 cherry * FIP/FDP. 261 1.1 cherry * 262 1.1 cherry * 0: allow hypervisor to choose based on the value of FIP/FDP 263 1.1 cherry * (default if CPU does not have FPCSDS). 264 1.1 cherry * 265 1.1 cherry * If FPCSDS (bit 13 in CPUID leaf 0x7, subleaf 0x0) is set, the CPU 266 1.1 cherry * never saves FCS/FDS and this parameter should be left at the 267 1.1 cherry * default of 8. 268 1.1 cherry */ 269 1.1 cherry #define HVM_PARAM_X87_FIP_WIDTH 36 270 1.1 cherry 271 1.1 cherry /* 272 1.1 cherry * TSS (and its size) used on Intel when CR0.PE=0. The address occupies 273 1.1 cherry * the low 32 bits, while the size is in the high 32 ones. 274 1.1 cherry */ 275 1.1 cherry #define HVM_PARAM_VM86_TSS_SIZED 37 276 1.1 cherry 277 1.1 cherry /* Enable MCA capabilities. */ 278 1.1 cherry #define HVM_PARAM_MCA_CAP 38 279 1.1 cherry #define XEN_HVM_MCA_CAP_LMCE (xen_mk_ullong(1) << 0) 280 1.1 cherry #define XEN_HVM_MCA_CAP_MASK XEN_HVM_MCA_CAP_LMCE 281 1.1 cherry 282 1.1 cherry #define HVM_NR_PARAMS 39 283 1.1 cherry 284 1.1 cherry #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ 285