1 | /* $Id: APIC.cpp 60379 2016-04-07 15:59:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * APIC - Advanced Programmable Interrupt Controller.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*********************************************************************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *********************************************************************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_DEV_APIC
|
---|
23 | #include <VBox/log.h>
|
---|
24 | #include "APICInternal.h"
|
---|
25 | #include <VBox/vmm/cpum.h>
|
---|
26 | #include <VBox/vmm/hm.h>
|
---|
27 | #include <VBox/vmm/mm.h>
|
---|
28 | #include <VBox/vmm/pdmdev.h>
|
---|
29 | #include <VBox/vmm/ssm.h>
|
---|
30 | #include <VBox/vmm/vm.h>
|
---|
31 |
|
---|
32 |
|
---|
33 | #ifndef VBOX_DEVICE_STRUCT_TESTCASE
|
---|
34 | /*********************************************************************************************************************************
|
---|
35 | * Defined Constants And Macros *
|
---|
36 | *********************************************************************************************************************************/
|
---|
37 | /** The current APIC saved state version. */
|
---|
38 | #define APIC_SAVED_STATE_VERSION 4
|
---|
39 | /** The saved state version used by VirtualBox 5.0 and
|
---|
40 | * earlier. */
|
---|
41 | #define APIC_SAVED_STATE_VERSION_VBOX_50 3
|
---|
42 | /** The saved state version used by VirtualBox v3 and earlier.
|
---|
43 | * This does not include the config. */
|
---|
44 | #define APIC_SAVED_STATE_VERSION_VBOX_30 2
|
---|
45 | /** Some ancient version... */
|
---|
46 | #define APIC_SAVED_STATE_VERSION_ANCIENT 1
|
---|
47 |
|
---|
48 |
|
---|
49 | /*********************************************************************************************************************************
|
---|
50 | * Global Variables *
|
---|
51 | *********************************************************************************************************************************/
|
---|
52 | /** Saved state field descriptors for XAPICPAGE. */
|
---|
53 | static const SSMFIELD g_aXApicPageFields[] =
|
---|
54 | {
|
---|
55 | SSMFIELD_ENTRY( XAPICPAGE, id.u8ApicId),
|
---|
56 | SSMFIELD_ENTRY( XAPICPAGE, version.all.u32Version),
|
---|
57 | SSMFIELD_ENTRY( XAPICPAGE, tpr.u8Tpr),
|
---|
58 | SSMFIELD_ENTRY( XAPICPAGE, apr.u8Apr),
|
---|
59 | SSMFIELD_ENTRY( XAPICPAGE, ppr.u8Ppr),
|
---|
60 | SSMFIELD_ENTRY( XAPICPAGE, ldr.all.u32Ldr),
|
---|
61 | SSMFIELD_ENTRY( XAPICPAGE, dfr.all.u32Dfr),
|
---|
62 | SSMFIELD_ENTRY( XAPICPAGE, svr.all.u32Svr),
|
---|
63 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[0].u32Reg),
|
---|
64 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[1].u32Reg),
|
---|
65 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[2].u32Reg),
|
---|
66 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[3].u32Reg),
|
---|
67 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[4].u32Reg),
|
---|
68 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[5].u32Reg),
|
---|
69 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[6].u32Reg),
|
---|
70 | SSMFIELD_ENTRY( XAPICPAGE, isr.u[7].u32Reg),
|
---|
71 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[0].u32Reg),
|
---|
72 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[1].u32Reg),
|
---|
73 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[2].u32Reg),
|
---|
74 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[3].u32Reg),
|
---|
75 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[4].u32Reg),
|
---|
76 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[5].u32Reg),
|
---|
77 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[6].u32Reg),
|
---|
78 | SSMFIELD_ENTRY( XAPICPAGE, tmr.u[7].u32Reg),
|
---|
79 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[0].u32Reg),
|
---|
80 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[1].u32Reg),
|
---|
81 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[2].u32Reg),
|
---|
82 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[3].u32Reg),
|
---|
83 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[4].u32Reg),
|
---|
84 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[5].u32Reg),
|
---|
85 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[6].u32Reg),
|
---|
86 | SSMFIELD_ENTRY( XAPICPAGE, irr.u[7].u32Reg),
|
---|
87 | SSMFIELD_ENTRY( XAPICPAGE, esr.all.u32Errors),
|
---|
88 | SSMFIELD_ENTRY( XAPICPAGE, icr_lo.all.u32IcrLo),
|
---|
89 | SSMFIELD_ENTRY( XAPICPAGE, icr_hi.all.u32IcrHi),
|
---|
90 | SSMFIELD_ENTRY( XAPICPAGE, lvt_timer.all.u32LvtTimer),
|
---|
91 | SSMFIELD_ENTRY( XAPICPAGE, lvt_thermal.all.u32LvtThermal),
|
---|
92 | SSMFIELD_ENTRY( XAPICPAGE, lvt_perf.all.u32LvtPerf),
|
---|
93 | SSMFIELD_ENTRY( XAPICPAGE, lvt_lint0.all.u32LvtLint0),
|
---|
94 | SSMFIELD_ENTRY( XAPICPAGE, lvt_lint1.all.u32LvtLint1),
|
---|
95 | SSMFIELD_ENTRY( XAPICPAGE, lvt_error.all.u32LvtError),
|
---|
96 | SSMFIELD_ENTRY( XAPICPAGE, timer_icr.u32InitialCount),
|
---|
97 | SSMFIELD_ENTRY( XAPICPAGE, timer_ccr.u32CurrentCount),
|
---|
98 | SSMFIELD_ENTRY( XAPICPAGE, timer_dcr.all.u32DivideValue),
|
---|
99 | SSMFIELD_ENTRY_TERM()
|
---|
100 | };
|
---|
101 |
|
---|
102 | /** Saved state field descriptors for X2APICPAGE. */
|
---|
103 | static const SSMFIELD g_aX2ApicPageFields[] =
|
---|
104 | {
|
---|
105 | SSMFIELD_ENTRY(X2APICPAGE, id.u32ApicId),
|
---|
106 | SSMFIELD_ENTRY(X2APICPAGE, version.all.u32Version),
|
---|
107 | SSMFIELD_ENTRY(X2APICPAGE, tpr.u8Tpr),
|
---|
108 | SSMFIELD_ENTRY(X2APICPAGE, ppr.u8Ppr),
|
---|
109 | SSMFIELD_ENTRY(X2APICPAGE, ldr.u32LogicalApicId),
|
---|
110 | SSMFIELD_ENTRY(X2APICPAGE, svr.all.u32Svr),
|
---|
111 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[0].u32Reg),
|
---|
112 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[1].u32Reg),
|
---|
113 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[2].u32Reg),
|
---|
114 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[3].u32Reg),
|
---|
115 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[4].u32Reg),
|
---|
116 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[5].u32Reg),
|
---|
117 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[6].u32Reg),
|
---|
118 | SSMFIELD_ENTRY(X2APICPAGE, isr.u[7].u32Reg),
|
---|
119 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[0].u32Reg),
|
---|
120 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[1].u32Reg),
|
---|
121 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[2].u32Reg),
|
---|
122 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[3].u32Reg),
|
---|
123 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[4].u32Reg),
|
---|
124 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[5].u32Reg),
|
---|
125 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[6].u32Reg),
|
---|
126 | SSMFIELD_ENTRY(X2APICPAGE, tmr.u[7].u32Reg),
|
---|
127 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[0].u32Reg),
|
---|
128 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[1].u32Reg),
|
---|
129 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[2].u32Reg),
|
---|
130 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[3].u32Reg),
|
---|
131 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[4].u32Reg),
|
---|
132 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[5].u32Reg),
|
---|
133 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[6].u32Reg),
|
---|
134 | SSMFIELD_ENTRY(X2APICPAGE, irr.u[7].u32Reg),
|
---|
135 | SSMFIELD_ENTRY(X2APICPAGE, esr.all.u32Errors),
|
---|
136 | SSMFIELD_ENTRY(X2APICPAGE, icr_lo.all.u32IcrLo),
|
---|
137 | SSMFIELD_ENTRY(X2APICPAGE, icr_hi.u32IcrHi),
|
---|
138 | SSMFIELD_ENTRY(X2APICPAGE, lvt_timer.all.u32LvtTimer),
|
---|
139 | SSMFIELD_ENTRY(X2APICPAGE, lvt_thermal.all.u32LvtThermal),
|
---|
140 | SSMFIELD_ENTRY(X2APICPAGE, lvt_perf.all.u32LvtPerf),
|
---|
141 | SSMFIELD_ENTRY(X2APICPAGE, lvt_lint0.all.u32LvtLint0),
|
---|
142 | SSMFIELD_ENTRY(X2APICPAGE, lvt_lint1.all.u32LvtLint1),
|
---|
143 | SSMFIELD_ENTRY(X2APICPAGE, lvt_error.all.u32LvtError),
|
---|
144 | SSMFIELD_ENTRY(X2APICPAGE, timer_icr.u32InitialCount),
|
---|
145 | SSMFIELD_ENTRY(X2APICPAGE, timer_ccr.u32CurrentCount),
|
---|
146 | SSMFIELD_ENTRY(X2APICPAGE, timer_dcr.all.u32DivideValue),
|
---|
147 | SSMFIELD_ENTRY_TERM()
|
---|
148 | };
|
---|
149 |
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * Gets the descriptive APIC mode.
|
---|
153 | *
|
---|
154 | * @returns The name.
|
---|
155 | * @param enmMode The xAPIC mode.
|
---|
156 | */
|
---|
157 | static const char *apicGetModeName(APICMODE enmMode)
|
---|
158 | {
|
---|
159 | switch (enmMode)
|
---|
160 | {
|
---|
161 | case APICMODE_DISABLED: return "Disabled";
|
---|
162 | case APICMODE_XAPIC: return "xAPIC";
|
---|
163 | case APICMODE_X2APIC: return "x2APIC";
|
---|
164 | default: break;
|
---|
165 | }
|
---|
166 | return "Invalid";
|
---|
167 | }
|
---|
168 |
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * Gets the descriptive destination format name.
|
---|
172 | *
|
---|
173 | * @returns The destination format name.
|
---|
174 | * @param enmDestFormat The destination format.
|
---|
175 | */
|
---|
176 | static const char *apicGetDestFormatName(XAPICDESTFORMAT enmDestFormat)
|
---|
177 | {
|
---|
178 | switch (enmDestFormat)
|
---|
179 | {
|
---|
180 | case XAPICDESTFORMAT_FLAT: return "Flat";
|
---|
181 | case XAPICDESTFORMAT_CLUSTER: return "Cluster";
|
---|
182 | default: break;
|
---|
183 | }
|
---|
184 | return "Invalid";
|
---|
185 | }
|
---|
186 |
|
---|
187 |
|
---|
188 | /**
|
---|
189 | * Gets the descriptive delivery mode name.
|
---|
190 | *
|
---|
191 | * @returns The delivery mode name.
|
---|
192 | * @param enmDeliveryMode The delivery mode.
|
---|
193 | */
|
---|
194 | static const char *apicGetDeliveryModeName(XAPICDELIVERYMODE enmDeliveryMode)
|
---|
195 | {
|
---|
196 | switch (enmDeliveryMode)
|
---|
197 | {
|
---|
198 | case XAPICDELIVERYMODE_FIXED: return "Fixed";
|
---|
199 | case XAPICDELIVERYMODE_LOWEST_PRIO: return "Lowest priority";
|
---|
200 | case XAPICDELIVERYMODE_SMI: return "SMI";
|
---|
201 | case XAPICDELIVERYMODE_NMI: return "NMI";
|
---|
202 | case XAPICDELIVERYMODE_INIT: return "INIT";
|
---|
203 | case XAPICDELIVERYMODE_STARTUP: return "SIPI";
|
---|
204 | case XAPICDELIVERYMODE_EXTINT: return "ExtINT";
|
---|
205 | default: break;
|
---|
206 | }
|
---|
207 | return "Invalid";
|
---|
208 | }
|
---|
209 |
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * Gets the descriptive destination mode name.
|
---|
213 | *
|
---|
214 | * @returns The destination mode name.
|
---|
215 | * @param enmDestMode The destination mode.
|
---|
216 | */
|
---|
217 | static const char *apicGetDestModeName(XAPICDESTMODE enmDestMode)
|
---|
218 | {
|
---|
219 | switch (enmDestMode)
|
---|
220 | {
|
---|
221 | case XAPICDESTMODE_PHYSICAL: return "Physical";
|
---|
222 | case XAPICDESTMODE_LOGICAL: return "Logical";
|
---|
223 | default: break;
|
---|
224 | }
|
---|
225 | return "Invalid";
|
---|
226 | }
|
---|
227 |
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * Gets the descriptive trigger mode name.
|
---|
231 | *
|
---|
232 | * @returns The trigger mode name.
|
---|
233 | * @param enmTriggerMode The trigger mode.
|
---|
234 | */
|
---|
235 | static const char *apicGetTriggerModeName(XAPICTRIGGERMODE enmTriggerMode)
|
---|
236 | {
|
---|
237 | switch (enmTriggerMode)
|
---|
238 | {
|
---|
239 | case XAPICTRIGGERMODE_EDGE: return "Edge";
|
---|
240 | case XAPICTRIGGERMODE_LEVEL: return "Level";
|
---|
241 | default: break;
|
---|
242 | }
|
---|
243 | return "Invalid";
|
---|
244 | }
|
---|
245 |
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * Gets the destination shorthand name.
|
---|
249 | *
|
---|
250 | * @returns The destination shorthand name.
|
---|
251 | * @param enmDestShorthand The destination shorthand.
|
---|
252 | */
|
---|
253 | static const char *apicGetDestShorthandName(XAPICDESTSHORTHAND enmDestShorthand)
|
---|
254 | {
|
---|
255 | switch (enmDestShorthand)
|
---|
256 | {
|
---|
257 | case XAPICDESTSHORTHAND_NONE: return "None";
|
---|
258 | case XAPICDESTSHORTHAND_SELF: return "Self";
|
---|
259 | case XAPIDDESTSHORTHAND_ALL_INCL_SELF: return "All including self";
|
---|
260 | case XAPICDESTSHORTHAND_ALL_EXCL_SELF: return "All excluding self";
|
---|
261 | default: break;
|
---|
262 | }
|
---|
263 | return "Invalid";
|
---|
264 | }
|
---|
265 |
|
---|
266 |
|
---|
267 | /**
|
---|
268 | * Gets the timer mode name.
|
---|
269 | *
|
---|
270 | * @returns The timer mode name.
|
---|
271 | * @param enmTimerMode The timer mode.
|
---|
272 | */
|
---|
273 | static const char *apicGetTimerModeName(XAPICTIMERMODE enmTimerMode)
|
---|
274 | {
|
---|
275 | switch (enmTimerMode)
|
---|
276 | {
|
---|
277 | case XAPICTIMERMODE_ONESHOT: return "One-shot";
|
---|
278 | case XAPICTIMERMODE_PERIODIC: return "Periodic";
|
---|
279 | case XAPICTIMERMODE_TSC_DEADLINE: return "TSC deadline";
|
---|
280 | default: break;
|
---|
281 | }
|
---|
282 | return "Invalid";
|
---|
283 | }
|
---|
284 |
|
---|
285 |
|
---|
286 | /**
|
---|
287 | * Initializes per-VCPU APIC to the state following an INIT reset
|
---|
288 | * ("Wait-for-SIPI" state).
|
---|
289 | *
|
---|
290 | * @param pVCpu The cross context virtual CPU structure.
|
---|
291 | */
|
---|
292 | static void apicR3InitIpi(PVMCPU pVCpu)
|
---|
293 | {
|
---|
294 | VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
|
---|
295 | PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
|
---|
296 |
|
---|
297 | /*
|
---|
298 | * See Intel spec. 10.4.7.3 "Local APIC State After an INIT Reset (Wait-for-SIPI State)"
|
---|
299 | * and AMD spec 16.3.2 "APIC Registers".
|
---|
300 | */
|
---|
301 | ASMMemZero32(&pXApicPage->irr, sizeof(pXApicPage->irr));
|
---|
302 | ASMMemZero32(&pXApicPage->isr, sizeof(pXApicPage->isr));
|
---|
303 | ASMMemZero32(&pXApicPage->tmr, sizeof(pXApicPage->tmr));
|
---|
304 | ASMMemZero32(&pXApicPage->icr_hi, sizeof(pXApicPage->icr_hi));
|
---|
305 | ASMMemZero32(&pXApicPage->icr_lo, sizeof(pXApicPage->icr_lo));
|
---|
306 | ASMMemZero32(&pXApicPage->ldr, sizeof(pXApicPage->ldr));
|
---|
307 | ASMMemZero32(&pXApicPage->tpr, sizeof(pXApicPage->tpr));
|
---|
308 | ASMMemZero32(&pXApicPage->timer_icr, sizeof(pXApicPage->timer_icr));
|
---|
309 | ASMMemZero32(&pXApicPage->timer_ccr, sizeof(pXApicPage->timer_ccr));
|
---|
310 | ASMMemZero32(&pXApicPage->timer_dcr, sizeof(pXApicPage->timer_dcr));
|
---|
311 |
|
---|
312 | pXApicPage->dfr.u.u4Model = XAPICDESTFORMAT_FLAT;
|
---|
313 | pXApicPage->dfr.u.u28ReservedMb1 = UINT32_C(0xfffffff);
|
---|
314 |
|
---|
315 | /** @todo CMCI. */
|
---|
316 |
|
---|
317 | ASMMemZero32(&pXApicPage->lvt_timer, sizeof(pXApicPage->lvt_timer));
|
---|
318 | pXApicPage->lvt_timer.u.u1Mask = 1;
|
---|
319 |
|
---|
320 | #if XAPIC_HARDWARE_VERSION == XAPIC_HARDWARE_VERSION_P4
|
---|
321 | ASMMemZero32(&pXApicPage->lvt_thermal, sizeof(pXApicPage->lvt_thermal));
|
---|
322 | pXApicPage->lvt_thermal.u.u1Mask = 1;
|
---|
323 | #endif
|
---|
324 |
|
---|
325 | ASMMemZero32(&pXApicPage->lvt_perf, sizeof(pXApicPage->lvt_perf));
|
---|
326 | pXApicPage->lvt_perf.u.u1Mask = 1;
|
---|
327 |
|
---|
328 | ASMMemZero32(&pXApicPage->lvt_lint0, sizeof(pXApicPage->lvt_lint0));
|
---|
329 | pXApicPage->lvt_lint0.u.u1Mask = 1;
|
---|
330 |
|
---|
331 | ASMMemZero32(&pXApicPage->lvt_lint1, sizeof(pXApicPage->lvt_lint1));
|
---|
332 | pXApicPage->lvt_lint1.u.u1Mask = 1;
|
---|
333 |
|
---|
334 | ASMMemZero32(&pXApicPage->lvt_error, sizeof(pXApicPage->lvt_error));
|
---|
335 | pXApicPage->lvt_error.u.u1Mask = 1;
|
---|
336 |
|
---|
337 | ASMMemZero32(&pXApicPage->svr, sizeof(pXApicPage->svr));
|
---|
338 | pXApicPage->svr.u.u8SpuriousVector = 0xff;
|
---|
339 |
|
---|
340 | /* The self-IPI register is 0. See Intel spec. 10.12.5.1 "x2APIC States" */
|
---|
341 | PX2APICPAGE pX2ApicPage = VMCPU_TO_X2APICPAGE(pVCpu);
|
---|
342 | ASMMemZero32(&pX2ApicPage->self_ipi, sizeof(pX2ApicPage->self_ipi));
|
---|
343 |
|
---|
344 | /* Clear the posted interrupt bitmaps. */
|
---|
345 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
346 | ASMMemZero32(&pApicCpu->ApicPibLevel, sizeof(APICPIB));
|
---|
347 | ASMMemZero32(&pApicCpu->pvApicPibR3, sizeof(APICPIB));
|
---|
348 | }
|
---|
349 |
|
---|
350 |
|
---|
351 | /**
|
---|
352 | * Resets the APIC base MSR.
|
---|
353 | *
|
---|
354 | * @param pVCpu The cross context virtual CPU structure.
|
---|
355 | */
|
---|
356 | static void apicR3ResetBaseMsr(PVMCPU pVCpu)
|
---|
357 | {
|
---|
358 | /*
|
---|
359 | * Initialize the APIC base MSR. The APIC enable-bit is set upon power-up or reset[1].
|
---|
360 | *
|
---|
361 | * A Reset (in xAPIC and x2APIC mode) brings up the local APIC in xAPIC mode.
|
---|
362 | * An INIT IPI does -not- cause a transition between xAPIC and x2APIC mode[2].
|
---|
363 | *
|
---|
364 | * [1] See AMD spec. 14.1.3 "Processor Initialization State"
|
---|
365 | * [2] See Intel spec. 10.12.5.1 "x2APIC States".
|
---|
366 | */
|
---|
367 | VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
|
---|
368 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
369 | pApicCpu->uApicBaseMsr = XAPIC_APICBASE_PHYSADDR
|
---|
370 | | MSR_APICBASE_XAPIC_ENABLE_BIT;
|
---|
371 | if (pVCpu->idCpu == 0)
|
---|
372 | pApicCpu->uApicBaseMsr |= MSR_APICBASE_BOOTSTRAP_CPU_BIT;
|
---|
373 | }
|
---|
374 |
|
---|
375 |
|
---|
376 | /**
|
---|
377 | * Sets the xAPIC enabled bit in the APIC base MSR.
|
---|
378 | *
|
---|
379 | * @param pVCpu The cross context virtual CPU structure.
|
---|
380 | * @param fEnabled Whether to enable or disable the APIC.
|
---|
381 | *
|
---|
382 | * @remarks Warning!!! This does -not- touch the x2APIC enable bit and could
|
---|
383 | * thus lead to invalid states if used incorrectly!
|
---|
384 | */
|
---|
385 | static void apicR3SetEnabled(PVMCPU pVCpu, bool fEnabled)
|
---|
386 | {
|
---|
387 | VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
|
---|
388 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
389 | if (!fEnabled)
|
---|
390 | {
|
---|
391 | pApicCpu->uApicBaseMsr &= ~MSR_APICBASE_XAPIC_ENABLE_BIT;
|
---|
392 | Assert(!(pApicCpu->uApicBaseMsr & MSR_APICBASE_XAPIC_ENABLE_BIT));
|
---|
393 | }
|
---|
394 | else
|
---|
395 | pApicCpu->uApicBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT;
|
---|
396 | }
|
---|
397 |
|
---|
398 |
|
---|
399 | /**
|
---|
400 | * Initializes per-VCPU APIC to the state following a power-up or hardware
|
---|
401 | * reset.
|
---|
402 | *
|
---|
403 | * @param pVCpu The cross context virtual CPU structure.
|
---|
404 | */
|
---|
405 | VMMR3_INT_DECL(void) APICR3Reset(PVMCPU pVCpu)
|
---|
406 | {
|
---|
407 | VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
|
---|
408 |
|
---|
409 | #ifdef RT_STRICT
|
---|
410 | /* Verify that the initial APIC ID reported via CPUID matches our VMCPU ID assumption. */
|
---|
411 | CPUMCPUIDLEAF CpuLeaf;
|
---|
412 | int rc = CPUMR3CpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), &CpuLeaf, 1, 0);
|
---|
413 | AssertRC(rc);
|
---|
414 | Assert(((CpuLeaf.uEbx >> 24) & 0xff) == pVCpu->idCpu);
|
---|
415 | #endif
|
---|
416 |
|
---|
417 | apicR3InitIpi(pVCpu);
|
---|
418 |
|
---|
419 | PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
|
---|
420 |
|
---|
421 | /*
|
---|
422 | * The APIC version register is read-only, so just initialize it here.
|
---|
423 | * It is not clear from the specs, where exactly it is initalized.
|
---|
424 | * The version determines the number of LVT entries and size of the APIC ID (8 bits for P4).
|
---|
425 | */
|
---|
426 | #if XAPIC_HARDWARE_VERSION == XAPIC_HARDWARE_VERSION_P4
|
---|
427 | pXApicPage->version.u.u8MaxLvtEntry = XAPIC_MAX_LVT_ENTRIES_P4 - 1;
|
---|
428 | pXApicPage->version.u.u8Version = XAPIC_HARDWARE_VERSION_P4;
|
---|
429 | AssertCompile(sizeof(pXApicPage->id.u8ApicId) >= XAPIC_APIC_ID_BIT_COUNT_P4 / 8);
|
---|
430 | #else
|
---|
431 | # error "Implement Pentium and P6 family APIC architectures"
|
---|
432 | #endif
|
---|
433 |
|
---|
434 | /** @todo It isn't very clear where the default base address is (re)initialized,
|
---|
435 | * atm we do it here in Reset. */
|
---|
436 | apicR3ResetBaseMsr(pVCpu);
|
---|
437 |
|
---|
438 | /*
|
---|
439 | * Initialize the APIC ID register to xAPIC format.
|
---|
440 | */
|
---|
441 | ASMMemZero32(&pXApicPage->id, sizeof(pXApicPage->id));
|
---|
442 | pXApicPage->id.u8ApicId = pVCpu->idCpu;
|
---|
443 | }
|
---|
444 |
|
---|
445 |
|
---|
446 | /**
|
---|
447 | * Called when a init phase has completed.
|
---|
448 | *
|
---|
449 | * @returns VBox status code.
|
---|
450 | * @param pVM The cross context VM structure.
|
---|
451 | * @param enmWhat Which init phase.
|
---|
452 | */
|
---|
453 | VMMR3_INT_DECL(int) APICR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat)
|
---|
454 | {
|
---|
455 | switch (enmWhat)
|
---|
456 | {
|
---|
457 | case VMINITCOMPLETED_RING0:
|
---|
458 | {
|
---|
459 | /*
|
---|
460 | * Map the virtual-PIB into RC.
|
---|
461 | * The virtual-PIB should've already been mapped into R0 and R3, see APICR0InitVM().
|
---|
462 | */
|
---|
463 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
464 | RTGCPTR GCPtrApicPib;
|
---|
465 | if ( RT_VALID_PTR(pApic->pvApicPibR3)
|
---|
466 | && pApic->HCPhysApicPib != NIL_RTHCPHYS)
|
---|
467 | {
|
---|
468 | int rc = MMR3HyperMapHCPhys(pVM, (void *)pApic->pvApicPibR3, NIL_RTR0PTR, pApic->HCPhysApicPib,
|
---|
469 | (size_t)pApic->cbApicPib, "APIC PIB", &GCPtrApicPib);
|
---|
470 | if (RT_FAILURE(rc))
|
---|
471 | {
|
---|
472 | LogRel(("APIC: Failed to map HC APIC PIB of %u bytes at %#RHp to RC, rc=%Rrc\n", pApic->cbApicPib,
|
---|
473 | pApic->HCPhysApicPib, rc));
|
---|
474 | return rc;
|
---|
475 | }
|
---|
476 | }
|
---|
477 | else
|
---|
478 | {
|
---|
479 | LogRel(("APIC: Failed to find R3 mapping for virtual-PIB\n"));
|
---|
480 | return VERR_MAP_FAILED;
|
---|
481 | }
|
---|
482 |
|
---|
483 | /*
|
---|
484 | * Map the virtual-APIC pages into RC and initialize per-VCPU APIC state.
|
---|
485 | * The virtual-APIC pages should by now have been mapped into R0 and R3 by APICR0InitVM().
|
---|
486 | */
|
---|
487 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
488 | {
|
---|
489 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
490 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
491 |
|
---|
492 | if ( RT_VALID_PTR(pApicCpu->pvApicPageR3)
|
---|
493 | && pApicCpu->HCPhysApicPage != NIL_RTHCPHYS)
|
---|
494 | {
|
---|
495 | RTGCPTR GCPtrApicPage;
|
---|
496 | int rc = MMR3HyperMapHCPhys(pVM, (void *)pApicCpu->pvApicPageR3, NIL_RTR0PTR, pApicCpu->HCPhysApicPage,
|
---|
497 | (size_t)pApicCpu->cbApicPage, "APIC", &GCPtrApicPage);
|
---|
498 | if (RT_SUCCESS(rc))
|
---|
499 | {
|
---|
500 | pApicCpu->pvApicPageRC = GCPtrApicPage;
|
---|
501 |
|
---|
502 | /*
|
---|
503 | * Associate the per-VCPU PIB RC pointer to the per-VM PIB RC mapping.
|
---|
504 | */
|
---|
505 | size_t const offApicPib = idCpu * sizeof(APICPIB);
|
---|
506 | pApicCpu->pvApicPibRC = GCPtrApicPib + offApicPib;
|
---|
507 |
|
---|
508 | /*
|
---|
509 | * Initialize the remaining state now that we have R3 mappings.
|
---|
510 | */
|
---|
511 | APICR3Reset(pVCpu);
|
---|
512 | }
|
---|
513 | else
|
---|
514 | {
|
---|
515 | LogRel(("APIC%u: Failed to map HC virtual-APIC page of %u bytes at %#RHp to RC, rc=%Rrc\n",
|
---|
516 | pVCpu->idCpu, pApicCpu->cbApicPage, pApicCpu->HCPhysApicPage, rc));
|
---|
517 | return rc;
|
---|
518 | }
|
---|
519 | }
|
---|
520 | else
|
---|
521 | {
|
---|
522 | LogRel(("APIC%u: Failed to find R3 mapping for virtual-APIC page\n", pVCpu->idCpu));
|
---|
523 | return VERR_MAP_FAILED;
|
---|
524 | }
|
---|
525 | }
|
---|
526 | return VINF_SUCCESS;
|
---|
527 | }
|
---|
528 |
|
---|
529 | case VMINITCOMPLETED_HM:
|
---|
530 | {
|
---|
531 | CPUMCPUIDLEAF CpuLeaf;
|
---|
532 | int rc = CPUMR3CpuIdGetLeaf(pVM, &CpuLeaf, 1, 0);
|
---|
533 | AssertRCReturn(rc, rc);
|
---|
534 |
|
---|
535 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
536 | pApic->fSupportsTscDeadline = RT_BOOL(CpuLeaf.uEcx & X86_CPUID_FEATURE_ECX_TSCDEADL);
|
---|
537 | pApic->fPostedIntrsEnabled = HMR3IsPostedIntrsEnabled(pVM->pUVM);
|
---|
538 | pApic->fVirtApicRegsEnabled = HMR3IsVirtApicRegsEnabled(pVM->pUVM);
|
---|
539 | return VINF_SUCCESS;
|
---|
540 | }
|
---|
541 |
|
---|
542 | default:
|
---|
543 | return VINF_SUCCESS;
|
---|
544 | }
|
---|
545 | }
|
---|
546 |
|
---|
547 |
|
---|
548 | /**
|
---|
549 | * Receives an INIT IPI.
|
---|
550 | *
|
---|
551 | * @param pVCpu The cross context virtual CPU structure.
|
---|
552 | */
|
---|
553 | VMMR3_INT_DECL(void) APICR3InitIpi(PVMCPU pVCpu)
|
---|
554 | {
|
---|
555 | VMCPU_ASSERT_EMT(pVCpu);
|
---|
556 | apicR3InitIpi(pVCpu);
|
---|
557 | }
|
---|
558 |
|
---|
559 |
|
---|
560 | /**
|
---|
561 | * Helper for dumping an APIC 256-bit sparse register.
|
---|
562 | *
|
---|
563 | * @param pApicReg The APIC 256-bit spare register.
|
---|
564 | * @param pHlp The debug output helper.
|
---|
565 | */
|
---|
566 | static void apicR3DbgInfo256BitReg(volatile const XAPIC256BITREG *pApicReg, PCDBGFINFOHLP pHlp)
|
---|
567 | {
|
---|
568 | ssize_t const cFragments = RT_ELEMENTS(pApicReg->u);
|
---|
569 | unsigned const cBitsPerFragment = sizeof(pApicReg->u[0].u32Reg) * 8;
|
---|
570 | XAPIC256BITREG ApicReg;
|
---|
571 | RT_ZERO(ApicReg);
|
---|
572 |
|
---|
573 | pHlp->pfnPrintf(pHlp, " ");
|
---|
574 | for (ssize_t i = cFragments - 1; i >= 0; i--)
|
---|
575 | {
|
---|
576 | uint32_t const uFragment = pApicReg->u[i].u32Reg;
|
---|
577 | ApicReg.u[i].u32Reg = uFragment;
|
---|
578 | pHlp->pfnPrintf(pHlp, "%08x", uFragment);
|
---|
579 | }
|
---|
580 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
581 |
|
---|
582 | size_t cPending = 0;
|
---|
583 | pHlp->pfnPrintf(pHlp, " Pending\n");
|
---|
584 | pHlp->pfnPrintf(pHlp, " ");
|
---|
585 | for (ssize_t i = cFragments - 1; i >= 0; i--)
|
---|
586 | {
|
---|
587 | uint32_t uFragment = ApicReg.u[i].u32Reg;
|
---|
588 | if (uFragment)
|
---|
589 | {
|
---|
590 | do
|
---|
591 | {
|
---|
592 | unsigned idxSetBit = ASMBitLastSetU32(uFragment);
|
---|
593 | --idxSetBit;
|
---|
594 | ASMBitClear(&uFragment, idxSetBit);
|
---|
595 |
|
---|
596 | idxSetBit += (i * cBitsPerFragment);
|
---|
597 | pHlp->pfnPrintf(pHlp, " %02x", idxSetBit);
|
---|
598 | ++cPending;
|
---|
599 | } while (uFragment);
|
---|
600 | }
|
---|
601 | }
|
---|
602 | if (!cPending)
|
---|
603 | pHlp->pfnPrintf(pHlp, " None");
|
---|
604 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
605 | }
|
---|
606 |
|
---|
607 |
|
---|
608 | /**
|
---|
609 | * Dumps basic APIC state.
|
---|
610 | *
|
---|
611 | * @param pVCpu The cross context virtual CPU structure.
|
---|
612 | * @param pHlp The debug output helper.
|
---|
613 | */
|
---|
614 | static void apicR3DbgInfoBasic(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
|
---|
615 | {
|
---|
616 | PCAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
617 | PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
|
---|
618 | PCX2APICPAGE pX2ApicPage = VMCPU_TO_CX2APICPAGE(pVCpu);
|
---|
619 | bool const fX2ApicMode = XAPIC_IN_X2APIC_MODE(pVCpu);
|
---|
620 |
|
---|
621 | pHlp->pfnPrintf(pHlp, "VCPU[%u] APIC at %#RGp (%s mode):\n", pVCpu->idCpu, MSR_APICBASE_GET_PHYSADDR(pApicCpu->uApicBaseMsr),
|
---|
622 | fX2ApicMode ? "x2APIC" : "xAPIC");
|
---|
623 | if (fX2ApicMode)
|
---|
624 | {
|
---|
625 | pHlp->pfnPrintf(pHlp, " APIC ID = %u (%#x)\n", pX2ApicPage->id.u32ApicId,
|
---|
626 | pX2ApicPage->id.u32ApicId);
|
---|
627 | }
|
---|
628 | else
|
---|
629 | pHlp->pfnPrintf(pHlp, " APIC ID = %u (%#x)\n", pXApicPage->id.u8ApicId, pXApicPage->id.u8ApicId);
|
---|
630 | pHlp->pfnPrintf(pHlp, " Version = %#x\n", pXApicPage->version.all.u32Version);
|
---|
631 | pHlp->pfnPrintf(pHlp, " APIC Version = %#x\n", pXApicPage->version.u.u8Version);
|
---|
632 | pHlp->pfnPrintf(pHlp, " Max LVT entries = %u\n", pXApicPage->version.u.u8MaxLvtEntry);
|
---|
633 | pHlp->pfnPrintf(pHlp, " EOI Broadcast supression = %RTbool\n", pXApicPage->version.u.fEoiBroadcastSupression);
|
---|
634 | if (!fX2ApicMode)
|
---|
635 | pHlp->pfnPrintf(pHlp, " APR = %u (%#x)\n", pXApicPage->apr.u8Apr, pXApicPage->apr.u8Apr);
|
---|
636 | pHlp->pfnPrintf(pHlp, " TPR = %u (%#x)\n", pXApicPage->tpr.u8Tpr, pXApicPage->tpr.u8Tpr);
|
---|
637 | pHlp->pfnPrintf(pHlp, " Task-priority class = %u\n", XAPIC_TPR_GET_TP(pXApicPage->tpr.u8Tpr));
|
---|
638 | pHlp->pfnPrintf(pHlp, " Task-priority subclass = %u\n", XAPIC_TPR_GET_TP_SUBCLASS(pXApicPage->tpr.u8Tpr));
|
---|
639 | pHlp->pfnPrintf(pHlp, " PPR = %u (%#x)\n", pXApicPage->ppr.u8Ppr, pXApicPage->ppr.u8Ppr);
|
---|
640 | pHlp->pfnPrintf(pHlp, " Processor-priority class = %u\n", XAPIC_PPR_GET_PP(pXApicPage->ppr.u8Ppr));
|
---|
641 | pHlp->pfnPrintf(pHlp, " Processor-priority subclass = %u\n", XAPIC_PPR_GET_PP_SUBCLASS(pXApicPage->ppr.u8Ppr));
|
---|
642 | if (!fX2ApicMode)
|
---|
643 | pHlp->pfnPrintf(pHlp, " RRD = %u (%#x)\n", pXApicPage->rrd.u32Rrd, pXApicPage->rrd.u32Rrd);
|
---|
644 | pHlp->pfnPrintf(pHlp, " LDR = %u (%#x)\n", pXApicPage->ldr.all.u32Ldr, pXApicPage->ldr.all.u32Ldr);
|
---|
645 | pHlp->pfnPrintf(pHlp, " Logical APIC ID = %u\n", fX2ApicMode ? pX2ApicPage->ldr.u32LogicalApicId
|
---|
646 | : pXApicPage->ldr.u.u8LogicalApicId);
|
---|
647 | if (!fX2ApicMode)
|
---|
648 | {
|
---|
649 | pHlp->pfnPrintf(pHlp, " DFR = %RX32\n", pXApicPage->dfr.all.u32Dfr);
|
---|
650 | pHlp->pfnPrintf(pHlp, " Model = %#x (%s)\n", pXApicPage->dfr.u.u4Model,
|
---|
651 | apicGetDestFormatName((XAPICDESTFORMAT)pXApicPage->dfr.u.u4Model));
|
---|
652 | }
|
---|
653 | pHlp->pfnPrintf(pHlp, " SVR\n");
|
---|
654 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->svr.u.u8SpuriousVector,
|
---|
655 | pXApicPage->svr.u.u8SpuriousVector);
|
---|
656 | pHlp->pfnPrintf(pHlp, " Software Enabled = %RTbool\n", RT_BOOL(pXApicPage->svr.u.fApicSoftwareEnable));
|
---|
657 | pHlp->pfnPrintf(pHlp, " Supress EOI broadcast = %RTbool\n", RT_BOOL(pXApicPage->svr.u.fSupressEoiBroadcast));
|
---|
658 | pHlp->pfnPrintf(pHlp, " ISR\n");
|
---|
659 | apicR3DbgInfo256BitReg(&pXApicPage->isr, pHlp);
|
---|
660 | pHlp->pfnPrintf(pHlp, " TMR\n");
|
---|
661 | apicR3DbgInfo256BitReg(&pXApicPage->tmr, pHlp);
|
---|
662 | pHlp->pfnPrintf(pHlp, " IRR\n");
|
---|
663 | apicR3DbgInfo256BitReg(&pXApicPage->irr, pHlp);
|
---|
664 | pHlp->pfnPrintf(pHlp, "ESR Internal = %#x\n", pApicCpu->uEsrInternal);
|
---|
665 | pHlp->pfnPrintf(pHlp, " ESR = %#x\n", pXApicPage->esr.all.u32Errors);
|
---|
666 | pHlp->pfnPrintf(pHlp, " Redirectable IPI = %RTbool\n", pXApicPage->esr.u.fRedirectableIpi);
|
---|
667 | pHlp->pfnPrintf(pHlp, " Send Illegal Vector = %RTbool\n", pXApicPage->esr.u.fSendIllegalVector);
|
---|
668 | pHlp->pfnPrintf(pHlp, " Recv Illegal Vector = %RTbool\n", pXApicPage->esr.u.fRcvdIllegalVector);
|
---|
669 | pHlp->pfnPrintf(pHlp, " Illegal Register Address = %RTbool\n", pXApicPage->esr.u.fIllegalRegAddr);
|
---|
670 | pHlp->pfnPrintf(pHlp, " ICR Low = %#x\n", pXApicPage->icr_lo.all);
|
---|
671 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->icr_lo.u.u8Vector,
|
---|
672 | pXApicPage->icr_lo.u.u8Vector);
|
---|
673 | pHlp->pfnPrintf(pHlp, " Delivery Mode = %#x (%s)\n", pXApicPage->icr_lo.u.u3DeliveryMode,
|
---|
674 | apicGetDeliveryModeName((XAPICDELIVERYMODE)pXApicPage->icr_lo.u.u3DeliveryMode));
|
---|
675 | pHlp->pfnPrintf(pHlp, " Destination Mode = %#x (%s)\n", pXApicPage->icr_lo.u.u1DestMode,
|
---|
676 | apicGetDestModeName((XAPICDESTMODE)pXApicPage->icr_lo.u.u1DestMode));
|
---|
677 | if (!fX2ApicMode)
|
---|
678 | pHlp->pfnPrintf(pHlp, " Delivery Status = %u\n", pXApicPage->icr_lo.u.u1DeliveryStatus);
|
---|
679 | pHlp->pfnPrintf(pHlp, " Level = %u\n", pXApicPage->icr_lo.u.u1Level);
|
---|
680 | pHlp->pfnPrintf(pHlp, " Trigger Mode = %u (%s)\n", pXApicPage->icr_lo.u.u1TriggerMode,
|
---|
681 | apicGetTriggerModeName((XAPICTRIGGERMODE)pXApicPage->icr_lo.u.u1TriggerMode));
|
---|
682 | pHlp->pfnPrintf(pHlp, " Destination shorthand = %#x (%s)\n", pXApicPage->icr_lo.u.u2DestShorthand,
|
---|
683 | apicGetDestShorthandName((XAPICDESTSHORTHAND)pXApicPage->icr_lo.u.u2DestShorthand));
|
---|
684 | pHlp->pfnPrintf(pHlp, " ICR High = %#x\n", pXApicPage->icr_hi.all.u32IcrHi);
|
---|
685 | pHlp->pfnPrintf(pHlp, " Destination field/mask = %#x\n", fX2ApicMode ? pX2ApicPage->icr_hi.u32IcrHi
|
---|
686 | : pXApicPage->icr_hi.u.u8Dest);
|
---|
687 | }
|
---|
688 |
|
---|
689 |
|
---|
690 | /**
|
---|
691 | * Helper for dumping the LVT timer.
|
---|
692 | *
|
---|
693 | * @param pVCpu The cross context virtual CPU structure.
|
---|
694 | * @param pHlp The debug output helper.
|
---|
695 | */
|
---|
696 | static void apicR3DbgInfoLvtTimer(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
|
---|
697 | {
|
---|
698 | PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
|
---|
699 | uint32_t const uLvtTimer = pXApicPage->lvt_timer.all.u32LvtTimer;
|
---|
700 | pHlp->pfnPrintf(pHlp, "LVT Timer = %#RX32\n", uLvtTimer);
|
---|
701 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->lvt_timer.u.u8Vector);
|
---|
702 | pHlp->pfnPrintf(pHlp, " Delivery status = %u\n", pXApicPage->lvt_timer.u.u1DeliveryStatus);
|
---|
703 | pHlp->pfnPrintf(pHlp, " Masked = %RTbool\n", XAPIC_LVT_IS_MASKED(uLvtTimer));
|
---|
704 | pHlp->pfnPrintf(pHlp, " Timer Mode = %#x (%s)\n", pXApicPage->lvt_timer.u.u2TimerMode,
|
---|
705 | apicGetTimerModeName((XAPICTIMERMODE)pXApicPage->lvt_timer.u.u2TimerMode));
|
---|
706 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
707 | }
|
---|
708 |
|
---|
709 |
|
---|
710 | /**
|
---|
711 | * Dumps APIC Local Vector Table (LVT) state.
|
---|
712 | *
|
---|
713 | * @param pVCpu The cross context virtual CPU structure.
|
---|
714 | * @param pHlp The debug output helper.
|
---|
715 | */
|
---|
716 | static void apicR3DbgInfoLvt(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
|
---|
717 | {
|
---|
718 | PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
|
---|
719 |
|
---|
720 | apicR3DbgInfoLvtTimer(pVCpu, pHlp);
|
---|
721 |
|
---|
722 | #if XAPIC_HARDWARE_VERSION == XAPIC_HARDWARE_VERSION_P4
|
---|
723 | uint32_t const uLvtThermal = pXApicPage->lvt_thermal.all.u32LvtThermal;
|
---|
724 | pHlp->pfnPrintf(pHlp, "LVT Thermal = %#RX32)\n", uLvtThermal);
|
---|
725 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->lvt_thermal.u.u8Vector, pXApicPage->lvt_thermal.u.u8Vector);
|
---|
726 | pHlp->pfnPrintf(pHlp, " Delivery Mode = %#x (%s)\n", pXApicPage->lvt_thermal.u.u3DeliveryMode,
|
---|
727 | apicGetDeliveryModeName((XAPICDELIVERYMODE)pXApicPage->lvt_thermal.u.u3DeliveryMode));
|
---|
728 | pHlp->pfnPrintf(pHlp, " Delivery status = %u\n", pXApicPage->lvt_thermal.u.u1DeliveryStatus);
|
---|
729 | pHlp->pfnPrintf(pHlp, " Masked = %RTbool\n", XAPIC_LVT_IS_MASKED(uLvtThermal));
|
---|
730 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
731 | #endif
|
---|
732 |
|
---|
733 | uint32_t const uLvtPerf = pXApicPage->lvt_perf.all.u32LvtPerf;
|
---|
734 | pHlp->pfnPrintf(pHlp, "LVT Perf = %#RX32\n", uLvtPerf);
|
---|
735 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->lvt_perf.u.u8Vector, pXApicPage->lvt_perf.u.u8Vector);
|
---|
736 | pHlp->pfnPrintf(pHlp, " Delivery Mode = %#x (%s)\n", pXApicPage->lvt_perf.u.u3DeliveryMode,
|
---|
737 | apicGetDeliveryModeName((XAPICDELIVERYMODE)pXApicPage->lvt_perf.u.u3DeliveryMode));
|
---|
738 | pHlp->pfnPrintf(pHlp, " Delivery status = %u\n", pXApicPage->lvt_perf.u.u1DeliveryStatus);
|
---|
739 | pHlp->pfnPrintf(pHlp, " Masked = %RTbool\n", XAPIC_LVT_IS_MASKED(uLvtPerf));
|
---|
740 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
741 |
|
---|
742 | uint32_t const uLvtLint0 = pXApicPage->lvt_lint0.all.u32LvtLint0;
|
---|
743 | pHlp->pfnPrintf(pHlp, "LVT LINT0 = %#RX32\n", uLvtLint0);
|
---|
744 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->lvt_lint0.u.u8Vector, pXApicPage->lvt_lint0.u.u8Vector);
|
---|
745 | pHlp->pfnPrintf(pHlp, " Delivery Mode = %#x (%s)\n", pXApicPage->lvt_lint0.u.u3DeliveryMode,
|
---|
746 | apicGetDeliveryModeName((XAPICDELIVERYMODE)pXApicPage->lvt_lint0.u.u3DeliveryMode));
|
---|
747 | pHlp->pfnPrintf(pHlp, " Delivery status = %u\n", pXApicPage->lvt_lint0.u.u1DeliveryStatus);
|
---|
748 | pHlp->pfnPrintf(pHlp, " Pin polarity = %u\n", pXApicPage->lvt_lint0.u.u1IntrPolarity);
|
---|
749 | pHlp->pfnPrintf(pHlp, " Remote IRR = %u\n", pXApicPage->lvt_lint0.u.u1RemoteIrr);
|
---|
750 | pHlp->pfnPrintf(pHlp, " Trigger Mode = %u (%s)\n", pXApicPage->lvt_lint0.u.u1TriggerMode,
|
---|
751 | apicGetTriggerModeName((XAPICTRIGGERMODE)pXApicPage->lvt_lint0.u.u1TriggerMode));
|
---|
752 | pHlp->pfnPrintf(pHlp, " Masked = %RTbool\n", XAPIC_LVT_IS_MASKED(uLvtLint0));
|
---|
753 |
|
---|
754 | uint32_t const uLvtLint1 = pXApicPage->lvt_lint1.all.u32LvtLint1;
|
---|
755 | pHlp->pfnPrintf(pHlp, "LVT LINT1 = %#RX32\n", uLvtLint1);
|
---|
756 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->lvt_lint1.u.u8Vector, pXApicPage->lvt_lint1.u.u8Vector);
|
---|
757 | pHlp->pfnPrintf(pHlp, " Delivery Mode = %#x (%s)\n", pXApicPage->lvt_lint1.u.u3DeliveryMode,
|
---|
758 | apicGetDeliveryModeName((XAPICDELIVERYMODE)pXApicPage->lvt_lint1.u.u3DeliveryMode));
|
---|
759 | pHlp->pfnPrintf(pHlp, " Delivery status = %u\n", pXApicPage->lvt_lint1.u.u1DeliveryStatus);
|
---|
760 | pHlp->pfnPrintf(pHlp, " Pin polarity = %u\n", pXApicPage->lvt_lint1.u.u1IntrPolarity);
|
---|
761 | pHlp->pfnPrintf(pHlp, " Remote IRR = %u\n", pXApicPage->lvt_lint1.u.u1RemoteIrr);
|
---|
762 | pHlp->pfnPrintf(pHlp, " Trigger Mode = %u (%s)\n", pXApicPage->lvt_lint1.u.u1TriggerMode,
|
---|
763 | apicGetTriggerModeName((XAPICTRIGGERMODE)pXApicPage->lvt_lint1.u.u1TriggerMode));
|
---|
764 | pHlp->pfnPrintf(pHlp, " Masked = %RTbool\n", XAPIC_LVT_IS_MASKED(uLvtLint1));
|
---|
765 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
766 |
|
---|
767 | uint32_t const uLvtError = pXApicPage->lvt_error.all.u32LvtError;
|
---|
768 | pHlp->pfnPrintf(pHlp, "LVT Perf = %#RX32\n", uLvtError);
|
---|
769 | pHlp->pfnPrintf(pHlp, " Vector = %u (%#x)\n", pXApicPage->lvt_error.u.u8Vector, pXApicPage->lvt_error.u.u8Vector);
|
---|
770 | pHlp->pfnPrintf(pHlp, " Delivery status = %u\n", pXApicPage->lvt_error.u.u1DeliveryStatus);
|
---|
771 | pHlp->pfnPrintf(pHlp, " Masked = %RTbool\n", XAPIC_LVT_IS_MASKED(uLvtError));
|
---|
772 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
773 | }
|
---|
774 |
|
---|
775 |
|
---|
776 | /**
|
---|
777 | * Dumps APIC Timer state.
|
---|
778 | *
|
---|
779 | * @param pVCpu The cross context virtual CPU structure.
|
---|
780 | * @param pHlp The debug output helper.
|
---|
781 | */
|
---|
782 | static void apicR3DbgInfoTimer(PVMCPU pVCpu, PCDBGFINFOHLP pHlp)
|
---|
783 | {
|
---|
784 | PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu);
|
---|
785 | PCAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
786 |
|
---|
787 | pHlp->pfnPrintf(pHlp, "Local APIC timer:\n");
|
---|
788 | pHlp->pfnPrintf(pHlp, " ICR = %#RX32\n", pXApicPage->timer_icr.u32InitialCount);
|
---|
789 | pHlp->pfnPrintf(pHlp, " CCR = %#RX32\n", pXApicPage->timer_ccr.u32CurrentCount);
|
---|
790 | pHlp->pfnPrintf(pHlp, " DCR = %#RX32\n", pXApicPage->timer_dcr.all.u32DivideValue);
|
---|
791 | pHlp->pfnPrintf(pHlp, " Timer shift = %#x\n", apicGetTimerShift(pXApicPage));
|
---|
792 | pHlp->pfnPrintf(pHlp, " Timer initial TS = %#RU64", pApicCpu->u64TimerInitial);
|
---|
793 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
794 |
|
---|
795 | apicR3DbgInfoLvtTimer(pVCpu, pHlp);
|
---|
796 | }
|
---|
797 |
|
---|
798 |
|
---|
799 | /**
|
---|
800 | * @callback_method_impl{FNDBGFHANDLERDEV,
|
---|
801 | * Dumps the APIC state according to given argument for debugging purposes.}
|
---|
802 | */
|
---|
803 | static DECLCALLBACK(void) apicR3DbgInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
804 | {
|
---|
805 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
806 | PVMCPU pVCpu = VMMGetCpu(pVM);
|
---|
807 | Assert(pVCpu);
|
---|
808 |
|
---|
809 | if (pszArgs == NULL || !*pszArgs || !strcmp(pszArgs, "basic"))
|
---|
810 | apicR3DbgInfoBasic(pVCpu, pHlp);
|
---|
811 | else if (!strcmp(pszArgs, "lvt"))
|
---|
812 | apicR3DbgInfoLvt(pVCpu, pHlp);
|
---|
813 | else if (!strcmp(pszArgs, "timer"))
|
---|
814 | apicR3DbgInfoTimer(pVCpu, pHlp);
|
---|
815 | else
|
---|
816 | pHlp->pfnPrintf(pHlp, "Invalid argument. Recognized arguments are 'basic', 'lvt', 'timer'\n");
|
---|
817 | }
|
---|
818 |
|
---|
819 |
|
---|
820 | /**
|
---|
821 | * Converts legacy PDMAPICMODE to the new APICMODE enum.
|
---|
822 | *
|
---|
823 | * @returns The new APIC mode.
|
---|
824 | * @param enmLegacyMode The legacy mode to convert.
|
---|
825 | */
|
---|
826 | static APICMODE apicR3ConvertFromLegacyApicMode(PDMAPICMODE enmLegacyMode)
|
---|
827 | {
|
---|
828 | switch (enmLegacyMode)
|
---|
829 | {
|
---|
830 | case PDMAPICMODE_NONE: return APICMODE_DISABLED;
|
---|
831 | case PDMAPICMODE_APIC: return APICMODE_XAPIC;
|
---|
832 | case PDMAPICMODE_X2APIC: return APICMODE_X2APIC;
|
---|
833 | case PDMAPICMODE_INVALID: return APICMODE_INVALID;
|
---|
834 | default: break;
|
---|
835 | }
|
---|
836 | return (APICMODE)enmLegacyMode;
|
---|
837 | }
|
---|
838 |
|
---|
839 |
|
---|
840 | /**
|
---|
841 | * Converts the new APICMODE enum to the legacy PDMAPICMODE enum.
|
---|
842 | *
|
---|
843 | * @returns The legacy APIC mode.
|
---|
844 | * @param enmMode The APIC mode to convert.
|
---|
845 | */
|
---|
846 | static PDMAPICMODE apicR3ConvertToLegacyApicMode(APICMODE enmMode)
|
---|
847 | {
|
---|
848 | switch (enmMode)
|
---|
849 | {
|
---|
850 | case APICMODE_DISABLED: return PDMAPICMODE_NONE;
|
---|
851 | case APICMODE_XAPIC: return PDMAPICMODE_APIC;
|
---|
852 | case APICMODE_X2APIC: return PDMAPICMODE_X2APIC;
|
---|
853 | case APICMODE_INVALID: return PDMAPICMODE_INVALID;
|
---|
854 | default: break;
|
---|
855 | }
|
---|
856 | return (PDMAPICMODE)enmMode;
|
---|
857 | }
|
---|
858 |
|
---|
859 |
|
---|
860 | /**
|
---|
861 | * Worker for saving per-VM APIC data.
|
---|
862 | *
|
---|
863 | * @returns VBox status code.
|
---|
864 | * @param pVM The cross context VM structure.
|
---|
865 | * @param pSSM The SSM handle.
|
---|
866 | */
|
---|
867 | static int apicR3SaveVMData(PVM pVM, PSSMHANDLE pSSM)
|
---|
868 | {
|
---|
869 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
870 | SSMR3PutU32(pSSM, pVM->cCpus);
|
---|
871 | SSMR3PutBool(pSSM, pApic->fIoApicPresent);
|
---|
872 | return SSMR3PutU32(pSSM, apicR3ConvertToLegacyApicMode(pApic->enmOriginalMode));
|
---|
873 | }
|
---|
874 |
|
---|
875 |
|
---|
876 | /**
|
---|
877 | * @copydoc FNSSMDEVLIVEEXEC
|
---|
878 | */
|
---|
879 | static DECLCALLBACK(int) apicR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
|
---|
880 | {
|
---|
881 | PAPICDEV pApicDev = PDMINS_2_DATA(pDevIns, PAPICDEV);
|
---|
882 | PVM pVM = PDMDevHlpGetVM(pApicDev->pDevInsR3);
|
---|
883 |
|
---|
884 | int rc = apicR3SaveVMData(pVM, pSSM);
|
---|
885 | AssertRCReturn(rc, rc);
|
---|
886 | return VINF_SSM_DONT_CALL_AGAIN;
|
---|
887 | }
|
---|
888 |
|
---|
889 |
|
---|
890 | /**
|
---|
891 | * @copydoc FNSSMDEVSAVEEXEC
|
---|
892 | */
|
---|
893 | static DECLCALLBACK(int) apicR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
|
---|
894 | {
|
---|
895 | PAPICDEV pApicDev = PDMINS_2_DATA(pDevIns, PAPICDEV);
|
---|
896 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
897 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
898 | AssertReturn(pVM, VERR_INVALID_VM_HANDLE);
|
---|
899 |
|
---|
900 | /* Save per-VM data. */
|
---|
901 | int rc = apicR3SaveVMData(pVM, pSSM);
|
---|
902 | AssertRCReturn(rc, rc);
|
---|
903 |
|
---|
904 | /* Save per-VCPU data.*/
|
---|
905 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
906 | {
|
---|
907 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
908 | PCAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
909 |
|
---|
910 | SSMR3PutU64(pSSM, pApicCpu->uApicBaseMsr);
|
---|
911 |
|
---|
912 | /** @todo */
|
---|
913 | }
|
---|
914 |
|
---|
915 | return rc;
|
---|
916 | }
|
---|
917 |
|
---|
918 |
|
---|
919 | /**
|
---|
920 | * @copydoc FNSSMDEVLOADEXEC
|
---|
921 | */
|
---|
922 | static DECLCALLBACK(int) apicR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
|
---|
923 | {
|
---|
924 | PAPICDEV pApicDev = PDMINS_2_DATA(pDevIns, PAPICDEV);
|
---|
925 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
926 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
927 | AssertReturn(pVM, VERR_INVALID_VM_HANDLE);
|
---|
928 |
|
---|
929 | /* Weed out invalid versions. */
|
---|
930 | if ( uVersion != APIC_SAVED_STATE_VERSION
|
---|
931 | && uVersion != APIC_SAVED_STATE_VERSION_VBOX_30
|
---|
932 | && uVersion != APIC_SAVED_STATE_VERSION_ANCIENT)
|
---|
933 | {
|
---|
934 | return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
|
---|
935 | }
|
---|
936 |
|
---|
937 | if (uVersion > APIC_SAVED_STATE_VERSION_VBOX_30)
|
---|
938 | {
|
---|
939 | /* Verify number of CPUs. */
|
---|
940 | uint32_t cCpus;
|
---|
941 | int rc = SSMR3GetU32(pSSM, &cCpus);
|
---|
942 | AssertRCReturn(rc, rc);
|
---|
943 | if (cCpus != pVM->cCpus)
|
---|
944 | return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch - cCpus: saved=%u config=%u"), cCpus, pVM->cCpus);
|
---|
945 |
|
---|
946 | /* Verify I/O APIC presence. */
|
---|
947 | bool fIoApicPresent;
|
---|
948 | rc = SSMR3GetBool(pSSM, &fIoApicPresent);
|
---|
949 | AssertRCReturn(rc, rc);
|
---|
950 | if (fIoApicPresent != pApic->fIoApicPresent)
|
---|
951 | return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch - fIoApicPresent: saved=%RTbool config=%RTbool"),
|
---|
952 | fIoApicPresent, pApic->fIoApicPresent);
|
---|
953 |
|
---|
954 | /* Verify configured APIC mode. */
|
---|
955 | uint32_t uLegacyApicMode;
|
---|
956 | rc = SSMR3GetU32(pSSM, &uLegacyApicMode);
|
---|
957 | AssertRCReturn(rc, rc);
|
---|
958 | APICMODE const enmApicMode = apicR3ConvertFromLegacyApicMode((PDMAPICMODE)uLegacyApicMode);
|
---|
959 | if (enmApicMode != pApic->enmOriginalMode)
|
---|
960 | return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch - uApicMode: saved=%#x(%#x) config=%#x(%#x)"),
|
---|
961 | uLegacyApicMode, enmApicMode, apicR3ConvertToLegacyApicMode(pApic->enmOriginalMode),
|
---|
962 | pApic->enmOriginalMode);
|
---|
963 |
|
---|
964 | if (uVersion == APIC_SAVED_STATE_VERSION)
|
---|
965 | {
|
---|
966 | /** @todo load any new additional per-VM data. */
|
---|
967 | }
|
---|
968 | }
|
---|
969 |
|
---|
970 | if (uPass != SSM_PASS_FINAL)
|
---|
971 | return VINF_SUCCESS;
|
---|
972 |
|
---|
973 | int rc = VINF_SUCCESS;
|
---|
974 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
975 | {
|
---|
976 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
977 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
978 |
|
---|
979 | if (uVersion == APIC_SAVED_STATE_VERSION)
|
---|
980 | {
|
---|
981 | /** @todo load new per-VCPU data. */
|
---|
982 | }
|
---|
983 | else
|
---|
984 | {
|
---|
985 | /** @todo load & translate old per-VCPU data to new APIC code. */
|
---|
986 | uint32_t uApicBaseMsrLo;
|
---|
987 | SSMR3GetU32(pSSM, &uApicBaseMsrLo);
|
---|
988 | pApicCpu->uApicBaseMsr = uApicBaseMsrLo;
|
---|
989 | }
|
---|
990 | }
|
---|
991 |
|
---|
992 | return rc;
|
---|
993 | }
|
---|
994 |
|
---|
995 |
|
---|
996 | /**
|
---|
997 | * The timer callback.
|
---|
998 | *
|
---|
999 | * @param pDevIns The device instance.
|
---|
1000 | * @param pTimer The timer handle.
|
---|
1001 | * @param pvUser Opaque pointer to the VMCPU.
|
---|
1002 | *
|
---|
1003 | * @thread Any.
|
---|
1004 | * @remarks Currently this function is invoked on the last EMT, see @c
|
---|
1005 | * idTimerCpu in tmR3TimerCallback(). However, the code does -not-
|
---|
1006 | * rely on this and is designed to work with being invoked on any
|
---|
1007 | * thread.
|
---|
1008 | */
|
---|
1009 | static DECLCALLBACK(void) apicR3TimerCallback(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
|
---|
1010 | {
|
---|
1011 | PVMCPU pVCpu = (PVMCPU)pvUser;
|
---|
1012 | Assert(TMTimerIsLockOwner(pTimer));
|
---|
1013 | Assert(pVCpu);
|
---|
1014 |
|
---|
1015 | PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
|
---|
1016 | uint32_t const uLvtTimer = pXApicPage->lvt_timer.all.u32LvtTimer;
|
---|
1017 | if (!XAPIC_LVT_IS_MASKED(uLvtTimer))
|
---|
1018 | {
|
---|
1019 | uint8_t uVector = XAPIC_LVT_GET_VECTOR(uLvtTimer);
|
---|
1020 | APICPostInterrupt(pVCpu, uVector, XAPICTRIGGERMODE_EDGE);
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
1024 | XAPICTIMERMODE enmTimerMode = XAPIC_LVT_GET_TIMER_MODE(uLvtTimer);
|
---|
1025 | switch (enmTimerMode)
|
---|
1026 | {
|
---|
1027 | case XAPICTIMERMODE_PERIODIC:
|
---|
1028 | {
|
---|
1029 | /* The initial-count register determines if the periodic timer is re-armed. */
|
---|
1030 | uint32_t const uInitialCount = pXApicPage->timer_icr.u32InitialCount;
|
---|
1031 | pXApicPage->timer_ccr.u32CurrentCount = uInitialCount;
|
---|
1032 | if (uInitialCount)
|
---|
1033 | APICStartTimer(pApicCpu, uInitialCount);
|
---|
1034 | break;
|
---|
1035 | }
|
---|
1036 |
|
---|
1037 | case XAPICTIMERMODE_ONESHOT:
|
---|
1038 | {
|
---|
1039 | pXApicPage->timer_ccr.u32CurrentCount = 0;
|
---|
1040 | break;
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 | case XAPICTIMERMODE_TSC_DEADLINE:
|
---|
1044 | {
|
---|
1045 | /** @todo implement TSC deadline. */
|
---|
1046 | AssertMsgFailed(("APIC: TSC deadline mode unimplemented\n"));
|
---|
1047 | break;
|
---|
1048 | }
|
---|
1049 | }
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 |
|
---|
1053 | /**
|
---|
1054 | * @interface_method_impl{PDMDEVREG,pfnReset}
|
---|
1055 | */
|
---|
1056 | static DECLCALLBACK(void) apicR3Reset(PPDMDEVINS pDevIns)
|
---|
1057 | {
|
---|
1058 | PAPICDEV pApicDev = PDMINS_2_DATA(pDevIns, PAPICDEV);
|
---|
1059 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
1060 | VM_ASSERT_EMT0(pVM);
|
---|
1061 | VM_ASSERT_IS_NOT_RUNNING(pVM);
|
---|
1062 |
|
---|
1063 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
1064 | {
|
---|
1065 | PVMCPU pVCpuDest = &pVM->aCpus[idCpu];
|
---|
1066 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpuDest);
|
---|
1067 |
|
---|
1068 | int rc = TMTimerLock(pApicCpu->pTimerR3, VERR_IGNORED);
|
---|
1069 | Assert(rc == VINF_SUCCESS); NOREF(rc);
|
---|
1070 | TMTimerStop(pApicCpu->pTimerR3);
|
---|
1071 | TMTimerUnlock(pApicCpu->pTimerR3);
|
---|
1072 |
|
---|
1073 | APICR3Reset(pVCpuDest);
|
---|
1074 |
|
---|
1075 | /* Clear the interrupt pending force flag. */
|
---|
1076 | APICClearInterruptFF(pVCpuDest, PDMAPICIRQ_HARDWARE);
|
---|
1077 | }
|
---|
1078 | }
|
---|
1079 |
|
---|
1080 |
|
---|
1081 | /**
|
---|
1082 | * @interface_method_impl{PDMDEVREG,pfnRelocate}
|
---|
1083 | */
|
---|
1084 | static DECLCALLBACK(void) apicR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
|
---|
1085 | {
|
---|
1086 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
1087 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
1088 | PAPICDEV pApicDev = PDMINS_2_DATA(pDevIns, PAPICDEV);
|
---|
1089 |
|
---|
1090 | LogFlow(("APIC: apicR3Relocate: pDevIns=%p offDelta=%RGp\n", pDevIns, offDelta));
|
---|
1091 |
|
---|
1092 | pApicDev->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
|
---|
1093 | pApicDev->pApicHlpRC = pApicDev->pApicHlpR3->pfnGetRCHelpers(pDevIns);
|
---|
1094 | pApicDev->pCritSectRC = pApicDev->pApicHlpR3->pfnGetRCCritSect(pDevIns);
|
---|
1095 |
|
---|
1096 | pApic->pApicDevRC = PDMINS_2_DATA_RCPTR(pDevIns);
|
---|
1097 |
|
---|
1098 | /*
|
---|
1099 | * We can get invoked via PGMR3FinalizeMappings() which happens before initializing R0.
|
---|
1100 | * This we may not have allocated and mapped the R0, R3 data yet. Hence the NULL checks.
|
---|
1101 | */
|
---|
1102 | if (pApic->pvApicPibR3)
|
---|
1103 | pApic->pvApicPibRC = MMHyperR3ToRC(pVM, (void *)pApic->pvApicPibR3);
|
---|
1104 |
|
---|
1105 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
1106 | {
|
---|
1107 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
1108 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
1109 | pApicCpu->pTimerRC = TMTimerRCPtr(pApicCpu->pTimerR3);
|
---|
1110 |
|
---|
1111 | if (pApicCpu->pvApicPageR3)
|
---|
1112 | pApicCpu->pvApicPageRC = MMHyperR3ToRC(pVM, (void *)pApicCpu->pvApicPageR3);
|
---|
1113 |
|
---|
1114 | if (pApicCpu->pvApicPibR3)
|
---|
1115 | pApicCpu->pvApicPibRC = MMHyperR3ToRC(pVM, (void *)pApicCpu->pvApicPibR3);
|
---|
1116 | }
|
---|
1117 | }
|
---|
1118 |
|
---|
1119 |
|
---|
1120 | /**
|
---|
1121 | * @interface_method_impl{PDMDEVREG,pfnConstruct}
|
---|
1122 | */
|
---|
1123 | static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
|
---|
1124 | {
|
---|
1125 | /*
|
---|
1126 | * Validate inputs.
|
---|
1127 | */
|
---|
1128 | Assert(iInstance == 0);
|
---|
1129 | Assert(pDevIns);
|
---|
1130 |
|
---|
1131 | PAPICDEV pApicDev = PDMINS_2_DATA(pDevIns, PAPICDEV);
|
---|
1132 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
1133 | PAPIC pApic = VM_TO_APIC(pVM);
|
---|
1134 |
|
---|
1135 | /*
|
---|
1136 | * Validate APIC settings.
|
---|
1137 | */
|
---|
1138 | int rc = CFGMR3ValidateConfig(pCfg, "/APIC/",
|
---|
1139 | "RZEnabled"
|
---|
1140 | "|Mode"
|
---|
1141 | "|IOAPIC"
|
---|
1142 | "|NumCPUs",
|
---|
1143 | "" /* pszValidNodes */, "APIC" /* pszWho */, 0 /* uInstance */);
|
---|
1144 | if (RT_FAILURE(rc))
|
---|
1145 | return rc;
|
---|
1146 |
|
---|
1147 | rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pApic->fRZEnabled, true);
|
---|
1148 | AssertLogRelRCReturn(rc, rc);
|
---|
1149 |
|
---|
1150 | rc = CFGMR3QueryBoolDef(pCfg, "IOAPIC", &pApic->fIoApicPresent, true);
|
---|
1151 | AssertLogRelRCReturn(rc, rc);
|
---|
1152 |
|
---|
1153 | uint8_t uOriginalMode;
|
---|
1154 | rc = CFGMR3QueryU8Def(pCfg, "Mode", &uOriginalMode, APICMODE_XAPIC);
|
---|
1155 | AssertLogRelRCReturn(rc, rc);
|
---|
1156 | /* Validate APIC modes. */
|
---|
1157 | switch (uOriginalMode)
|
---|
1158 | {
|
---|
1159 | case APICMODE_DISABLED:
|
---|
1160 | case APICMODE_X2APIC:
|
---|
1161 | case APICMODE_XAPIC:
|
---|
1162 | pApic->enmOriginalMode = (APICMODE)uOriginalMode;
|
---|
1163 | break;
|
---|
1164 | default:
|
---|
1165 | return VMR3SetError(pVM->pUVM, VERR_INVALID_STATE, RT_SRC_POS, "APIC mode %#x unknown.", uOriginalMode);
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | /*
|
---|
1169 | * Initialize part of APIC state.
|
---|
1170 | */
|
---|
1171 | pApicDev->pDevInsR3 = pDevIns;
|
---|
1172 | pApicDev->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
|
---|
1173 | pApicDev->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
|
---|
1174 |
|
---|
1175 | pApic->pApicDevR0 = PDMINS_2_DATA_R0PTR(pDevIns);
|
---|
1176 | pApic->pApicDevR3 = (PAPICDEV)PDMINS_2_DATA_R3PTR(pDevIns);
|
---|
1177 | pApic->pApicDevRC = PDMINS_2_DATA_RCPTR(pDevIns);
|
---|
1178 |
|
---|
1179 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
1180 | {
|
---|
1181 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
1182 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
1183 | RTStrPrintf(&pApicCpu->szTimerDesc[0], sizeof(pApicCpu->szTimerDesc), "APIC Timer %u", pVCpu->idCpu);
|
---|
1184 |
|
---|
1185 | /* Initialize the APIC base MSR as we require it for registering the MMIO range. */
|
---|
1186 | apicR3ResetBaseMsr(pVCpu);
|
---|
1187 |
|
---|
1188 | /* Disable the APIC until we're fully initialized in APICR3InitCompleted(), see @bugref{8245#c46}. */
|
---|
1189 | apicR3SetEnabled(pVCpu, false);
|
---|
1190 | }
|
---|
1191 |
|
---|
1192 | /*
|
---|
1193 | * Disable automatic PDM locking for this device.
|
---|
1194 | */
|
---|
1195 | rc = PDMDevHlpSetDeviceCritSect(pDevIns, PDMDevHlpCritSectGetNop(pDevIns));
|
---|
1196 | AssertRCReturn(rc, rc);
|
---|
1197 |
|
---|
1198 | /*
|
---|
1199 | * Register the APIC.
|
---|
1200 | */
|
---|
1201 | PDMAPICREG ApicReg;
|
---|
1202 | RT_ZERO(ApicReg);
|
---|
1203 | ApicReg.u32Version = PDM_APICREG_VERSION;
|
---|
1204 | ApicReg.pfnGetInterruptR3 = APICGetInterrupt;
|
---|
1205 | ApicReg.pfnHasPendingIrqR3 = APICHasPendingIrq;
|
---|
1206 | ApicReg.pfnSetBaseMsrR3 = APICSetBaseMsr;
|
---|
1207 | ApicReg.pfnGetBaseMsrR3 = APICGetBaseMsr;
|
---|
1208 | ApicReg.pfnSetTprR3 = APICSetTpr;
|
---|
1209 | ApicReg.pfnGetTprR3 = APICGetTpr;
|
---|
1210 | ApicReg.pfnWriteMsrR3 = APICWriteMsr;
|
---|
1211 | ApicReg.pfnReadMsrR3 = APICReadMsr;
|
---|
1212 | ApicReg.pfnBusDeliverR3 = APICBusDeliver;
|
---|
1213 | ApicReg.pfnLocalInterruptR3 = APICLocalInterrupt;
|
---|
1214 | ApicReg.pfnGetTimerFreqR3 = APICGetTimerFreq;
|
---|
1215 | if (pApic->fRZEnabled)
|
---|
1216 | {
|
---|
1217 | ApicReg.pszGetInterruptRC = "APICGetInterrupt";
|
---|
1218 | ApicReg.pszHasPendingIrqRC = "APICHasPendingIrq";
|
---|
1219 | ApicReg.pszSetBaseMsrRC = "APICSetBaseMsr";
|
---|
1220 | ApicReg.pszGetBaseMsrRC = "APICGetBaseMsr";
|
---|
1221 | ApicReg.pszSetTprRC = "APICSetTpr";
|
---|
1222 | ApicReg.pszGetTprRC = "APICGetTpr";
|
---|
1223 | ApicReg.pszWriteMsrRC = "APICWriteMsr";
|
---|
1224 | ApicReg.pszReadMsrRC = "APICReadMsr";
|
---|
1225 | ApicReg.pszBusDeliverRC = "APICBusDeliver";
|
---|
1226 | ApicReg.pszLocalInterruptRC = "APICLocalInterrupt";
|
---|
1227 | ApicReg.pszGetTimerFreqRC = "APICGetTimerFreq";
|
---|
1228 |
|
---|
1229 | ApicReg.pszGetInterruptR0 = "APICGetInterrupt";
|
---|
1230 | ApicReg.pszHasPendingIrqR0 = "APICHasPendingIrq";
|
---|
1231 | ApicReg.pszSetBaseMsrR0 = "APICSetBaseMsr";
|
---|
1232 | ApicReg.pszGetBaseMsrR0 = "APICGetBaseMsr";
|
---|
1233 | ApicReg.pszSetTprR0 = "APICSetTpr";
|
---|
1234 | ApicReg.pszGetTprR0 = "APICGetTpr";
|
---|
1235 | ApicReg.pszWriteMsrR0 = "APICWriteMsr";
|
---|
1236 | ApicReg.pszReadMsrR0 = "APICReadMsr";
|
---|
1237 | ApicReg.pszBusDeliverR0 = "APICBusDeliver";
|
---|
1238 | ApicReg.pszLocalInterruptR0 = "APICLocalInterrupt";
|
---|
1239 | ApicReg.pszGetTimerFreqR0 = "APICGetTimerFreq";
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | rc = PDMDevHlpAPICRegister(pDevIns, &ApicReg, &pApicDev->pApicHlpR3);
|
---|
1243 | AssertLogRelRCReturn(rc, rc);
|
---|
1244 | pApicDev->pCritSectR3 = pApicDev->pApicHlpR3->pfnGetR3CritSect(pDevIns);
|
---|
1245 |
|
---|
1246 | /*
|
---|
1247 | * Update the CPUID bits.
|
---|
1248 | */
|
---|
1249 | APICUpdateCpuIdForMode(pVM, pApic->enmOriginalMode);
|
---|
1250 | LogRel(("APIC: Switched mode to %s\n", apicGetModeName(pApic->enmOriginalMode)));
|
---|
1251 |
|
---|
1252 | /*
|
---|
1253 | * Register the MMIO range.
|
---|
1254 | */
|
---|
1255 | PAPICCPU pApicCpu0 = VMCPU_TO_APICCPU(&pVM->aCpus[0]);
|
---|
1256 | RTGCPHYS GCPhysApicBase = MSR_APICBASE_GET_PHYSADDR(pApicCpu0->uApicBaseMsr);
|
---|
1257 | rc = PDMDevHlpMMIORegister(pDevIns, GCPhysApicBase, sizeof(XAPICPAGE), pVM,
|
---|
1258 | IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED,
|
---|
1259 | APICWriteMmio, APICReadMmio, "APIC");
|
---|
1260 | if (RT_FAILURE(rc))
|
---|
1261 | return rc;
|
---|
1262 |
|
---|
1263 | if (pApic->fRZEnabled)
|
---|
1264 | {
|
---|
1265 | pApicDev->pApicHlpRC = pApicDev->pApicHlpR3->pfnGetRCHelpers(pDevIns);
|
---|
1266 | pApicDev->pCritSectRC = pApicDev->pApicHlpR3->pfnGetRCCritSect(pDevIns);
|
---|
1267 | rc = PDMDevHlpMMIORegisterRC(pDevIns, GCPhysApicBase, sizeof(XAPICPAGE), NIL_RTRCPTR /*pvUser*/,
|
---|
1268 | "APICWriteMmio", "APICReadMmio");
|
---|
1269 | if (RT_FAILURE(rc))
|
---|
1270 | return rc;
|
---|
1271 |
|
---|
1272 | pApicDev->pApicHlpR0 = pApicDev->pApicHlpR3->pfnGetR0Helpers(pDevIns);
|
---|
1273 | pApicDev->pCritSectR0 = pApicDev->pApicHlpR3->pfnGetR0CritSect(pDevIns);
|
---|
1274 | rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysApicBase, sizeof(XAPICPAGE), NIL_RTR0PTR /*pvUser*/,
|
---|
1275 | "APICWriteMmio", "APICReadMmio");
|
---|
1276 | if (RT_FAILURE(rc))
|
---|
1277 | return rc;
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 | /*
|
---|
1281 | * Create the APIC timers.
|
---|
1282 | */
|
---|
1283 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
1284 | {
|
---|
1285 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
1286 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
1287 | rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, apicR3TimerCallback, pVCpu, TMTIMER_FLAGS_NO_CRIT_SECT,
|
---|
1288 | pApicCpu->szTimerDesc, &pApicCpu->pTimerR3);
|
---|
1289 | if (RT_SUCCESS(rc))
|
---|
1290 | {
|
---|
1291 | pApicCpu->pTimerR0 = TMTimerR0Ptr(pApicCpu->pTimerR3);
|
---|
1292 | pApicCpu->pTimerRC = TMTimerRCPtr(pApicCpu->pTimerR3);
|
---|
1293 |
|
---|
1294 | rc = PDMR3CritSectInit(pVM, &pApicCpu->TimerCritSect, RT_SRC_POS, pApicCpu->szTimerDesc);
|
---|
1295 | if (RT_SUCCESS(rc))
|
---|
1296 | TMR3TimerSetCritSect(pApicCpu->pTimerR3, &pApicCpu->TimerCritSect);
|
---|
1297 | else
|
---|
1298 | return rc;
|
---|
1299 | }
|
---|
1300 | else
|
---|
1301 | return rc;
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | /*
|
---|
1305 | * Register saved state callbacks.
|
---|
1306 | */
|
---|
1307 | rc = PDMDevHlpSSMRegister3(pDevIns, APIC_SAVED_STATE_VERSION, sizeof(*pApicDev), NULL /*pfnLiveExec*/, apicR3SaveExec,
|
---|
1308 | apicR3LoadExec);
|
---|
1309 | if (RT_FAILURE(rc))
|
---|
1310 | return rc;
|
---|
1311 |
|
---|
1312 | /*
|
---|
1313 | * Register debugger info callback.
|
---|
1314 | */
|
---|
1315 | PDMDevHlpDBGFInfoRegister(pDevIns, "apic", "Display Local APIC state for current CPU. "
|
---|
1316 | "Recognizes 'basic', 'lvt', 'timer' as arguments, defaulting to 'basic'.", apicR3DbgInfo);
|
---|
1317 |
|
---|
1318 | #ifdef VBOX_WITH_STATISTICS
|
---|
1319 | /*
|
---|
1320 | * Statistics.
|
---|
1321 | */
|
---|
1322 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
1323 | {
|
---|
1324 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
1325 | PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
|
---|
1326 | PDMDevHlpSTAMRegisterF(pDevIns, &pApicCpu->StatMmioReadGC, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
|
---|
1327 | "Number of APIC MMIO reads in GC.", "/Devices/APIC/%u/MmioReadGC", idCpu);
|
---|
1328 | PDMDevHlpSTAMRegisterF(pDevIns, &pApicCpu->StatMmioReadHC, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
|
---|
1329 | "Number of APIC MMIO reads in HC.", "/Devices/APIC/%u/MmioReadHC", idCpu);
|
---|
1330 |
|
---|
1331 | PDMDevHlpSTAMRegisterF(pDevIns, &pApicCpu->StatMmioWriteGC, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
|
---|
1332 | "Number of APIC MMIO writes in GC.", "/Devices/APIC/%u/MmioWriteGC", idCpu);
|
---|
1333 | PDMDevHlpSTAMRegisterF(pDevIns, &pApicCpu->StatMmioWriteHC, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
|
---|
1334 | "Number of APIC MMIO writes in HC.", "/Devices/APIC/%u/MmioWriteHC", idCpu);
|
---|
1335 |
|
---|
1336 | PDMDevHlpSTAMRegisterF(pDevIns, &pApicCpu->StatMsrWrite, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
|
---|
1337 | "Number of APIC MSR writes.", "/Devices/APIC/%u/MsrWrite", idCpu);
|
---|
1338 | PDMDevHlpSTAMRegisterF(pDevIns, &pApicCpu->StatMsrRead, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
|
---|
1339 | "Number of APIC MSR reads.", "/Devices/APIC/%u/MsrRead", idCpu);
|
---|
1340 | }
|
---|
1341 | #endif
|
---|
1342 | return VINF_SUCCESS;
|
---|
1343 | }
|
---|
1344 |
|
---|
1345 |
|
---|
1346 | /**
|
---|
1347 | * APIC device registration structure.
|
---|
1348 | */
|
---|
1349 | const PDMDEVREG g_DeviceAPIC =
|
---|
1350 | {
|
---|
1351 | /* u32Version */
|
---|
1352 | PDM_DEVREG_VERSION,
|
---|
1353 | /* szName */
|
---|
1354 | "apic",
|
---|
1355 | /* szRCMod */
|
---|
1356 | "VMMRC.rc",
|
---|
1357 | /* szR0Mod */
|
---|
1358 | "VMMR0.r0",
|
---|
1359 | /* pszDescription */
|
---|
1360 | "Advanced Programmable Interrupt Controller",
|
---|
1361 | /* fFlags */
|
---|
1362 | PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DEVREG_FLAGS_GUEST_BITS_32_64 | PDM_DEVREG_FLAGS_PAE36
|
---|
1363 | | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
|
---|
1364 | /* fClass */
|
---|
1365 | PDM_DEVREG_CLASS_PIC,
|
---|
1366 | /* cMaxInstances */
|
---|
1367 | 1,
|
---|
1368 | /* cbInstance */
|
---|
1369 | sizeof(APICDEV),
|
---|
1370 | /* pfnConstruct */
|
---|
1371 | apicR3Construct,
|
---|
1372 | /* pfnDestruct */
|
---|
1373 | NULL,
|
---|
1374 | /* pfnRelocate */
|
---|
1375 | apicR3Relocate,
|
---|
1376 | /* pfnMemSetup */
|
---|
1377 | NULL,
|
---|
1378 | /* pfnPowerOn */
|
---|
1379 | NULL,
|
---|
1380 | /* pfnReset */
|
---|
1381 | apicR3Reset,
|
---|
1382 | /* pfnSuspend */
|
---|
1383 | NULL,
|
---|
1384 | /* pfnResume */
|
---|
1385 | NULL,
|
---|
1386 | /* pfnAttach */
|
---|
1387 | NULL,
|
---|
1388 | /* pfnDetach */
|
---|
1389 | NULL,
|
---|
1390 | /* pfnQueryInterface. */
|
---|
1391 | NULL,
|
---|
1392 | /* pfnInitComplete */
|
---|
1393 | NULL,
|
---|
1394 | /* pfnPowerOff */
|
---|
1395 | NULL,
|
---|
1396 | /* pfnSoftReset */
|
---|
1397 | NULL,
|
---|
1398 | /* u32VersionEnd */
|
---|
1399 | PDM_DEVREG_VERSION
|
---|
1400 | };
|
---|
1401 |
|
---|
1402 | #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
|
---|
1403 |
|
---|