Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1232513ybh; Thu, 12 Mar 2020 20:15:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtNyVXjTl95I9rmJ1lAP+HndcZqkBMAm4gQah77Pji55kQRHLvySGWJ8Qf6s5WbSzA+Xa/n X-Received: by 2002:aca:4e08:: with SMTP id c8mr5347536oib.143.1584069356677; Thu, 12 Mar 2020 20:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584069356; cv=none; d=google.com; s=arc-20160816; b=u5/EyiezboZMWbXBvPo+dbqaSiaj7bxgrzsph1mxiyPhcnw+EF2AUb5gxvt9Zy+NvI 0Y0ZaxajXYq0oWtFifYXUfdMQ92E8lSi0maOEM1z8ApjbVzPkQG8kdT/ZwF5ky8wQHyS /XWptUehIvrezONvRKF3sVVr6zBrqXzarrT81QCoRT8zQ1lmpfuP2CMttQj692SVxBiP DROMbArVUe6L0qBL4CATLu0we6B8GoDUhXm1kz5iMvm5FOwvz20GG9XpSvHhsrsyGz4x VWQ+PJcvqyToEw5rEZv2avJcFu2TFs9k85L9X400lWQcjeTkhynTKmq8tuFtIBlRrJGT uKKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=f79TcaUT4cnab6pF2RosLCK92s4TqrF4f3c4imFE2/4=; b=HMXuc/NDafzjMHtBi+sOI9O4wYMoBrvYKjnr4CJIpovrZ5P6Ir9f+SKoAPep4U+Mab YxZJWv5KbLSuPAktmU57y6vHpG7vHU/oYcYgFQj4xGQmB/ApXKQQPO0FN8ktJeAZYVrY 3TE3PMpThR7+GTKuPll6/wEke4YqWiPcqxy5AXA0wuq42VLoEQVXAt+KZv6Jnj/R6vC+ 6hIEl8p1EnhVpDUc/CRDq0KITcfFrd3hi6pbRdEHzVZw5irQwReXaEqs0hW4PAqemR/u IHhbn7AJGUKk4MqGvCZDFimcpTcr8VF4pf+QVpzuYKNYDS0qjKAl1EMRXN63W0eOKO9a vm2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si3878346otk.120.2020.03.12.20.15.44; Thu, 12 Mar 2020 20:15:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbgCMDO2 (ORCPT + 99 others); Thu, 12 Mar 2020 23:14:28 -0400 Received: from mail.loongson.cn ([114.242.206.163]:55504 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726377AbgCMDO2 (ORCPT ); Thu, 12 Mar 2020 23:14:28 -0400 Received: from localhost.localdomain.localdomain (unknown [125.69.47.232]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxn9uK+mpe1gcaAA--.45S4; Fri, 13 Mar 2020 11:14:20 +0800 (CST) From: Xing Li To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, maobibo@loongson.cn, chenhc@lemote.com, jiaxun.yang@flygoat.com Subject: [PATCH v2 Resend 3/3] KVM: MIPS: Support kvm modules autoprobed when startup system Date: Fri, 13 Mar 2020 11:14:17 +0800 Message-Id: <1584069257-30896-3-git-send-email-lixing@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584069257-30896-1-git-send-email-lixing@loongson.cn> References: <1584069257-30896-1-git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x4A2jsIE14v26r1j6r4UMIIF0xvEx4 A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU5pnQUUUUU= X-CM-SenderInfo: pol0x03j6o00pqjv00gofq/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the module_init of kvm_mips_init cannot force the kvm modules insmod when startup system. Add new feature CPU_MIPS_VZ in elf_hwcap to support KVM auto probe when hardware virtualization supported. Signed-off-by: Xing Li --- arch/mips/include/uapi/asm/hwcap.h | 1 + arch/mips/kernel/cpu-probe.c | 4 +++- arch/mips/kvm/mips.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/uapi/asm/hwcap.h b/arch/mips/include/uapi/asm/hwcap.h index 1ade1da..9e66509 100644 --- a/arch/mips/include/uapi/asm/hwcap.h +++ b/arch/mips/include/uapi/asm/hwcap.h @@ -17,5 +17,6 @@ #define HWCAP_LOONGSON_MMI (1 << 11) #define HWCAP_LOONGSON_EXT (1 << 12) #define HWCAP_LOONGSON_EXT2 (1 << 13) +#define HWCAP_MIPS_VZ (1 << 14) #endif /* _UAPI_ASM_HWCAP_H */ diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index c543326..b305269 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -2242,8 +2242,10 @@ void cpu_probe(void) if (cpu_has_loongson_ext2) elf_hwcap |= HWCAP_LOONGSON_EXT2; - if (cpu_has_vz) + if (cpu_has_vz) { cpu_probe_vz(c); + elf_hwcap |= HWCAP_MIPS_VZ; + } cpu_probe_vmbits(c); diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 1109924..1da5df3 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -1742,7 +1743,7 @@ static void __exit kvm_mips_exit(void) unregister_die_notifier(&kvm_mips_csr_die_notifier); } -module_init(kvm_mips_init); +module_cpu_feature_match(MIPS_VZ, kvm_mips_init); module_exit(kvm_mips_exit); EXPORT_TRACEPOINT_SYMBOL(kvm_exit); -- 2.1.0