Skip to content

Commit 4e26de2

Browse files
author
Marc Zyngier
committed
Merge remote-tracking branch 'arm64/for-next/cpufeature' into kvm-arm64/pkvm-fixed-features-6.14
Merge arm64/for-next/cpufeature to solve extensive conflicts caused by the CPACR_ELx->CPACR_EL1 repainting. Signed-off-by: Marc Zyngier <[email protected]>
2 parents b7f345f + e5ecedc commit 4e26de2

File tree

17 files changed

+85
-86
lines changed

17 files changed

+85
-86
lines changed

arch/arm64/include/asm/cpucaps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ cpucap_is_possible(const unsigned int cap)
4646
return IS_ENABLED(CONFIG_ARM64_POE);
4747
case ARM64_HAS_GCS:
4848
return IS_ENABLED(CONFIG_ARM64_GCS);
49+
case ARM64_HAFT:
50+
return IS_ENABLED(CONFIG_ARM64_HAFT);
4951
case ARM64_UNMAP_KERNEL_AT_EL0:
5052
return IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0);
5153
case ARM64_WORKAROUND_843419:

arch/arm64/include/asm/cpufeature.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,7 @@ static inline bool system_supports_gcs(void)
852852

853853
static inline bool system_supports_haft(void)
854854
{
855-
return IS_ENABLED(CONFIG_ARM64_HAFT) &&
856-
cpus_have_final_cap(ARM64_HAFT);
855+
return cpus_have_final_cap(ARM64_HAFT);
857856
}
858857

859858
static __always_inline bool system_supports_mpam(void)

arch/arm64/include/asm/el2_setup.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
/* Coprocessor traps */
155155
.macro __init_el2_cptr
156156
__check_hvhe .LnVHE_\@, x1
157-
mov x0, #CPACR_ELx_FPEN
157+
mov x0, #CPACR_EL1_FPEN
158158
msr cpacr_el1, x0
159159
b .Lskip_set_cptr_\@
160160
.LnVHE_\@:
@@ -332,7 +332,7 @@
332332

333333
// (h)VHE case
334334
mrs x0, cpacr_el1 // Disable SVE traps
335-
orr x0, x0, #CPACR_ELx_ZEN
335+
orr x0, x0, #CPACR_EL1_ZEN
336336
msr cpacr_el1, x0
337337
b .Lskip_set_cptr_\@
338338

@@ -353,7 +353,7 @@
353353

354354
// (h)VHE case
355355
mrs x0, cpacr_el1 // Disable SME traps
356-
orr x0, x0, #CPACR_ELx_SMEN
356+
orr x0, x0, #CPACR_EL1_SMEN
357357
msr cpacr_el1, x0
358358
b .Lskip_set_cptr_sme_\@
359359

arch/arm64/include/asm/kvm_arm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@
391391
ECN(SOFTSTP_CUR), ECN(WATCHPT_LOW), ECN(WATCHPT_CUR), \
392392
ECN(BKPT32), ECN(VECTOR32), ECN(BRK64), ECN(ERET)
393393

