From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: cpufeature: Trim feature reporting and include PAN emulation
Date: Wed, 21 Feb 2018 14:39:55 +0000 [thread overview]
Message-ID: <20180221143954.zlwau63wx75ixslv@salmiak> (raw)
In-Reply-To: <20180221111823.GB32331@e103592.cambridge.arm.com>
On Wed, Feb 21, 2018 at 11:18:27AM +0000, Dave Martin wrote:
> On Tue, Feb 20, 2018 at 02:46:24PM -0800, Kees Cook wrote:
> > The PAN emulation notification was only happening for non-boot CPUs
> > if CPU capabilities had already been configured. This seems to be the
> > wrong place, as it's system-wide and isn't attached to capabilities,
> > so its reporting didn't normally happen. Instead, report it once from
> > the boot CPU. Additionally removes the redundant "feature" word from the
> > "CPU features:" line.
> >
> > Before (redundant "feature", and missing PAN emulation report):
> >
> > SMP: Total of 4 processors activated.
> > CPU features: detected feature: 32-bit EL0 Support
> > CPU features: detected feature: Kernel page table isolation (KPTI)
> > CPU: All CPU(s) started at EL2
> >
> > After:
> >
> > SMP: Total of 4 processors activated.
> > CPU features: detected: 32-bit EL0 Support
> > CPU features: detected: Kernel page table isolation (KPTI)
> > CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
> > CPU: All CPU(s) started at EL2
> >
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> > arch/arm64/kernel/cpufeature.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> > index 29b1f873e337..6c799ca58b53 100644
> > --- a/arch/arm64/kernel/cpufeature.c
> > +++ b/arch/arm64/kernel/cpufeature.c
> > @@ -1333,9 +1333,6 @@ static void verify_local_cpu_capabilities(void)
> >
> > if (system_supports_sve())
> > verify_sve_features();
> > -
> > - if (system_uses_ttbr0_pan())
> > - pr_info("Emulating Privileged Access Never (PAN) using TTBR0_EL1 switching\n");
> > }
> >
> > void check_local_cpu_capabilities(void)
> > @@ -1360,7 +1357,7 @@ void check_local_cpu_capabilities(void)
> >
> > static void __init setup_feature_capabilities(void)
> > {
> > - update_cpu_capabilities(arm64_features, "detected feature:");
> > + update_cpu_capabilities(arm64_features, "detected:");
>
> Although I get what you're saying about redundant use of the word
> "features", this feels like cosmetic churn that is unrelated to the
> problem this patch is addressing.
Given it seems sensible, shall we just split that into a separate patch?
FWIW, for a patch with just this change:
Acked-by: Mark Rutland <mark.rutland@arm.com>
> It could be worth reviewing the CPU errata messages and other
> miscellaneous printks together to make them less verbose and more
> consistent all in one go, but that would be a separate patch...
>
> > enable_cpu_capabilities(arm64_features);
> > }
> >
> > @@ -1394,6 +1391,9 @@ void __init setup_cpu_features(void)
> > if (system_supports_32bit_el0())
> > setup_elf_hwcaps(compat_elf_hwcaps);
> >
> > + if (system_uses_ttbr0_pan())
> > + pr_info("emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching\n");
> > +
>
> Moving this seems sensible. The other option would be to paste it into
> update_cpu_capabilities(), but the message would still potentially get
> printed multiple times, so that doesn't feel like the right approach.
I think that more ideally, we'd give this an entry in the arm64_features array,
but because it's effectively a negative feature, it's a little tricky.
This also looks fine to me, so FWIW:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
next prev parent reply other threads:[~2018-02-21 14:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 22:46 [PATCH] arm64: cpufeature: Trim feature reporting and include PAN emulation Kees Cook
2018-02-21 11:18 ` Dave Martin
2018-02-21 14:39 ` Mark Rutland [this message]
2018-02-21 16:26 ` Dave Martin
2018-02-21 18:04 ` Kees Cook
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=20180221143954.zlwau63wx75ixslv@salmiak \
--to=mark.rutland@arm.com \
--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