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

Catalin Marinas catalin.marinas at arm.com
Tue Feb 22 04:09:37 PST 2022


On Mon, Feb 21, 2022 at 11:10:34PM +0000, Mark Brown wrote:
> On Mon, Feb 21, 2022 at 07:24:59PM +0000, Catalin Marinas wrote:
> > On Mon, Feb 21, 2022 at 03:01:03PM +0000, Mark Brown wrote:
> > > 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.
> 
> > So, IIUC, for Linux it is mandatory that FEAT_SME_FA64 is supported,
> > otherwise we won't be able to enable SME. Does the architecture say
> 
> The feature is not mandatory and we do not require it for Linux.  It is
> expected that many implementations will choose to not support FA64.
> 
> The only impact it has on the kernel is that if it's present then we
> need to enable it for each EL and then context switch FFR in streaming
> mode, the code is there to do that conditionally already.

OK, I get it. So FFR is only present if FA64 is supported.

> This is actually a bit awkward for not disabling streaming mode when we
> do a syscall since the disabled instructions include the FPSMID mov
> vector, vector instruction which we currently use to zero the high bits
> of the Z registers.  That issue goes away if the optimisations I've got
> for relaxed flushing of the non-shared SVE state that we discussed in
> relation to syscall-abi get merged, though it'd still be there if we add
> a sysctl to force flushing.  This is a solvable problem though, even if
> we have to use a less efficient sequence to flush in streaming mode.

I guess the simplest is to just disable streaming mode on syscall. The C
library would mark the syscall wrappers as not streaming compatible, so
whoever is calling them might disable SM anyway.

So I think your original proposal in the ABI doc is fine (I just need
the libc people to confirm ;)).

-- 
Catalin



More information about the linux-arm-kernel mailing list