Commit 90a6bcbc authored by Haibo Xu's avatar Haibo Xu Committed by Anup Patel

KVM: arm64: selftests: Move reject_set check logic to a function

No functional changes. Just move the reject_set check logic to a
function so we can check for a specific errno. This is a preparation
for support reject_set in riscv.
Suggested-by: default avatarAndrew Jones <ajones@ventanamicro.com>
Signed-off-by: default avatarHaibo Xu <haibo1.xu@intel.com>
Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
parent be4c5806
......@@ -79,6 +79,11 @@ bool check_supported_reg(struct kvm_vcpu *vcpu, __u64 reg)
return check_supported_feat_reg(vcpu, reg);
}
bool check_reject_set(int err)
{
return err == EPERM;
}
#define REG_MASK (KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_COPROC_MASK)
#define CORE_REGS_XX_NR_WORDS 2
......
......@@ -104,6 +104,11 @@ void __weak print_reg(const char *prefix, __u64 id)
printf("\t0x%llx,\n", id);
}
bool __weak check_reject_set(int err)
{
return true;
}
#ifdef __aarch64__
static void prepare_vcpu_init(struct vcpu_reg_list *c, struct kvm_vcpu_init *init)
{
......@@ -222,7 +227,7 @@ static void run_test(struct vcpu_reg_list *c)
if (s->rejects_set && find_reg(s->rejects_set, s->rejects_set_n, reg.id)) {
reject_reg = true;
ret = __vcpu_ioctl(vcpu, KVM_SET_ONE_REG, &reg);
if (ret != -1 || errno != EPERM) {
if (ret != -1 || !check_reject_set(errno)) {
printf("%s: Failed to reject (ret=%d, errno=%d) ", config_name(c), ret, errno);
print_reg(config_name(c), reg.id);
putchar('\n');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment