From: daniel.thompson@linaro.org (Daniel Thompson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] irqchip/gic: Identify and report any reserved SGI IDs
Date: Fri, 18 Dec 2015 11:29:18 +0000 [thread overview]
Message-ID: <5673EE0E.6090500@linaro.org> (raw)
In-Reply-To: <20151218073956.0622f8bf@why.wild-wind.fr.eu.org>
On 18/12/15 07:39, Marc Zyngier wrote:
>>> On 16/12/15 17:08, Daniel Thompson wrote:
>>>> It is possible for the secure world to reserve certain SGI IDs for itself.
>>>> Currently we have limited visibility of which IDs are safe to use for IPIs.
>>>>
>>>> Modify the GIC initialization code to actively search for reserved SGI IDs
>>>> and report if any are found. Warn even more loudly if the reserved SGIs
>>>> overlap with the normal IPI range.
>>>>
>>>> When run on an Inforce IFC6410 (Snapdragon 600) this code produces the
>>>> following messages:
>>>> ~~~ cut here ~~~
>>>> CPU0: Detected reserved SGI IDs: 14-15
>>>> CPU1: Detected reserved SGI IDs: 15
>>>> CPU2: Detected reserved SGI IDs: 15
>>>> CPU3: Detected reserved SGI IDs: 15
>>>> ~~~ cut here ~~~
>>>>
>>>> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
...
>>> Another thing to consider is that these locations are only defined on
>>> GICv2 and not GICv1, so this patch is likely to cause trouble on older HW.
>>
>> As presented the code relies on the RAZ/WI property of reserved
>> registers to avoid issues on GICv1; it does not report anything if there
>> appear to be know working SGIs on the assumption we are actually running
>> on a GICv1.
>>
>> You'd prefer an explicit version check?
>
> I'd rather be cautious and check for the architecture version,
> specially if you settle for the byte access mentioned above (a GICv1
> may not support byte access and explode unexpectedly). ICPIDR2.ArchRev
> should be the right thing to check.
Will do.
>>>> +
>>>> + /* record original value */
>>>> + pending = readl_relaxed(set_reg);
>>>> +
>>>> + /* clear, test, set, and test again */
>>>> + writel_relaxed(mask, clear_reg);
>>>> + after_clear = readl_relaxed(set_reg);
>>>> + writel_relaxed(mask, set_reg);
>>>> + after_set = readl_relaxed(set_reg);
>>>
>>> It should be enough to write to the SET register, and read back, as the
>>> bit is RAZ/WI when the interrupt is Group-0.
>>
>> Good point. Will simplify.
>
> I'd also suggest moving the whole thing to a separate function that'd
> get called from gic_cpu_init().
Will do.
I think I will also upgrade the pr_crit() to a WARN_ON() and hard code
the check to 8 rather than NR_IPI.
Currently NR_IPI is small on arm64 so it would be good for us to shout
loudly about latent firmware/secure-zone misconfiguration.
Daniel.
prev parent reply other threads:[~2015-12-18 11:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 17:08 [PATCH 0/2] Fix NMI backtrace for Inforce IFC6410 Daniel Thompson
2015-12-16 17:08 ` [PATCH 1/2] arm: Fix "NMI" " Daniel Thompson
2015-12-18 8:58 ` Marc Zyngier
2015-12-16 17:08 ` [PATCH 2/2] irqchip/gic: Identify and report any reserved SGI IDs Daniel Thompson
2015-12-16 17:47 ` Marc Zyngier
2015-12-17 19:26 ` Daniel Thompson
2015-12-18 7:39 ` Marc Zyngier
2015-12-18 11:29 ` Daniel Thompson [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=5673EE0E.6090500@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).