#
# KVM configuration
#

source "virt/kvm/Kconfig"

menuconfig KVM
	tristate "Kernel-based Virtual Machine (KVM) support"
	depends on VIRTUALIZATION
	default y
	select KVM_GUEST
	select PREEMPT_NOTIFIERS
	select HAVE_KVM_IRQCHIP
	select HAVE_KVM_IRQFD
	select HAVE_KVM_EVENTFD
	select HAVE_KVM_IRQ_ROUTING
	select KVM_APIC_ARCHITECTURE

	help
	  Support hosting:
	   - paravirtualized guest kernels
	   - fully virtualized guest machines based on hardware
	     virtualization extensions (only for CPUs ISET >= V6)
	  If unsure, say N.

if KVM
config KVM_GUEST
	bool # KVM guest machine support
	help
	  This allows support of KVM guest machines

config KVM_HW_VIRTUALIZATION
	bool "Hypervisor based on hardware virtualization and KVM support"
	help
	  Say Y here if machine hardware has virtualization support
	  and to enable host kernel and hypervisor based on KVM
	default y if CPU_ISET >= 6

config KVM_HW_PARAVIRTUALIZATION
	bool "Hypervisor based on hardware virtualization and paravirtulized guest"
	depends on KVM_HW_VIRTUALIZATION
	help
	  Say Y here if machine hardware has virtualization support
	  and to enable host kernel and hypervisor based on KVM.
	  In addition hypervisor supports guest paravirtualized kernels
	  based on hardware virtualization extensions
	default KVM_HW_VIRTUALIZATION

choice
	prompt "KVM host and guest kernels support type"
	depends on KVM_GUEST
	default KVM_HOST_KERNEL

config KVM_HOST_KERNEL
	bool "KVM hypervisor and host kernel support"
	select KVM_HOST_MODE
	help
	  Say Y here to get host kernel which can be run
	  only as host kernel with hypervisor functionality
	  and support any guest machines based on KVM

config KVM_GUEST_KERNEL
	bool "Paravirtualized native guest kernel support"
	select KVM_GUEST_MODE
	help
	  Say Y here to get native guest kernel which can be run
	  only as guest kernel on any hypervisor based on KVM

config PARAVIRT_GUEST
	bool "Paravirtualized host & guest kernel support"
	select PARAVIRT
	select KVM_HOST_MODE
	select KVM_GUEST_MODE
	help
	  Say Y here to get paravirtualized united host & guest kernel,
	  which can be run as host + hypervisor and as guest kernel.
endchoice

config KVM_GUEST_HW_PV
	bool "Paravirtualized guest kernel based on hardware virtualization"
	depends on KVM_GUEST_KERNEL
	help
	  Say Y here to get paravirtualized guest kernel which can be run
	  only as guest kernel and only on hypervisor based on hardware
	  virtualization extensions

config E2K_VIRT
	bool # Elbrus virtual (1 core, no NUMA, machine & IO - virtual)
	depends on (KVM_GUEST_KERNEL && E2K_MACHINE)
	default y
	help
	  Native machine to run such kernel can be any.
	  Guest machine is Elbrus virtual systems.

config KVM_HOST_MODE
	bool # Enable run the kernel as host kernel
	help
	  This allows support of KVM on kernel

config KVM_GUEST_MODE
	bool # Enable run the kernel as guest kernel
	help
	  This allows building of KVM guest kernel

config KVM_GUEST_SMP
	bool # Enable SMP mode on guest kernel
	depends on (KVM_GUEST_MODE && SMP)
	default y
	help
	  This allows SMP mode of building of KVM guest kernel

endif	# KVM

if PARAVIRT_GUEST

config KVM_CLOCK
	bool "KVM paravirtualized clock"
	select PARAVIRT
	select PARAVIRT_CLOCK
	help
	  Turning on this option will allow you to run a paravirtualized clock
	  when running over the KVM hypervisor. Instead of relying on a PIT
	  (or probably other) emulation by the underlying device model, the host
	  provides the guest with timing infrastructure such as time of day, and
	  system time

config PARAVIRT
	bool "Enable paravirtualization code"
	help
	  This changes the kernel so it can modify itself when it is run
	  under a hypervisor, potentially improving performance significantly
	  over full virtualization.  However, when run without a hypervisor
	  the kernel is theoretically slower and slightly larger.

config PARAVIRT_SPINLOCKS
	bool "Paravirtualization layer for spinlocks"
	depends on PARAVIRT && SMP && EXPERIMENTAL
	help
	  Paravirtualized spinlocks allow a pvops backend to replace the
	  spinlock implementation with something virtualization-friendly
	  (for example, block the virtual CPU rather than spinning).

	  Unfortunately the downside is an up to 5% performance hit on
	  native kernels, with various workloads.

	  If you are unsure how to answer this question, answer N.

config PARAVIRT_CLOCK
	bool
	default n

endif	# PARAVIRT_GUEST

config PARAVIRT_DEBUG
	bool "paravirt-ops debugging"
	depends on PARAVIRT && DEBUG_KERNEL
	help
	  Enable to debug paravirt_ops internals.  Specifically, BUG if
	  a paravirt_op is missing when it is called.

config KVM_GUEST_DEBUG
	bool "KVM guest kernel debugging"
	depends on (PARAVIRT_GUEST || KVM_GUEST_KERNEL)
	help
	  Enable to debug KVM guest kernel. This mode turn on
	  compilation with debugging info (-g option) to enable
	  run guest kernel under gdb

config	GUEST_LAPIC_REGS
	tristate "Guest has own local APIC registers copy"
	depends on KVM
	default n

config	DIRECT_VIRQ_INJECTION
	tristate "Enable direct injection of virtual IRQs to guest kernel"
	depends on KVM
	default y
	help
	  There are two ways of VIRQ delivery:
	  1). Independent the VIRQ VCPU process on host to emulate interrupt
	      controller. Any VIRQ wakes up this process (front end of controller)
	      The VIRQ VCPU process calls guest function (back end of controller)
	      to wake up guest VIRQ handler process.
	      The guest VIRQ handler process runs on guest VCPU and provides
	      VIRQ handling
	  2). Direct injection of VIRQs to guest kernel VCPU through standard
	      mechanism of traps passing from host to guest
	  This mode turn on seconf method - direct injection

config	VIRQ_VCPU_INJECTION
	tristate "Enable special process VIRQ VCPU to inject virtual IRQs"
	depends on KVM
	default y
	help
	  There are two ways of VIRQ delivery:
	  1). Independent the VIRQ VCPU process on host to emulate interrupt
	      controller. Any VIRQ wakes up this process (front end of controller)
	      The VIRQ VCPU process calls guest function (back end of controller)
	      to wake up guest VIRQ handler process.
	      The guest VIRQ handler process runs on guest VCPU and provides
	      VIRQ handling
	  2). Direct injection of VIRQs to guest kernel VCPU through standard
	      mechanism of traps passing from host to guest
	  This mode turn on first method - injection through VIRQ VCPU threads
