On 08/02/2018 23:58, Tom Lendacky wrote: > Provide a new KVM capability that allows bits within MSRs to be recognized > as features. Two new ioctls are added to the VM ioctl routine to retrieve > the list of these MSRs and their values. The MSR features can optionally > be exposed based on a CPU and/or a CPU feature. Yes, pretty much. Just two changes: > +struct kvm_msr_based_features { > + u32 msr; /* MSR to query */ > + u64 mask; /* MSR mask */ > + const struct x86_cpu_id *match; /* Match criteria */ > + u64 value; /* MSR value */ 1) These two should be replaced by a kvm_x86_ops callback, because computing the value is sometimes a bit more complicated than just rdmsr (for example, MSRs for VMX capabilities depend on the kvm_intel.ko module parameters). > + case KVM_CAP_GET_MSR_FEATURES: This should be KVM_GET_MSR. > + r = msr_io(NULL, argp, do_get_msr_features, 1); > + break; Bonus points for writing documentation :) and for moving the MSR handling code to arch/x86/kvm/msr.{c,h}. Thanks, Paolo