linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Wei Li <liwei391@huawei.com>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Felix Fietkau <nbd@nbd.name>
Subject: Re: [PATCH] MIPS: add support for buggy MT7621S core detection
Date: Tue, 6 Apr 2021 03:22:48 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2104060311490.65251@angie.orcam.me.uk> (raw)
In-Reply-To: <20210403061912.1012509-1-ilya.lipnitskiy@gmail.com>

On Fri, 2 Apr 2021, Ilya Lipnitskiy wrote:

> diff --git a/arch/mips/include/asm/bugs.h b/arch/mips/include/asm/bugs.h
> index d72dc6e1cf3c..d32f0c4e61f7 100644
> --- a/arch/mips/include/asm/bugs.h
> +++ b/arch/mips/include/asm/bugs.h
> @@ -50,4 +51,21 @@ static inline int r4k_daddiu_bug(void)
>  	return daddiu_bug != 0;
>  }
>  
> +static inline void cm_gcr_pcores_bug(unsigned int *ncores)
> +{
> +	struct cpulaunch *launch;
> +
> +	if (!IS_ENABLED(CONFIG_SOC_MT7621) || !ncores)
> +		return;
> +
> +	/*
> +	 * Ralink MT7621S SoC is single core, but GCR_CONFIG always reports 2 cores.

 Overlong line.

> diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
> index bcd6a944b839..e1e9c11e8a7c 100644
> --- a/arch/mips/kernel/smp-cps.c
> +++ b/arch/mips/kernel/smp-cps.c
> @@ -60,6 +61,7 @@ static void __init cps_smp_setup(void)
>  		pr_cont("{");
>  
>  		ncores = mips_cps_numcores(cl);
> +		cm_gcr_pcores_bug(&ncores);
>  		for (c = 0; c < ncores; c++) {
>  			core_vpes = core_vpe_count(cl, c);
>  
> @@ -170,6 +172,7 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
>  
>  	/* Allocate core boot configuration structs */
>  	ncores = mips_cps_numcores(0);
> +	cm_gcr_pcores_bug(&ncores);

 Why called at each `mips_cps_numcores' call site rather than within the 
callee?  Also weird inefficient interface: why isn't `ncores' passed by 
value for a new value to be returned?

  Maciej

  reply	other threads:[~2021-04-06  1:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-03  6:19 [PATCH] MIPS: add support for buggy MT7621S core detection Ilya Lipnitskiy
2021-04-06  1:22 ` Maciej W. Rozycki [this message]
2021-04-06  1:54   ` Ilya Lipnitskiy
2021-04-07 13:49     ` Maciej W. Rozycki
2021-04-07 18:49       ` Ilya Lipnitskiy
2021-06-25 10:54         ` Strontium
2021-04-06  4:23   ` [PATCH v2] " Ilya Lipnitskiy
2021-04-07 13:52     ` Maciej W. Rozycki
2021-04-07 20:07       ` [PATCH v3] " Ilya Lipnitskiy
2021-04-12 15:03         ` Thomas Bogendoerfer

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=alpine.DEB.2.21.2104060311490.65251@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=ilya.lipnitskiy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=nbd@nbd.name \
    --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;
as well as URLs for NNTP newsgroup(s).