summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/arch_timer.c
diff options
context:
space:
mode:
authorHaibo Xu <haibo1.xu@intel.com>2024-01-22 12:58:42 +0300
committerAnup Patel <anup@brainfault.org>2024-03-06 18:23:29 +0300
commitd0b94bcbb04262b9ffe6e172223e8cbb663a2c9d (patch)
tree7779a0ba757871823641275e7d742b19bdb52b88 /tools/testing/selftests/kvm/arch_timer.c
parent812806bd1e70f79cc69061f9fd9bb1d367990d37 (diff)
downloadlinux-d0b94bcbb04262b9ffe6e172223e8cbb663a2c9d.tar.xz
KVM: riscv: selftests: Add sstc timer test
Add a KVM selftests to validate the Sstc timer functionality. The test was ported from arm64 arch timer test. Signed-off-by: Haibo Xu <haibo1.xu@intel.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'tools/testing/selftests/kvm/arch_timer.c')
-rw-r--r--tools/testing/selftests/kvm/arch_timer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/testing/selftests/kvm/arch_timer.c b/tools/testing/selftests/kvm/arch_timer.c
index f7e4cee8cb34..ae1f1a6d8312 100644
--- a/tools/testing/selftests/kvm/arch_timer.c
+++ b/tools/testing/selftests/kvm/arch_timer.c
@@ -36,7 +36,7 @@ struct test_args test_args = {
.timer_period_ms = TIMER_TEST_PERIOD_MS_DEF,
.migration_freq_ms = TIMER_TEST_MIGRATION_FREQ_MS,
.timer_err_margin_us = TIMER_TEST_ERR_MARGIN_US,
- .offset = { .reserved = 1 },
+ .reserved = 1,
};
struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
@@ -75,6 +75,8 @@ static void *test_vcpu_run(void *arg)
TEST_FAIL("Unexpected guest exit");
}
+ pr_info("PASS(vCPU-%d).\n", vcpu_idx);
+
return NULL;
}
@@ -190,7 +192,7 @@ static void test_print_help(char *name)
TIMER_TEST_PERIOD_MS_DEF);
pr_info("\t-m: Frequency (in ms) of vCPUs to migrate to different pCPU. 0 to turn off (default: %u)\n",
TIMER_TEST_MIGRATION_FREQ_MS);
- pr_info("\t-o: Counter offset (in counter cycles, default: 0)\n");
+ pr_info("\t-o: Counter offset (in counter cycles, default: 0) [aarch64-only]\n");
pr_info("\t-e: Interrupt arrival error margin (in us) of the guest timer (default: %u)\n",
TIMER_TEST_ERR_MARGIN_US);
pr_info("\t-h: print this help screen\n");
@@ -223,8 +225,8 @@ static bool parse_args(int argc, char *argv[])
test_args.timer_err_margin_us = atoi_non_negative("Error Margin", optarg);
break;
case 'o':
- test_args.offset.counter_offset = strtol(optarg, NULL, 0);
- test_args.offset.reserved = 0;
+ test_args.counter_offset = strtol(optarg, NULL, 0);
+ test_args.reserved = 0;
break;
case 'h':
default: