[PATCH v11 10/40] arm64/sme: Basic enumeration support
Mark Brown
broonie at kernel.org
Mon Feb 21 07:01:03 PST 2022
On Mon, Feb 21, 2022 at 02:32:38PM +0000, Catalin Marinas wrote:
> On Mon, Feb 07, 2022 at 03:20:39PM +0000, Mark Brown wrote:
> > static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = {
> > + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_SME_SHIFT, 4, 0),
> Shouldn't this field also be visible (if SME is enabled)?
Yes.
> > +/*
> > + * This must be called after sme_kernel_enable(), we rely on the
> > + * feature table being sorted to ensure this.
> > + */
> > +void fa64_kernel_enable(const struct arm64_cpu_capabilities *__always_unused p)
> > +{
> > + /* Allow use of FA64 */
> > + write_sysreg_s(read_sysreg_s(SYS_SMCR_EL1) | SMCR_ELx_FA64_MASK,
> > + SYS_SMCR_EL1);
> > +}
> > +
> > +#endif /* CONFIG_ARM64_SVE */
> I think instead of worrying about the order, we could check the
> sanitised register value in sme_kernel_enable() and set the FA64 bit.
There's going to be a ordering/clarity issue whatever way round we do it
- the FA64 feature bit is in a different feature register to the main
SME feature bitfield and it's not as abundantly clear as might be ideal
that it will have been sanitised when we're getting callbacks for the
main SME feature, there's an awful lot of sharp edges with this code.
Having things this way round felt more idiomatic to me.
> Also to me 'fa64_kernel_enable' somehow implies that the kernel cares
> about FA64 for itself but AFAICT we never run the kernel in streaming
> mode.
We do run the kernel in streaming mode - entering the kernel through a
syscall or preemption will not change the streaming mode state, and we
need to be in streaming mode in order to save or restore the register
state for streaming mode. In particular we need FA64 enabled for EL1 in
order to context switch FFR when in streaming mode, without it we'll
generate an exception when we execute the rdffr or wrffr. We don't do
any real floating point work in streaming mode but we absolutely need to
run in streaming mode and only exit streaming mode when restoring a
context where it is disabled, when using floating point in the kernel or
when idling the CPU.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20220221/6862b501/attachment.sig>
More information about the linux-arm-kernel
mailing list