Commit 0c3a8774 authored by David Matlack's avatar David Matlack Committed by Sean Christopherson
Browse files

KVM: selftests: Use u32 instead of uint32_t



Use u32 instead of uint32_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/uint32_t/u32/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-7-seanjc@google.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 286e8903
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -78,9 +78,9 @@ static void *test_vcpu_run(void *arg)
	return NULL;
}

static uint32_t test_get_pcpu(void)
static u32 test_get_pcpu(void)
{
	uint32_t pcpu;
	u32 pcpu;
	unsigned int nproc_conf;
	cpu_set_t online_cpuset;

@@ -98,7 +98,7 @@ static uint32_t test_get_pcpu(void)
static int test_migrate_vcpu(unsigned int vcpu_idx)
{
	int ret;
	uint32_t new_pcpu = test_get_pcpu();
	u32 new_pcpu = test_get_pcpu();

	pr_debug("Migrating vCPU: %u to pCPU: %u\n", vcpu_idx, new_pcpu);

+3 −3
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ static void guest_validate_irq(unsigned int intid,
static void guest_irq_handler(struct ex_regs *regs)
{
	unsigned int intid = gic_get_and_ack_irq();
	uint32_t cpu = guest_get_vcpuid();
	u32 cpu = guest_get_vcpuid();
	struct test_vcpu_shared_data *shared_data = &vcpu_shared_data[cpu];

	guest_validate_irq(intid, shared_data);
@@ -116,7 +116,7 @@ static void guest_irq_handler(struct ex_regs *regs)
static void guest_run_stage(struct test_vcpu_shared_data *shared_data,
				enum guest_stage stage)
{
	uint32_t irq_iter, config_iter;
	u32 irq_iter, config_iter;

	shared_data->guest_stage = stage;
	shared_data->nr_iter = 0;
@@ -140,7 +140,7 @@ static void guest_run_stage(struct test_vcpu_shared_data *shared_data,

static void guest_code(void)
{
	uint32_t cpu = guest_get_vcpuid();
	u32 cpu = guest_get_vcpuid();
	struct test_vcpu_shared_data *shared_data = &vcpu_shared_data[cpu];

	local_irq_disable();
+13 −13
Original line number Diff line number Diff line
@@ -29,19 +29,19 @@ static const int32_t TVAL_MAX = INT32_MAX;
static const int32_t TVAL_MIN = INT32_MIN;

/* After how much time we say there is no IRQ. */
static const uint32_t TIMEOUT_NO_IRQ_US = 50000;
static const u32 TIMEOUT_NO_IRQ_US = 50000;

/* Counter value to use as the starting one for most tests. Set to CVAL_MAX/2 */
static u64 DEF_CNT;

/* Number of runs. */
static const uint32_t NR_TEST_ITERS_DEF = 5;
static const u32 NR_TEST_ITERS_DEF = 5;

/* Default wait test time in ms. */
static const uint32_t WAIT_TEST_MS = 10;
static const u32 WAIT_TEST_MS = 10;

/* Default "long" wait test time in ms. */
static const uint32_t LONG_WAIT_TEST_MS = 100;
static const u32 LONG_WAIT_TEST_MS = 100;

/* Shared with IRQ handler. */
struct test_vcpu_shared_data {
@@ -115,7 +115,7 @@ enum timer_view {
	TIMER_TVAL,
};

static void assert_irqs_handled(uint32_t n)
static void assert_irqs_handled(u32 n)
{
	int h = atomic_read(&shared_data.handled);

@@ -147,7 +147,7 @@ static void guest_irq_handler(struct ex_regs *regs)
	unsigned int intid = gic_get_and_ack_irq();
	enum arch_timer timer;
	u64 cnt, cval;
	uint32_t ctl;
	u32 ctl;
	bool timer_condition, istatus;

	if (intid == IAR_SPURIOUS) {
@@ -179,7 +179,7 @@ static void guest_irq_handler(struct ex_regs *regs)
}

static void set_cval_irq(enum arch_timer timer, u64 cval_cycles,
			 uint32_t ctl)
			 u32 ctl)
{
	atomic_set(&shared_data.handled, 0);
	atomic_set(&shared_data.spurious, 0);
@@ -188,7 +188,7 @@ static void set_cval_irq(enum arch_timer timer, u64 cval_cycles,
}

static void set_tval_irq(enum arch_timer timer, u64 tval_cycles,
			 uint32_t ctl)
			 u32 ctl)
{
	atomic_set(&shared_data.handled, 0);
	atomic_set(&shared_data.spurious, 0);
@@ -196,7 +196,7 @@ static void set_tval_irq(enum arch_timer timer, u64 tval_cycles,
	timer_set_ctl(timer, ctl);
}

static void set_xval_irq(enum arch_timer timer, u64 xval, uint32_t ctl,
static void set_xval_irq(enum arch_timer timer, u64 xval, u32 ctl,
			 enum timer_view tv)
{
	switch (tv) {
@@ -845,11 +845,11 @@ static void guest_code(enum arch_timer timer)

static cpu_set_t default_cpuset;

static uint32_t next_pcpu(void)
static u32 next_pcpu(void)
{
	uint32_t max = get_nprocs();
	uint32_t cur = sched_getcpu();
	uint32_t next = cur;
	u32 max = get_nprocs();
	u32 cur = sched_getcpu();
	u32 next = cur;
	cpu_set_t cpuset = default_cpuset;

	TEST_ASSERT(max > 1, "Need at least two physical cpus");
+6 −6
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ static void enable_monitor_debug_exceptions(void)

static void install_wp(uint8_t wpn, u64 addr)
{
	uint32_t wcr;
	u32 wcr;

	wcr = DBGWCR_LEN8 | DBGWCR_RD | DBGWCR_WR | DBGWCR_EL1 | DBGWCR_E;
	write_dbgwcr(wpn, wcr);
@@ -164,7 +164,7 @@ static void install_wp(uint8_t wpn, u64 addr)

static void install_hw_bp(uint8_t bpn, u64 addr)
{
	uint32_t bcr;
	u32 bcr;

	bcr = DBGBCR_LEN8 | DBGBCR_EXEC | DBGBCR_EL1 | DBGBCR_E;
	write_dbgbcr(bpn, bcr);
@@ -177,7 +177,7 @@ static void install_hw_bp(uint8_t bpn, u64 addr)
static void install_wp_ctx(uint8_t addr_wp, uint8_t ctx_bp, u64 addr,
			   u64 ctx)
{
	uint32_t wcr;
	u32 wcr;
	u64 ctx_bcr;

	/* Setup a context-aware breakpoint for Linked Context ID Match */
@@ -188,7 +188,7 @@ static void install_wp_ctx(uint8_t addr_wp, uint8_t ctx_bp, u64 addr,

	/* Setup a linked watchpoint (linked to the context-aware breakpoint) */
	wcr = DBGWCR_LEN8 | DBGWCR_RD | DBGWCR_WR | DBGWCR_EL1 | DBGWCR_E |
	      DBGWCR_WT_LINK | ((uint32_t)ctx_bp << DBGWCR_LBN_SHIFT);
	      DBGWCR_WT_LINK | ((u32)ctx_bp << DBGWCR_LBN_SHIFT);
	write_dbgwcr(addr_wp, wcr);
	write_dbgwvr(addr_wp, addr);
	isb();
@@ -199,7 +199,7 @@ static void install_wp_ctx(uint8_t addr_wp, uint8_t ctx_bp, u64 addr,
void install_hw_bp_ctx(uint8_t addr_bp, uint8_t ctx_bp, u64 addr,
		       u64 ctx)
{
	uint32_t addr_bcr, ctx_bcr;
	u32 addr_bcr, ctx_bcr;

	/* Setup a context-aware breakpoint for Linked Context ID Match */
	ctx_bcr = DBGBCR_LEN8 | DBGBCR_EXEC | DBGBCR_EL1 | DBGBCR_E |
@@ -213,7 +213,7 @@ void install_hw_bp_ctx(uint8_t addr_bp, uint8_t ctx_bp, u64 addr,
	 */
	addr_bcr = DBGBCR_LEN8 | DBGBCR_EXEC | DBGBCR_EL1 | DBGBCR_E |
		   DBGBCR_BT_ADDR_LINK_CTX |
		   ((uint32_t)ctx_bp << DBGBCR_LBN_SHIFT);
		   ((u32)ctx_bp << DBGBCR_LBN_SHIFT);
	write_dbgbcr(addr_bp, addr_bcr);
	write_dbgbvr(addr_bp, addr);
	isb();
+3 −3
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ enum test_stage {
static int stage = TEST_STAGE_REG_IFACE;

struct test_hvc_info {
	uint32_t func_id;
	u32 func_id;
	u64 arg1;
};

@@ -152,8 +152,8 @@ static void guest_code(void)
}

struct st_time {
	uint32_t rev;
	uint32_t attr;
	u32 rev;
	u32 attr;
	u64 st_time;
};

Loading