summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/riscv/get-reg-list.c
diff options
context:
space:
mode:
authorHaibo Xu <haibo1.xu@intel.com>2024-01-22 17:58:41 +0800
committerAnup Patel <anup@brainfault.org>2024-03-06 20:53:27 +0530
commit812806bd1e70f79cc69061f9fd9bb1d367990d37 (patch)
tree80e2d5c9ed6e3b968a5d9766f993d555024eba6b /tools/testing/selftests/kvm/riscv/get-reg-list.c
parent1e979288c9b50a1eef1c5fa2fa93936012a0ed6f (diff)
KVM: riscv: selftests: Change vcpu_has_ext to a common function
Move vcpu_has_ext to the processor.c and rename it to __vcpu_has_ext so that other test cases can use it for vCPU extension check. 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/riscv/get-reg-list.c')
-rw-r--r--tools/testing/selftests/kvm/riscv/get-reg-list.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c
index 6435e7a65642..8cece02ca23a 100644
--- a/tools/testing/selftests/kvm/riscv/get-reg-list.c
+++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c
@@ -123,15 +123,6 @@ bool check_reject_set(int err)
return err == EINVAL;
}
-static bool vcpu_has_ext(struct kvm_vcpu *vcpu, uint64_t ext_id)
-{
- int ret;
- unsigned long value;
-
- ret = __vcpu_get_reg(vcpu, ext_id, &value);
- return (ret) ? false : !!value;
-}
-
void finalize_vcpu(struct kvm_vcpu *vcpu, struct vcpu_reg_list *c)
{
unsigned long isa_ext_state[KVM_RISCV_ISA_EXT_MAX] = { 0 };
@@ -176,7 +167,7 @@ void finalize_vcpu(struct kvm_vcpu *vcpu, struct vcpu_reg_list *c)
__vcpu_set_reg(vcpu, feature, 1);
/* Double check whether the desired extension was enabled */
- __TEST_REQUIRE(vcpu_has_ext(vcpu, feature),
+ __TEST_REQUIRE(__vcpu_has_ext(vcpu, feature),
"%s not available, skipping tests", s->name);
}
}