From: Marc Zyngier <marc.zyngier@arm.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] arm64: Restrict ARM64_ERRATUM_1188873 mitigation to AArch32
Date: Mon, 15 Apr 2019 09:15:34 +0100 [thread overview]
Message-ID: <0ae5e59a-8e24-b4ca-581d-d7c99c0404a6@arm.com> (raw)
In-Reply-To: <20190412131750.GC29218@fuggles.cambridge.arm.com>
On 12/04/2019 14:17, Will Deacon wrote:
> Hi Marc,
>
> On Mon, Apr 08, 2019 at 05:02:13PM +0100, Marc Zyngier wrote:
>> We currently deal with ARM64_ERRATUM_1188873 by always trapping EL0
>> accesses for both instruction sets. Although nothing wrong comes out
>> of that, people trying to squeeze the last drop of performance from
>> buggy HW find this over the top. Oh well.
>>
>> Let's change the mitigation by flipping the counter enable bit
>> on return to userspace. Non-broken HW gets an extra branch on
>> the fast path, which is hopefully not the end of the world.
>> The arch timer workaround it also removed.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>> ---
>> arch/arm64/kernel/entry.S | 23 +++++++++++++++++++++++
>> drivers/clocksource/arm_arch_timer.c | 15 ---------------
>> 2 files changed, 23 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
>> index c50a7a75f2e0..e0aed21ab402 100644
>> --- a/arch/arm64/kernel/entry.S
>> +++ b/arch/arm64/kernel/entry.S
>> @@ -336,6 +336,29 @@ alternative_if ARM64_WORKAROUND_845719
>> alternative_else_nop_endif
>> #endif
>> 3:
>> +#ifdef CONFIG_ARM64_ERRATUM_1188873
>> +alternative_if_not ARM64_WORKAROUND_1188873
>> + b 1f
>> +alternative_else_nop_endif
>> +
>> + ubfx x0, x22, #4, #1 // Extract PSR_MODE32
>> + eor x0, x0, #1 // Negate it
>> +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
>> + mrs x1, cntkctl_el1
>> +alternative_else
>> + mrs x1, cnthctl_el2
>> +alternative_endif
>> + ubfx x2, x1, #1, #1 // Extract EL0VCTEN
>> + cmp x2, x0
>
> Aren't the flags live at this point (they indicate native vs compat)?
> Maybe you can use that instead of re-extracting PSR_MODE32.
Robin and I have been reworking this, see other emails in the same
thread, and the code looks pretty different now (and not breaking things
anymore).
>
>> + b.eq 1f // Matches, nothing to do
>> + bfi x1, x0, #1, #1 // Move EL0VCTEN in place
>
> ARCH_TIMER_USR_VCT_ACCESS_EN
>
>> +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
>> + msr cntkctl_el1, x1
>> +alternative_else
>> + msr cnthctl_el2, x1
>> +alternative_endif
>> +1:
>
> Sorry to be a pain, but could you use label '4:' here and update the others
> in this macro, please?
Sure, no problem.
>
>> +#endif
>> apply_ssbd 0, x0, x1
>> .endif
>>
>> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
>> index 5fcccc467868..27acc9eb0f7c 100644
>> --- a/drivers/clocksource/arm_arch_timer.c
>> +++ b/drivers/clocksource/arm_arch_timer.c
>
> I probably need an Ack from Thomas or Daniel on these parts, so I can take
> the series via arm64.
Daniel is on Cc, and hopefully v2 will be OK.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-15 8:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 16:02 [PATCH 0/4] arm64: Rework handling of erratum 1188873 Marc Zyngier
2019-04-08 16:02 ` [PATCH 1/4] arm64: Restrict ARM64_ERRATUM_1188873 mitigation to AArch32 Marc Zyngier
2019-04-08 18:34 ` Robin Murphy
2019-04-09 9:18 ` Marc Zyngier
2019-04-09 9:49 ` Robin Murphy
2019-04-12 13:17 ` Will Deacon
2019-04-15 8:15 ` Marc Zyngier [this message]
2019-04-15 8:26 ` Daniel Lezcano
2019-04-08 16:02 ` [PATCH 2/4] arm64: Make ARM64_ERRATUM_1188873 depend on COMPAT Marc Zyngier
2019-04-08 16:02 ` [PATCH 3/4] arm64: Add part number for Neoverse N1 Marc Zyngier
2019-04-08 16:02 ` [PATCH 4/4] arm64: Apply ARM64_ERRATUM_1188873 to Neoverse-N1 Marc Zyngier
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=0ae5e59a-8e24-b4ca-581d-d7c99c0404a6@arm.com \
--to=marc.zyngier@arm.com \
--cc=catalin.marinas@arm.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=will.deacon@arm.com \
/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).