Commit ae328dad authored by Andrew Jones's avatar Andrew Jones Committed by Anup Patel

RISC-V: KVM: Rename dis_idx to ext_idx

Make the name of the extension_disabled[] index more general in
order to expand its application.
Signed-off-by: default avatarAndrew Jones <ajones@ventanamicro.com>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
parent 19bff88e
...@@ -31,49 +31,49 @@ static const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_pmu = { ...@@ -31,49 +31,49 @@ static const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_pmu = {
#endif #endif
struct kvm_riscv_sbi_extension_entry { struct kvm_riscv_sbi_extension_entry {
enum KVM_RISCV_SBI_EXT_ID dis_idx; enum KVM_RISCV_SBI_EXT_ID ext_idx;
const struct kvm_vcpu_sbi_extension *ext_ptr; const struct kvm_vcpu_sbi_extension *ext_ptr;
}; };
static const struct kvm_riscv_sbi_extension_entry sbi_ext[] = { static const struct kvm_riscv_sbi_extension_entry sbi_ext[] = {
{ {
.dis_idx = KVM_RISCV_SBI_EXT_V01, .ext_idx = KVM_RISCV_SBI_EXT_V01,
.ext_ptr = &vcpu_sbi_ext_v01, .ext_ptr = &vcpu_sbi_ext_v01,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_MAX, /* Can't be disabled */ .ext_idx = KVM_RISCV_SBI_EXT_MAX, /* Can't be disabled */
.ext_ptr = &vcpu_sbi_ext_base, .ext_ptr = &vcpu_sbi_ext_base,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_TIME, .ext_idx = KVM_RISCV_SBI_EXT_TIME,
.ext_ptr = &vcpu_sbi_ext_time, .ext_ptr = &vcpu_sbi_ext_time,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_IPI, .ext_idx = KVM_RISCV_SBI_EXT_IPI,
.ext_ptr = &vcpu_sbi_ext_ipi, .ext_ptr = &vcpu_sbi_ext_ipi,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_RFENCE, .ext_idx = KVM_RISCV_SBI_EXT_RFENCE,
.ext_ptr = &vcpu_sbi_ext_rfence, .ext_ptr = &vcpu_sbi_ext_rfence,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_SRST, .ext_idx = KVM_RISCV_SBI_EXT_SRST,
.ext_ptr = &vcpu_sbi_ext_srst, .ext_ptr = &vcpu_sbi_ext_srst,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_HSM, .ext_idx = KVM_RISCV_SBI_EXT_HSM,
.ext_ptr = &vcpu_sbi_ext_hsm, .ext_ptr = &vcpu_sbi_ext_hsm,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_PMU, .ext_idx = KVM_RISCV_SBI_EXT_PMU,
.ext_ptr = &vcpu_sbi_ext_pmu, .ext_ptr = &vcpu_sbi_ext_pmu,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_EXPERIMENTAL, .ext_idx = KVM_RISCV_SBI_EXT_EXPERIMENTAL,
.ext_ptr = &vcpu_sbi_ext_experimental, .ext_ptr = &vcpu_sbi_ext_experimental,
}, },
{ {
.dis_idx = KVM_RISCV_SBI_EXT_VENDOR, .ext_idx = KVM_RISCV_SBI_EXT_VENDOR,
.ext_ptr = &vcpu_sbi_ext_vendor, .ext_ptr = &vcpu_sbi_ext_vendor,
}, },
}; };
...@@ -147,7 +147,7 @@ static int riscv_vcpu_set_sbi_ext_single(struct kvm_vcpu *vcpu, ...@@ -147,7 +147,7 @@ static int riscv_vcpu_set_sbi_ext_single(struct kvm_vcpu *vcpu,
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(sbi_ext); i++) { for (i = 0; i < ARRAY_SIZE(sbi_ext); i++) {
if (sbi_ext[i].dis_idx == reg_num) { if (sbi_ext[i].ext_idx == reg_num) {
sext = &sbi_ext[i]; sext = &sbi_ext[i];
break; break;
} }
...@@ -155,7 +155,7 @@ static int riscv_vcpu_set_sbi_ext_single(struct kvm_vcpu *vcpu, ...@@ -155,7 +155,7 @@ static int riscv_vcpu_set_sbi_ext_single(struct kvm_vcpu *vcpu,
if (!sext) if (!sext)
return -ENOENT; return -ENOENT;
scontext->extension_disabled[sext->dis_idx] = !reg_val; scontext->extension_disabled[sext->ext_idx] = !reg_val;
return 0; return 0;
} }
...@@ -172,7 +172,7 @@ static int riscv_vcpu_get_sbi_ext_single(struct kvm_vcpu *vcpu, ...@@ -172,7 +172,7 @@ static int riscv_vcpu_get_sbi_ext_single(struct kvm_vcpu *vcpu,
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(sbi_ext); i++) { for (i = 0; i < ARRAY_SIZE(sbi_ext); i++) {
if (sbi_ext[i].dis_idx == reg_num) { if (sbi_ext[i].ext_idx == reg_num) {
sext = &sbi_ext[i]; sext = &sbi_ext[i];
break; break;
} }
...@@ -180,7 +180,7 @@ static int riscv_vcpu_get_sbi_ext_single(struct kvm_vcpu *vcpu, ...@@ -180,7 +180,7 @@ static int riscv_vcpu_get_sbi_ext_single(struct kvm_vcpu *vcpu,
if (!sext) if (!sext)
return -ENOENT; return -ENOENT;
*reg_val = !scontext->extension_disabled[sext->dis_idx]; *reg_val = !scontext->extension_disabled[sext->ext_idx];
return 0; return 0;
} }
...@@ -315,8 +315,8 @@ const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext( ...@@ -315,8 +315,8 @@ const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext(
sext = &sbi_ext[i]; sext = &sbi_ext[i];
if (sext->ext_ptr->extid_start <= extid && if (sext->ext_ptr->extid_start <= extid &&
sext->ext_ptr->extid_end >= extid) { sext->ext_ptr->extid_end >= extid) {
if (sext->dis_idx < KVM_RISCV_SBI_EXT_MAX && if (sext->ext_idx < KVM_RISCV_SBI_EXT_MAX &&
scontext->extension_disabled[sext->dis_idx]) scontext->extension_disabled[sext->ext_idx])
return NULL; return NULL;
return sbi_ext[i].ext_ptr; return sbi_ext[i].ext_ptr;
} }
......
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