xref: /linux/arch/x86/kvm/Kconfig (revision 9591fdb0611dccdeeeeacb99d89f0098737d209b)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
2edf88417SAvi Kivity#
3edf88417SAvi Kivity# KVM configuration
4edf88417SAvi Kivity#
5edf88417SAvi Kivity
60ba12d10SAvi Kivitysource "virt/kvm/Kconfig"
75d9b8e30SAvi Kivity
8edf88417SAvi Kivitymenuconfig VIRTUALIZATION
9edf88417SAvi Kivity	bool "Virtualization"
10edf88417SAvi Kivity	default y
11a7f7f624SMasahiro Yamada	help
12edf88417SAvi Kivity	  Say Y here to get to see options for using your Linux host to run other
13edf88417SAvi Kivity	  operating systems inside virtual machines (guests).
14edf88417SAvi Kivity	  This option alone does not add any kernel code.
15edf88417SAvi Kivity
16edf88417SAvi Kivity	  If you say N, all options in this submenu will be skipped and disabled.
17edf88417SAvi Kivity
18edf88417SAvi Kivityif VIRTUALIZATION
19edf88417SAvi Kivity
20ea4290d7SPaolo Bonziniconfig KVM_X86
219ee62c33SSean Christopherson	def_tristate KVM if (KVM_INTEL != n || KVM_AMD != n)
22caadf876SPaolo Bonzini	select KVM_COMMON
23f128cf8cSSean Christopherson	select KVM_GENERIC_MMU_NOTIFIER
24b9883ee4SSean Christopherson	select KVM_ELIDE_TLB_FLUSH_IF_YOUNG
25b146a9b3SSean Christopherson	select KVM_MMU_LOCKLESS_AGING
260ba12d10SAvi Kivity	select HAVE_KVM_IRQCHIP
27982ed0deSDavid Woodhouse	select HAVE_KVM_PFNCACHE
2817601bfeSMarc Zyngier	select HAVE_KVM_DIRTY_RING_TSO
29fc0693d4SMarc Zyngier	select HAVE_KVM_DIRTY_RING_ACQ_REL
3087276880SFeng Wu	select HAVE_KVM_IRQ_BYPASS
31a725d56aSAlexander Graf	select HAVE_KVM_IRQ_ROUTING
328886640dSPaolo Bonzini	select HAVE_KVM_READONLY_MEM
33d96c77bdSPaolo Bonzini	select VHOST_TASK
34af585b92SGleb Natapov	select KVM_ASYNC_PF
3518863bddSAvi Kivity	select USER_RETURN_NOTIFIER
3650eb2a3cSAvi Kivity	select KVM_MMIO
3763b3f96eSPeter Zijlstra	select SCHED_INFO
38f5132b01SGleb Natapov	select PERF_EVENTS
392aef6f30SSean Christopherson	select GUEST_PERF_EVENTS
4007975ad3SJan Kiszka	select HAVE_KVM_MSI
41f2a74347SRaghavendra K T	select HAVE_KVM_CPU_RELAX_INTERCEPT
422d5ba19bSMarcelo Tosatti	select HAVE_KVM_NO_POLL
439be7e1e3SSean Christopherson	select VIRT_XFER_TO_GUEST_WORK
44e108ff2fSPaolo Bonzini	select KVM_GENERIC_DIRTYLOG_READ_PROTECT
45ec53500fSAlex Williamson	select KVM_VFIO
467d62874fSSergey Senozhatsky	select HAVE_KVM_PM_NOTIFIER if PM
47441f7bfaSSean Christopherson	select KVM_GENERIC_HARDWARE_ENABLING
486e01b760SPaolo Bonzini	select KVM_GENERIC_PRE_FAULT_MEMORY
4976d5363cSSean Christopherson	select KVM_WERROR if WERROR
50d1e54dd0SFuad Tabba	select KVM_GUEST_MEMFD if X86_64
51ea4290d7SPaolo Bonzini
52ea4290d7SPaolo Bonziniconfig KVM
53ea4290d7SPaolo Bonzini	tristate "Kernel-based Virtual Machine (KVM) support"
541331343aSArnd Bergmann	depends on X86_LOCAL_APIC
55a7f7f624SMasahiro Yamada	help
56edf88417SAvi Kivity	  Support hosting fully virtualized guest machines using hardware
57edf88417SAvi Kivity	  virtualization extensions.  You will need a fairly recent
58edf88417SAvi Kivity	  processor equipped with virtualization extensions. You will also
59edf88417SAvi Kivity	  need to select one or more of the processor modules below.
60edf88417SAvi Kivity
61edf88417SAvi Kivity	  This module provides access to the hardware capabilities through
62edf88417SAvi Kivity	  a character device node named /dev/kvm.
63edf88417SAvi Kivity
64edf88417SAvi Kivity	  To compile this as a module, choose M here: the module
65edf88417SAvi Kivity	  will be called kvm.
66edf88417SAvi Kivity
67edf88417SAvi Kivity	  If unsure, say N.
68edf88417SAvi Kivity
694f337fafSPaolo Bonziniconfig KVM_WERROR
704f337fafSPaolo Bonzini	bool "Compile KVM with -Werror"
7175bedc1eSSean Christopherson	# Disallow KVM's -Werror if KASAN is enabled, e.g. to guard against
7275bedc1eSSean Christopherson	# randomized configs from selecting KVM_WERROR=y, which doesn't play
7375bedc1eSSean Christopherson	# nice with KASAN.  KASAN builds generates warnings for the default
7475bedc1eSSean Christopherson	# FRAME_WARN, i.e. KVM_WERROR=y with KASAN=y requires special tuning.
7575bedc1eSSean Christopherson	# Building KVM with -Werror and KASAN is still doable via enabling
7675bedc1eSSean Christopherson	# the kernel-wide WERROR=y.
771d95f2d3SSean Christopherson	depends on KVM_X86 && ((EXPERT && !KASAN) || WERROR)
784f337fafSPaolo Bonzini	help
79a754acc3SJason A. Donenfeld	  Add -Werror to the build flags for KVM.
804f337fafSPaolo Bonzini
814f337fafSPaolo Bonzini	  If in doubt, say "N".
824f337fafSPaolo Bonzini
8389ea60c2SSean Christophersonconfig KVM_SW_PROTECTED_VM
8489ea60c2SSean Christopherson	bool "Enable support for KVM software-protected VMs"
8589ea60c2SSean Christopherson	depends on EXPERT
861d95f2d3SSean Christopherson	depends on KVM_X86 && X86_64
87d1e54dd0SFuad Tabba	select KVM_GENERIC_MEMORY_ATTRIBUTES
8889ea60c2SSean Christopherson	help
8942269209SSean Christopherson	  Enable support for KVM software-protected VMs.  Currently, software-
9042269209SSean Christopherson	  protected VMs are purely a development and testing vehicle for
9142269209SSean Christopherson	  KVM_CREATE_GUEST_MEMFD.  Attempting to run a "real" VM workload as a
9242269209SSean Christopherson	  software-protected VM will fail miserably.
9389ea60c2SSean Christopherson
9489ea60c2SSean Christopherson	  If unsure, say "N".
9589ea60c2SSean Christopherson
96edf88417SAvi Kivityconfig KVM_INTEL
978f63aaf5SSean Christopherson	tristate "KVM for Intel (and compatible) processors support"
988f63aaf5SSean Christopherson	depends on KVM && IA32_FEAT_CTL
99*28d11e45SSean Christopherson	select X86_FRED if X86_64
100a7f7f624SMasahiro Yamada	help
1018f63aaf5SSean Christopherson	  Provides support for KVM on processors equipped with Intel's VT
1028f63aaf5SSean Christopherson	  extensions, a.k.a. Virtual Machine Extensions (VMX).
103edf88417SAvi Kivity
10458f8ac27SRobert P. J. Day	  To compile this as a module, choose M here: the module
10558f8ac27SRobert P. J. Day	  will be called kvm-intel.
10658f8ac27SRobert P. J. Day
1078131cf5bSIsaku Yamahataconfig KVM_INTEL_PROVE_VE
1088131cf5bSIsaku Yamahata        bool "Check that guests do not receive #VE exceptions"
1096af6142eSSean Christopherson        depends on KVM_INTEL && EXPERT
1108131cf5bSIsaku Yamahata        help
1118131cf5bSIsaku Yamahata          Checks that KVM's page table management code will not incorrectly
1128131cf5bSIsaku Yamahata          let guests receive a virtualization exception.  Virtualization
1138131cf5bSIsaku Yamahata          exceptions will be trapped by the hypervisor rather than injected
1148131cf5bSIsaku Yamahata          in the guest.
1158131cf5bSIsaku Yamahata
1166af6142eSSean Christopherson          Note: some CPUs appear to generate spurious EPT Violations #VEs
1176af6142eSSean Christopherson          that trigger KVM's WARN, in particular with eptad=0 and/or nested
1186af6142eSSean Christopherson          virtualization.
1196af6142eSSean Christopherson
1208131cf5bSIsaku Yamahata          If unsure, say N.
1218131cf5bSIsaku Yamahata
122540745ddSSean Christophersonconfig X86_SGX_KVM
123540745ddSSean Christopherson	bool "Software Guard eXtensions (SGX) Virtualization"
124540745ddSSean Christopherson	depends on X86_SGX && KVM_INTEL
125540745ddSSean Christopherson	help
126540745ddSSean Christopherson
127540745ddSSean Christopherson	  Enables KVM guests to create SGX enclaves.
128540745ddSSean Christopherson
129540745ddSSean Christopherson	  This includes support to expose "raw" unreclaimable enclave memory to
130540745ddSSean Christopherson	  guests via a device node, e.g. /dev/sgx_vepc.
131540745ddSSean Christopherson
132540745ddSSean Christopherson	  If unsure, say N.
133540745ddSSean Christopherson
134fcdbdf63SKai Huangconfig KVM_INTEL_TDX
135fcdbdf63SKai Huang	bool "Intel Trust Domain Extensions (TDX) support"
136fcdbdf63SKai Huang	default y
137fcdbdf63SKai Huang	depends on INTEL_TDX_HOST
138d1e54dd0SFuad Tabba	select KVM_GENERIC_MEMORY_ATTRIBUTES
13936cf63bbSFuad Tabba	select HAVE_KVM_ARCH_GMEM_POPULATE
140fcdbdf63SKai Huang	help
141fcdbdf63SKai Huang	  Provides support for launching Intel Trust Domain Extensions (TDX)
142fcdbdf63SKai Huang	  confidential VMs on Intel processors.
143fcdbdf63SKai Huang
144fcdbdf63SKai Huang	  If unsure, say N.
145fcdbdf63SKai Huang
146edf88417SAvi Kivityconfig KVM_AMD
147edf88417SAvi Kivity	tristate "KVM for AMD processors support"
148554856b6SSean Christopherson	depends on KVM && (CPU_SUP_AMD || CPU_SUP_HYGON)
149a7f7f624SMasahiro Yamada	help
150edf88417SAvi Kivity	  Provides support for KVM on AMD processors equipped with the AMD-V
151edf88417SAvi Kivity	  (SVM) extensions.
152edf88417SAvi Kivity
15358f8ac27SRobert P. J. Day	  To compile this as a module, choose M here: the module
15458f8ac27SRobert P. J. Day	  will be called kvm-amd.
15558f8ac27SRobert P. J. Day
1565dd0a57cSBrijesh Singhconfig KVM_AMD_SEV
1575dd0a57cSBrijesh Singh	bool "AMD Secure Encrypted Virtualization (SEV) support"
158cd14b018SMasahiro Yamada	default y
1595dd0a57cSBrijesh Singh	depends on KVM_AMD && X86_64
160d30f370dSJanakarajan Natarajan	depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
16154f5f47bSBorislav Petkov (AMD)	select ARCH_HAS_CC_PLATFORM
162d1e54dd0SFuad Tabba	select KVM_GENERIC_MEMORY_ATTRIBUTES
163564429a6SPaolo Bonzini	select HAVE_KVM_ARCH_GMEM_PREPARE
164564429a6SPaolo Bonzini	select HAVE_KVM_ARCH_GMEM_INVALIDATE
16536cf63bbSFuad Tabba	select HAVE_KVM_ARCH_GMEM_POPULATE
166a7f7f624SMasahiro Yamada	help
1675fa9f048SVitaly Kuznetsov	  Provides support for launching encrypted VMs which use Secure
1685fa9f048SVitaly Kuznetsov	  Encrypted Virtualization (SEV), Secure Encrypted Virtualization with
1695fa9f048SVitaly Kuznetsov	  Encrypted State (SEV-ES), and Secure Encrypted Virtualization with
1705fa9f048SVitaly Kuznetsov	  Secure Nested Paging (SEV-SNP) technologies on AMD processors.
1715dd0a57cSBrijesh Singh
172628a2773SSean Christophersonconfig KVM_IOAPIC
173628a2773SSean Christopherson	bool "I/O APIC, PIC, and PIT emulation"
174628a2773SSean Christopherson	default y
1751d95f2d3SSean Christopherson	depends on KVM_X86
176628a2773SSean Christopherson	help
177628a2773SSean Christopherson	  Provides support for KVM to emulate an I/O APIC, PIC, and PIT, i.e.
178628a2773SSean Christopherson	  for full in-kernel APIC emulation.
179628a2773SSean Christopherson
180628a2773SSean Christopherson	  If unsure, say Y.
181628a2773SSean Christopherson
1824b8e1b32SPaolo Bonziniconfig KVM_SMM
1834b8e1b32SPaolo Bonzini	bool "System Management Mode emulation"
1844b8e1b32SPaolo Bonzini	default y
1851d95f2d3SSean Christopherson	depends on KVM_X86
1864b8e1b32SPaolo Bonzini	help
1874b8e1b32SPaolo Bonzini	  Provides support for KVM to emulate System Management Mode (SMM)
1884b8e1b32SPaolo Bonzini	  in virtual machines.  This can be used by the virtual machine
1894b8e1b32SPaolo Bonzini	  firmware to implement UEFI secure boot.
1904b8e1b32SPaolo Bonzini
1914b8e1b32SPaolo Bonzini	  If unsure, say Y.
1924b8e1b32SPaolo Bonzini
193b4f69df0SVitaly Kuznetsovconfig KVM_HYPERV
194b4f69df0SVitaly Kuznetsov	bool "Support for Microsoft Hyper-V emulation"
1951d95f2d3SSean Christopherson	depends on KVM_X86
196b4f69df0SVitaly Kuznetsov	default y
197b4f69df0SVitaly Kuznetsov	help
198b4f69df0SVitaly Kuznetsov	  Provides KVM support for emulating Microsoft Hyper-V.  This allows KVM
199b4f69df0SVitaly Kuznetsov	  to expose a subset of the paravirtualized interfaces defined in the
200b4f69df0SVitaly Kuznetsov	  Hyper-V Hypervisor Top-Level Functional Specification (TLFS):
201b4f69df0SVitaly Kuznetsov	  https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
202b4f69df0SVitaly Kuznetsov	  These interfaces are required for the correct and performant functioning
203b4f69df0SVitaly Kuznetsov	  of Windows and Hyper-V guests on KVM.
204b4f69df0SVitaly Kuznetsov
205b4f69df0SVitaly Kuznetsov	  If unsure, say "Y".
206b4f69df0SVitaly Kuznetsov
207b59b153dSPaolo Bonziniconfig KVM_XEN
208b59b153dSPaolo Bonzini	bool "Support for Xen hypercall interface"
2091d95f2d3SSean Christopherson	depends on KVM_X86
210b59b153dSPaolo Bonzini	help
211b59b153dSPaolo Bonzini	  Provides KVM support for the hosting Xen HVM guests and
212b59b153dSPaolo Bonzini	  passing Xen hypercalls to userspace.
213b59b153dSPaolo Bonzini
214b59b153dSPaolo Bonzini	  If in doubt, say "N".
215b59b153dSPaolo Bonzini
216870d4d4eSSean Christophersonconfig KVM_PROVE_MMU
217870d4d4eSSean Christopherson	bool "Prove KVM MMU correctness"
218870d4d4eSSean Christopherson	depends on DEBUG_KERNEL
2191d95f2d3SSean Christopherson	depends on KVM_X86
220870d4d4eSSean Christopherson	depends on EXPERT
221870d4d4eSSean Christopherson	help
222870d4d4eSSean Christopherson	  Enables runtime assertions in KVM's MMU that are too costly to enable
223870d4d4eSSean Christopherson	  in anything remotely resembling a production environment, e.g. this
224870d4d4eSSean Christopherson	  gates code that verifies a to-be-freed page table doesn't have any
225870d4d4eSSean Christopherson	  present SPTEs.
226870d4d4eSSean Christopherson
227870d4d4eSSean Christopherson	  If in doubt, say "N".
228870d4d4eSSean Christopherson
229e9d0c0c4SDavid Stevensconfig KVM_EXTERNAL_WRITE_TRACKING
230e9d0c0c4SDavid Stevens	bool
231e9d0c0c4SDavid Stevens
232f10a570bSKyle Meyerconfig KVM_MAX_NR_VCPUS
233f10a570bSKyle Meyer	int "Maximum number of vCPUs per KVM guest"
2341d95f2d3SSean Christopherson	depends on KVM_X86
235f10a570bSKyle Meyer	range 1024 4096
236f10a570bSKyle Meyer	default 4096 if MAXSMP
237f10a570bSKyle Meyer	default 1024
238f10a570bSKyle Meyer	help
239f10a570bSKyle Meyer	  Set the maximum number of vCPUs per KVM guest. Larger values will increase
240f10a570bSKyle Meyer	  the memory footprint of each KVM guest, regardless of how many vCPUs are
241f10a570bSKyle Meyer	  created for a given VM.
242f10a570bSKyle Meyer
243edf88417SAvi Kivityendif # VIRTUALIZATION
244