From: Suzuki K Poulose <Suzuki.Poulose@arm.com>
To: Dave Martin <Dave.Martin@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com,
ckadabi@codeaurora.org, ard.biesheuvel@linaro.org,
marc.zyngier@arm.com, catalin.marinas@arm.com,
will.deacon@arm.com, linux-kernel@vger.kernel.org,
jnair@caviumnetworks.com, robin.murphy@arm.com
Subject: Re: [PATCH v3 15/22] arm64: capabilities: Change scope of VHE to Boot CPU feature
Date: Thu, 8 Mar 2018 12:10:22 +0000 [thread overview]
Message-ID: <25d774db-0ebd-b06d-20b5-5e31ede58fa3@arm.com> (raw)
In-Reply-To: <20180212171727.GL5862@e103592.cambridge.arm.com>
On 12/02/18 17:17, Dave Martin wrote:
> On Fri, Feb 09, 2018 at 05:54:59PM +0000, Suzuki K Poulose wrote:
>> We expect all CPUs to be running at the same EL inside the kernel
>> with or without VHE enabled and we have strict checks to ensure
>> that any mismatch triggers a kernel panic. If VHE is enabled,
>> we use the feature based on the boot CPU and all other CPUs
>> should follow. This makes it a perfect candidate for a cpability
>
> capability
>
>> based on the boot CPU, which should be matched by all the CPUs
>> (both when is ON and OFF). This saves us some not-so-pretty
>> hooks and special code, just for verifying the conflict.
>>
>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>> Cc: Dave Martin <dave.martin@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>> arch/arm64/include/asm/cpufeature.h | 7 +++++++
>> arch/arm64/include/asm/virt.h | 6 ------
>> arch/arm64/kernel/cpufeature.c | 5 +++--
>> arch/arm64/kernel/smp.c | 38 -------------------------------------
>> 4 files changed, 10 insertions(+), 46 deletions(-)
>>
>> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
>> index 5f56a8342065..dfce93f79ae7 100644
>> --- a/arch/arm64/include/asm/cpufeature.h
>> +++ b/arch/arm64/include/asm/cpufeature.h
>> @@ -276,6 +276,13 @@ extern struct arm64_ftr_reg arm64_ftr_reg_ctrel0;
>> (ARM64_CPUCAP_SCOPE_LOCAL_CPU | \
>> ARM64_CPUCAP_OPTIONAL_FOR_LATE_CPU)
>>
>> +/*
>> + * Critical CPU feature used early in the boot based on the boot CPU.
>> + * The feature should be matched by all booting CPU (both miss and hit
>> + * cases).
>> + */
>> +#define ARM64_CPUCAP_CRITICAL_BOOT_CPU_FEATURE ARM64_CPUCAP_SCOPE_BOOT_CPU
>> +
>
> Nit: would it be consistent with the uses we already have for the word
> "strict" to use that word here? i.e.,
> ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE.
> Or do you think that would be more confusing?
We don't use the "STRICT" tag anymore. Moreover, I used CRITICAL to indicate
that it is special in a way that all the "late" CPUs (in this case all
secondaries) should match the "state" of the capability (i.e, both ON and OFF)
as that of the boot CPU. I am OK to change it to STRICT.
>
> Otherwise, "critical" sounds a bit like we depend on the capability
> being available.
>
> If "strict" doesn't fit though and no other option suggests itself,
> it's probably not worth changing this.
>
>> struct arm64_cpu_capabilities {
>> const char *desc;
>> u16 capability;
>> diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
>> index c5f89442785c..9d1e24e030b3 100644
>> --- a/arch/arm64/include/asm/virt.h
>> +++ b/arch/arm64/include/asm/virt.h
>> @@ -102,12 +102,6 @@ static inline bool has_vhe(void)
>> return false;
>> }
>>
>> -#ifdef CONFIG_ARM64_VHE
>> -extern void verify_cpu_run_el(void);
>> -#else
>> -static inline void verify_cpu_run_el(void) {}
>> -#endif
>> -
>> #endif /* __ASSEMBLY__ */
>>
>> #endif /* ! __ASM__VIRT_H */
>> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
>> index 7625e2962e2b..f66e66c79916 100644
>> --- a/arch/arm64/kernel/cpufeature.c
>> +++ b/arch/arm64/kernel/cpufeature.c
>> @@ -1016,11 +1016,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
>> },
>> #endif /* CONFIG_ARM64_PAN */
>> {
>> +#ifdef CONFIG_ARM64_VHE
>> .desc = "Virtualization Host Extensions",
>> .capability = ARM64_HAS_VIRT_HOST_EXTN,
>> - .type = ARM64_CPUCAP_SYSTEM_FEATURE,
>> + .type = ARM64_CPUCAP_CRITICAL_BOOT_CPU_FEATURE,
>> .matches = runs_at_el2,
>> .cpu_enable = cpu_copy_el2regs,
>> +#endif
>
> Shouldn't the #ifdef...#endif be outside the { ... },?
>
> Otherwise this yields an empty block that will truncate the list in the
> CONFIG_ARM64_VHE case...
Good catch. You're right, I will fix it.
>
>
> Removal of this block for !CONFIG_ARM64_VHE is a change rather than just
> refactoring, so the commit message should explain it.
Ok.
Cheers
Suzuki
next prev parent reply other threads:[~2018-03-08 12:10 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 17:54 [PATCH v3 00/21] arm64: Rework cpu capabilities handling Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 01/21] arm64: capabilities: Move errata work around check on boot CPU Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 01/22] arm64: capabilities: Update prototype for enable call back Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 02/21] arm64: capabilities: Move errata processing code Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 02/22] arm64: capabilities: Move errata work around check on boot CPU Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 03/22] arm64: capabilities: Move errata processing code Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 03/21] arm64: capabilities: Prepare for fine grained capabilities Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 04/21] arm64: capabilities: Add flags to handle the conflicts on late CPU Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 04/22] arm64: capabilities: Prepare for fine grained capabilities Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 05/22] arm64: capabilities: Add flags to handle the conflicts on late CPU Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 05/21] arm64: capabilities: Unify the verification Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 06/21] arm64: capabilities: Filter the entries based on a given mask Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 06/22] arm64: capabilities: Unify the verification Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 07/22] arm64: capabilities: Filter the entries based on a given mask Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 07/21] arm64: capabilities: Prepare for grouping features and errata work arounds Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 08/22] " Suzuki K Poulose
2018-02-09 18:11 ` Dave Martin
2018-02-09 17:54 ` [PATCH v3 08/21] arm64: capabilities: Split the processing of " Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 09/21] arm64: capabilities: Allow features based on local CPU scope Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 09/22] arm64: capabilities: Split the processing of errata work arounds Suzuki K Poulose
2018-02-09 18:18 ` Dave Martin
2018-03-08 12:24 ` Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 10/22] arm64: capabilities: Allow features based on local CPU scope Suzuki K Poulose
2018-02-09 18:22 ` Dave Martin
2018-03-08 12:14 ` Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 10/21] arm64: capabilities: Group handling of features and errata workarounds Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 11/22] " Suzuki K Poulose
2018-02-09 18:25 ` Dave Martin
2018-02-09 17:54 ` [PATCH v3 11/21] arm64: capabilities: Introduce weak features based on local CPU Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 12/22] " Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 12/21] arm64: capabilities: Restrict KPTI detection to boot-time CPUs Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 13/21] arm64: capabilities: Add support for features enabled early Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 13/22] arm64: capabilities: Restrict KPTI detection to boot-time CPUs Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 14/22] arm64: capabilities: Add support for features enabled early Suzuki K Poulose
2018-02-12 17:17 ` Dave Martin
2018-03-07 17:42 ` Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 14/21] arm64: capabilities: Change scope of VHE to Boot CPU feature Suzuki K Poulose
2018-02-09 17:54 ` [PATCH v3 15/22] " Suzuki K Poulose
2018-02-12 17:17 ` Dave Martin
2018-03-08 12:10 ` Suzuki K Poulose [this message]
2018-03-08 13:43 ` Dave Martin
2018-02-09 17:55 ` [PATCH v3 15/21] arm64: capabilities: Clean up midr range helpers Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 16/21] arm64: Add helpers for checking CPU MIDR against a range Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 16/22] arm64: capabilities: Clean up midr range helpers Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 17/22] arm64: Add helpers for checking CPU MIDR against a range Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 17/21] arm64: capabilities: Add support for checks based on a list of MIDRs Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 18/22] " Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 18/21] arm64: capabilities: Handle shared entries Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 19/21] arm64: Add MIDR encoding for Arm Cortex-A55 and Cortex-A35 Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 19/22] arm64: capabilities: Handle shared entries Suzuki K Poulose
2018-02-12 17:17 ` Dave Martin
2018-03-08 12:16 ` Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 20/22] arm64: Add MIDR encoding for Arm Cortex-A55 and Cortex-A35 Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 20/21] arm64: Delay enabling hardware DBM feature Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 21/21] arm64: Add work around for Arm Cortex-A55 Erratum 1024718 Suzuki K Poulose
2018-02-09 17:55 ` [PATCH v3 21/22] arm64: Delay enabling hardware DBM feature Suzuki K Poulose
2018-02-09 18:58 ` Dave Martin
2018-03-07 17:39 ` Suzuki K Poulose
2018-03-08 13:53 ` Dave Martin
2018-03-08 13:55 ` Mark Rutland
2018-02-09 17:55 ` [PATCH v3 22/22] arm64: Add work around for Arm Cortex-A55 Erratum 1024718 Suzuki K Poulose
2018-02-09 18:04 ` [PATCH v3 00/21] arm64: Rework cpu capabilities handling Suzuki K Poulose
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=25d774db-0ebd-b06d-20b5-5e31ede58fa3@arm.com \
--to=suzuki.poulose@arm.com \
--cc=Dave.Martin@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=ckadabi@codeaurora.org \
--cc=jnair@caviumnetworks.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=robin.murphy@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
Powered by JetHome