Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2073691ybp; Thu, 10 Oct 2019 01:42:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWEwTXIp1Skk5E1V5EnfLwFBUn7nILDL6MSsRKzXDqvZfqUMfUW4jehfNKSZ3a+oE/el1e X-Received: by 2002:a17:906:5a98:: with SMTP id l24mr7146310ejq.40.1570696951051; Thu, 10 Oct 2019 01:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570696951; cv=none; d=google.com; s=arc-20160816; b=gJBV6TKf1DVVYpSB/Ca79H2Nhd5OVpREKxRaAyFPJoAcHPMSco2Xoxthr7UAVPdZG8 cRXwie7HLgpDnIf1sGNrJ+BmuiQyq1PKqRa7LwYGyx/Gy0ojzWK3huSYFqESQl3WVWWr vUy72QjsCUGQiqTy0DDcIvNgb1DQ4i78sdW3xXs+w8/BcbImp/ujQUEHqyfR3Ujoze1x QmS2o4E9Ts/M4jKf77Qj1BfZLXKLWYaOcSL3TEu4t3gyxgvL5tQ9YbpQMLE5khpU6xXo xpzWhI8XSzKOnonMnw08cK/VSGKDvL9EM8IGKhcgZHlW51m4l2GD7BfIfvzUyPAJpmmH rIKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SAguuabbHDQ7hJF8gvmwqWXblIMZ81YIfj9lWuol0gE=; b=XT+mEoD+4DDKaH/SMwdIGlYetJj9Z4XJcYK5zqGHdOUGvB8Fbn4ExzSamKel25EBGv imHyYwc+NrGodUXrF1iL9J7RmS+BLMICb8XKH8CqX/Bm95xdOdo/0nYSWikQM1gUDsVO PhDGJRuuR8xBPbHyttIsTCgxpBtleyHiSiX0OxMQVQvuZpJ0lzdv2vN0KOkLwNoFC95f ARIQ8VCAqCRH7OheyE13Y8yXdS0rJZ36c10LrY2J9/Z2tD/9EmBZTBwMm9dFuGz1U12M j0dnvNE3c6w2rhQzIIi46Ld+JsLVo5TlYAjKkkDGITDzG6F7cTL7BZDijOyKZTQ18inJ bTLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oZjtaCne; 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 c9si2721902ejn.362.2019.10.10.01.42.07; Thu, 10 Oct 2019 01:42:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=oZjtaCne; 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 S2387890AbfJJIjc (ORCPT + 99 others); Thu, 10 Oct 2019 04:39:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:43062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387430AbfJJIjb (ORCPT ); Thu, 10 Oct 2019 04:39:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9EFCC20B7C; Thu, 10 Oct 2019 08:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696770; bh=TCv7P4P55wOWxJe1zl0BvFhLRs/OUW8MmTl9rU+rGi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZjtaCneTIN+ppfss/xajn3f2kp45FuI8ZDsqJ90b3sKgGKq1kJGUzxhR8+UNJ6Ba WKkJry7xcUC9f9rOsaVstl0Na0enEoQqCsMmDFOv1UYoTl4BKlbmhjCvPXZNxcESTK SOYwlprS4BXEZj4zaYduSPN/eh7hYc9XG/UB6EK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiaxun Yang , Huacai Chen , Yunqiang Su , Paul Burton , linux-mips@vger.kernel.org Subject: [PATCH 5.3 047/148] MIPS: Treat Loongson Extensions as ASEs Date: Thu, 10 Oct 2019 10:35:08 +0200 Message-Id: <20191010083613.994151814@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiaxun Yang commit d2f965549006acb865c4638f1f030ebcefdc71f6 upstream. Recently, binutils had split Loongson-3 Extensions into four ASEs: MMI, CAM, EXT, EXT2. This patch do the samething in kernel and expose them in cpuinfo so applications can probe supported ASEs at runtime. Signed-off-by: Jiaxun Yang Cc: Huacai Chen Cc: Yunqiang Su Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: Paul Burton Cc: linux-mips@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/mips/include/asm/cpu-features.h | 16 ++++++++++++++++ arch/mips/include/asm/cpu.h | 4 ++++ arch/mips/kernel/cpu-probe.c | 6 ++++++ arch/mips/kernel/proc.c | 4 ++++ 4 files changed, 30 insertions(+) --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h @@ -397,6 +397,22 @@ #define cpu_has_dsp3 __ase(MIPS_ASE_DSP3) #endif +#ifndef cpu_has_loongson_mmi +#define cpu_has_loongson_mmi __ase(MIPS_ASE_LOONGSON_MMI) +#endif + +#ifndef cpu_has_loongson_cam +#define cpu_has_loongson_cam __ase(MIPS_ASE_LOONGSON_CAM) +#endif + +#ifndef cpu_has_loongson_ext +#define cpu_has_loongson_ext __ase(MIPS_ASE_LOONGSON_EXT) +#endif + +#ifndef cpu_has_loongson_ext2 +#define cpu_has_loongson_ext2 __ase(MIPS_ASE_LOONGSON_EXT2) +#endif + #ifndef cpu_has_mipsmt #define cpu_has_mipsmt __isa_lt_and_ase(6, MIPS_ASE_MIPSMT) #endif --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h @@ -433,5 +433,9 @@ enum cpu_type_enum { #define MIPS_ASE_MSA 0x00000100 /* MIPS SIMD Architecture */ #define MIPS_ASE_DSP3 0x00000200 /* Signal Processing ASE Rev 3*/ #define MIPS_ASE_MIPS16E2 0x00000400 /* MIPS16e2 */ +#define MIPS_ASE_LOONGSON_MMI 0x00000800 /* Loongson MultiMedia extensions Instructions */ +#define MIPS_ASE_LOONGSON_CAM 0x00001000 /* Loongson CAM */ +#define MIPS_ASE_LOONGSON_EXT 0x00002000 /* Loongson EXTensions */ +#define MIPS_ASE_LOONGSON_EXT2 0x00004000 /* Loongson EXTensions R2 */ #endif /* _ASM_CPU_H */ --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1573,6 +1573,8 @@ static inline void cpu_probe_legacy(stru __cpu_name[cpu] = "ICT Loongson-3"; set_elf_platform(cpu, "loongson3a"); set_isa(c, MIPS_CPU_ISA_M64R1); + c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | + MIPS_ASE_LOONGSON_EXT); break; case PRID_REV_LOONGSON3B_R1: case PRID_REV_LOONGSON3B_R2: @@ -1580,6 +1582,8 @@ static inline void cpu_probe_legacy(stru __cpu_name[cpu] = "ICT Loongson-3"; set_elf_platform(cpu, "loongson3b"); set_isa(c, MIPS_CPU_ISA_M64R1); + c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | + MIPS_ASE_LOONGSON_EXT); break; } @@ -1946,6 +1950,8 @@ static inline void cpu_probe_loongson(st decode_configs(c); c->options |= MIPS_CPU_FTLB | MIPS_CPU_TLBINV | MIPS_CPU_LDPTE; c->writecombine = _CACHE_UNCACHED_ACCELERATED; + c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | + MIPS_ASE_LOONGSON_EXT | MIPS_ASE_LOONGSON_EXT2); break; default: panic("Unknown Loongson Processor ID!"); --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -124,6 +124,10 @@ static int show_cpuinfo(struct seq_file if (cpu_has_eva) seq_printf(m, "%s", " eva"); if (cpu_has_htw) seq_printf(m, "%s", " htw"); if (cpu_has_xpa) seq_printf(m, "%s", " xpa"); + if (cpu_has_loongson_mmi) seq_printf(m, "%s", " loongson-mmi"); + if (cpu_has_loongson_cam) seq_printf(m, "%s", " loongson-cam"); + if (cpu_has_loongson_ext) seq_printf(m, "%s", " loongson-ext"); + if (cpu_has_loongson_ext2) seq_printf(m, "%s", " loongson-ext2"); seq_printf(m, "\n"); if (cpu_has_mmips) {