Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp306233pxb; Mon, 2 Nov 2020 23:15:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoKZyc+10y6WKW0TP087YQWBOkrv9hV5Hop3c1BeGGsyirs+A4maA2QL3GWA3ohkfBma5z X-Received: by 2002:a17:906:cb2:: with SMTP id k18mr19523373ejh.71.1604387735868; Mon, 02 Nov 2020 23:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604387735; cv=none; d=google.com; s=arc-20160816; b=OXsvtHOP9MOhaAtd8+rfnO8twvpxbxtxq8gge2yw45d48ky0fy2rwp7LLZstl6xFIm PsoniKKvBcmsvBYDoKQQe20GjZ4H3s9KebBaGqJnrLWhOj6Q5bMTe+Ui8vhF4NoT0pAf 0igOHqTg6CS96rNLeBGTdXwi9OSxLVzsXUB8CBiyI+Bww6Bsuli3Q6nCu5/MkvTGaBj1 W2mCb8upOyyEIVunoEWWyN+x52/C2xhGXz3K46uDIGbg9IU0nPp6KKhbIu8Mn6sI4nHp TKZ3ab1yP1NFDXpsjSwtprmkk8mrm4GeAJSr5CjmLgMG5oOuABDm0gKUEpXaifviySST 1w0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=9smNatfdfvgi80pI3Dl3lP5nnOYXzfgdOaekb/GMweo=; b=bmfosiKnM1M07dThFpwXW4ITqaZTmSK6QjQQWHigi/B9uG/zZkOGkxe3KZChMN0Vi+ ZbABKRDU/oDRLa/8y0V0h6j1sPUwIkwySQEiMwe6us9Fc6MUQ5UtnIA5q5TWik1VhWCh r8nKwYrzGaajJf5Iuqmrg21px2anzM96lKgFe4VSRIEntSCXRxegR/6B/TPMy+bpxRvl 5WeSG4xcE7iil/6A2pE1Z/sQR8SA3GnFqSYgeej9eMrcF/QXqPB8/DL9/SvBEejfF0EQ 0vsvwibYGS55lepRdLGopNoXXx783biZxsuIM1IkaJQtwdBmYVXi+Rr7R37x7kIzo0yj C4Gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si12118408ejq.58.2020.11.02.23.15.13; Mon, 02 Nov 2020 23:15:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727989AbgKCHM2 (ORCPT + 99 others); Tue, 3 Nov 2020 02:12:28 -0500 Received: from mail.loongson.cn ([114.242.206.163]:37312 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727960AbgKCHMT (ORCPT ); Tue, 3 Nov 2020 02:12:19 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx79PGAqFfIKEEAA--.12977S8; Tue, 03 Nov 2020 15:12:14 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer , Huacai Chen , Jiaxun Yang Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li Subject: [PATCH v3 6/6] MIPS: Loongson64: Move decode_cpucfg() to loongson_regs.h Date: Tue, 3 Nov 2020 15:12:05 +0800 Message-Id: <1604387525-23400-7-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1604387525-23400-1-git-send-email-yangtiezhu@loongson.cn> References: <1604387525-23400-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf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4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVj vjDU0xZFpf9x0JUasjbUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since decode_cpucfg() is only used for Loongson64, just move it to loongson_regs.h to avoid the pollution of common code with #ifdef CONFIG_CPU_LOONGSON64. Signed-off-by: Tiezhu Yang --- v2: No changes v3: No changes .../include/asm/mach-loongson64/loongson_regs.h | 24 +++++++++++++++++ arch/mips/kernel/cpu-probe.c | 31 +--------------------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/arch/mips/include/asm/mach-loongson64/loongson_regs.h b/arch/mips/include/asm/mach-loongson64/loongson_regs.h index 1659935..2d469d6 100644 --- a/arch/mips/include/asm/mach-loongson64/loongson_regs.h +++ b/arch/mips/include/asm/mach-loongson64/loongson_regs.h @@ -129,6 +129,30 @@ static inline u32 read_cpucfg(u32 reg) #define LOONGSON_CFG7_GCCAEQRP BIT(0) #define LOONGSON_CFG7_UCAWINP BIT(1) +static inline void decode_cpucfg(struct cpuinfo_mips *c) +{ + u32 cfg1 = read_cpucfg(LOONGSON_CFG1); + u32 cfg2 = read_cpucfg(LOONGSON_CFG2); + u32 cfg3 = read_cpucfg(LOONGSON_CFG3); + + if (cfg1 & LOONGSON_CFG1_MMI) + c->ases |= MIPS_ASE_LOONGSON_MMI; + + if (cfg2 & LOONGSON_CFG2_LEXT1) + c->ases |= MIPS_ASE_LOONGSON_EXT; + + if (cfg2 & LOONGSON_CFG2_LEXT2) + c->ases |= MIPS_ASE_LOONGSON_EXT2; + + if (cfg2 & LOONGSON_CFG2_LSPW) { + c->options |= MIPS_CPU_LDPTE; + c->guest.options |= MIPS_CPU_LDPTE; + } + + if (cfg3 & LOONGSON_CFG3_LCAMP) + c->ases |= MIPS_ASE_LOONGSON_CAM; +} + static inline bool cpu_has_csr(void) { if (cpu_has_cfg()) diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index e685369..1fa2c8b 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -31,6 +31,7 @@ #include "fpu-probe.h" #include +#include /* Hardware capabilities */ unsigned int elf_hwcap __read_mostly; @@ -1692,33 +1693,6 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) } } -#ifdef CONFIG_CPU_LOONGSON64 -#include - -static inline void decode_cpucfg(struct cpuinfo_mips *c) -{ - u32 cfg1 = read_cpucfg(LOONGSON_CFG1); - u32 cfg2 = read_cpucfg(LOONGSON_CFG2); - u32 cfg3 = read_cpucfg(LOONGSON_CFG3); - - if (cfg1 & LOONGSON_CFG1_MMI) - c->ases |= MIPS_ASE_LOONGSON_MMI; - - if (cfg2 & LOONGSON_CFG2_LEXT1) - c->ases |= MIPS_ASE_LOONGSON_EXT; - - if (cfg2 & LOONGSON_CFG2_LEXT2) - c->ases |= MIPS_ASE_LOONGSON_EXT2; - - if (cfg2 & LOONGSON_CFG2_LSPW) { - c->options |= MIPS_CPU_LDPTE; - c->guest.options |= MIPS_CPU_LDPTE; - } - - if (cfg3 & LOONGSON_CFG3_LCAMP) - c->ases |= MIPS_ASE_LOONGSON_CAM; -} - static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) { decode_configs(c); @@ -1787,9 +1761,6 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) break; } } -#else -static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) { } -#endif static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) { -- 2.1.0