]> www.infradead.org Git - users/hch/block.git/commit
KVM: selftests: Drop @selector from segment helpers
authorSean Christopherson <seanjc@google.com>
Thu, 14 Mar 2024 23:26:37 +0000 (16:26 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 29 Apr 2024 19:55:22 +0000 (12:55 -0700)
commitb093f87fd1957cdfbe518d5bb2caa39ba80c1669
treef7ac352223f4c3fae85822b1686a4c2b0029b0cf
parent0f53a0245068e09b3b31e7f43ace0ab9edd066ef
KVM: selftests: Drop @selector from segment helpers

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: Ackerley Tng <ackerleytng@google.com>
Link: https://lore.kernel.org/r/20240314232637.2538648-19-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/lib/x86_64/processor.c