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