Commit 286e8903 authored by David Matlack's avatar David Matlack Committed by Sean Christopherson
Browse files

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: default avatarDavid Matlack <dmatlack@google.com>
Link: https://patch.msgid.link/20260420212004.3938325-6-seanjc@google.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 26f84532
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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)		\
+2 −2
Original line number Diff line number Diff line
@@ -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);
+8 −8
Original line number Diff line number Diff line
@@ -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);
}
Loading