Hi Reiji, On Thu, Mar 10, 2022 at 08:47:47PM -0800, Reiji Watanabe wrote: > Introduce arm64_check_features(), which does a basic validity checking > of an ID register value against the register's limit value, which is > generally the host's sanitized value. > > This function will be used by the following patches to check if an ID > register value that userspace tries to set for a guest can be supported > on the host. > > The validation is done using arm64_ftr_bits_kvm, which is created from > arm64_ftr_regs, with some entries overwritten by entries from > arm64_ftr_bits_kvm_override. > > Signed-off-by: Reiji Watanabe <reijiw@xxxxxxxxxx> I have some concerns regarding the API between cpufeature and KVM that's being proposed here. It would appear that we are adding some of KVM's implementation details into the cpufeature code. In particular, I see that KVM's limitations on AA64DFR0 are being copied here. Additionally, I think it would be preferable to expose this in a manner that does not require CONFIG_KVM guards in other parts of the kernel. WDYT about having KVM keep its set of feature overrides and otherwise rely on the kernel's feature tables? I messed around with the idea a bit until I could get something workable (attached). I only compile tested this :) -- Thanks, Oliver