394-
#define CPACR_EL1_TTA (1 << 28)
395-
396394
#define kvm_mode_names \
397395
{ PSR_MODE_EL0t, "EL0t" }, \
398396
{ PSR_MODE_EL1t, "EL1t" }, \

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,13 @@ static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu)
556556
({ \
557557
u64 cptr = 0; \
558558
\
559-
if ((set) & CPACR_ELx_FPEN) \
559+
if ((set) & CPACR_EL1_FPEN) \
560560
cptr |= CPTR_EL2_TFP; \
561-
if ((set) & CPACR_ELx_ZEN) \
561+
if ((set) & CPACR_EL1_ZEN) \
562562
cptr |= CPTR_EL2_TZ; \
563-
if ((set) & CPACR_ELx_SMEN) \
563+
if ((set) & CPACR_EL1_SMEN) \
564564
cptr |= CPTR_EL2_TSM; \
565-
if ((clr) & CPACR_ELx_TTA) \
565+
if ((clr) & CPACR_EL1_TTA) \
566566
cptr |= CPTR_EL2_TTA; \
567567
if ((clr) & CPTR_EL2_TAM) \
568568
cptr |= CPTR_EL2_TAM; \
@@ -576,13 +576,13 @@ static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu)
576576
({ \
577577
u64 cptr = 0; \
578578
\
579-
if ((clr) & CPACR_ELx_FPEN) \
579+
if ((clr) & CPACR_EL1_FPEN) \
580580
cptr |= CPTR_EL2_TFP; \
581-
if ((clr) & CPACR_ELx_ZEN) \
581+
if ((clr) & CPACR_EL1_ZEN) \
582582
cptr |= CPTR_EL2_TZ; \
583-
if ((clr) & CPACR_ELx_SMEN) \
583+
if ((clr) & CPACR_EL1_SMEN) \
584584
cptr |= CPTR_EL2_TSM; \
585-
if ((set) & CPACR_ELx_TTA) \
585+
if ((set) & CPACR_EL1_TTA) \
586586
cptr |= CPTR_EL2_TTA; \
587587
if ((set) & CPTR_EL2_TAM) \
588588
cptr |= CPTR_EL2_TAM; \
@@ -595,13 +595,13 @@ static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu)
595595
#define cpacr_clear_set(clr, set) \
596596
do { \
597597
BUILD_BUG_ON((set) & CPTR_VHE_EL2_RES0); \
598-
BUILD_BUG_ON((clr) & CPACR_ELx_E0POE); \
599-
__build_check_all_or_none((clr), CPACR_ELx_FPEN); \
600-
__build_check_all_or_none((set), CPACR_ELx_FPEN); \
601-
__build_check_all_or_none((clr), CPACR_ELx_ZEN); \
602-
__build_check_all_or_none((set), CPACR_ELx_ZEN); \
603-
__build_check_all_or_none((clr), CPACR_ELx_SMEN); \
604-
__build_check_all_or_none((set), CPACR_ELx_SMEN); \
598+
BUILD_BUG_ON((clr) & CPACR_EL1_E0POE); \
599+
__build_check_all_or_none((clr), CPACR_EL1_FPEN); \
600+
__build_check_all_or_none((set), CPACR_EL1_FPEN); \
601+
__build_check_all_or_none((clr), CPACR_EL1_ZEN); \
602+
__build_check_all_or_none((set), CPACR_EL1_ZEN); \
603+
__build_check_all_or_none((clr), CPACR_EL1_SMEN); \
604+
__build_check_all_or_none((set), CPACR_EL1_SMEN); \
605605
\
606606
if (has_vhe() || has_hvhe()) \
607607
sysreg_clear_set(cpacr_el1, clr, set); \
@@ -625,16 +625,16 @@ static __always_inline void __kvm_reset_cptr_el2(struct kvm *kvm)
625625
u64 val;
626626

627627
if (has_vhe()) {
628-
val = (CPACR_ELx_FPEN | CPACR_EL1_ZEN_EL1EN);
628+
val = (CPACR_EL1_FPEN | CPACR_EL1_ZEN_EL1EN);
629629
if (cpus_have_final_cap(ARM64_SME))
630630
val |= CPACR_EL1_SMEN_EL1EN;
631631
} else if (has_hvhe()) {
632-
val = CPACR_ELx_FPEN;
632+
val = CPACR_EL1_FPEN;
633633

634634
if (!kvm_has_sve(kvm) || !guest_owns_fp_regs())
635-
val |= CPACR_ELx_ZEN;
635+
val |= CPACR_EL1_ZEN;
636636
if (cpus_have_final_cap(ARM64_SME))
637-
val |= CPACR_ELx_SMEN;
637+
val |= CPACR_EL1_SMEN;
638638
} else {
639639
val = CPTR_NVHE_EL2_RES1;
640640

@@ -685,7 +685,7 @@ static inline bool ____cptr_xen_trap_enabled(const struct kvm_vcpu *vcpu,
685685
#define __guest_hyp_cptr_xen_trap_enabled(vcpu, xen) \
686686
(!vcpu_has_nv(vcpu) ? false : \
687687
____cptr_xen_trap_enabled(vcpu, \
688-
SYS_FIELD_GET(CPACR_ELx, xen, \
688+
SYS_FIELD_GET(CPACR_EL1, xen, \
689689
vcpu_sanitised_cptr_el2(vcpu))))
690690

691691
static inline bool guest_hyp_fpsimd_traps_enabled(const struct kvm_vcpu *vcpu)

arch/arm64/include/asm/kvm_nested.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ static inline u64 translate_tcr_el2_to_tcr_el1(u64 tcr)
3333

3434
static inline u64 translate_cptr_el2_to_cpacr_el1(u64 cptr_el2)
3535
{
36-
u64 cpacr_el1 = CPACR_ELx_RES1;
36+
u64 cpacr_el1 = CPACR_EL1_RES1;
3737

3838
if (cptr_el2 & CPTR_EL2_TTA)
39-
cpacr_el1 |= CPACR_ELx_TTA;
39+
cpacr_el1 |= CPACR_EL1_TTA;
4040
if (!(cptr_el2 & CPTR_EL2_TFP))
41-
cpacr_el1 |= CPACR_ELx_FPEN;
41+
cpacr_el1 |= CPACR_EL1_FPEN;
4242
if (!(cptr_el2 & CPTR_EL2_TZ))
43-
cpacr_el1 |= CPACR_ELx_ZEN;
43+
cpacr_el1 |= CPACR_EL1_ZEN;
4444

4545
cpacr_el1 |= cptr_el2 & (CPTR_EL2_TCPAC | CPTR_EL2_TAM);
4646

arch/arm64/kernel/cpufeature.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,17 +1004,16 @@ static void init_cpu_ftr_reg(u32 sys_reg, u64 new)
10041004
/* Override was valid */
10051005
ftr_new = tmp;
10061006
str = "forced";
1007-
} else if (ftr_ovr == tmp) {
1007+
} else {
10081008
/* Override was the safe value */
10091009
str = "already set";
10101010
}
10111011

1012-
if (str)
1013-
pr_warn("%s[%d:%d]: %s to %llx\n",
1014-
reg->name,
1015-
ftrp->shift + ftrp->width - 1,
1016-
ftrp->shift, str,
1017-
tmp & (BIT(ftrp->width) - 1));
1012+
pr_warn("%s[%d:%d]: %s to %llx\n",
1013+
reg->name,
1014+
ftrp->shift + ftrp->width - 1,
1015+
ftrp->shift, str,
1016+
tmp & (BIT(ftrp->width) - 1));
10181017
} else if ((ftr_mask & reg->override->val) == ftr_mask) {
10191018
reg->override->val &= ~ftr_mask;
10201019
pr_warn("%s[%d:%d]: impossible override, ignored\n",
@@ -2376,8 +2375,8 @@ static void cpu_enable_mops(const struct arm64_cpu_capabilities *__unused)
23762375
#ifdef CONFIG_ARM64_POE
23772376
static void cpu_enable_poe(const struct arm64_cpu_capabilities *__unused)
23782377
{
2379-
sysreg_clear_set(REG_TCR2_EL1, 0, TCR2_EL1x_E0POE);
2380-
sysreg_clear_set(CPACR_EL1, 0, CPACR_ELx_E0POE);
2378+
sysreg_clear_set(REG_TCR2_EL1, 0, TCR2_EL1_E0POE);
2379+
sysreg_clear_set(CPACR_EL1, 0, CPACR_EL1_E0POE);
23812380
}
23822381
#endif
23832382

arch/arm64/kvm/at.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static bool s1pie_enabled(struct kvm_vcpu *vcpu, enum trans_regime regime)
111111
return vcpu_read_sys_reg(vcpu, TCR2_EL2) & TCR2_EL2_PIE;
112112
case TR_EL10:
113113
return (__vcpu_sys_reg(vcpu, HCRX_EL2) & HCRX_EL2_TCR2En) &&
114-
(__vcpu_sys_reg(vcpu, TCR2_EL1) & TCR2_EL1x_PIE);
114+
(__vcpu_sys_reg(vcpu, TCR2_EL1) & TCR2_EL1_PIE);
115115
default:
116116
BUG();
117117
}
@@ -140,8 +140,8 @@ static void compute_s1poe(struct kvm_vcpu *vcpu, struct s1_walk_info *wi)
140140
}
141141

142142
val = __vcpu_sys_reg(vcpu, TCR2_EL1);
143-
wi->poe = val & TCR2_EL1x_POE;
144-
wi->e0poe = val & TCR2_EL1x_E0POE;
143+
wi->poe = val & TCR2_EL1_POE;
144+
wi->e0poe = val & TCR2_EL1_E0POE;
145145
}
146146
}
147147

arch/arm64/kvm/emulate-nested.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static enum trap_behaviour check_cptr_tta(struct kvm_vcpu *vcpu)
494494
if (!vcpu_el2_e2h_is_set(vcpu))
495495
val = translate_cptr_el2_to_cpacr_el1(val);
496496

497-
if (val & CPACR_ELx_TTA)
497+
if (val & CPACR_EL1_TTA)
498498
return BEHAVE_FORWARD_RW;
499499

500500
return BEHAVE_HANDLE_LOCALLY;

arch/arm64/kvm/fpsimd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)
169169
if (has_vhe() && system_supports_sme()) {
170170
/* Also restore EL0 state seen on entry */
171171
if (vcpu_get_flag(vcpu, HOST_SME_ENABLED))
172-
sysreg_clear_set(CPACR_EL1, 0, CPACR_ELx_SMEN);
172+
sysreg_clear_set(CPACR_EL1, 0, CPACR_EL1_SMEN);
173173
else
174174
sysreg_clear_set(CPACR_EL1,
175175
CPACR_EL1_SMEN_EL0EN,

0 commit comments

Comments
 (0)