1# SPDX-License-Identifier: GPL-2.0
2#
3# KVM configuration
4#
5
6source "virt/kvm/Kconfig"
7
8menuconfig VIRTUALIZATION
9	bool "Virtualization"
10	help
11	  Say Y here to get to see options for using your Linux host to run
12	  other operating systems inside virtual machines (guests).
13	  This option alone does not add any kernel code.
14
15	  If you say N, all options in this submenu will be skipped and
16	  disabled.
17
18if VIRTUALIZATION
19
20config KVM
21	bool
22	select PREEMPT_NOTIFIERS
23	select HAVE_KVM_EVENTFD
24	select HAVE_KVM_VCPU_ASYNC_IOCTL
25	select KVM_VFIO
26	select IRQ_BYPASS_MANAGER
27	select HAVE_KVM_IRQ_BYPASS
28	select INTERVAL_TREE
29
30config KVM_BOOK3S_HANDLER
31	bool
32
33config KVM_BOOK3S_32_HANDLER
34	bool
35	select KVM_BOOK3S_HANDLER
36	select KVM_MMIO
37
38config KVM_BOOK3S_64_HANDLER
39	bool
40	select KVM_BOOK3S_HANDLER
41
42config KVM_BOOK3S_PR_POSSIBLE
43	bool
44	select KVM_MMIO
45	select MMU_NOTIFIER
46
47config KVM_BOOK3S_HV_POSSIBLE
48	bool
49
50config KVM_BOOK3S_32
51	tristate "KVM support for PowerPC book3s_32 processors"
52	depends on PPC_BOOK3S_32 && !SMP && !PTE_64BIT
53	depends on !CONTEXT_TRACKING_USER
54	select KVM
55	select KVM_BOOK3S_32_HANDLER
56	select KVM_BOOK3S_PR_POSSIBLE
57	select PPC_FPU
58	help
59	  Support running unmodified book3s_32 guest kernels
60	  in virtual machines on book3s_32 host processors.
61
62	  This module provides access to the hardware capabilities through
63	  a character device node named /dev/kvm.
64
65	  If unsure, say N.
66
67config KVM_BOOK3S_64
68	tristate "KVM support for PowerPC book3s_64 processors"
69	depends on PPC_BOOK3S_64
70	select KVM_BOOK3S_64_HANDLER
71	select KVM
72	select KVM_BOOK3S_PR_POSSIBLE if !KVM_BOOK3S_HV_POSSIBLE
73	select PPC_64S_HASH_MMU
74	select SPAPR_TCE_IOMMU if IOMMU_SUPPORT && (PPC_PSERIES || PPC_POWERNV)
75	help
76	  Support running unmodified book3s_64 and book3s_32 guest kernels
77	  in virtual machines on book3s_64 host processors.
78
79	  This module provides access to the hardware capabilities through
80	  a character device node named /dev/kvm.
81
82	  If unsure, say N.
83
84config KVM_BOOK3S_64_HV
85	tristate "KVM for POWER7 and later using hypervisor mode in host"
86	depends on KVM_BOOK3S_64 && PPC_POWERNV
87	select KVM_BOOK3S_HV_POSSIBLE
88	select MMU_NOTIFIER
89	select CMA
90	help
91	  Support running unmodified book3s_64 guest kernels in
92	  virtual machines on POWER7 and newer processors that have
93	  hypervisor mode available to the host.
94
95	  If you say Y here, KVM will use the hardware virtualization
96	  facilities of POWER7 (and later) processors, meaning that
97	  guest operating systems will run at full hardware speed
98	  using supervisor and user modes.  However, this also means
99	  that KVM is not usable under PowerVM (pHyp), is only usable
100	  on POWER7 or later processors, and cannot emulate a
101	  different processor from the host processor.
102
103	  If unsure, say N.
104
105config KVM_BOOK3S_64_PR
106	tristate "KVM support without using hypervisor mode in host"
107	depends on KVM_BOOK3S_64
108	depends on !CONTEXT_TRACKING_USER
109	select KVM_BOOK3S_PR_POSSIBLE
110	help
111	  Support running guest kernels in virtual machines on processors
112	  without using hypervisor mode in the host, by running the
113	  guest in user mode (problem state) and emulating all
114	  privileged instructions and registers.
115
116	  This is only available for hash MMU mode and only supports
117	  guests that use hash MMU mode.
118
119	  This is not as fast as using hypervisor mode, but works on
120	  machines where hypervisor mode is not available or not usable,
121	  and can emulate processors that are different from the host
122	  processor, including emulating 32-bit processors on a 64-bit
123	  host.
124
125	  Selecting this option will cause the SCV facility to be
126	  disabled when the kernel is booted on the pseries platform in
127	  hash MMU mode (regardless of PR VMs running). When any PR VMs
128	  are running, "AIL" mode is disabled which may slow interrupts
129	  and system calls on the host.
130
131config KVM_BOOK3S_HV_EXIT_TIMING
132	bool
133
134config KVM_BOOK3S_HV_P9_TIMING
135	bool "Detailed timing for the P9 entry point"
136	select KVM_BOOK3S_HV_EXIT_TIMING
137	depends on KVM_BOOK3S_HV_POSSIBLE && DEBUG_FS
138	help
139	  Calculate time taken for each vcpu during vcpu entry and
140	  exit, time spent inside the guest and time spent handling
141	  hypercalls and page faults. The total, minimum and maximum
142	  times in nanoseconds together with the number of executions
143	  are reported in debugfs in kvm/vm#/vcpu#/timings.
144
145	  If unsure, say N.
146
147config KVM_BOOK3S_HV_P8_TIMING
148	bool "Detailed timing for hypervisor real-mode code (for POWER8)"
149	select KVM_BOOK3S_HV_EXIT_TIMING
150	depends on KVM_BOOK3S_HV_POSSIBLE && DEBUG_FS && !KVM_BOOK3S_HV_P9_TIMING
151	help
152	  Calculate time taken for each vcpu in the real-mode guest entry,
153	  exit, and interrupt handling code, plus time spent in the guest
154	  and in nap mode due to idle (cede) while other threads are still
155	  in the guest.  The total, minimum and maximum times in nanoseconds
156	  together with the number of executions are reported in debugfs in
157	  kvm/vm#/vcpu#/timings.  The overhead is of the order of 30 - 40
158	  ns per exit on POWER8.
159
160	  If unsure, say N.
161
162config KVM_BOOK3S_HV_NESTED_PMU_WORKAROUND
163	bool "Nested L0 host workaround for L1 KVM host PMU handling bug" if EXPERT
164	depends on KVM_BOOK3S_HV_POSSIBLE
165	default !EXPERT
166	help
167	  Old nested HV capable Linux guests have a bug where they don't
168	  reflect the PMU in-use status of their L2 guest to the L0 host
169	  while the L2 PMU registers are live. This can result in loss
170	  of L2 PMU register state, causing perf to not work correctly in
171	  L2 guests.
172
173	  Selecting this option for the L0 host implements a workaround for
174	  those buggy L1s which saves the L2 state, at the cost of performance
175	  in all nested-capable guest entry/exit.
176
177config KVM_BOOKE_HV
178	bool
179
180config KVM_EXIT_TIMING
181	bool "Detailed exit timing"
182	depends on KVM_E500V2 || KVM_E500MC
183	help
184	  Calculate elapsed time for every exit/enter cycle. A per-vcpu
185	  report is available in debugfs kvm/vm#_vcpu#_timing.
186	  The overhead is relatively small, however it is not recommended for
187	  production environments.
188
189	  If unsure, say N.
190
191config KVM_E500V2
192	bool "KVM support for PowerPC E500v2 processors"
193	depends on PPC_E500 && !PPC_E500MC
194	depends on !CONTEXT_TRACKING_USER
195	select KVM
196	select KVM_MMIO
197	select MMU_NOTIFIER
198	help
199	  Support running unmodified E500 guest kernels in virtual machines on
200	  E500v2 host processors.
201
202	  This module provides access to the hardware capabilities through
203	  a character device node named /dev/kvm.
204
205	  If unsure, say N.
206
207config KVM_E500MC
208	bool "KVM support for PowerPC E500MC/E5500/E6500 processors"
209	depends on PPC_E500MC
210	depends on !CONTEXT_TRACKING_USER
211	select KVM
212	select KVM_MMIO
213	select KVM_BOOKE_HV
214	select MMU_NOTIFIER
215	help
216	  Support running unmodified E500MC/E5500/E6500 guest kernels in
217	  virtual machines on E500MC/E5500/E6500 host processors.
218
219	  This module provides access to the hardware capabilities through
220	  a character device node named /dev/kvm.
221
222	  If unsure, say N.
223
224config KVM_MPIC
225	bool "KVM in-kernel MPIC emulation"
226	depends on KVM && PPC_E500
227	select HAVE_KVM_IRQCHIP
228	select HAVE_KVM_IRQFD
229	select HAVE_KVM_IRQ_ROUTING
230	select HAVE_KVM_MSI
231	help
232	  Enable support for emulating MPIC devices inside the
233	  host kernel, rather than relying on userspace to emulate.
234	  Currently, support is limited to certain versions of
235	  Freescale's MPIC implementation.
236
237config KVM_XICS
238	bool "KVM in-kernel XICS emulation"
239	depends on KVM_BOOK3S_64 && !KVM_MPIC
240	select HAVE_KVM_IRQCHIP
241	select HAVE_KVM_IRQFD
242	default y
243	help
244	  Include support for the XICS (eXternal Interrupt Controller
245	  Specification) interrupt controller architecture used on
246	  IBM POWER (pSeries) servers.
247
248config KVM_XIVE
249	bool
250	default y
251	depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE
252
253endif # VIRTUALIZATION
254