linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Yongcai Huang <anson.huang@nxp.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>
Subject: Re: [PATCH 3/3] ARM: imx: add SMP support for i.MX7D
Date: Fri, 26 Aug 2016 13:35:50 +0100	[thread overview]
Message-ID: <20160826123550.GQ1041@n2100.armlinux.org.uk> (raw)
In-Reply-To: <AM3PR04MB13154FA0116D397AABD75E10F5EC0@AM3PR04MB1315.eurprd04.prod.outlook.com>

On Fri, Aug 26, 2016 at 12:20:15PM +0000, Yongcai Huang wrote:
> > On Fri, Aug 26, 2016 at 07:12:51PM +0800, Anson Huang wrote:
> > > diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
> > > index 711dbbd..63af911 100644
> > > --- a/arch/arm/mach-imx/platsmp.c
> > > +++ b/arch/arm/mach-imx/platsmp.c
> > > @@ -60,8 +60,17 @@ static int imx_boot_secondary(unsigned int cpu,
> > > struct task_struct *idle)  static void __init imx_smp_init_cpus(void)
> > > {
> > >  	int i, ncores;
> > > +	unsigned long val, arch_type;
> > >
> > > -	ncores = scu_get_core_count(scu_base);
> > > +	asm volatile("mrc p15, 0, %0, c0, c0, 0" : "=r" (arch_type));
> > > +
> > > +	if (((arch_type >> 4) & 0xfff) == 0xc07) {
> > 
> > This is buggy.  Plus, we have macros for this.  Please use the macros in
> > asm/cputype.h to achieve these tests.
> 
> Thanks, I will use read_cpuid_id() API intead of putting asm code here.

Nope.  Do this:

	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A7) {

Because the part number field is defined by the implementer, so before
you can interpret the part number field, you have to first check who
has implemented the device.

That's exactly why these macros exist - to help you get these tests
correct, so when someone else releases an ARM core with the same value
in the part number field, we don't end up with a load of tests which
incorrectly matching.

While it may be unlikely that an iMX7 would end up with a non-ARM CPU,
that's no real excuse for avoiding using what's been provided for you,
especially when avoiding it causes issues for static analysis.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2016-08-26 12:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 11:12 [PATCH 0/3] Add SMP support for i.MX7D Anson Huang
2016-08-26 11:12 ` [PATCH 1/3] ARM: dts: imx7: support SMP boot up Anson Huang
2016-08-26 11:12 ` [PATCH 2/3] ARM: imx: add gpcv2 support Anson Huang
2016-08-26 11:17   ` Russell King - ARM Linux
2016-08-26 12:25     ` Yongcai Huang
2016-08-26 11:12 ` [PATCH 3/3] ARM: imx: add SMP support for i.MX7D Anson Huang
2016-08-26  8:59   ` Arnd Bergmann
2016-08-26 10:28     ` Yongcai Huang
2016-08-26 11:13   ` Russell King - ARM Linux
2016-08-26 12:20     ` Yongcai Huang
2016-08-26 12:35       ` Russell King - ARM Linux [this message]
2016-08-26 13:48       ` Arnd Bergmann
2016-08-26 13:00   ` kbuild test robot
2016-08-26 12:43 ` [PATCH 0/3] Add " Fabio Estevam
2016-08-26 13:02   ` Yongcai Huang

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=20160826123550.GQ1041@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=anson.huang@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    /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).