• Marc Zyngier's avatar
    KVM: arm64: Use event mask matching architecture revision · fd65a3b5
    Marc Zyngier authored
    The PMU code suffers from a small defect where we assume that the event
    number provided by the guest is always 16 bit wide, even if the CPU only
    implements the ARMv8.0 architecture. This isn't really problematic in
    the sense that the event number ends up in a system register, cropping
    it to the right width, but still this needs fixing.
    
    In order to make it work, let's probe the version of the PMU that the
    guest is going to use. This is done by temporarily creating a kernel
    event and looking at the PMUVer field that has been saved at probe time
    in the associated arm_pmu structure. This in turn gets saved in the kvm
    structure, and subsequently used to compute the event mask that gets
    used throughout the PMU code.
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    fd65a3b5
pmu-emul.c 23.4 KB