|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 0/2] xen/arm: report the correct number of PMU counters to guests
When the vPMU feature is enabled for a domain, guests running at EL0/EL1
read PMCR_EL0.N to discover the number of available PMU counters. Per
the Arm Architecture Registers, such reads return the value of
MDCR_EL2.HPMN, not the hardware-implemented count.
Xen currently never initializes HPMN, so it stays 0 and guests see no
usable counters even when vPMU is enabled. This series fills HPMN in
with the number of implemented counters so guests can use them.
Patch 1 adds the infrastructure: it reads PMCR_EL0.N once on the boot
CPU and once on each secondary CPU during bring-up, keeping the minimum
in 'system_pmu_num_cntrs'. The minimum is used because on heterogeneous
systems (e.g. big.LITTLE) the counter count may differ between cores,
and a vCPU may migrate to any of them. The update happens in
update_system_features(), which runs only for CPUs that stay online, so
cores parked during heterogeneous bring-up are excluded. To make the
code usable from common arm code, the PMCR_EL0.N field definitions are
moved to asm/processor.h and a PMCR_EL0 -> PMCR alias is provided for
arm32 builds, where READ_SYSREG() resolves to the AArch32 PMCR
coprocessor encoding.
Patch 2 then sets MDCR_EL2.HPMN from that value for vPMU domains. This
is a rework of a downstream patch by Leonid Komarianskyi (authorship
and Signed-off-by kept): instead of reading PMCR_EL0 in
arch_vcpu_create(), which would sample the CPU where the domain is
created rather than the CPUs the vCPU may run on, it uses the
system-wide minimum collected at boot. It is also adapted to the
upstream change b836ef686e ("xen/arm: Hide PMU registers from the
guest, when the vPMU feature is disabled"), which moved this code under
is_vpmu_domain().
Build-tested for arm32 and arm64 (x86 is unaffected: all touched code
lives under xen/arch/arm/).
Daisuke Nishimura (1):
xen/arm: Track the minimum number of PMU counters across CPUs
Leonid Komarianskyi (1):
xen/domain: Save PMU counters to mdcr_el2
xen/arch/arm/arm64/cpufeature.c | 6 ++++++
xen/arch/arm/cpufeature.c | 21 +++++++++++++++++++++
xen/arch/arm/domain.c | 2 ++
xen/arch/arm/include/asm/cpregs.h | 1 +
xen/arch/arm/include/asm/cpufeature.h | 7 ++++++-
xen/arch/arm/include/asm/processor.h | 4 ++++
xen/arch/arm/setup.c | 1 +
7 files changed, 41 insertions(+), 1 deletion(-)
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |