Re: [PATCH v10 32/43] arm64: RME: Enable PMU support with a realm guest

Gavin Shan
2025-09-22T00:03:45Z

On 8/21/25 12:55 AM, Steven Price wrote:
> Use the PMU registers from the RmiRecExit structure to identify when an
> overflow interrupt is due and inject it into the guest. Also hook up the
> configuration option for enabling the PMU within the guest.
>
> When entering a realm guest with a PMU interrupt pending, it is
> necessary to disable the physical interrupt. Otherwise when the RMM
> restores the PMU state the physical interrupt will trigger causing an
> immediate exit back to the host. The guest is expected to acknowledge
> the interrupt causing a host exit (to update the GIC state) which gives
> the opportunity to re-enable the physical interrupt before the next PMU
> event.
>
> Number of PMU counters is configured by the VMM by writing to PMCR.N.
>
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
> Changes since v2:
> * Add a macro kvm_pmu_get_irq_level() to avoid compile issues when PMU
> support is disabled.
> ---
> arch/arm64/kvm/arm.c | 11 +++++++++++
> arch/arm64/kvm/guest.c | 7 +++++++
> arch/arm64/kvm/pmu-emul.c | 3 +++
> arch/arm64/kvm/rme.c | 8 ++++++++
> arch/arm64/kvm/sys_regs.c | 5 +++--
> include/kvm/arm_pmu.h | 4 ++++
> 6 files changed, 36 insertions(+), 2 deletions(-)
>