From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C05A52253FB for ; Thu, 1 May 2025 18:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746124408; cv=none; b=oHWqasriCt8QIxEz9g/WbxIcdTyDQcQY+IVj+w8a/5aXPCo+IGEu1/FWHJeYuHDrNDNoiPnOKNa4dW7Pu8bkxPNa2/+OXhPOGKJHSoPBVXhNuypf0dzndvHf/oDoxTPMmIu6xvTN/HyZTNBtPj40iDe4qQvIDKti9HIDHQB5o3U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746124408; c=relaxed/simple; bh=0VCzdFs14Yow09pwhlni5FGJycbkqXupqE6+SdFxv6w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=j2JmMsHrk5WLHSHNlq+J9k47YmN4sgPcYB4NeYdtjAXMofcUSR0xTmpPXmrXJjxPEz5/OG6kFKhCXAl0joicbMSfnnlu9wk4frkjbJCzE1b0sTKX+vUfeG9dXU8FT39XWmXk7O8iLEHtkfNzC4dn73rGFfppTT1J9osj6SQqm/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pDaVUjO1; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pDaVUjO1" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-7369c5ed395so1500456b3a.0 for ; Thu, 01 May 2025 11:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1746124406; x=1746729206; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8qNHq0SIhTmNxKhTx3tC44zxjWyK0Dj0ScUzyvuVNlQ=; b=pDaVUjO1QRCq+YcyAGcZ03lCdQ/j05r8QG+Gg6s9Wav/2LraBYl5J11djydlxAkoXC g90ffMthASKkqjgTVty+uzu2JSLVXj7YRxsEDwGB0FdGIiOawlqoCisO4LSeXy8kvOfD INslrwC2mXF1JIOidZLG3/fSpi8U++IdO0KUadRohor3rAWlFysKwaV4wzUjw3dzOm2l yvORhVNvEoBw7fpC2OFvOOVEsMAqqKPwb6/G6/oaWYsaY1l0to0Z9VZjzG2zWJaOahPP AlFcBdV8W9+e/XQsbL2lm33A3AjhYeYC2xq01K5cBgL2A4xPI5JRozSU7Vac6dLBNHy9 HuIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746124406; x=1746729206; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8qNHq0SIhTmNxKhTx3tC44zxjWyK0Dj0ScUzyvuVNlQ=; b=qSHWr02BwoLGKhBQiwHZQq2sZUd5Z+4mrBmyKDS4542/ttgwCryRVWyrUILrVRX5ER IbuHDTBRnrXbJUrMCLtOQcwvbPYgaJkYZdrzML5snUUYcc/Tk7n4k8uf02+Fjw/P0sh+ ueuYgAmQpGZoFXrrHsCScRzHWKSD0tB0dQtD71gage4nJUy+WEgH4wwxaawZC4epuPfl 7Y7e0RiZwByWf2dI2z0UiWgMILHFKs+Jlvu7DKI0w+Y0vmNja0u1vfqqZMEh4yhKt3mO N0Qstj7IZNx+V5BIVjUDDNUhYm6MZHv8tzxvbqWn84veGomx0gMx60Iy/hMTIlG3ffXa mZGg== X-Forwarded-Encrypted: i=1; AJvYcCX3053Hh35quL7ef1WyJ4k00gMMGEEO30osLjihXsHgY9r3fOb37zjIJ2W+2+Teiaiy/PIhEMg=@lists.linux.dev X-Gm-Message-State: AOJu0Yw/UP5hdNU7DPdHUS8dMy9CPmR9ss2te+MoggjN0Pl8yZk3bZJG yzs5cdjlaOrzb5EeJ1M+GTB5M3j7ccjeYdbLHIWtAVepjdkCKyMsLqwSlOFR9g6ggV+gaRoCIZg bNN+I9rMAMw== X-Google-Smtp-Source: AGHT+IFKCJy5QtPU13VuKMr9mFb8aJkCwRtWAJ+xW0sweTVsenbE6xlefcq15jGKqhd6hJdIsGl1FFtKDY+i1w== X-Received: from pfun12.prod.google.com ([2002:a05:6a00:7cc:b0:73c:28d4:aca4]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:928e:b0:736:2a73:6756 with SMTP id d2e1a72fcca58-7403a831702mr10825890b3a.21.1746124406032; Thu, 01 May 2025 11:33:26 -0700 (PDT) Date: Thu, 1 May 2025 11:33:01 -0700 In-Reply-To: <20250501183304.2433192-1-dmatlack@google.com> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250501183304.2433192-1-dmatlack@google.com> X-Mailer: git-send-email 2.49.0.906.g1f30a19c02-goog Message-ID: <20250501183304.2433192-8-dmatlack@google.com> Subject: [PATCH 07/10] KVM: selftests: Use s32 instead of int32_t From: David Matlack To: Paolo Bonzini Cc: Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Sean Christopherson , David Matlack , Andrew Jones , Isaku Yamahata , Reinette Chatre , Eric Auger , James Houghton , Colin Ian King , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Use s32 instead of int32_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/int32_t/s32/g' Then by manually adjusting whitespace to make checkpatch.pl happy. No functional change intended. Signed-off-by: David Matlack --- .../kvm/arm64/arch_timer_edge_cases.c | 24 +++++++++---------- .../selftests/kvm/include/arm64/arch_timer.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c b/tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c index 2d799823a366..b99eb6b4b314 100644 --- a/tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c +++ b/tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c @@ -24,8 +24,8 @@ static const u64 CVAL_MAX = ~0ULL; /* tval is a signed 32-bit int. */ -static const int32_t TVAL_MAX = INT32_MAX; -static const int32_t TVAL_MIN = INT32_MIN; +static const s32 TVAL_MAX = INT32_MAX; +static const s32 TVAL_MIN = INT32_MIN; /* After how much time we say there is no IRQ. */ static const u32 TIMEOUT_NO_IRQ_US = 50000; @@ -354,7 +354,7 @@ static void test_timer_cval(enum arch_timer timer, u64 cval, test_timer_xval(timer, cval, TIMER_CVAL, wm, reset_state, reset_cnt); } -static void test_timer_tval(enum arch_timer timer, int32_t tval, +static void test_timer_tval(enum arch_timer timer, s32 tval, irq_wait_method_t wm, bool reset_state, u64 reset_cnt) { @@ -384,10 +384,10 @@ static void test_cval_no_irq(enum arch_timer timer, u64 cval, test_xval_check_no_irq(timer, cval, usec, TIMER_CVAL, wm); } -static void test_tval_no_irq(enum arch_timer timer, int32_t tval, u64 usec, +static void test_tval_no_irq(enum arch_timer timer, s32 tval, u64 usec, sleep_method_t wm) { - /* tval will be cast to an int32_t in test_xval_check_no_irq */ + /* tval will be cast to an s32 in test_xval_check_no_irq */ test_xval_check_no_irq(timer, (u64)tval, usec, TIMER_TVAL, wm); } @@ -462,7 +462,7 @@ static void test_timers_fired_multiple_times(enum arch_timer timer) * timeout for the wait: we use the wfi instruction. */ static void test_reprogramming_timer(enum arch_timer timer, irq_wait_method_t wm, - int32_t delta_1_ms, int32_t delta_2_ms) + s32 delta_1_ms, s32 delta_2_ms) { local_irq_disable(); reset_timer_state(timer, DEF_CNT); @@ -503,7 +503,7 @@ static void test_reprogram_timers(enum arch_timer timer) static void test_basic_functionality(enum arch_timer timer) { - int32_t tval = (int32_t) msec_to_cycles(test_args.wait_ms); + s32 tval = (s32)msec_to_cycles(test_args.wait_ms); u64 cval = DEF_CNT + msec_to_cycles(test_args.wait_ms); int i; @@ -684,7 +684,7 @@ static void test_set_cnt_after_xval_no_irq(enum arch_timer timer, } static void test_set_cnt_after_tval(enum arch_timer timer, u64 cnt_1, - int32_t tval, u64 cnt_2, + s32 tval, u64 cnt_2, irq_wait_method_t wm) { test_set_cnt_after_xval(timer, cnt_1, tval, cnt_2, wm, TIMER_TVAL); @@ -698,7 +698,7 @@ static void test_set_cnt_after_cval(enum arch_timer timer, u64 cnt_1, } static void test_set_cnt_after_tval_no_irq(enum arch_timer timer, - u64 cnt_1, int32_t tval, + u64 cnt_1, s32 tval, u64 cnt_2, sleep_method_t wm) { test_set_cnt_after_xval_no_irq(timer, cnt_1, tval, cnt_2, wm, @@ -717,7 +717,7 @@ static void test_set_cnt_after_cval_no_irq(enum arch_timer timer, static void test_move_counters_ahead_of_timers(enum arch_timer timer) { int i; - int32_t tval; + s32 tval; for (i = 0; i < ARRAY_SIZE(irq_wait_method); i++) { irq_wait_method_t wm = irq_wait_method[i]; @@ -758,7 +758,7 @@ static void test_move_counters_behind_timers(enum arch_timer timer) static void test_timers_in_the_past(enum arch_timer timer) { - int32_t tval = -1 * (int32_t) msec_to_cycles(test_args.wait_ms); + s32 tval = -1 * (s32)msec_to_cycles(test_args.wait_ms); u64 cval; int i; @@ -794,7 +794,7 @@ static void test_timers_in_the_past(enum arch_timer timer) static void test_long_timer_delays(enum arch_timer timer) { - int32_t tval = (int32_t) msec_to_cycles(test_args.long_wait_ms); + s32 tval = (s32)msec_to_cycles(test_args.long_wait_ms); u64 cval = DEF_CNT + msec_to_cycles(test_args.long_wait_ms); int i; diff --git a/tools/testing/selftests/kvm/include/arm64/arch_timer.h b/tools/testing/selftests/kvm/include/arm64/arch_timer.h index 600ee9163604..9d32c196c7ab 100644 --- a/tools/testing/selftests/kvm/include/arm64/arch_timer.h +++ b/tools/testing/selftests/kvm/include/arm64/arch_timer.h @@ -79,7 +79,7 @@ static inline u64 timer_get_cval(enum arch_timer timer) return 0; } -static inline void timer_set_tval(enum arch_timer timer, int32_t tval) +static inline void timer_set_tval(enum arch_timer timer, s32 tval) { switch (timer) { case VIRTUAL: @@ -95,7 +95,7 @@ static inline void timer_set_tval(enum arch_timer timer, int32_t tval) isb(); } -static inline int32_t timer_get_tval(enum arch_timer timer) +static inline s32 timer_get_tval(enum arch_timer timer) { isb(); switch (timer) { -- 2.49.0.906.g1f30a19c02-goog