• Sean Christopherson's avatar
    KVM: selftests: Split out kvm_cpuid2_size() from allocate_kvm_cpuid2() · fc66963d
    Sean Christopherson authored
    Split out the computation of the effective size of a kvm_cpuid2 struct
    from allocate_kvm_cpuid2(), and modify both to take an arbitrary number
    of entries.  Future commits will add caching of a vCPU's CPUID model, and
    will (a) be able to precisely size the entries array, and (b) will need
    to know the effective size of the struct in order to copy to/from the
    cache.
    
    Expose the helpers so that the Hyper-V Features test can use them in the
    (somewhat distant) future.  The Hyper-V test very, very subtly relies on
    propagating CPUID info across vCPU instances, and will need to make a
    copy of the previous vCPU's CPUID information when it switches to using
    the per-vCPU cache.  Alternatively, KVM could provide helpers to
    duplicate and/or copy a kvm_cpuid2 instance, but each is literally a
    single line of code if the helpers are exposed, and it's not like the
    size of kvm_cpuid2 is secret knowledge.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Link: https://lore.kernel.org/r/20220614200707.3315957-18-seanjc@google.com
    fc66963d
processor.h 22.5 KB