Skip to content

Commit c1fc48a

Browse files
zhaotianrui-loongsonchenhuacai
authored andcommitted
LoongArch: KVM: Enable kvm config and add the makefile
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]>
1 parent 39fdf4b commit c1fc48a

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

arch/loongarch/Kbuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ obj-y += mm/
33
obj-y += net/
44
obj-y += vdso/
55

6+
obj-$(CONFIG_KVM) += kvm/
7+
68
# for cleaning
79
subdir- += boot

arch/loongarch/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ config LOONGARCH
129129
select HAVE_KPROBES
130130
select HAVE_KPROBES_ON_FTRACE
131131
select HAVE_KRETPROBES
132+
select HAVE_KVM
132133
select HAVE_MOD_ARCH_SPECIFIC
133134
select HAVE_NMI
134135
select HAVE_PCI
@@ -263,6 +264,9 @@ config AS_HAS_LASX_EXTENSION
263264
config AS_HAS_LBT_EXTENSION
264265
def_bool $(as-instr,movscr2gr \$a0$(comma)\$scr0)
265266

267+
config AS_HAS_LVZ_EXTENSION
268+
def_bool $(as-instr,hvcl 0)
269+
266270
menu "Kernel type and options"
267271

268272
source "kernel/Kconfig.hz"
@@ -676,3 +680,5 @@ source "kernel/power/Kconfig"
676680
source "drivers/acpi/Kconfig"
677681

678682
endmenu
683+
684+
source "arch/loongarch/kvm/Kconfig"

arch/loongarch/configs/loongson3_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ CONFIG_EFI_ZBOOT=y
6666
CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER=y
6767
CONFIG_EFI_CAPSULE_LOADER=m
6868
CONFIG_EFI_TEST=m
69+
CONFIG_VIRTUALIZATION=y
70+
CONFIG_KVM=m
6971
CONFIG_JUMP_LABEL=y
7072
CONFIG_MODULES=y
7173
CONFIG_MODULE_FORCE_LOAD=y

arch/loongarch/kvm/Kconfig

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# KVM configuration
4+
#
5+
6+
source "virt/kvm/Kconfig"
7+
8+
menuconfig 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+
18+
if VIRTUALIZATION
19+
20+
config KVM
21+
tristate "Kernel-based Virtual Machine (KVM) support"
22+
depends on AS_HAS_LVZ_EXTENSION
23+
depends on HAVE_KVM
24+
select HAVE_KVM_DIRTY_RING_ACQ_REL
25+
select HAVE_KVM_EVENTFD
26+
select HAVE_KVM_VCPU_ASYNC_IOCTL
27+
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
28+
select KVM_GENERIC_HARDWARE_ENABLING
29+
select KVM_MMIO
30+
select KVM_XFER_TO_GUEST_WORK
31+
select MMU_NOTIFIER
32+
select PREEMPT_NOTIFIERS
33+
help
34+
Support hosting virtualized guest machines using
35+
hardware virtualization extensions. You will need
36+
a processor equipped with virtualization extensions.
37+
38+
If unsure, say N.
39+
40+
endif # VIRTUALIZATION

arch/loongarch/kvm/Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# Makefile for LoongArch KVM support
4+
#
5+
6+
ccflags-y += -I $(srctree)/$(src)
7+
8+
include $(srctree)/virt/kvm/Makefile.kvm
9+
10+
obj-$(CONFIG_KVM) += kvm.o
11+
12+
kvm-y += exit.o
13+
kvm-y += interrupt.o
14+
kvm-y += main.o
15+
kvm-y += mmu.o
16+
kvm-y += switch.o
17+
kvm-y += timer.o
18+
kvm-y += tlb.o
19+
kvm-y += vcpu.o
20+
kvm-y += vm.o
21+
22+
CFLAGS_exit.o += $(call cc-option,-Wno-override-init,)

0 commit comments

Comments
 (0)