[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aTioEWHu0ZbFCjR6@kernel.org>
Date: Tue, 9 Dec 2025 14:52:01 -0800
From: Oliver Upton <oupton@...nel.org>
To: Colton Lewis <coltonlewis@...gle.com>
Cc: kvm@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Jonathan Corbet <corbet@....net>,
Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>,
Mingwei Zhang <mizhang@...gle.com>, Joey Gouly <joey.gouly@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Mark Rutland <mark.rutland@....com>, Shuah Khan <shuah@...nel.org>,
Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
linux-perf-users@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v5 21/24] KVM: arm64: Inject recorded guest interrupts
In no situation should KVM be injecting a "recorded" IRQ. The overflow
condition of the PMU is well defined in the architecture and we should
implement *exactly* that.
On Tue, Dec 09, 2025 at 08:51:18PM +0000, Colton Lewis wrote:
> +/**
> + * kvm_pmu_part_overflow_status() - Determine if any guest counters have overflowed
> + * @vcpu: Ponter to struct kvm_vcpu
> + *
> + * Determine if any guest counters have overflowed and therefore an
> + * IRQ needs to be injected into the guest.
> + *
> + * Return: True if there was an overflow, false otherwise
> + */
> +bool kvm_pmu_part_overflow_status(struct kvm_vcpu *vcpu)
> +{
> + struct arm_pmu *pmu = vcpu->kvm->arch.arm_pmu;
> + u64 mask = kvm_pmu_guest_counter_mask(pmu);
> + u64 pmovs = __vcpu_sys_reg(vcpu, PMOVSSET_EL0);
> + u64 pmint = read_pmintenset();
> + u64 pmcr = read_pmcr();
How do we know that the vPMU has been loaded on the CPU at this point?
> +
> + return (pmcr & ARMV8_PMU_PMCR_E) && (mask & pmovs & pmint);
> +}
I'd rather reuse kvm_pmu_overflow_status(), relying on the accessors to
abstract away the implementation / location of the guest PMU context.
Thanks,
Oliver
Powered by blists - more mailing lists