Skip to content

Commit b556889

Browse files
author
Marc Zyngier
committed
KVM: arm64: Move SVCR into the sysreg array
SVCR is just a system register, and has no purpose being outside of the sysreg array. If anything, it only makes it more difficult to eventually support SME one day. If ever. Move it into the array with its little friends, and associate it with a visibility predicate. Although this is dead code, it at least paves the way for the next set of FP-related extensions. Reviewed-by: Mark Brown <[email protected]> Tested-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 8400291 commit b556889

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ enum vcpu_sysreg {
446446
GCR_EL1, /* Tag Control Register */
447447
TFSRE0_EL1, /* Tag Fault Status Register (EL0) */
448448

449+
/* FP/SIMD/SVE */
450+
SVCR,
451+
449452
/* 32bit specific registers. */
450453
DACR32_EL2, /* Domain Access Control Register */
451454
IFSR32_EL2, /* Instruction Fault Status Register */
@@ -664,7 +667,6 @@ struct kvm_vcpu_arch {
664667
void *sve_state;
665668
enum fp_type fp_type;
666669
unsigned int sve_max_vl;
667-
u64 svcr;
668670
u64 fpmr;
669671

670672
/* Stage 2 paging state used by the hardware on next switch */

arch/arm64/kvm/fpsimd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu)
134134
fp_state.sve_state = vcpu->arch.sve_state;
135135
fp_state.sve_vl = vcpu->arch.sve_max_vl;
136136
fp_state.sme_state = NULL;
137-
fp_state.svcr = &vcpu->arch.svcr;
137+
fp_state.svcr = &__vcpu_sys_reg(vcpu, SVCR);
138138
fp_state.fpmr = &vcpu->arch.fpmr;
139139
fp_state.fp_type = &vcpu->arch.fp_type;
140140

arch/arm64/kvm/sys_regs.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,15 @@ static unsigned int sve_visibility(const struct kvm_vcpu *vcpu,
16691669
return REG_HIDDEN;
16701670
}
16711671

1672+
static unsigned int sme_visibility(const struct kvm_vcpu *vcpu,
1673+
const struct sys_reg_desc *rd)
1674+
{
1675+
if (kvm_has_feat(vcpu->kvm, ID_AA64PFR1_EL1, SME, IMP))
1676+
return 0;
1677+
1678+
return REG_HIDDEN;
1679+
}
1680+
16721681
static u64 read_sanitised_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
16731682
const struct sys_reg_desc *rd)
16741683
{
@@ -2535,7 +2544,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
25352544
CTR_EL0_IDC_MASK |
25362545
CTR_EL0_DminLine_MASK |
25372546
CTR_EL0_IminLine_MASK),
2538-
{ SYS_DESC(SYS_SVCR), undef_access },
2547+
{ SYS_DESC(SYS_SVCR), undef_access, reset_val, SVCR, 0, .visibility = sme_visibility },
25392548

25402549
{ PMU_SYS_REG(PMCR_EL0), .access = access_pmcr, .reset = reset_pmcr,
25412550
.reg = PMCR_EL0, .get_user = get_pmcr, .set_user = set_pmcr },

0 commit comments

Comments
 (0)