Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp211049pxb; Mon, 2 Nov 2020 19:17:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMcRRFJep2GqwzN6m6GrKL2A/o54RIIojzC9ktMXSNW6LX5RDqqrxWt718Z4xtwsEyGUkG X-Received: by 2002:a17:906:4d03:: with SMTP id r3mr17074259eju.364.1604373440841; Mon, 02 Nov 2020 19:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604373440; cv=none; d=google.com; s=arc-20160816; b=gKvkZWB+L6odkHO0vPLfdGg5WFy22jsdVcLU3aqdZ5RmPe4+Xx6YcZemsNl4oW2dCk olFK9xNX2b3XT3ln1D5+0dWtzCEWata73nntPnELxtz442H6kjjtQy3OEmOTdD7Fiwif J4TjbdNaL92lBMwlAKPr/ycVsgxocGtPnnjPcKC/Erb+60HQAvMsS35Unj/MS7Sq7vfk Ps/HZh1BYxeOCrjfAWJ9eYMpBBPKItFD5pVZBdtD5rMm3mRZi09BxS2V8R7w7Ccbn0Bi y6l7JCndpUBktuBsJ/IrJHKUsCNKvtLsCvs5E5huclqivNU0pfNQbEHKW1Qr8rsbBlgN 5j3g== 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=yYVGvdTmYNHU+nfj3oLDnDSr7hS5SQ6ny1uqphJcEvE=; b=BCO8BGpeY5kBCc0c1VSVubDKB9jX+J34/br+mP5KAaiQw/d/iANu1nZHWEhqt+DOhc B5xjYgflhIM+JJQwn2OK2KCogATevErk8SfdQHi0R8Vop2Rfwu++fVrNdiH6539PHW7E eRRkk1MY322y+CT+e3oszQ+4DBqSaPBzwtOniPEV4x9bA1CGDrNHB7RqvEK/xICOLzXC 2Fu9V52rAicUvQ7IPiunsEo+H8tcm6dl+lMBlt4RGnfJZml4jYff7eJjbrdegxIiFeiR iCh+Iu8jjcosYzDX0CTQ7+o/jexjqg5UPpQnu6Uaf/EGpcQNEb9tu7PnzHa80ZdfItni +nHg== 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 m16si2069538ejc.357.2020.11.02.19.16.58; Mon, 02 Nov 2020 19:17:20 -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 S1727385AbgKCDP1 (ORCPT + 99 others); Mon, 2 Nov 2020 22:15:27 -0500 Received: from mail.loongson.cn ([114.242.206.163]:47118 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727139AbgKCDPW (ORCPT ); Mon, 2 Nov 2020 22:15:22 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx7387y6BfU3sEAA--.3657S8; Tue, 03 Nov 2020 11:15:17 +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 v2 6/6] MIPS: Loongson64: Move decode_cpucfg() to loongson_regs.h Date: Tue, 3 Nov 2020 11:15:06 +0800 Message-Id: <1604373306-3599-7-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1604373306-3599-1-git-send-email-yangtiezhu@loongson.cn> References: <1604373306-3599-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9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c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU3fHbUUUUU= 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 .../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