Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: selftests: Use s64 instead of int64_t

Use s64 instead of int64_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int64_t/s64/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Link: https://patch.msgid.link/20260420212004.3938325-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

authored by

David Matlack and committed by
Sean Christopherson
286e8903 26f84532

+22 -22
+1 -1
tools/testing/selftests/kvm/arm64/sea_to_user.c
··· 59 59 static u64 translate_to_host_paddr(unsigned long vaddr) 60 60 { 61 61 u64 pinfo; 62 - int64_t offset = vaddr / getpagesize() * sizeof(pinfo); 62 + s64 offset = vaddr / getpagesize() * sizeof(pinfo); 63 63 int fd; 64 64 u64 page_addr; 65 65 u64 paddr;
+1 -1
tools/testing/selftests/kvm/arm64/set_id_regs.c
··· 36 36 * For FTR_EXACT, safe_val is used as the exact safe value. 37 37 * For FTR_LOWER_SAFE, safe_val is used as the minimal safe value. 38 38 */ 39 - int64_t safe_val; 39 + s64 safe_val; 40 40 41 41 /* Allowed to be changed by the host after run */ 42 42 bool mutable;
+1 -1
tools/testing/selftests/kvm/guest_print_test.c
··· 25 25 26 26 /* GUEST_PRINTF()/GUEST_ASSERT_FMT() does not support float or double. */ 27 27 #define TYPE_LIST \ 28 - TYPE(test_type_i64, I64, "%ld", int64_t) \ 28 + TYPE(test_type_i64, I64, "%ld", s64) \ 29 29 TYPE(test_type_u64, U64u, "%lu", u64) \ 30 30 TYPE(test_type_x64, U64x, "0x%lx", u64) \ 31 31 TYPE(test_type_X64, U64X, "0x%lX", u64) \
+2 -2
tools/testing/selftests/kvm/include/test_util.h
··· 101 101 102 102 size_t parse_size(const char *size); 103 103 104 - int64_t timespec_to_ns(struct timespec ts); 105 - struct timespec timespec_add_ns(struct timespec ts, int64_t ns); 104 + s64 timespec_to_ns(struct timespec ts); 105 + struct timespec timespec_add_ns(struct timespec ts, s64 ns); 106 106 struct timespec timespec_add(struct timespec ts1, struct timespec ts2); 107 107 struct timespec timespec_sub(struct timespec ts1, struct timespec ts2); 108 108 struct timespec timespec_elapsed(struct timespec start);
+8 -8
tools/testing/selftests/kvm/lib/test_util.c
··· 83 83 return base << shift; 84 84 } 85 85 86 - int64_t timespec_to_ns(struct timespec ts) 86 + s64 timespec_to_ns(struct timespec ts) 87 87 { 88 - return (int64_t)ts.tv_nsec + 1000000000LL * (int64_t)ts.tv_sec; 88 + return (s64)ts.tv_nsec + 1000000000LL * (s64)ts.tv_sec; 89 89 } 90 90 91 - struct timespec timespec_add_ns(struct timespec ts, int64_t ns) 91 + struct timespec timespec_add_ns(struct timespec ts, s64 ns) 92 92 { 93 93 struct timespec res; 94 94 ··· 101 101 102 102 struct timespec timespec_add(struct timespec ts1, struct timespec ts2) 103 103 { 104 - int64_t ns1 = timespec_to_ns(ts1); 105 - int64_t ns2 = timespec_to_ns(ts2); 104 + s64 ns1 = timespec_to_ns(ts1); 105 + s64 ns2 = timespec_to_ns(ts2); 106 106 return timespec_add_ns((struct timespec){0}, ns1 + ns2); 107 107 } 108 108 109 109 struct timespec timespec_sub(struct timespec ts1, struct timespec ts2) 110 110 { 111 - int64_t ns1 = timespec_to_ns(ts1); 112 - int64_t ns2 = timespec_to_ns(ts2); 111 + s64 ns1 = timespec_to_ns(ts1); 112 + s64 ns2 = timespec_to_ns(ts2); 113 113 return timespec_add_ns((struct timespec){0}, ns1 - ns2); 114 114 } 115 115 ··· 123 123 124 124 struct timespec timespec_div(struct timespec ts, int divisor) 125 125 { 126 - int64_t ns = timespec_to_ns(ts) / divisor; 126 + s64 ns = timespec_to_ns(ts) / divisor; 127 127 128 128 return timespec_add_ns((struct timespec){0}, ns); 129 129 }
+1 -1
tools/testing/selftests/kvm/lib/userfaultfd_util.c
··· 27 27 { 28 28 struct uffd_reader_args *reader_args = (struct uffd_reader_args *)arg; 29 29 int uffd = reader_args->uffd; 30 - int64_t pages = 0; 30 + s64 pages = 0; 31 31 struct timespec start; 32 32 struct timespec ts_diff; 33 33 struct epoll_event evt;
+1 -1
tools/testing/selftests/kvm/lib/x86/processor.c
··· 379 379 * Check that the vaddr is a sign-extended va_width value. 380 380 */ 381 381 TEST_ASSERT(vaddr == 382 - (((int64_t)vaddr << (64 - va_width) >> (64 - va_width))), 382 + (((s64)vaddr << (64 - va_width) >> (64 - va_width))), 383 383 "Canonical check failed. The virtual address is invalid."); 384 384 385 385 for (current_level = mmu->pgtable_levels;
+1 -1
tools/testing/selftests/kvm/memslot_perf_test.c
··· 1040 1040 1041 1041 struct test_result { 1042 1042 struct timespec slot_runtime, guest_runtime, iter_runtime; 1043 - int64_t slottimens, runtimens; 1043 + s64 slottimens, runtimens; 1044 1044 u64 nloops; 1045 1045 }; 1046 1046
+2 -2
tools/testing/selftests/kvm/steal_time.c
··· 123 123 u64 st_time; 124 124 }; 125 125 126 - static int64_t smccc(uint32_t func, u64 arg) 126 + static s64 smccc(uint32_t func, u64 arg) 127 127 { 128 128 struct arm_smccc_res res; 129 129 ··· 140 140 static void guest_code(int cpu) 141 141 { 142 142 struct st_time *st; 143 - int64_t status; 143 + s64 status; 144 144 145 145 status = smccc(SMCCC_ARCH_FEATURES, PV_TIME_FEATURES); 146 146 GUEST_ASSERT_EQ(status, 0);
+1 -1
tools/testing/selftests/kvm/x86/kvm_clock_test.c
··· 18 18 19 19 struct test_case { 20 20 u64 kvmclock_base; 21 - int64_t realtime_offset; 21 + s64 realtime_offset; 22 22 }; 23 23 24 24 static struct test_case test_cases[] = {
+3 -3
tools/testing/selftests/kvm/x86/nested_tsc_adjust_test.c
··· 53 53 /* The virtual machine object. */ 54 54 static struct kvm_vm *vm; 55 55 56 - static void check_ia32_tsc_adjust(int64_t max) 56 + static void check_ia32_tsc_adjust(s64 max) 57 57 { 58 - int64_t adjust; 58 + s64 adjust; 59 59 60 60 adjust = rdmsr(MSR_IA32_TSC_ADJUST); 61 61 GUEST_SYNC(adjust); ··· 117 117 GUEST_DONE(); 118 118 } 119 119 120 - static void report(int64_t val) 120 + static void report(s64 val) 121 121 { 122 122 pr_info("IA32_TSC_ADJUST is %ld (%lld * TSC_ADJUST_VALUE + %lld).\n", 123 123 val, val / TSC_ADJUST_VALUE, val % TSC_ADJUST_VALUE);