Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1833000rwd; Fri, 9 Jun 2023 02:54:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65EFIFAMcGjq5B/3bjOe1U+8vdTaLZz8Qnp9w/u5eft3YS1mgnQKfc3HWBYEYFlc/IusBH X-Received: by 2002:a05:6a00:138f:b0:663:716e:e752 with SMTP id t15-20020a056a00138f00b00663716ee752mr938489pfg.26.1686304490735; Fri, 09 Jun 2023 02:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686304490; cv=none; d=google.com; s=arc-20160816; b=JyqQ0bj+DiM7sh7SzyOEJnSBW6w7ReZxv1Py5+el0p4kZ/XCAIOGjQhVc5N60KOs1H z8Si/Zzc6LsmzNuhosNIebZsEiTFoP84kbOjwH+LWehF4v7HnSRykHq/47eatDPKJ5WI vDTWl58cbAJXgt+OdOlxeNpdvOJl5XfnEo7Z5ME0a0PYJwq3+/9kKd3Dd4a4rBpuXrcI acC0p6Ud/etV8cBSIKvZ5MtZdrmjnRqzwRCDeY1YBS9TxUAZiXoqaiLWafKVo9CYsOag 5fgsyAKmgDsvTce/9pUlX+1ggaNkzr/R7eogOYpu27SlwmvEIl+GOR8jMf4j2G/qVm/M LgLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ASZLi7z0RI0kH+VUK311P3o7l/P+vBKAXUSmVm9KWsA=; b=qLnMqKkUskDg64ulToXSpHUrpMLOcn1bu6jq1tI0dj6TiT/zpW/C5a90VZH9HfgPsf ypGylP5bRyRDt+aZlhOfgAKFUYkdjcN9oqZ4GQQev+QqWb+kyPF8qH8TTheA1+jsmckV /peQX8TCaIcFt2HiE72XjHqr8MAE43EJZg+YuL/fHtxnzyj/j/fcGQJpTbSCV4vrCptV 1lNKNUnuJUJ3vb+/z93je4pLx7bsfokrnHW/rYCmv4D2lXko3+49GrMSovVrPqNkfD8e tcCSNuaAdFYX1OSFowHQGhBus7CdC0OE33ZqYRi+bNXYcjintYE0yP68rtyhjgwz3Um2 zHag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a6566c5000000b0053fa62fc004si2423995pgw.33.2023.06.09.02.54.39; Fri, 09 Jun 2023 02:54:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241727AbjFIJjU (ORCPT + 99 others); Fri, 9 Jun 2023 05:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241777AbjFIJjA (ORCPT ); Fri, 9 Jun 2023 05:39:00 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E75F85BA3; Fri, 9 Jun 2023 02:33:33 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8AxnOod7IJkAv4AAA--.2973S3; Fri, 09 Jun 2023 17:08:45 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxFOQQ7IJkzHQKAA--.31790S30; Fri, 09 Jun 2023 17:08:44 +0800 (CST) From: Tianrui Zhao To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Huacai Chen , WANG Xuerui , Greg Kroah-Hartman , loongarch@lists.linux.dev, Jens Axboe , Mark Brown , Alex Deucher , Oliver Upton , maobibo@loongson.cn, Xi Ruoyao , zhaotianrui@loongson.cn, tangyouling@loongson.cn, kernel test robot Subject: [PATCH v13 28/30] LoongArch: KVM: Enable kvm config and add the makefile Date: Fri, 9 Jun 2023 17:08:30 +0800 Message-Id: <20230609090832.2131037-29-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230609090832.2131037-1-zhaotianrui@loongson.cn> References: <20230609090832.2131037-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxFOQQ7IJkzHQKAA--.31790S30 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable LoongArch kvm config and add the makefile to support build kvm module. Reviewed-by: Bibo Mao Reported-by: kernel test robot Link: https://lore.kernel.org/oe-kbuild-all/202304131526.iXfLaVZc-lkp@intel.com/ Signed-off-by: Tianrui Zhao --- arch/loongarch/Kbuild | 1 + arch/loongarch/Kconfig | 2 ++ arch/loongarch/configs/loongson3_defconfig | 2 ++ arch/loongarch/kvm/Kconfig | 38 ++++++++++++++++++++++ arch/loongarch/kvm/Makefile | 22 +++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 arch/loongarch/kvm/Kconfig create mode 100644 arch/loongarch/kvm/Makefile diff --git a/arch/loongarch/Kbuild b/arch/loongarch/Kbuild index b01f5cdb27e0..40be8a1696f9 100644 --- a/arch/loongarch/Kbuild +++ b/arch/loongarch/Kbuild @@ -2,6 +2,7 @@ obj-y += kernel/ obj-y += mm/ obj-y += net/ obj-y += vdso/ +obj-y += kvm/ # for cleaning subdir- += boot diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index d38b066fc931..16ddf4f6f9bd 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -113,6 +113,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 @@ -604,3 +605,4 @@ source "drivers/acpi/Kconfig" endmenu source "drivers/firmware/Kconfig" +source "arch/loongarch/kvm/Kconfig" diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index 6cd26dd3c134..3c0cbe6ad08f 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -63,6 +63,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_MODULES=y CONFIG_MODULE_FORCE_LOAD=y CONFIG_MODULE_UNLOAD=y diff --git a/arch/loongarch/kvm/Kconfig b/arch/loongarch/kvm/Kconfig new file mode 100644 index 000000000000..8a999b4c0232 --- /dev/null +++ b/arch/loongarch/kvm/Kconfig @@ -0,0 +1,38 @@ +# 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 HAVE_KVM + select MMU_NOTIFIER + select ANON_INODES + select PREEMPT_NOTIFIERS + select KVM_MMIO + select KVM_GENERIC_DIRTYLOG_READ_PROTECT + select HAVE_KVM_VCPU_ASYNC_IOCTL + select HAVE_KVM_EVENTFD + select SRCU + help + Support hosting virtualized guest machines using hardware + virtualization extensions. You will need a fairly 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 index 000000000000..2335e873a6ef --- /dev/null +++ b/arch/loongarch/kvm/Makefile @@ -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 += main.o +kvm-y += vm.o +kvm-y += vmid.o +kvm-y += tlb.o +kvm-y += mmu.o +kvm-y += vcpu.o +kvm-y += exit.o +kvm-y += interrupt.o +kvm-y += timer.o +kvm-y += switch.o +kvm-y += csr_ops.o -- 2.39.1