Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3530924ybl; Sun, 12 Jan 2020 20:41:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzvUoR9/uTGBBrfXyWvMGOCeeFAoRtl+/cAKtFZMy2lBYJOaVSUfREmdnvOJObv/58YwyS7 X-Received: by 2002:a05:6808:8ca:: with SMTP id k10mr10884321oij.164.1578890483283; Sun, 12 Jan 2020 20:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578890483; cv=none; d=google.com; s=arc-20160816; b=Mc9o83sgcX6xTXDCHaQY8ZVV1jkeJHnPq5GLsuEdH0jCu3Pr5y6m9rqJtU0vitRiNL /XEg1Kvlz7p1lRljYQzo5ri1dW/bxuna8PaL0tHBOI2MXohhzX1erjwn+QOIIxrX0VAZ XAS4XIc9XmVsQKkOkQNGjRDXU6PfRm2UUJti04Vu5aM1rAICdbZ37AAGv1VXcnc/JLTR XRdNavUCconvwk2ObKsi+fMNHYJfjbjpBQwzeqmo6dIMyoYp5jFDNUNyddvpAkLbb17q NKnJg6kPzXRv+4BI+3I2YgzJ9Q37GISUTe6aLg3dLB/5QA1wjwANJebzbXVqnF86DJUY FR3Q== 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=R0iH898MumkPh84lKY2o8raXFVnYH4K0CGesv2JvXhkdfvy5k9P06h7RBB8IDEpAOS EghOUMAcqDrKzYvoWA8DL/JNZY+rAtMET7ClMYCsJ7LG5SSx9+uA3ZmYndAYlUugTvWa +UZ8a+oIHekwPC9Muxy/zYWi0cAwyBtxoMunYXXGacmD4+nWxjXmkMi1joF6XrNMS4E5 DoCIZLh9bPoLDpu3jljBOpBWMig6OdDndiDid0o/pJoY5CYWhE/rDdtHsIIv4j3MYx9M WCXNJANjOg/sjPhxH8cTB+R4TQQU8cZavHZJcosBhJnUCXWyyLJn8uWelBCBwYb0jIR7 FD5A== 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 t14si6293395otp.210.2020.01.12.20.41.11; Sun, 12 Jan 2020 20:41:23 -0800 (PST) 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 S1733204AbgAMEjX (ORCPT + 99 others); Sun, 12 Jan 2020 23:39:23 -0500 Received: from mail.loongson.cn ([114.242.206.163]:54802 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733020AbgAMEjW (ORCPT ); Sun, 12 Jan 2020 23:39:22 -0500 Received: from localhost.localdomain.localdomain (unknown [222.209.11.32]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxD91s9BteOV0EAA--.4S4; Mon, 13 Jan 2020 12:39:10 +0800 (CST) From: Xing Li To: Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] KVM: MIPS: Support kvm modules autoprobed when startup system Date: Mon, 13 Jan 2020 12:39:08 +0800 Message-Id: <1578890348-2734-3-git-send-email-lixing@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1578890348-2734-1-git-send-email-lixing@loongson.cn> References: <1578890348-2734-1-git-send-email-lixing@loongson.cn> X-CM-TRANSID: AQAAf9DxD91s9BteOV0EAA--.4S4 X-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nIWIevJa73UjIFyTuYvjxUxNeoUUUUU 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