Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3983195pxf; Tue, 6 Apr 2021 05:22:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgMkTSXq0/6c0yrXu4MmPEE9y3lt2ggka6+fDpy/bLZbNnnGMBZLwhFWL7EqSZT4eJnV+e X-Received: by 2002:a6b:5811:: with SMTP id m17mr22798420iob.102.1617711769641; Tue, 06 Apr 2021 05:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617711769; cv=none; d=google.com; s=arc-20160816; b=yWR7uJ/cHKKz8LyWr5rsX8tvSXnbq08M6cpTM3hAU/aVrmuLZhAo4SuTiWg5gV8lzJ RTWuXPMMCPwErpm1ZazZnx1DxYmX2nBmMVy3HyOHXsLjKb/IBe3BJe7iyd19cpxf/8AB SwXfe/vondoUp2fH0dNS/ohSUZc4sEl/GvaEOcmWydqq3zlVjTkwSFexzAa3FXa5N7bc j+EDYCyStDqnN2oPFGwXyQF/EiuMeWxLWkxj/5q05U0VPVFIjt5vKLC1ahmhjrTW9R2F aM2DQVAH/PJHZhO5F7arZwcCIJjm0B1ton/xJlDp4urGhNLCf7uo34B5MVh4cEemmcXm DP6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=IvN3nX8vPfBlIObPPoJbVmKu3kpWcSBPspGGShZT73Y=; b=iz1YU0mn1or2iDB0szG4ucs7M9frVWWusoQuZeS1wuLmBUxIaTb2huhU3KfAfM0BSu bY8kqGSXAjADrd36AlCOvUAhNfnG6ZSUUQHfkoLcdb9ObOAwC3+fPSQ5Rxts9ldYBgHA V5qeqBEwg9WjjNJHR2yk7OqQJ97RhuBNsPkXcWPFO8vEBpfJCh5ZeoHDcOhDJo1+Kw9D NA4i9XiOjTlI4aV+dAFEuQWyESuFj/NDrHpQhEF4icH9/nKXqHQ2T2wmqQHnk/SCJ03b OSwz26VtESs3gsRAxnJ7imCJQL8K9rKNGZoMcyHxTfJGVH3XBqUFzrHjSfiRJ4+UI5U1 WkYw== 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 i8si18593468jaj.118.2021.04.06.05.22.36; Tue, 06 Apr 2021 05:22:49 -0700 (PDT) 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 S243076AbhDFBXH (ORCPT + 99 others); Mon, 5 Apr 2021 21:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235662AbhDFBXG (ORCPT ); Mon, 5 Apr 2021 21:23:06 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE08AC06174A; Mon, 5 Apr 2021 18:22:51 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 9A85B92009C; Tue, 6 Apr 2021 03:22:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 8CC6292009B; Tue, 6 Apr 2021 03:22:48 +0200 (CEST) Date: Tue, 6 Apr 2021 03:22:48 +0200 (CEST) From: "Maciej W. Rozycki" To: Ilya Lipnitskiy cc: Thomas Bogendoerfer , Wei Li , Tiezhu Yang , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Felix Fietkau Subject: Re: [PATCH] MIPS: add support for buggy MT7621S core detection In-Reply-To: <20210403061912.1012509-1-ilya.lipnitskiy@gmail.com> Message-ID: References: <20210403061912.1012509-1-ilya.lipnitskiy@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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