On Mon, 24 Nov 2025 at 20:13, Mark Brown broonie@kernel.org wrote:
On Mon, Nov 24, 2025 at 03:48:06PM +0000, Peter Maydell wrote:
On Tue, 2 Sept 2025 at 12:45, Mark Brown broonie@kernel.org wrote:
SME, the Scalable Matrix Extension, is an arm64 extension which adds support for matrix operations, with core concepts patterned after SVE.
I haven't actually tried writing any code that uses this proposed ABI, but mostly it looks OK to me. I have a few nits below, but my main concern is the bits of text that say (or seem to say -- maybe I'm misinterpreting them) that various parts of how userspace accesses the guest state (e.g. the fp regs) depend on the current state of the vcpu, rather than being only a function of how the vcpu was configured. That seems to me like it's unnecessarily awkward. (More detail below.)
That was deliberate and I agree it is awkward, it was introduced as a result of earlier review comments. I had originally implemented an ABI where the VL for the vector registers was the maximum of the SVE and SME VLs but the feedback was that the ABI should instead follow what the architecture does with the vector length and potentially presence of the vector registers depending on the current streaming mode configuration. It sounds like you would prefer something more like what was there originally?
Yes, that's what I would prefer. The "varies by current CPU state" approach seems to me to be not the way we do things right now, and to be awkward for the VMM side, so it ought to have a really strong justification for why we need it.
Generally the VMM doesn't care about the actual current state of the CPU, it just wants all the data (e.g. to send for migration). We don't make the current SVE accessors change based on what the current SVE vq length is or whether the guest has set the SVE enable bits -- we have "if the vcpu supports SVE at all, data is always accessed via the SVE accessors, and it's always the max_vq length, regardless of how the vcpu has set its current vq length".
What's the benefit of making the way KVM exposes the data bounce around based on the current CPU state? Does that make things easier for the kernel internally?
-- PMM