Skip to content

Commit 86f0160

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "A simple fix to a definition in the CXL PMU driver, a couple of patches to restore SME control registers on the resume path (since Arm's fast model now clears them) and a revert for our jump label asm constraints after Geert noticed they broke the build with GCC 5.5. There was then the ensuing discussion about raising the minimum GCC (and corresponding binutils) versions at [1], but for now we'll keep things working as they were until that goes ahead. - Revert fix to jump label asm constraints, as it regresses the build with some GCC 5.5 toolchains. - Restore SME control registers when resuming from suspend - Fix incorrect filter definition in CXL PMU driver" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64/sme: Restore SMCR_EL1.EZT0 on exit from suspend arm64/sme: Restore SME registers on exit from suspend Revert "arm64: jump_label: use constraints "Si" instead of "i"" perf: CXL: fix CPMU filter value mask length
2 parents 5efa18e + d7b77a0 commit 86f0160

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

arch/arm64/include/asm/fpsimd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ extern void sme_alloc(struct task_struct *task, bool flush);
386386
extern unsigned int sme_get_vl(void);
387387
extern int sme_set_current_vl(unsigned long arg);
388388
extern int sme_get_current_vl(void);
389+
extern void sme_suspend_exit(void);
389390

390391
/*
391392
* Return how many bytes of memory are required to store the full SME
@@ -421,6 +422,7 @@ static inline int sme_max_vl(void) { return 0; }
421422
static inline int sme_max_virtualisable_vl(void) { return 0; }
422423
static inline int sme_set_current_vl(unsigned long arg) { return -EINVAL; }
423424
static inline int sme_get_current_vl(void) { return -EINVAL; }
425+
static inline void sme_suspend_exit(void) { }
424426

425427
static inline size_t sme_state_size(struct task_struct const *task)
426428
{

arch/arm64/include/asm/jump_label.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
1717

18-
/*
19-
* Prefer the constraint "S" to support PIC with GCC. Clang before 19 does not
20-
* support "S" on a symbol with a constant offset, so we use "i" as a fallback.
21-
*/
2218
static __always_inline bool arch_static_branch(struct static_key * const key,
2319
const bool branch)
2420
{
@@ -27,9 +23,9 @@ static __always_inline bool arch_static_branch(struct static_key * const key,
2723
" .pushsection __jump_table, \"aw\" \n\t"
2824
" .align 3 \n\t"
2925
" .long 1b - ., %l[l_yes] - . \n\t"
30-
" .quad (%[key] - .) + %[bit0] \n\t"
26+
" .quad %c0 - . \n\t"
3127
" .popsection \n\t"
32-
: : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);
28+
: : "i"(&((char *)key)[branch]) : : l_yes);
3329

3430
return false;
3531
l_yes:
@@ -44,9 +40,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke
4440
" .pushsection __jump_table, \"aw\" \n\t"
4541
" .align 3 \n\t"
4642
" .long 1b - ., %l[l_yes] - . \n\t"
47-
" .quad (%[key] - .) + %[bit0] \n\t"
43+
" .quad %c0 - . \n\t"
4844
" .popsection \n\t"
49-
: : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);
45+
: : "i"(&((char *)key)[branch]) : : l_yes);
5046

5147
return false;
5248
l_yes:

arch/arm64/kernel/fpsimd.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,22 @@ void __init sme_setup(void)
13111311
get_sme_default_vl());
13121312
}
13131313

1314+
void sme_suspend_exit(void)
1315+
{
1316+
u64 smcr = 0;
1317+
1318+
if (!system_supports_sme())
1319+
return;
1320+
1321+
if (system_supports_fa64())
1322+
smcr |= SMCR_ELx_FA64;
1323+
if (system_supports_sme2())
1324+
smcr |= SMCR_ELx_EZT0;
1325+
1326+
write_sysreg_s(smcr, SYS_SMCR_EL1);
1327+
write_sysreg_s(0, SYS_SMPRI_EL1);
1328+
}
1329+
13141330
#endif /* CONFIG_ARM64_SME */
13151331

13161332
static void sve_init_regs(void)

arch/arm64/kernel/suspend.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <asm/daifflags.h>
1313
#include <asm/debug-monitors.h>
1414
#include <asm/exec.h>
15+
#include <asm/fpsimd.h>
1516
#include <asm/mte.h>
1617
#include <asm/memory.h>
1718
#include <asm/mmu_context.h>
@@ -80,6 +81,8 @@ void notrace __cpu_suspend_exit(void)
8081
*/
8182
spectre_v4_enable_mitigation(NULL);
8283

84+
sme_suspend_exit();
85+
8386
/* Restore additional feature-specific configuration */
8487
ptrauth_suspend_exit();
8588
}

drivers/perf/cxl_pmu.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#define CXL_PMU_COUNTER_CFG_EVENT_GRP_ID_IDX_MSK GENMASK_ULL(63, 59)
6060

6161
#define CXL_PMU_FILTER_CFG_REG(n, f) (0x400 + 4 * ((f) + (n) * 8))
62-
#define CXL_PMU_FILTER_CFG_VALUE_MSK GENMASK(15, 0)
62+
#define CXL_PMU_FILTER_CFG_VALUE_MSK GENMASK(31, 0)
6363

6464
#define CXL_PMU_COUNTER_REG(n) (0xc00 + 8 * (n))
6565

@@ -314,9 +314,9 @@ static bool cxl_pmu_config1_get_edge(struct perf_event *event)
314314
}
315315

316316
/*
317-
* CPMU specification allows for 8 filters, each with a 16 bit value...
318-
* So we need to find 8x16bits to store it in.
319-
* As the value used for disable is 0xffff, a separate enable switch
317+
* CPMU specification allows for 8 filters, each with a 32 bit value...
318+
* So we need to find 8x32bits to store it in.
319+
* As the value used for disable is 0xffff_ffff, a separate enable switch
320320
* is needed.
321321
*/
322322

@@ -642,7 +642,7 @@ static void cxl_pmu_event_start(struct perf_event *event, int flags)
642642
if (cxl_pmu_config1_hdm_filter_en(event))
643643
cfg = cxl_pmu_config2_get_hdm_decoder(event);
644644
else
645-
cfg = GENMASK(15, 0); /* No filtering if 0xFFFF_FFFF */
645+
cfg = GENMASK(31, 0); /* No filtering if 0xFFFF_FFFF */
646646
writeq(cfg, base + CXL_PMU_FILTER_CFG_REG(hwc->idx, 0));
647647
}
648648

0 commit comments

Comments
 (0)