Re: [PATCH v11 18/40] arm64/sme: Implement traps and syscall handling for SME

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

 



On Tue, Feb 22, 2022 at 05:54:45PM +0000, Catalin Marinas wrote:
> On Mon, Feb 07, 2022 at 03:20:47PM +0000, Mark Brown wrote:

> > On syscall we exit streaming mode if we were previously in it and ensure
> > that all but the lower 128 bits of the registers are zeroed while
> > preserving the state of ZA. This follows the aarch64 PCS for SME, ZA
> > state is preserved over a function call and streaming mode is exited.

> I'm not sure this is entirely correct about the PCS. The caller must
> disable SM if the function it calls is not compatible. But it's fine for
> the kernel to impose this at the ABI level.

Yeah, I was thinking of it as being constructive error handling for
being a normal function - if this were within userspace then the risk
for the caller would be a SIGILL when the called function tries to do
something that's invalid in streaming mode.  I'll tweak the text.

> > +	if (system_supports_sme() && test_thread_flag(TIF_SME) &&
> > +	    !restore_sve_regs) {
> > +		int sve_vq_minus_one;
> > +
> > +		sve_vq_minus_one = sve_vq_from_vl(task_get_sve_vl(current)) - 1;
> > +		sve_set_vq(sve_vq_minus_one);
> > +		sve_flush_live(true, sve_vq_minus_one);
> > +	}

> Shouldn't the SVE state be flushed by the hardware when switching to
> streaming mode?

Ah, yes - this is now the case.  In earlier revisions of the
specification it was implementation defined if the state was zeroed or
preserved so we had to clear but with the current version the state will
always be zeroed so the flush is redundant and can be deleted.

> > +	/*
> > +	 * If SME is active then exit streaming mode.  If ZA is active
> > +	 * then flush the SVE registers but leave userspace access to
> > +	 * both SVE and SME enabled, otherwise disable SME for the
> > +	 * task and fall through to disabling SVE too.  This means
> > +	 * that after a syscall we never have any SME register state
> > +	 * to track, if this changes the KVM code will need updating.
> > +	 */

> By "we never have any SME register state to track" I understand that we
> drop the ZA state as well which AFAICT is not the case.

s/SME/streaming SVE/

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