On Tue, 17 Jan 2023 01:35:38 +0000, Reiji Watanabe <reijiw@xxxxxxxxxx> wrote: > > Currently, KVM allows userspace to set PMCR_EL0 to any values > with KVM_SET_ONE_REG for a vCPU with PMUv3 configured. > > Disallow userspace to set PMCR_EL0.N to a value that is greater > than the host value (KVM_SET_ONE_REG will fail), as KVM doesn't > support more event counters than the host HW implements. > Although this is an ABI change, this change only affects > userspace setting PMCR_EL0.N to a larger value than the host. > As accesses to unadvertised event counters indices is CONSTRAINED > UNPREDICTABLE behavior, and PMCR_EL0.N was reset to the host value > on every vCPU reset before this series, I can't think of any > use case where a user space would do that. > > Also, ignore writes to read-only bits that are cleared on vCPU reset, > and RES{0,1} bits (including writable bits that KVM doesn't support > yet), as those bits shouldn't be modified (at least with > the current KVM). > > Signed-off-by: Reiji Watanabe <reijiw@xxxxxxxxxx> Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx> M. -- Without deviation from the norm, progress is not possible.