On Mon, 17 Mar 2025 at 11:53, Peter Maydell <peter.mayd...@linaro.org> wrote: > > On Mon, 17 Mar 2025 at 11:16, Akihiko Odaki <akihiko.od...@daynix.com> wrote: > > > > Supersedes: <20250314-clr-v2-1-7c7220c17...@daynix.com> > > ("[PATCH v2] target/arm: Define raw write for PMU CLR registers") > > > > A normal write to PMCNTENCLR clears written bits so it is not > > appropriate for writing a raw value. This kind of situation is usually > > handled by setting a raw write function, but flag the register with > > ARM_CP_NO_RAW instead to workaround a problem with KVM. > > I'm not sure there's a "problem with KVM" here -- it implements the > write to PMCNTENCLR to have the semantics the architecture specifies.
I checked with the KVM developers on this one, and you are correct that this is a KVM issue, so I was wrong here; sorry about that. There is a fix queued: https://web.git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git/commit/?h=next&id=f2aeb7bbd5745fbcf7f0769e29a184e24924b9a9 which will restore the "just writes the value" semantics. This is apparently the intended semantics for KVM_SET_ONE_REG for all cases: the write is supposed to do "sets register to the specified value", not "behaves as if the guest vCPU had done the register write insn, with attendant side effects". thanks -- PMM