linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Florian Fainelli <f.fainelli@gmail.com>, linux-kernel@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	"kernelci.org bot" <bot@kernelci.org>,
	wahrenst@gmx.net
Subject: Re: [PATCH] ARM: dt: check MPIDR on MP devices built without SMP
Date: Thu, 03 Oct 2019 21:39:38 +0200	[thread overview]
Message-ID: <2af0a5ad604064d8fcf9febce72f0c23f1a1a1db.camel@suse.de> (raw)
In-Reply-To: <17976e82-04da-d22d-5779-f50db63f98a2@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

On Thu, 2019-10-03 at 11:08 -0700, Florian Fainelli wrote:
> On 10/2/19 4:45 AM, Nicolas Saenz Julienne wrote:
> > Currently, in arm_dt_init_cpu_maps(), the hwid of the boot CPU is read
> > from MPIDR on SMP devices and set to 0 for non SMP. This value is then
> > matched with the DT cpu nodes' reg property in order to find the boot
> > CPU in DT.
> 
> The code you change is about the "mpidr" variable, yet in your commit
> message you refer to "hwid", that is a tad confusing for the reader.

Sorry, it's indeed pretty confusing. I'll send a new version with a fixed
description if there is no major push back.

> > On MP devices build without SMP the cpu DT node contains the expected
> > MPIDR yet the hwid is set to 0. With this the function fails to match
> > the cpus and uses the default CPU logical map. Making it impossible to
> > get the CPU's DT node further down the line. This causes issues with
> > cpufreq-dt, as it triggers warnings when not finding a suitable DT node
> > on CPU0.
> > 
> > Change the way we choose whether to get MPIDR or not. Instead of
> > depending on SMP check the number of CPUs defined in DT. Anything > 1
> > means MPIDR will be available.
> 
> Except if someone accidentally wrote their Device Tree such as to have >
> 1 CPU nodes, yet the CPU is not MP capable and reading the MPIDR
> register does return the expected value, but that is wrong anyway.

An UP device will most likely not have a MPIDR. That said I'm not sure this is
always true. As per ARM1176JZ's TRM[1], the RPi1 CPU, if one was to get the
MPIDR it would raise an undefined exception.

The way I see it's an acceptable outcome as the DT is clearly wrong.

Regarda,
Nicolas

[1] See 3.1.10 Use of the system control coprocessor in
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0333h/DDI0333H_arm1176jzs_r0p7_trm.pdf:

	"Attempting to read from a nonreadable register, or to write to a
	nonwriteable register causes Undefined exceptions."


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-10-03 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 11:45 [PATCH] ARM: dt: check MPIDR on MP devices built without SMP Nicolas Saenz Julienne
2019-10-03 17:28 ` Stefan Wahren
2019-10-03 18:08 ` Florian Fainelli
2019-10-03 19:39   ` Nicolas Saenz Julienne [this message]
2019-10-03 23:47     ` Florian Fainelli
2019-10-04  8:36       ` Nicolas Saenz Julienne

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=2af0a5ad604064d8fcf9febce72f0c23f1a1a1db.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=bot@kernelci.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=wahrenst@gmx.net \
    /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).