This patchset refactors/adds code to support writable per guest CPU ID feature registers. Part of the code/ideas are from [1]. No functional change is intended in this patchset. With the new CPU ID feature registers infrastructure, only writtings of ID_AA64PFR0_EL1.[CSV2|CSV3], ID_AA64DFR0_EL1.PMUVer and ID_DFR0_ELF.PerfMon are allowed as KVM does before. Writable (Configurable) per guest CPU ID feature registers are useful for creating/migrating guest on ARM CPUs with different kinds of features. --- [1] https://lore.kernel.org/all/20220419065544.3616948-1-reijiw@xxxxxxxxxx --- Jing Zhang (5): KVM: arm64: Move CPU ID feature registers emulation into a separate file KVM: arm64: Use per guest ID register for ID_AA64PFR0_EL1.[CSV2|CSV3] KVM: arm64: Use per guest ID register for ID_AA64DFR0_EL1.PMUVer KVM: arm64: Introduce ID register specific descriptor KVM: arm64: Refactor writings for PMUVer/CSV2/CSV3 Reiji Watanabe (1): KVM: arm64: Save ID registers' sanitized value per guest arch/arm64/include/asm/cpufeature.h | 25 + arch/arm64/include/asm/kvm_host.h | 20 +- arch/arm64/kernel/cpufeature.c | 26 +- arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/arm.c | 24 +- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 7 +- arch/arm64/kvm/id_regs.c | 738 ++++++++++++++++++++++++++++ arch/arm64/kvm/sys_regs.c | 465 ++---------------- arch/arm64/kvm/sys_regs.h | 30 ++ include/kvm/arm_pmu.h | 6 +- 10 files changed, 844 insertions(+), 499 deletions(-) create mode 100644 arch/arm64/kvm/id_regs.c base-commit: a875b2475abff82b2318886da6d29c34db678dd5 -- 2.39.1.456.gfc5497dd1b-goog