On Thu, Sep 17, 2020 at 08:00:54PM +0800, Peng Liang wrote: > In AArch64, guest will read the same values of the ID regsiters with > host. Both of them read the values from arm64_ftr_regs. This patch > series add support to emulate and configure ID registers so that we can > control the value of ID registers that guest read. > > v1 -> v2: > - save the ID registers in sysreg file instead of a new struct > - apply a checker before setting the value to the register > - add doc for new KVM_CAP_ARM_CPU_FEATURE > > Peng Liang (7): > arm64: add a helper function to traverse arm64_ftr_regs > arm64: introduce check_features > kvm: arm64: save ID registers to sys_regs file > kvm: arm64: introduce check_user > kvm: arm64: implement check_user for ID registers > kvm: arm64: make ID registers configurable > kvm: arm64: add KVM_CAP_ARM_CPU_FEATURE extension > > Documentation/virt/kvm/api.rst | 8 + > arch/arm64/include/asm/cpufeature.h | 4 + > arch/arm64/include/asm/kvm_coproc.h | 2 + > arch/arm64/include/asm/kvm_host.h | 3 + > arch/arm64/kernel/cpufeature.c | 36 +++ > arch/arm64/kvm/arm.c | 3 + > arch/arm64/kvm/sys_regs.c | 481 +++++++++++++++++++++++++++- > arch/arm64/kvm/sys_regs.h | 6 + > include/uapi/linux/kvm.h | 1 + > 9 files changed, 532 insertions(+), 12 deletions(-) > > -- > 2.26.2 > Hi Peng, I'd much rather see a series of patches where each patch converts a single ID register from using ID_SANITISED() to having its own table entry, where its own set_user() and reset() functions take into account its features using high level arm64_ftr* functions. Any ID registers that can still share code can certainly do so with some post-conversion refactoring. Thanks, drew