Skip to content

Commit 7d9c1ed

Browse files
author
Marc Zyngier
committed
KVM: arm64: Move FPMR into the sysreg array
Just like SVCR, FPMR is currently stored at the wrong location. Let's move it where it belongs. Reviewed-by: Mark Brown <broonie@kernel.org> Tested-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20240820131802.3547589-4-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent d4db987 commit 7d9c1ed

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ enum vcpu_sysreg {
448448

449449
/* FP/SIMD/SVE */
450450
SVCR,
451+
FPMR,
451452

452453
/* 32bit specific registers. */
453454
DACR32_EL2, /* Domain Access Control Register */
@@ -667,7 +668,6 @@ struct kvm_vcpu_arch {
667668
void *sve_state;
668669
enum fp_type fp_type;
669670
unsigned int sve_max_vl;
670-
u64 fpmr;
671671

672672
/* Stage 2 paging state used by the hardware on next switch */
673673
struct kvm_s2_mmu *hw_mmu;

arch/arm64/kvm/fpsimd.c

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

141141
if (vcpu_has_sve(vcpu))

arch/arm64/kvm/sys_regs.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,15 @@ static unsigned int sme_visibility(const struct kvm_vcpu *vcpu,
16781678
return REG_HIDDEN;
16791679
}
16801680

1681+
static unsigned int fp8_visibility(const struct kvm_vcpu *vcpu,
1682+
const struct sys_reg_desc *rd)
1683+
{
1684+
if (kvm_has_fpmr(vcpu->kvm))
1685+
return 0;
1686+
1687+
return REG_HIDDEN;
1688+
}
1689+
16811690
static u64 read_sanitised_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
16821691
const struct sys_reg_desc *rd)
16831692
{
@@ -2545,6 +2554,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
25452554
CTR_EL0_DminLine_MASK |
25462555
CTR_EL0_IminLine_MASK),
25472556
{ SYS_DESC(SYS_SVCR), undef_access, reset_val, SVCR, 0, .visibility = sme_visibility },
2557+
{ SYS_DESC(SYS_FPMR), undef_access, reset_val, FPMR, 0, .visibility = fp8_visibility },
25482558

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

0 commit comments

Comments
 (0)