Re: [PATCH v11 10/40] arm64/sme: Basic enumeration support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux