Subject: Re: [PATCH v7 08/20] KVM: arm64: Add Partitioned PMU register trap handlers

From: Oliver Upton <[email-masked]>
Date: Wed, 13 May 2026 00:45:55 -0700

On Mon, May 04, 2026 at 09:18:01PM +0000, Colton Lewis wrote:
> We may want a partitioned PMU but not have FEAT_FGT to untrap the
> specific registers that would normally be untrapped. Add handling for
> those trapped register accesses that does the right thing if the PMU
> is partitioned.
> 
> For registers that shouldn't be written to hardware because they
> require special handling (PMEVTYPER and PMOVS), write to the virtual
> register. A later patch will ensure these are handled correctly at
> vcpu_load time.
> 
> Signed-off-by: Colton Lewis <[email-masked]>

I'd prefer an approach that provides a single accessor helper that takes
a vcpu_sysreg enum as an argument and internally handles the dispatch
between partitioned and emulated PMUs. That goes for all of the PMU
sysregs.

This will help you reuse some of the PMU emuation code that you'll still
need for things like nested...

Thanks,
Oliver