mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Tiezhu Yang <yangtiezhu@loongson.cn>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Huacai Chen <chenhc@lemote.com>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>
Subject: Re: [PATCH v2 6/6] MIPS: Loongson64: Move decode_cpucfg() to loongson_regs.h
Date: Tue, 3 Nov 2020 13:33:13 +0800	[thread overview]
Message-ID: <e6354e46-648b-ccd1-c0ee-c20158ac8a8e@flygoat.com> (raw)
In-Reply-To: <1604373306-3599-7-git-send-email-yangtiezhu@loongson.cn>



在 2020/11/3 11:15, Tiezhu Yang 写道:
> 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 <yangtiezhu@loongson.cn>

Hi all,

Don't know if it's a good idea to move this piece of code around...
Also I do think loongson_regs.h should be a common header while
cpucfg_decode won't be reused else where.

But I do respect Thomas's decision if it's necessary.

Thanks

- Jiaxun

> ---
>
> 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 <asm/mach-loongson64/cpucfg-emul.h>
> +#include <asm/mach-loongson64/loongson_regs.h>
>   
>   /* 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 <loongson_regs.h>
> -
> -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)
>   {

      reply	other threads:[~2020-11-03  5:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  3:15 [PATCH v2 0/6] Modify some registers operations and move " Tiezhu Yang
2020-11-03  3:15 ` [PATCH v2 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3 Tiezhu Yang
2020-11-03  3:15 ` [PATCH v2 2/6] MIPS: Loongson64: Set the field ELPA of CP0_PAGEGRAIN only once Tiezhu Yang
2020-11-03  3:15 ` [PATCH v2 3/6] MIPS: Loongson64: Set IPI_Enable register per core by itself Tiezhu Yang
2020-11-03  3:15 ` [PATCH v2 4/6] MIPS: Loongson64: Add Mail_Send support for 3A4000+ CPU Tiezhu Yang
2020-11-03  3:15 ` [PATCH v2 5/6] MIPS: Loongson64: Make sure the PC address is correct when 3A4000+ CPU hotplug Tiezhu Yang
2020-11-03  5:28   ` Jiaxun Yang
2020-11-03  6:17     ` Tiezhu Yang
2020-11-03  3:15 ` [PATCH v2 6/6] MIPS: Loongson64: Move decode_cpucfg() to loongson_regs.h Tiezhu Yang
2020-11-03  5:33   ` Jiaxun Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e6354e46-648b-ccd1-c0ee-c20158ac8a8e@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=chenhc@lemote.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®