xref: /linux/arch/x86/kvm/Kconfig (revision 9bcd6af09e2a3493ee702c9aa1110002ed4e83e8)
1# SPDX-License-Identifier: GPL-2.0
2#
3# KVM configuration
4#
5
6source "virt/kvm/Kconfig"
7
8menuconfig VIRTUALIZATION
9	bool "Virtualization"
10	default y
11	help
12	  Say Y here to get to see options for using your Linux host to run other
13	  operating systems inside virtual machines (guests).
14	  This option alone does not add any kernel code.
15
16	  If you say N, all options in this submenu will be skipped and disabled.
17
18if VIRTUALIZATION
19
20config KVM_X86
21	def_tristate KVM if (KVM_INTEL != n || KVM_AMD != n)
22	select KVM_COMMON
23	select KVM_ELIDE_TLB_FLUSH_IF_YOUNG
24	select KVM_MMU_LOCKLESS_AGING
25	select HAVE_KVM_IRQCHIP
26	select HAVE_KVM_PFNCACHE
27	select HAVE_KVM_DIRTY_RING_TSO
28	select HAVE_KVM_DIRTY_RING_ACQ_REL
29	select HAVE_KVM_IRQ_BYPASS
30	select HAVE_KVM_IRQ_ROUTING
31	select VHOST_TASK
32	select KVM_ASYNC_PF
33	select USER_RETURN_NOTIFIER
34	select SCHED_INFO
35	select PERF_EVENTS
36	select GUEST_PERF_EVENTS
37	select PERF_GUEST_MEDIATED_PMU
38	select HAVE_KVM_CPU_RELAX_INTERCEPT
39	select VIRT_XFER_TO_GUEST_WORK
40	select KVM_GENERIC_DIRTYLOG_READ_PROTECT
41	select KVM_VFIO
42	select HAVE_KVM_PM_NOTIFIER if PM
43	select KVM_GENERIC_HARDWARE_ENABLING
44	select KVM_GENERIC_PRE_FAULT_MEMORY
45	select KVM_WERROR if WERROR
46	select KVM_GUEST_MEMFD if X86_64
47
48config KVM
49	tristate "Kernel-based Virtual Machine (KVM) support"
50	depends on X86_LOCAL_APIC
51	help
52	  Support hosting fully virtualized guest machines using hardware
53	  virtualization extensions.  You will need a fairly recent
54	  processor equipped with virtualization extensions. You will also
55	  need to select one or more of the processor modules below.
56
57	  This module provides access to the hardware capabilities through
58	  a character device node named /dev/kvm.
59
60	  To compile this as a module, choose M here: the module
61	  will be called kvm.
62
63	  If unsure, say N.
64
65config KVM_WERROR
66	bool "Compile KVM with -Werror"
67	# Disallow KVM's -Werror if KASAN is enabled, e.g. to guard against
68	# randomized configs from selecting KVM_WERROR=y, which doesn't play
69	# nice with KASAN.  KASAN builds generates warnings for the default
70	# FRAME_WARN, i.e. KVM_WERROR=y with KASAN=y requires special tuning.
71	# Building KVM with -Werror and KASAN is still doable via enabling
72	# the kernel-wide WERROR=y.
73	depends on KVM_X86 && ((EXPERT && !KASAN) || WERROR)
74	help
75	  Add -Werror to the build flags for KVM.
76
77	  If in doubt, say "N".
78
79config KVM_PRIVATE_MEMATTR_VM
80	bool "Enable per-VM PRIVATE vs. SHARED attributes (for CoCo VMs)"
81	depends on KVM_SW_PROTECTED_VM || KVM_INTEL_TDX || KVM_AMD_SEV
82	select KVM_VM_MEMORY_ATTRIBUTES
83	default KVM_INTEL_TDX || KVM_AMD_SEV
84	help
85	  Enable support for tracking PRIVATE vs. SHARED memory using per-VM
86	  memory attributes.  Using per-VM attributes is deprecated in favor of
87	  tracking PRIVATE state in guest_memfd.  Select this if you need to run
88	  CoCo VMs using a VMM that doesn't support guest_memfd memory
89	  attributes.
90
91	  If unsure, say Y.
92
93config KVM_SW_PROTECTED_VM
94	bool "Enable support for KVM software-protected VMs"
95	depends on EXPERT
96	depends on KVM_X86 && X86_64
97	help
98	  Enable support for KVM software-protected VMs.  Currently, software-
99	  protected VMs are purely a development and testing vehicle for
100	  KVM_CREATE_GUEST_MEMFD.  Attempting to run a "real" VM workload as a
101	  software-protected VM will fail miserably.
102
103	  If unsure, say "N".
104
105config KVM_INTEL
106	tristate "KVM for Intel (and compatible) processors support"
107	depends on KVM && IA32_FEAT_CTL
108	select X86_FRED if X86_64
109	help
110	  Provides support for KVM on processors equipped with Intel's VT
111	  extensions, a.k.a. Virtual Machine Extensions (VMX).
112
113	  To compile this as a module, choose M here: the module
114	  will be called kvm-intel.
115
116config KVM_INTEL_PROVE_VE
117        bool "Check that guests do not receive #VE exceptions"
118        depends on KVM_INTEL && EXPERT
119        help
120          Checks that KVM's page table management code will not incorrectly
121          let guests receive a virtualization exception.  Virtualization
122          exceptions will be trapped by the hypervisor rather than injected
123          in the guest.
124
125          Note: some CPUs appear to generate spurious EPT Violations #VEs
126          that trigger KVM's WARN, in particular with eptad=0 and/or nested
127          virtualization.
128
129          If unsure, say N.
130
131config X86_SGX_KVM
132	bool "Software Guard eXtensions (SGX) Virtualization"
133	depends on X86_SGX && KVM_INTEL
134	help
135
136	  Enables KVM guests to create SGX enclaves.
137
138	  This includes support to expose "raw" unreclaimable enclave memory to
139	  guests via a device node, e.g. /dev/sgx_vepc.
140
141	  If unsure, say N.
142
143config KVM_INTEL_TDX
144	bool "Intel Trust Domain Extensions (TDX) support"
145	default y
146	depends on INTEL_TDX_HOST
147	select HAVE_KVM_ARCH_GMEM_POPULATE
148	help
149	  Provides support for launching Intel Trust Domain Extensions (TDX)
150	  confidential VMs on Intel processors.
151
152	  If unsure, say N.
153
154config KVM_AMD
155	tristate "KVM for AMD processors support"
156	depends on KVM && (CPU_SUP_AMD || CPU_SUP_HYGON)
157	help
158	  Provides support for KVM on AMD processors equipped with the AMD-V
159	  (SVM) extensions.
160
161	  To compile this as a module, choose M here: the module
162	  will be called kvm-amd.
163
164config KVM_AMD_SEV
165	bool "AMD Secure Encrypted Virtualization (SEV) support"
166	default y
167	depends on KVM_AMD && X86_64
168	depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
169	select ARCH_HAS_CC_PLATFORM
170	select HAVE_KVM_ARCH_GMEM_CONVERT
171	select HAVE_KVM_ARCH_GMEM_RECLAIM
172	select HAVE_KVM_ARCH_GMEM_INVALIDATE
173	select HAVE_KVM_ARCH_GMEM_POPULATE
174	help
175	  Provides support for launching encrypted VMs which use Secure
176	  Encrypted Virtualization (SEV), Secure Encrypted Virtualization with
177	  Encrypted State (SEV-ES), and Secure Encrypted Virtualization with
178	  Secure Nested Paging (SEV-SNP) technologies on AMD processors.
179
180config KVM_IOAPIC
181	bool "I/O APIC, PIC, and PIT emulation"
182	default y
183	depends on KVM_X86
184	help
185	  Provides support for KVM to emulate an I/O APIC, PIC, and PIT, i.e.
186	  for full in-kernel APIC emulation.
187
188	  If unsure, say Y.
189
190config KVM_SMM
191	bool "System Management Mode emulation"
192	default y
193	depends on KVM_X86
194	help
195	  Provides support for KVM to emulate System Management Mode (SMM)
196	  in virtual machines.  This can be used by the virtual machine
197	  firmware to implement UEFI secure boot.
198
199	  If unsure, say Y.
200
201config KVM_HYPERV
202	bool "Support for Microsoft Hyper-V emulation"
203	depends on KVM_X86
204	default y
205	help
206	  Provides KVM support for emulating Microsoft Hyper-V.  This allows KVM
207	  to expose a subset of the paravirtualized interfaces defined in the
208	  Hyper-V Hypervisor Top-Level Functional Specification (TLFS):
209	  https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
210	  These interfaces are required for the correct and performant functioning
211	  of Windows and Hyper-V guests on KVM.
212
213	  If unsure, say "Y".
214
215config KVM_XEN
216	bool "Support for Xen hypercall interface"
217	depends on KVM_X86
218	help
219	  Provides KVM support for the hosting Xen HVM guests and
220	  passing Xen hypercalls to userspace.
221
222	  If in doubt, say "N".
223
224config KVM_PROVE_MMU
225	bool "Prove KVM MMU correctness"
226	depends on DEBUG_KERNEL
227	depends on KVM_X86
228	depends on EXPERT
229	help
230	  Enables runtime assertions in KVM's MMU that are too costly to enable
231	  in anything remotely resembling a production environment, e.g. this
232	  gates code that verifies a to-be-freed page table doesn't have any
233	  present SPTEs.
234
235	  If in doubt, say "N".
236
237config KVM_EXTERNAL_WRITE_TRACKING
238	bool
239
240config KVM_MAX_NR_VCPUS
241	int "Maximum number of vCPUs per KVM guest"
242	depends on KVM_X86
243	range 1024 4096
244	default 4096 if MAXSMP
245	default 1024
246	help
247	  Set the maximum number of vCPUs per KVM guest. Larger values will increase
248	  the memory footprint of each KVM guest, regardless of how many vCPUs are
249	  created for a given VM.
250
251endif # VIRTUALIZATION
252