[PATCH v2 27/36] KVM: arm64: gic-v5: Mandate architected PPI for PMU emulation on GICv5
Jonathan Cameron
jonathan.cameron at huawei.com
Wed Jan 7 08:11:30 PST 2026
On Fri, 19 Dec 2025 15:52:45 +0000
Sascha Bischoff <Sascha.Bischoff at arm.com> wrote:
> Make it mandatory to use the architected PPI when running a GICv5
> guest. Attempts to set anything other than the architected PPI (23)
> are rejected.
>
> Signed-off-by: Sascha Bischoff <sascha.bischoff at arm.com>
> ---
> arch/arm64/kvm/pmu-emul.c | 14 ++++++++++++--
> include/kvm/arm_pmu.h | 5 ++++-
> 2 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
> index afc838ea2503e..2d3b50dec6c5d 100644
> --- a/arch/arm64/kvm/pmu-emul.c
> +++ b/arch/arm64/kvm/pmu-emul.c
> @@ -962,8 +962,13 @@ static int kvm_arm_pmu_v3_init(struct kvm_vcpu *vcpu)
> if (!vgic_initialized(vcpu->kvm))
> return -ENODEV;
>
> - if (!kvm_arm_pmu_irq_initialized(vcpu))
> - return -ENXIO;
> + if (!kvm_arm_pmu_irq_initialized(vcpu)) {
> + /* Use the architected irq number for GICv5. */
> + if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V5)
> + vcpu->arch.pmu.irq_num = KVM_ARMV8_PMU_GICV5_IRQ;
> + else
> + return -ENXIO;
Might as well flip logic and exit quickly on error.
if (vcpu->kvm->arch.vgic.vgic_model != KVM_DEV_TYPE_ARM_VGIC_V5)
As before it might be nice to make the helper for this visible.
return -ENXIO;
vcpu->arch.pmu.irq_num = KVM_ARMV8_PMU_GICV5_IRQl;
}
> + }
More information about the linux-arm-kernel
mailing list