]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: selftests: Use s64 instead of int64_t
authorDavid Matlack <dmatlack@google.com>
Mon, 20 Apr 2026 21:19:50 +0000 (14:19 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 20 Apr 2026 21:54:16 +0000 (14:54 -0700)
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>
tools/testing/selftests/kvm/arm64/sea_to_user.c
tools/testing/selftests/kvm/arm64/set_id_regs.c
tools/testing/selftests/kvm/guest_print_test.c
tools/testing/selftests/kvm/include/test_util.h
tools/testing/selftests/kvm/lib/test_util.c
tools/testing/selftests/kvm/lib/userfaultfd_util.c
tools/testing/selftests/kvm/lib/x86/processor.c
tools/testing/selftests/kvm/memslot_perf_test.c
tools/testing/selftests/kvm/steal_time.c
tools/testing/selftests/kvm/x86/kvm_clock_test.c
tools/testing/selftests/kvm/x86/nested_tsc_adjust_test.c

index 61954f2221e4f1d5cf692e0c7b0dc9527657115f..7285eade4acfb8017e665c4ddc551c6c486e64ea 100644 (file)
@@ -59,7 +59,7 @@ static bool far_invalid;
 static u64 translate_to_host_paddr(unsigned long vaddr)
 {
        u64 pinfo;
-       int64_t offset = vaddr / getpagesize() * sizeof(pinfo);
+       s64 offset = vaddr / getpagesize() * sizeof(pinfo);
        int fd;
        u64 page_addr;
        u64 paddr;
index 9b9c04c963a10810b3943ed7e2be13bfa88b7f64..4402f317f7d92fc641302c3655b810e626b9badc 100644 (file)
@@ -36,7 +36,7 @@ struct reg_ftr_bits {
         * For FTR_EXACT, safe_val is used as the exact safe value.
         * For FTR_LOWER_SAFE, safe_val is used as the minimal safe value.
         */
-       int64_t safe_val;
+       s64 safe_val;
 
        /* Allowed to be changed by the host after run */
        bool mutable;
index 894ef7d2481e606371b2f7b0eb8d1336ddf7c2e0..b059abcf1a5b5f7a6bc9d94026092ec828c184ed 100644 (file)
@@ -25,7 +25,7 @@ static struct guest_vals vals;
 
 /* GUEST_PRINTF()/GUEST_ASSERT_FMT() does not support float or double. */
 #define TYPE_LIST                                      \
-TYPE(test_type_i64,  I64,  "%ld",   int64_t)           \
+TYPE(test_type_i64,  I64,  "%ld",   s64)               \
 TYPE(test_type_u64,  U64u, "%lu",   u64)               \
 TYPE(test_type_x64,  U64x, "0x%lx", u64)               \
 TYPE(test_type_X64,  U64X, "0x%lX", u64)               \
index 62fe83763021aebd6f84af9317d1e289808011d8..d7489db738bf3194efb8a8d417feadee81313ef9 100644 (file)
@@ -101,8 +101,8 @@ do {                                                                                \
 
 size_t parse_size(const char *size);
 
-int64_t timespec_to_ns(struct timespec ts);
-struct timespec timespec_add_ns(struct timespec ts, int64_t ns);
+s64 timespec_to_ns(struct timespec ts);
+struct timespec timespec_add_ns(struct timespec ts, s64 ns);
 struct timespec timespec_add(struct timespec ts1, struct timespec ts2);
 struct timespec timespec_sub(struct timespec ts1, struct timespec ts2);
 struct timespec timespec_elapsed(struct timespec start);
index d863705f67951e50e82b4be0653b21b2658b48a3..f5b460c445be4c1fb4af2cccee9d9fff405257fd 100644 (file)
@@ -83,12 +83,12 @@ size_t parse_size(const char *size)
        return base << shift;
 }
 
-int64_t timespec_to_ns(struct timespec ts)
+s64 timespec_to_ns(struct timespec ts)
 {
-       return (int64_t)ts.tv_nsec + 1000000000LL * (int64_t)ts.tv_sec;
+       return (s64)ts.tv_nsec + 1000000000LL * (s64)ts.tv_sec;
 }
 
-struct timespec timespec_add_ns(struct timespec ts, int64_t ns)
+struct timespec timespec_add_ns(struct timespec ts, s64 ns)
 {
        struct timespec res;
 
@@ -101,15 +101,15 @@ struct timespec timespec_add_ns(struct timespec ts, int64_t ns)
 
 struct timespec timespec_add(struct timespec ts1, struct timespec ts2)
 {
-       int64_t ns1 = timespec_to_ns(ts1);
-       int64_t ns2 = timespec_to_ns(ts2);
+       s64 ns1 = timespec_to_ns(ts1);
+       s64 ns2 = timespec_to_ns(ts2);
        return timespec_add_ns((struct timespec){0}, ns1 + ns2);
 }
 
 struct timespec timespec_sub(struct timespec ts1, struct timespec ts2)
 {
-       int64_t ns1 = timespec_to_ns(ts1);
-       int64_t ns2 = timespec_to_ns(ts2);
+       s64 ns1 = timespec_to_ns(ts1);
+       s64 ns2 = timespec_to_ns(ts2);
        return timespec_add_ns((struct timespec){0}, ns1 - ns2);
 }
 
@@ -123,7 +123,7 @@ struct timespec timespec_elapsed(struct timespec start)
 
 struct timespec timespec_div(struct timespec ts, int divisor)
 {
-       int64_t ns = timespec_to_ns(ts) / divisor;
+       s64 ns = timespec_to_ns(ts) / divisor;
 
        return timespec_add_ns((struct timespec){0}, ns);
 }
index 2f069ce6a44638594ee0d83c2b34f3a632e9336f..ef8d76f71f83702bd926280c3d450cb66333de20 100644 (file)
@@ -27,7 +27,7 @@ static void *uffd_handler_thread_fn(void *arg)
 {
        struct uffd_reader_args *reader_args = (struct uffd_reader_args *)arg;
        int uffd = reader_args->uffd;
-       int64_t pages = 0;
+       s64 pages = 0;
        struct timespec start;
        struct timespec ts_diff;
        struct epoll_event evt;
index 81f5dea51fc3e974d2a521b14d9f657e4222d4d7..802543aa588c222f7b90141d7906992079aa865a 100644 (file)
@@ -379,7 +379,7 @@ static u64 *__vm_get_page_table_entry(struct kvm_vm *vm,
         * Check that the vaddr is a sign-extended va_width value.
         */
        TEST_ASSERT(vaddr ==
-                   (((int64_t)vaddr << (64 - va_width) >> (64 - va_width))),
+                   (((s64)vaddr << (64 - va_width) >> (64 - va_width))),
                    "Canonical check failed.  The virtual address is invalid.");
 
        for (current_level = mmu->pgtable_levels;
index d5161e8aee140b630c941466b12732743c8904a9..bf62b522d32e5528c9ebf342ba10723b82708c73 100644 (file)
@@ -1040,7 +1040,7 @@ static bool parse_args(int argc, char *argv[],
 
 struct test_result {
        struct timespec slot_runtime, guest_runtime, iter_runtime;
-       int64_t slottimens, runtimens;
+       s64 slottimens, runtimens;
        u64 nloops;
 };
 
index 6379f47af422514a9aa9858a5a1c94e60ab36f9a..d0a41a2bcccbc10c139b6a123edbf5d1e813766b 100644 (file)
@@ -123,7 +123,7 @@ struct st_time {
        u64 st_time;
 };
 
-static int64_t smccc(uint32_t func, u64 arg)
+static s64 smccc(uint32_t func, u64 arg)
 {
        struct arm_smccc_res res;
 
@@ -140,7 +140,7 @@ static void check_status(struct st_time *st)
 static void guest_code(int cpu)
 {
        struct st_time *st;
-       int64_t status;
+       s64 status;
 
        status = smccc(SMCCC_ARCH_FEATURES, PV_TIME_FEATURES);
        GUEST_ASSERT_EQ(status, 0);
index 5df0cceec03b7bab48f1f8db321c656a102483e0..2b8a3feee1f8cd34eed29e48e4cc723c0afabb08 100644 (file)
@@ -18,7 +18,7 @@
 
 struct test_case {
        u64 kvmclock_base;
-       int64_t realtime_offset;
+       s64 realtime_offset;
 };
 
 static struct test_case test_cases[] = {
index db0d44b8fbd6230522c0408b53bfe3080e9d9d67..a18b0cfd42e2762487c83ae6d126ba4a2e5b5aeb 100644 (file)
@@ -53,9 +53,9 @@ enum {
 /* The virtual machine object. */
 static struct kvm_vm *vm;
 
-static void check_ia32_tsc_adjust(int64_t max)
+static void check_ia32_tsc_adjust(s64 max)
 {
-       int64_t adjust;
+       s64 adjust;
 
        adjust = rdmsr(MSR_IA32_TSC_ADJUST);
        GUEST_SYNC(adjust);
@@ -117,7 +117,7 @@ static void l1_guest_code(void *data)
        GUEST_DONE();
 }
 
-static void report(int64_t val)
+static void report(s64 val)
 {
        pr_info("IA32_TSC_ADJUST is %ld (%lld * TSC_ADJUST_VALUE + %lld).\n",
                val, val / TSC_ADJUST_VALUE, val % TSC_ADJUST_VALUE);