162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# KVM configuration
462306a36Sopenharmony_ci#
562306a36Sopenharmony_ci
662306a36Sopenharmony_cisource "virt/kvm/Kconfig"
762306a36Sopenharmony_ci
862306a36Sopenharmony_cimenuconfig VIRTUALIZATION
962306a36Sopenharmony_ci	bool "Virtualization"
1062306a36Sopenharmony_ci	help
1162306a36Sopenharmony_ci	  Say Y here to get to see options for using your Linux host to run
1262306a36Sopenharmony_ci	  other operating systems inside virtual machines (guests).
1362306a36Sopenharmony_ci	  This option alone does not add any kernel code.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci	  If you say N, all options in this submenu will be skipped and
1662306a36Sopenharmony_ci	  disabled.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciif VIRTUALIZATION
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciconfig KVM
2162306a36Sopenharmony_ci	bool
2262306a36Sopenharmony_ci	select PREEMPT_NOTIFIERS
2362306a36Sopenharmony_ci	select HAVE_KVM_EVENTFD
2462306a36Sopenharmony_ci	select HAVE_KVM_VCPU_ASYNC_IOCTL
2562306a36Sopenharmony_ci	select KVM_VFIO
2662306a36Sopenharmony_ci	select IRQ_BYPASS_MANAGER
2762306a36Sopenharmony_ci	select HAVE_KVM_IRQ_BYPASS
2862306a36Sopenharmony_ci	select INTERVAL_TREE
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciconfig KVM_BOOK3S_HANDLER
3162306a36Sopenharmony_ci	bool
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciconfig KVM_BOOK3S_32_HANDLER
3462306a36Sopenharmony_ci	bool
3562306a36Sopenharmony_ci	select KVM_BOOK3S_HANDLER
3662306a36Sopenharmony_ci	select KVM_MMIO
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciconfig KVM_BOOK3S_64_HANDLER
3962306a36Sopenharmony_ci	bool
4062306a36Sopenharmony_ci	select KVM_BOOK3S_HANDLER
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciconfig KVM_BOOK3S_PR_POSSIBLE
4362306a36Sopenharmony_ci	bool
4462306a36Sopenharmony_ci	select KVM_MMIO
4562306a36Sopenharmony_ci	select MMU_NOTIFIER
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciconfig KVM_BOOK3S_HV_POSSIBLE
4862306a36Sopenharmony_ci	bool
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciconfig KVM_BOOK3S_32
5162306a36Sopenharmony_ci	tristate "KVM support for PowerPC book3s_32 processors"
5262306a36Sopenharmony_ci	depends on PPC_BOOK3S_32 && !SMP && !PTE_64BIT
5362306a36Sopenharmony_ci	depends on !CONTEXT_TRACKING_USER
5462306a36Sopenharmony_ci	select KVM
5562306a36Sopenharmony_ci	select KVM_BOOK3S_32_HANDLER
5662306a36Sopenharmony_ci	select KVM_BOOK3S_PR_POSSIBLE
5762306a36Sopenharmony_ci	select PPC_FPU
5862306a36Sopenharmony_ci	help
5962306a36Sopenharmony_ci	  Support running unmodified book3s_32 guest kernels
6062306a36Sopenharmony_ci	  in virtual machines on book3s_32 host processors.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci	  This module provides access to the hardware capabilities through
6362306a36Sopenharmony_ci	  a character device node named /dev/kvm.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	  If unsure, say N.
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciconfig KVM_BOOK3S_64
6862306a36Sopenharmony_ci	tristate "KVM support for PowerPC book3s_64 processors"
6962306a36Sopenharmony_ci	depends on PPC_BOOK3S_64
7062306a36Sopenharmony_ci	select KVM_BOOK3S_64_HANDLER
7162306a36Sopenharmony_ci	select KVM
7262306a36Sopenharmony_ci	select KVM_BOOK3S_PR_POSSIBLE if !KVM_BOOK3S_HV_POSSIBLE
7362306a36Sopenharmony_ci	select PPC_64S_HASH_MMU
7462306a36Sopenharmony_ci	select SPAPR_TCE_IOMMU if IOMMU_SUPPORT && (PPC_PSERIES || PPC_POWERNV)
7562306a36Sopenharmony_ci	help
7662306a36Sopenharmony_ci	  Support running unmodified book3s_64 and book3s_32 guest kernels
7762306a36Sopenharmony_ci	  in virtual machines on book3s_64 host processors.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci	  This module provides access to the hardware capabilities through
8062306a36Sopenharmony_ci	  a character device node named /dev/kvm.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	  If unsure, say N.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ciconfig KVM_BOOK3S_64_HV
8562306a36Sopenharmony_ci	tristate "KVM for POWER7 and later using hypervisor mode in host"
8662306a36Sopenharmony_ci	depends on KVM_BOOK3S_64 && PPC_POWERNV
8762306a36Sopenharmony_ci	select KVM_BOOK3S_HV_POSSIBLE
8862306a36Sopenharmony_ci	select MMU_NOTIFIER
8962306a36Sopenharmony_ci	select CMA
9062306a36Sopenharmony_ci	help
9162306a36Sopenharmony_ci	  Support running unmodified book3s_64 guest kernels in
9262306a36Sopenharmony_ci	  virtual machines on POWER7 and newer processors that have
9362306a36Sopenharmony_ci	  hypervisor mode available to the host.
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci	  If you say Y here, KVM will use the hardware virtualization
9662306a36Sopenharmony_ci	  facilities of POWER7 (and later) processors, meaning that
9762306a36Sopenharmony_ci	  guest operating systems will run at full hardware speed
9862306a36Sopenharmony_ci	  using supervisor and user modes.  However, this also means
9962306a36Sopenharmony_ci	  that KVM is not usable under PowerVM (pHyp), is only usable
10062306a36Sopenharmony_ci	  on POWER7 or later processors, and cannot emulate a
10162306a36Sopenharmony_ci	  different processor from the host processor.
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	  If unsure, say N.
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciconfig KVM_BOOK3S_64_PR
10662306a36Sopenharmony_ci	tristate "KVM support without using hypervisor mode in host"
10762306a36Sopenharmony_ci	depends on KVM_BOOK3S_64
10862306a36Sopenharmony_ci	depends on !CONTEXT_TRACKING_USER
10962306a36Sopenharmony_ci	select KVM_BOOK3S_PR_POSSIBLE
11062306a36Sopenharmony_ci	help
11162306a36Sopenharmony_ci	  Support running guest kernels in virtual machines on processors
11262306a36Sopenharmony_ci	  without using hypervisor mode in the host, by running the
11362306a36Sopenharmony_ci	  guest in user mode (problem state) and emulating all
11462306a36Sopenharmony_ci	  privileged instructions and registers.
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci	  This is only available for hash MMU mode and only supports
11762306a36Sopenharmony_ci	  guests that use hash MMU mode.
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci	  This is not as fast as using hypervisor mode, but works on
12062306a36Sopenharmony_ci	  machines where hypervisor mode is not available or not usable,
12162306a36Sopenharmony_ci	  and can emulate processors that are different from the host
12262306a36Sopenharmony_ci	  processor, including emulating 32-bit processors on a 64-bit
12362306a36Sopenharmony_ci	  host.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci	  Selecting this option will cause the SCV facility to be
12662306a36Sopenharmony_ci	  disabled when the kernel is booted on the pseries platform in
12762306a36Sopenharmony_ci	  hash MMU mode (regardless of PR VMs running). When any PR VMs
12862306a36Sopenharmony_ci	  are running, "AIL" mode is disabled which may slow interrupts
12962306a36Sopenharmony_ci	  and system calls on the host.
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciconfig KVM_BOOK3S_HV_EXIT_TIMING
13262306a36Sopenharmony_ci	bool
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ciconfig KVM_BOOK3S_HV_P9_TIMING
13562306a36Sopenharmony_ci	bool "Detailed timing for the P9 entry point"
13662306a36Sopenharmony_ci	select KVM_BOOK3S_HV_EXIT_TIMING
13762306a36Sopenharmony_ci	depends on KVM_BOOK3S_HV_POSSIBLE && DEBUG_FS
13862306a36Sopenharmony_ci	help
13962306a36Sopenharmony_ci	  Calculate time taken for each vcpu during vcpu entry and
14062306a36Sopenharmony_ci	  exit, time spent inside the guest and time spent handling
14162306a36Sopenharmony_ci	  hypercalls and page faults. The total, minimum and maximum
14262306a36Sopenharmony_ci	  times in nanoseconds together with the number of executions
14362306a36Sopenharmony_ci	  are reported in debugfs in kvm/vm#/vcpu#/timings.
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci	  If unsure, say N.
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ciconfig KVM_BOOK3S_HV_P8_TIMING
14862306a36Sopenharmony_ci	bool "Detailed timing for hypervisor real-mode code (for POWER8)"
14962306a36Sopenharmony_ci	select KVM_BOOK3S_HV_EXIT_TIMING
15062306a36Sopenharmony_ci	depends on KVM_BOOK3S_HV_POSSIBLE && DEBUG_FS && !KVM_BOOK3S_HV_P9_TIMING
15162306a36Sopenharmony_ci	help
15262306a36Sopenharmony_ci	  Calculate time taken for each vcpu in the real-mode guest entry,
15362306a36Sopenharmony_ci	  exit, and interrupt handling code, plus time spent in the guest
15462306a36Sopenharmony_ci	  and in nap mode due to idle (cede) while other threads are still
15562306a36Sopenharmony_ci	  in the guest.  The total, minimum and maximum times in nanoseconds
15662306a36Sopenharmony_ci	  together with the number of executions are reported in debugfs in
15762306a36Sopenharmony_ci	  kvm/vm#/vcpu#/timings.  The overhead is of the order of 30 - 40
15862306a36Sopenharmony_ci	  ns per exit on POWER8.
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci	  If unsure, say N.
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ciconfig KVM_BOOK3S_HV_NESTED_PMU_WORKAROUND
16362306a36Sopenharmony_ci	bool "Nested L0 host workaround for L1 KVM host PMU handling bug" if EXPERT
16462306a36Sopenharmony_ci	depends on KVM_BOOK3S_HV_POSSIBLE
16562306a36Sopenharmony_ci	default !EXPERT
16662306a36Sopenharmony_ci	help
16762306a36Sopenharmony_ci	  Old nested HV capable Linux guests have a bug where they don't
16862306a36Sopenharmony_ci	  reflect the PMU in-use status of their L2 guest to the L0 host
16962306a36Sopenharmony_ci	  while the L2 PMU registers are live. This can result in loss
17062306a36Sopenharmony_ci	  of L2 PMU register state, causing perf to not work correctly in
17162306a36Sopenharmony_ci	  L2 guests.
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci	  Selecting this option for the L0 host implements a workaround for
17462306a36Sopenharmony_ci	  those buggy L1s which saves the L2 state, at the cost of performance
17562306a36Sopenharmony_ci	  in all nested-capable guest entry/exit.
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciconfig KVM_BOOKE_HV
17862306a36Sopenharmony_ci	bool
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ciconfig KVM_EXIT_TIMING
18162306a36Sopenharmony_ci	bool "Detailed exit timing"
18262306a36Sopenharmony_ci	depends on KVM_E500V2 || KVM_E500MC
18362306a36Sopenharmony_ci	help
18462306a36Sopenharmony_ci	  Calculate elapsed time for every exit/enter cycle. A per-vcpu
18562306a36Sopenharmony_ci	  report is available in debugfs kvm/vm#_vcpu#_timing.
18662306a36Sopenharmony_ci	  The overhead is relatively small, however it is not recommended for
18762306a36Sopenharmony_ci	  production environments.
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci	  If unsure, say N.
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ciconfig KVM_E500V2
19262306a36Sopenharmony_ci	bool "KVM support for PowerPC E500v2 processors"
19362306a36Sopenharmony_ci	depends on PPC_E500 && !PPC_E500MC
19462306a36Sopenharmony_ci	depends on !CONTEXT_TRACKING_USER
19562306a36Sopenharmony_ci	select KVM
19662306a36Sopenharmony_ci	select KVM_MMIO
19762306a36Sopenharmony_ci	select MMU_NOTIFIER
19862306a36Sopenharmony_ci	help
19962306a36Sopenharmony_ci	  Support running unmodified E500 guest kernels in virtual machines on
20062306a36Sopenharmony_ci	  E500v2 host processors.
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci	  This module provides access to the hardware capabilities through
20362306a36Sopenharmony_ci	  a character device node named /dev/kvm.
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci	  If unsure, say N.
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ciconfig KVM_E500MC
20862306a36Sopenharmony_ci	bool "KVM support for PowerPC E500MC/E5500/E6500 processors"
20962306a36Sopenharmony_ci	depends on PPC_E500MC
21062306a36Sopenharmony_ci	depends on !CONTEXT_TRACKING_USER
21162306a36Sopenharmony_ci	select KVM
21262306a36Sopenharmony_ci	select KVM_MMIO
21362306a36Sopenharmony_ci	select KVM_BOOKE_HV
21462306a36Sopenharmony_ci	select MMU_NOTIFIER
21562306a36Sopenharmony_ci	help
21662306a36Sopenharmony_ci	  Support running unmodified E500MC/E5500/E6500 guest kernels in
21762306a36Sopenharmony_ci	  virtual machines on E500MC/E5500/E6500 host processors.
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci	  This module provides access to the hardware capabilities through
22062306a36Sopenharmony_ci	  a character device node named /dev/kvm.
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci	  If unsure, say N.
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ciconfig KVM_MPIC
22562306a36Sopenharmony_ci	bool "KVM in-kernel MPIC emulation"
22662306a36Sopenharmony_ci	depends on KVM && PPC_E500
22762306a36Sopenharmony_ci	select HAVE_KVM_IRQCHIP
22862306a36Sopenharmony_ci	select HAVE_KVM_IRQFD
22962306a36Sopenharmony_ci	select HAVE_KVM_IRQ_ROUTING
23062306a36Sopenharmony_ci	select HAVE_KVM_MSI
23162306a36Sopenharmony_ci	help
23262306a36Sopenharmony_ci	  Enable support for emulating MPIC devices inside the
23362306a36Sopenharmony_ci	  host kernel, rather than relying on userspace to emulate.
23462306a36Sopenharmony_ci	  Currently, support is limited to certain versions of
23562306a36Sopenharmony_ci	  Freescale's MPIC implementation.
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ciconfig KVM_XICS
23862306a36Sopenharmony_ci	bool "KVM in-kernel XICS emulation"
23962306a36Sopenharmony_ci	depends on KVM_BOOK3S_64 && !KVM_MPIC
24062306a36Sopenharmony_ci	select HAVE_KVM_IRQCHIP
24162306a36Sopenharmony_ci	select HAVE_KVM_IRQFD
24262306a36Sopenharmony_ci	default y
24362306a36Sopenharmony_ci	help
24462306a36Sopenharmony_ci	  Include support for the XICS (eXternal Interrupt Controller
24562306a36Sopenharmony_ci	  Specification) interrupt controller architecture used on
24662306a36Sopenharmony_ci	  IBM POWER (pSeries) servers.
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ciconfig KVM_XIVE
24962306a36Sopenharmony_ci	bool
25062306a36Sopenharmony_ci	default y
25162306a36Sopenharmony_ci	depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ciendif # VIRTUALIZATION
254