1 /*
2  * cpu_x86_data.h: x86 specific CPU data
3  *
4  * Copyright (C) 2009-2010, 2013 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library.  If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #pragma once
22 
23 typedef struct _virCPUx86CPUID virCPUx86CPUID;
24 struct _virCPUx86CPUID {
25     uint32_t eax_in;
26     uint32_t ecx_in;
27     uint32_t eax;
28     uint32_t ebx;
29     uint32_t ecx;
30     uint32_t edx;
31 };
32 
33 typedef struct _virCPUx86MSR virCPUx86MSR;
34 struct _virCPUx86MSR {
35     uint32_t index;
36     uint32_t eax;
37     uint32_t edx;
38 };
39 
40 #define CPUX86_BASIC    0x0
41 #define CPUX86_KVM      0x40000000
42 #define CPUX86_EXTENDED 0x80000000
43 
44 #define VIR_CPU_x86_KVM_PV_UNHALT   "kvm_pv_unhalt"
45 
46 /*
47  * The following HyperV feature names suffixes must exactly match corresponding
48  * ones defined for virDomainHyperv in domain_conf.c.
49  * E.g "hv-runtime" -> "runtime", "hv-spinlocks" -> "spinlocks" etc.
50 */
51 #define VIR_CPU_x86_HV_RUNTIME   "hv-runtime"
52 #define VIR_CPU_x86_HV_SYNIC     "hv-synic"
53 #define VIR_CPU_x86_HV_STIMER    "hv-stimer"
54 #define VIR_CPU_x86_HV_RELAXED   "hv-relaxed"
55 #define VIR_CPU_x86_HV_SPINLOCKS "hv-spinlocks"
56 #define VIR_CPU_x86_HV_VAPIC     "hv-vapic"
57 #define VIR_CPU_x86_HV_VPINDEX   "hv-vpindex"
58 #define VIR_CPU_x86_HV_RESET     "hv-reset"
59 #define VIR_CPU_x86_HV_FREQUENCIES "hv-frequencies"
60 #define VIR_CPU_x86_HV_REENLIGHTENMENT "hv-reenlightenment"
61 #define VIR_CPU_x86_HV_TLBFLUSH  "hv-tlbflush"
62 #define VIR_CPU_x86_HV_IPI       "hv-ipi"
63 #define VIR_CPU_x86_HV_EVMCS     "hv-evmcs"
64 
65 /* Hyper-V Synthetic Timer option */
66 #define VIR_CPU_x86_HV_STIMER_DIRECT "hv-stimer-direct"
67 
68 #define VIR_CPU_X86_DATA_INIT { 0 }
69 
70 typedef enum {
71     VIR_CPU_X86_DATA_NONE = 0,
72     VIR_CPU_X86_DATA_CPUID,
73     VIR_CPU_X86_DATA_MSR,
74 } virCPUx86DataType;
75 
76 typedef struct _virCPUx86DataItem virCPUx86DataItem;
77 struct _virCPUx86DataItem {
78     virCPUx86DataType type;
79     union {
80         virCPUx86CPUID cpuid;
81         virCPUx86MSR msr;
82     } data;
83 };
84 
85 typedef struct _virCPUx86Data virCPUx86Data;
86 struct _virCPUx86Data {
87     size_t len;
88     virCPUx86DataItem *items;
89 };
90