]> Git Repo - linux.git/commitdiff
LoongArch: KVM: Enable kvm config and add the makefile
authorTianrui Zhao <[email protected]>
Mon, 2 Oct 2023 02:01:29 +0000 (10:01 +0800)
committerHuacai Chen <[email protected]>
Mon, 2 Oct 2023 02:01:29 +0000 (10:01 +0800)
Enable LoongArch kvm config and add the makefile to support build kvm
module.

Reviewed-by: Bibo Mao <[email protected]>
Tested-by: Huacai Chen <[email protected]>
Signed-off-by: Tianrui Zhao <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
arch/loongarch/Kbuild
arch/loongarch/Kconfig
arch/loongarch/configs/loongson3_defconfig
arch/loongarch/kvm/Kconfig [new file with mode: 0644]
arch/loongarch/kvm/Makefile [new file with mode: 0644]

index b01f5cdb27e03d778dfa400e370037c39cd7abed..beb8499dd8ed84330beecbcd61977df0aa3474f8 100644 (file)
@@ -3,5 +3,7 @@ obj-y += mm/
 obj-y += net/
 obj-y += vdso/
 
+obj-$(CONFIG_KVM) += kvm/
+
 # for cleaning
 subdir- += boot
index e14396a2ddcbfc6d6130b63dca258343a03f35cb..d889a0b97bc18f9b38cf93aaa60d86c38935fa5f 100644 (file)
@@ -129,6 +129,7 @@ config LOONGARCH
        select HAVE_KPROBES
        select HAVE_KPROBES_ON_FTRACE
        select HAVE_KRETPROBES
+       select HAVE_KVM
        select HAVE_MOD_ARCH_SPECIFIC
        select HAVE_NMI
        select HAVE_PCI
@@ -263,6 +264,9 @@ config AS_HAS_LASX_EXTENSION
 config AS_HAS_LBT_EXTENSION
        def_bool $(as-instr,movscr2gr \$a0$(comma)\$scr0)
 
+config AS_HAS_LVZ_EXTENSION
+       def_bool $(as-instr,hvcl 0)
+
 menu "Kernel type and options"
 
 source "kernel/Kconfig.hz"
@@ -676,3 +680,5 @@ source "kernel/power/Kconfig"
 source "drivers/acpi/Kconfig"
 
 endmenu
+
+source "arch/loongarch/kvm/Kconfig"
index a3b52aaa83b33634c5be146bc02d50589bf5f762..33795e4a5bd63292831d40dcb0cb8d35ed24d8ce 100644 (file)
@@ -66,6 +66,8 @@ CONFIG_EFI_ZBOOT=y
 CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER=y
 CONFIG_EFI_CAPSULE_LOADER=m
 CONFIG_EFI_TEST=m
+CONFIG_VIRTUALIZATION=y
+CONFIG_KVM=m
 CONFIG_JUMP_LABEL=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
diff --git a/arch/loongarch/kvm/Kconfig b/arch/loongarch/kvm/Kconfig
new file mode 100644 (file)
index 0000000..fda425b
--- /dev/null
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# KVM configuration
+#
+
+source "virt/kvm/Kconfig"
+
+menuconfig VIRTUALIZATION
+       bool "Virtualization"
+       help
+         Say Y here to get to see options for using your Linux host to run
+         other operating systems inside virtual machines (guests).
+         This option alone does not add any kernel code.
+
+         If you say N, all options in this submenu will be skipped and
+         disabled.
+
+if VIRTUALIZATION
+
+config KVM
+       tristate "Kernel-based Virtual Machine (KVM) support"
+       depends on AS_HAS_LVZ_EXTENSION
+       depends on HAVE_KVM
+       select HAVE_KVM_DIRTY_RING_ACQ_REL
+       select HAVE_KVM_EVENTFD
+       select HAVE_KVM_VCPU_ASYNC_IOCTL
+       select KVM_GENERIC_DIRTYLOG_READ_PROTECT
+       select KVM_GENERIC_HARDWARE_ENABLING
+       select KVM_MMIO
+       select KVM_XFER_TO_GUEST_WORK
+       select MMU_NOTIFIER
+       select PREEMPT_NOTIFIERS
+       help
+         Support hosting virtualized guest machines using
+         hardware virtualization extensions. You will need
+         a processor equipped with virtualization extensions.
+
+         If unsure, say N.
+
+endif # VIRTUALIZATION
diff --git a/arch/loongarch/kvm/Makefile b/arch/loongarch/kvm/Makefile
new file mode 100644 (file)
index 0000000..244467d
--- /dev/null
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for LoongArch KVM support
+#
+
+ccflags-y += -I $(srctree)/$(src)
+
+include $(srctree)/virt/kvm/Makefile.kvm
+
+obj-$(CONFIG_KVM) += kvm.o
+
+kvm-y += exit.o
+kvm-y += interrupt.o
+kvm-y += main.o
+kvm-y += mmu.o
+kvm-y += switch.o
+kvm-y += timer.o
+kvm-y += tlb.o
+kvm-y += vcpu.o
+kvm-y += vm.o
+
+CFLAGS_exit.o  += $(call cc-option,-Wno-override-init,)
This page took 0.066015 seconds and 4 git commands to generate.