• Sean Christopherson's avatar
    KVM: selftests: Drop @selector from segment helpers · b093f87f
    Sean Christopherson authored
    Drop the @selector from the kernel code, data, and TSS builders and
    instead hardcode the respective selector in the helper.  Accepting a
    selector but not a base makes the selector useless, e.g. the data helper
    can't create per-vCPU for FS or GS, and so loading GS with KERNEL_DS is
    the only logical choice.
    
    And for code and TSS, there is no known reason to ever want multiple
    segments, e.g. there are zero plans to support 32-bit kernel code (and
    again, that would require more than just the selector).
    
    If KVM selftests ever do add support for per-vCPU segments, it'd arguably
    be more readable to add a dedicated helper for building/setting the
    per-vCPU segment, and move the common data segment code to an inner
    helper.
    
    Lastly, hardcoding the selector reduces the probability of setting the
    wrong selector in the vCPU versus what was created by the VM in the GDT.
    Reviewed-by: default avatarAckerley Tng <ackerleytng@google.com>
    Link: https://lore.kernel.org/r/20240314232637.2538648-19-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
    b093f87f
processor.c 34.7 KB