Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp441692ybl; Fri, 10 Jan 2020 01:09:57 -0800 (PST) X-Google-Smtp-Source: APXvYqz3gDSa1C4gPSikDre1P+sfYA3DKnSaPY4eix63IFg6Xp8flulTQH+/erAVVj/fFYNUXbMm X-Received: by 2002:a9d:674f:: with SMTP id w15mr1724653otm.243.1578647397259; Fri, 10 Jan 2020 01:09:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578647397; cv=none; d=google.com; s=arc-20160816; b=kyjwwzwKciJARGOUAYYQ5pfuLVUP+EELorQjGEHS/JE3TiARMxC3HemCI1w6hFhY9e 48qAeXQ9E2cDIGe/6UFdBOrSVqMmF8woOU/kezOTTuRGzWk57Ii5PMpZG0/0SunygJzI YOdKJ3GSEmN/YJtW72W7HLrJuwsPkZt0BUyniSCfeqTRvBY2XrqU8+1cm6KV9YnY3cdm uwksXK9RJ8qPeHwmqQYS4peQ40cAuI4ZtsTNVbP85C3NfV7siEFqri3uTN0/JYHhHCpw r5iXUgMcPS6KEBDikTh4NKbcJ4H9InUd7Cym/jO8EJDA2CrxQ2iRvimWIbXB+m1EOd02 nxFw== 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=qPbY0IsOmYImPqkHC6hdxJNGx4W6IRsAilllB1liDs93nkbssq5UiEHsf6OpcKSNC3 X+TCGS5m/IxYZP8j0XV2IGnidD3ptkRmkKHZVSBSn0qyqYk5Fk5bwUSrisZwLD6FBJxq nOw4jY7VOtnSvCf5S8NqOsS2zRhhCpIJ8icdX5sWcfS4g++xD0XKhRf1/KomkoGWWiyu 31lc5Jf+ZkCS9+mmI3kEz6rfkgdfOXP8ZL8zXNZnlvP6ixi7eysBMz3Y1dG0RniUveTr 5Tw7AD9Go+wNuJbTqMJyeVHiGeJxBTdoGOoh+h0EeZ+s2RzdKElbG/8TP5qVd6QfUVkM LZAA== 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 25si684066oiz.230.2020.01.10.01.09.46; Fri, 10 Jan 2020 01:09:57 -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 S1727218AbgAJJIt (ORCPT + 99 others); Fri, 10 Jan 2020 04:08:49 -0500 Received: from mail.loongson.cn ([114.242.206.163]:53784 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727167AbgAJJIs (ORCPT ); Fri, 10 Jan 2020 04:08:48 -0500 Received: from localhost.localdomain.localdomain (unknown [182.149.160.139]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxL2oYPxheAPICAA--.2S4; Fri, 10 Jan 2020 17:08:42 +0800 (CST) From: Xing Li To: Ralf Baechle , Paul Burton Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] KVM: MIPS: Support kvm modules autoprobed when startup system Date: Fri, 10 Jan 2020 17:08:40 +0800 Message-Id: <1578647320-14391-3-git-send-email-lixing@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1578647320-14391-1-git-send-email-lixing@loongson.cn> References: <1578647320-14391-1-git-send-email-lixing@loongson.cn> X-CM-TRANSID: AQAAf9DxL2oYPxheAPICAA--.2S4 X-Coremail-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a7IU8LqXPUUUUU== 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