On Sat, Feb 28, 2026 at 12:53:54AM +0000, Jiakai Xu wrote: > Move steal time UAPI tests from steal_time_init() into a separate > check_steal_time_uapi() function for better code organization and > maintainability. > > Previously, x86 and ARM64 architectures performed UAPI validation > tests within steal_time_init(), mixing initialization logic with > uapi tests. > > Changes by architecture: > x86_64: > - Extract MSR reserved bits test from steal_time_init() > - Move to check_steal_time_uapi() which tests that setting > MSR_KVM_STEAL_TIME with KVM_STEAL_RESERVED_MASK fails > ARM64: > - Extract three UAPI tests from steal_time_init(): > Device attribute support check > Misaligned IPA rejection (EINVAL) > Duplicate IPA setting rejection (EEXIST) > - Move all tests to check_steal_time_uapi() > RISC-V: > - Add empty check_steal_time_uapi() stub for future use > - No changes to steal_time_init() (had no tests to extract) > > The new check_steal_time_uapi() function: > - Is called once before the per-VCPU test loop > > No functional change intended. > > Suggested-by: Andrew Jones <[email protected]> > Signed-off-by: Jiakai Xu <[email protected]> > Signed-off-by: Jiakai Xu <[email protected]> > --- > V8 -> V9: Created a temporary VM with one vCPU in > check_steal_time_uapi() instead of adding extra vCPUs to the > main VM. > Made check_steal_time_uapi() parameterless for all architectures. > V7 -> V8: Used ST_GPA_BASE directly instead of > st_gva[]/sync_global_to_guest() in x86_64 and ARM64 > check_steal_time_uapi(). > Created a temporary vcpu in ARM64 check_steal_time_uapi() to > avoid EEXIST when steal_time_init() later sets IPA for vcpu[0]. > Removed unnecessary comment in RISC-V check_steal_time_uapi(). > --- > tools/testing/selftests/kvm/steal_time.c | 67 ++++++++++++++++++------ > 1 file changed, 51 insertions(+), 16 deletions(-)
Reviewed-by: Andrew Jones <[email protected]>

