Re: [PATCH 1/2] arm64/sme: Restore SMCR on exit from suspend

From: Mark Brown
Date: Tue Jan 30 2024 - 07:43:14 EST


On Tue, Jan 30, 2024 at 10:53:42AM +0000, Dave Martin wrote:
> On Tue, Jan 30, 2024 at 12:02:48AM +0000, Mark Brown wrote:

Sorry, didn't see these bits due to the large block of quoted text.

> > + if (system_supports_fa64())
> > + smcr |= SMCR_ELx_FA64;

> This seems to silently duplicate logic present in cpufeatures.c.
> Would it be cleaner to save/restore this register explicitly across
> suspend, once cpufeatures has initialised it?

I was unsure about that, I could go either way. All the register save
and restore is currently done in assembler which felt like it was doing
things too early so I went with this instead.

> Or this could be factored somehow, but dumbly saving/restoring it is
> probably simpler (?)

Yes, I keep thinking about doing that but factoring out is annoying
since there's also the KVM case where we don't always want to base the
decision about the settings on the cpufeature detection.

> > + write_sysreg_s(smcr, SYS_SMCR_EL1);

> Is there an ISB or equivalent somewhere on this path?

> Can we blow up when trying to restore SME state (e.g., ZT0) before we
> enter userspace for the first time, if the firmware left the SME regs
> inaccessible?

I concluded when I wrote this that there was but I confess I can't
remember where exactly now.

Attachment: signature.asc
Description: PGP signature