Skip to content

Commit 2594faa

Browse files
committed
Merge tag 'perf-tools-fixes-for-v6.7-1-2023-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools fixes from Namhyung Kim: "Assorted build fixes including: - fix compile errors in printf() with u64 on 32-bit systesm - sync kernel headers to the tool copies - update arm64 sysreg generation for tarballs - disable compile warnings on __packed attribute" * tag 'perf-tools-fixes-for-v6.7-1-2023-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: tools: Disable __packed attribute compiler warning due to -Werror=attributes perf build: Ensure sysreg-defs Makefile respects output dir tools perf: Add arm64 sysreg files to MANIFEST tools/perf: Update tools's copy of mips syscall table tools/perf: Update tools's copy of s390 syscall table tools/perf: Update tools's copy of powerpc syscall table tools/perf: Update tools's copy of x86 syscall table tools headers: Update tools's copy of s390/asm headers tools headers: Update tools's copy of arm64/asm headers tools headers: Update tools's copy of x86/asm headers tools headers: Update tools's copy of socket.h header tools headers UAPI: Update tools's copy of unistd.h header tools headers UAPI: Update tools's copy of vhost.h header tools headers UAPI: Update tools's copy of mount.h header tools headers UAPI: Update tools's copy of kvm.h header tools headers UAPI: Update tools's copy of fscrypt.h header tools headers UAPI: Update tools's copy of drm headers perf lock contention: Fix a build error on 32-bit perf kwork: Fix a build error on 32-bit
2 parents 6172a51 + 57686a7 commit 2594faa

File tree

28 files changed

+226
-39
lines changed

28 files changed

+226
-39
lines changed

tools/arch/arm64/include/asm/cputype.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@
7979
#define ARM_CPU_PART_CORTEX_A78AE 0xD42
8080
#define ARM_CPU_PART_CORTEX_X1 0xD44
8181
#define ARM_CPU_PART_CORTEX_A510 0xD46
82+
#define ARM_CPU_PART_CORTEX_A520 0xD80
8283
#define ARM_CPU_PART_CORTEX_A710 0xD47
8384
#define ARM_CPU_PART_CORTEX_A715 0xD4D
8485
#define ARM_CPU_PART_CORTEX_X2 0xD48
8586
#define ARM_CPU_PART_NEOVERSE_N2 0xD49
8687
#define ARM_CPU_PART_CORTEX_A78C 0xD4B
8788

88-
#define APM_CPU_PART_POTENZA 0x000
89+
#define APM_CPU_PART_XGENE 0x000
90+
#define APM_CPU_VAR_POTENZA 0x00
8991

9092
#define CAVIUM_CPU_PART_THUNDERX 0x0A1
9193
#define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2
@@ -148,6 +150,7 @@
148150
#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
149151
#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
150152
#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
153+
#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)
151154
#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
152155
#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
153156
#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)

tools/arch/arm64/include/uapi/asm/kvm.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,38 @@ struct kvm_smccc_filter {
505505
#define KVM_HYPERCALL_EXIT_SMC (1U << 0)
506506
#define KVM_HYPERCALL_EXIT_16BIT (1U << 1)
507507

508+
/*
509+
* Get feature ID registers userspace writable mask.
510+
*
511+
* From DDI0487J.a, D19.2.66 ("ID_AA64MMFR2_EL1, AArch64 Memory Model
512+
* Feature Register 2"):
513+
*
514+
* "The Feature ID space is defined as the System register space in
515+
* AArch64 with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7},
516+
* op2=={0-7}."
517+
*
518+
* This covers all currently known R/O registers that indicate
519+
* anything useful feature wise, including the ID registers.
520+
*
521+
* If we ever need to introduce a new range, it will be described as
522+
* such in the range field.
523+
*/
524+
#define KVM_ARM_FEATURE_ID_RANGE_IDX(op0, op1, crn, crm, op2) \
525+
({ \
526+
__u64 __op1 = (op1) & 3; \
527+
__op1 -= (__op1 == 3); \
528+
(__op1 << 6 | ((crm) & 7) << 3 | (op2)); \
529+
})
530+
531+
#define KVM_ARM_FEATURE_ID_RANGE 0
532+
#define KVM_ARM_FEATURE_ID_RANGE_SIZE (3 * 8 * 8)
533+
534+
struct reg_mask_range {
535+
__u64 addr; /* Pointer to mask array */
536+
__u32 range; /* Requested range */
537+
__u32 reserved[13];
538+
};
539+
508540
#endif
509541

510542
#endif /* __ARM_KVM_H__ */

tools/arch/arm64/include/uapi/asm/perf_regs.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ enum perf_event_arm_regs {
3636
PERF_REG_ARM64_LR,
3737
PERF_REG_ARM64_SP,
3838
PERF_REG_ARM64_PC,
39+
PERF_REG_ARM64_MAX,
3940

4041
/* Extended/pseudo registers */
41-
PERF_REG_ARM64_VG = 46, // SVE Vector Granule
42-
43-
PERF_REG_ARM64_MAX = PERF_REG_ARM64_PC + 1,
44-
PERF_REG_ARM64_EXTENDED_MAX = PERF_REG_ARM64_VG + 1
42+
PERF_REG_ARM64_VG = 46, /* SVE Vector Granule */
43+
PERF_REG_ARM64_EXTENDED_MAX
4544
};
45+
46+
#define PERF_REG_EXTENDED_MASK (1ULL << PERF_REG_ARM64_VG)
47+
4648
#endif /* _ASM_ARM64_PERF_REGS_H */

tools/arch/arm64/tools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ endif
2222
arm64_tools_dir = $(top_srcdir)/arch/arm64/tools
2323
arm64_sysreg_tbl = $(arm64_tools_dir)/sysreg
2424
arm64_gen_sysreg = $(arm64_tools_dir)/gen-sysreg.awk
25-
arm64_generated_dir = $(top_srcdir)/tools/arch/arm64/include/generated
25+
arm64_generated_dir = $(OUTPUT)arch/arm64/include/generated
2626
arm64_sysreg_defs = $(arm64_generated_dir)/asm/sysreg-defs.h
2727

2828
all: $(arm64_sysreg_defs)

tools/arch/s390/include/uapi/asm/kvm.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ struct kvm_s390_vm_cpu_subfunc {
159159
__u8 reserved[1728];
160160
};
161161

162+
#define KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST 6
163+
#define KVM_S390_VM_CPU_MACHINE_UV_FEAT_GUEST 7
164+
165+
#define KVM_S390_VM_CPU_UV_FEAT_NR_BITS 64
166+
struct kvm_s390_vm_cpu_uv_feat {
167+
union {
168+
struct {
169+
__u64 : 4;
170+
__u64 ap : 1; /* bit 4 */
171+
__u64 ap_intr : 1; /* bit 5 */
172+
__u64 : 58;
173+
};
174+
__u64 feat;
175+
};
176+
};
177+
162178
/* kvm attributes for crypto */
163179
#define KVM_S390_VM_CRYPTO_ENABLE_AES_KW 0
164180
#define KVM_S390_VM_CRYPTO_ENABLE_DEA_KW 1

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@
198198
#define X86_FEATURE_CAT_L3 ( 7*32+ 4) /* Cache Allocation Technology L3 */
199199
#define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */
200200
#define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */
201-
#define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */
202201
#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */
203202
#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
204203
#define X86_FEATURE_XCOMPACTED ( 7*32+10) /* "" Use compacted XSTATE (XSAVES or XSAVEC) */
@@ -308,6 +307,11 @@
308307
#define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */
309308
#define X86_FEATURE_SMBA (11*32+21) /* "" Slow Memory Bandwidth Allocation */
310309
#define X86_FEATURE_BMEC (11*32+22) /* "" Bandwidth Monitoring Event Configuration */
310+
#define X86_FEATURE_USER_SHSTK (11*32+23) /* Shadow stack support for user mode applications */
311+
312+
#define X86_FEATURE_SRSO (11*32+24) /* "" AMD BTB untrain RETs */
313+
#define X86_FEATURE_SRSO_ALIAS (11*32+25) /* "" AMD BTB untrain RETs through aliasing */
314+
#define X86_FEATURE_IBPB_ON_VMEXIT (11*32+26) /* "" Issue an IBPB only on VMEXIT */
311315

312316
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
313317
#define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
@@ -380,6 +384,7 @@
380384
#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
381385
#define X86_FEATURE_WAITPKG (16*32+ 5) /* UMONITOR/UMWAIT/TPAUSE Instructions */
382386
#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */
387+
#define X86_FEATURE_SHSTK (16*32+ 7) /* "" Shadow stack */
383388
#define X86_FEATURE_GFNI (16*32+ 8) /* Galois Field New Instructions */
384389
#define X86_FEATURE_VAES (16*32+ 9) /* Vector AES */
385390
#define X86_FEATURE_VPCLMULQDQ (16*32+10) /* Carry-Less Multiplication Double Quadword */
@@ -438,11 +443,16 @@
438443

439444
/* AMD-defined Extended Feature 2 EAX, CPUID level 0x80000021 (EAX), word 20 */
440445
#define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* "" No Nested Data Breakpoints */
446+
#define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* "" WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */
441447
#define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* "" LFENCE always serializing / synchronizes RDTSC */
442448
#define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* "" Null Selector Clears Base */
443449
#define X86_FEATURE_AUTOIBRS (20*32+ 8) /* "" Automatic IBRS */
444450
#define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* "" SMM_CTL MSR is not present */
445451

452+
#define X86_FEATURE_SBPB (20*32+27) /* "" Selective Branch Prediction Barrier */
453+
#define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* "" MSR_PRED_CMD[IBPB] flushes all branch type predictions */
454+
#define X86_FEATURE_SRSO_NO (20*32+29) /* "" CPU is not affected by SRSO */
455+
446456
/*
447457
* BUG word(s)
448458
*/
@@ -484,5 +494,9 @@
484494
#define X86_BUG_RETBLEED X86_BUG(27) /* CPU is affected by RETBleed */
485495
#define X86_BUG_EIBRS_PBRSB X86_BUG(28) /* EIBRS is vulnerable to Post Barrier RSB Predictions */
486496
#define X86_BUG_SMT_RSB X86_BUG(29) /* CPU is vulnerable to Cross-Thread Return Address Predictions */
497+
#define X86_BUG_GDS X86_BUG(30) /* CPU is affected by Gather Data Sampling */
487498

499+
/* BUG word 2 */
500+
#define X86_BUG_SRSO X86_BUG(1*32 + 0) /* AMD SRSO bug */
501+
#define X86_BUG_DIV0 X86_BUG(1*32 + 1) /* AMD DIV0 speculation bug */
488502
#endif /* _ASM_X86_CPUFEATURES_H */

tools/arch/x86/include/asm/disabled-features.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@
105105
# define DISABLE_TDX_GUEST (1 << (X86_FEATURE_TDX_GUEST & 31))
106106
#endif
107107

108+
#ifdef CONFIG_X86_USER_SHADOW_STACK
109+
#define DISABLE_USER_SHSTK 0
110+
#else
111+
#define DISABLE_USER_SHSTK (1 << (X86_FEATURE_USER_SHSTK & 31))
112+
#endif
113+
114+
#ifdef CONFIG_X86_KERNEL_IBT
115+
#define DISABLE_IBT 0
116+
#else
117+
#define DISABLE_IBT (1 << (X86_FEATURE_IBT & 31))
118+
#endif
119+
108120
/*
109121
* Make sure to add features to the correct mask
110122
*/
@@ -120,15 +132,15 @@
120132
#define DISABLED_MASK9 (DISABLE_SGX)
121133
#define DISABLED_MASK10 0
122134
#define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \
123-
DISABLE_CALL_DEPTH_TRACKING)
135+
DISABLE_CALL_DEPTH_TRACKING|DISABLE_USER_SHSTK)
124136
#define DISABLED_MASK12 (DISABLE_LAM)
125137
#define DISABLED_MASK13 0
126138
#define DISABLED_MASK14 0
127139
#define DISABLED_MASK15 0
128140
#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \
129141
DISABLE_ENQCMD)
130142
#define DISABLED_MASK17 0
131-
#define DISABLED_MASK18 0
143+
#define DISABLED_MASK18 (DISABLE_IBT)
132144
#define DISABLED_MASK19 0
133145
#define DISABLED_MASK20 0
134146
#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21)

tools/arch/x86/include/asm/msr-index.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
#define MSR_INTEGRITY_CAPS_ARRAY_BIST BIT(MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT)
223223
#define MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT 4
224224
#define MSR_INTEGRITY_CAPS_PERIODIC_BIST BIT(MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT)
225+
#define MSR_INTEGRITY_CAPS_SAF_GEN_MASK GENMASK_ULL(10, 9)
225226

226227
#define MSR_LBR_NHM_FROM 0x00000680
227228
#define MSR_LBR_NHM_TO 0x000006c0
@@ -553,6 +554,7 @@
553554
#define MSR_AMD64_CPUID_FN_1 0xc0011004
554555
#define MSR_AMD64_LS_CFG 0xc0011020
555556
#define MSR_AMD64_DC_CFG 0xc0011022
557+
#define MSR_AMD64_TW_CFG 0xc0011023
556558

557559
#define MSR_AMD64_DE_CFG 0xc0011029
558560
#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT 1
@@ -637,12 +639,21 @@
637639
/* AMD Last Branch Record MSRs */
638640
#define MSR_AMD64_LBR_SELECT 0xc000010e
639641

642+
/* Zen4 */
643+
#define MSR_ZEN4_BP_CFG 0xc001102e
644+
#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
645+
646+
/* Fam 19h MSRs */
647+
#define MSR_F19H_UMC_PERF_CTL 0xc0010800
648+
#define MSR_F19H_UMC_PERF_CTR 0xc0010801
649+
650+
/* Zen 2 */
651+
#define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3
652+
#define MSR_ZEN2_SPECTRAL_CHICKEN_BIT BIT_ULL(1)
653+
640654
/* Fam 17h MSRs */
641655
#define MSR_F17H_IRPERF 0xc00000e9
642656

643-
#define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3
644-
#define MSR_ZEN2_SPECTRAL_CHICKEN_BIT BIT_ULL(1)
645-
646657
/* Fam 16h MSRs */
647658
#define MSR_F16H_L2I_PERF_CTL 0xc0010230
648659
#define MSR_F16H_L2I_PERF_CTR 0xc0010231
@@ -1112,12 +1123,16 @@
11121123
#define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14)
11131124
#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
11141125
#define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE 0x1F
1115-
/* AMD-V MSRs */
11161126

1127+
/* AMD-V MSRs */
11171128
#define MSR_VM_CR 0xc0010114
11181129
#define MSR_VM_IGNNE 0xc0010115
11191130
#define MSR_VM_HSAVE_PA 0xc0010117
11201131

1132+
#define SVM_VM_CR_VALID_MASK 0x001fULL
1133+
#define SVM_VM_CR_SVM_LOCK_MASK 0x0008ULL
1134+
#define SVM_VM_CR_SVM_DIS_MASK 0x0010ULL
1135+
11211136
/* Hardware Feedback Interface */
11221137
#define MSR_IA32_HW_FEEDBACK_PTR 0x17d0
11231138
#define MSR_IA32_HW_FEEDBACK_CONFIG 0x17d1

tools/arch/x86/include/uapi/asm/prctl.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@
2323
#define ARCH_MAP_VDSO_32 0x2002
2424
#define ARCH_MAP_VDSO_64 0x2003
2525

26+
/* Don't use 0x3001-0x3004 because of old glibcs */
27+
2628
#define ARCH_GET_UNTAG_MASK 0x4001
2729
#define ARCH_ENABLE_TAGGED_ADDR 0x4002
2830
#define ARCH_GET_MAX_TAG_BITS 0x4003
2931
#define ARCH_FORCE_TAGGED_SVA 0x4004
3032

33+
#define ARCH_SHSTK_ENABLE 0x5001
34+
#define ARCH_SHSTK_DISABLE 0x5002
35+
#define ARCH_SHSTK_LOCK 0x5003
36+
#define ARCH_SHSTK_UNLOCK 0x5004
37+
#define ARCH_SHSTK_STATUS 0x5005
38+
39+
/* ARCH_SHSTK_ features bits */
40+
#define ARCH_SHSTK_SHSTK (1ULL << 0)
41+
#define ARCH_SHSTK_WRSS (1ULL << 1)
42+
3143
#endif /* _ASM_X86_PRCTL_H */

tools/include/asm-generic/unaligned.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
#pragma GCC diagnostic push
1010
#pragma GCC diagnostic ignored "-Wpacked"
11+
#pragma GCC diagnostic ignored "-Wattributes"
1112

1213
#define __get_unaligned_t(type, ptr) ({ \
1314
const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \

0 commit comments

Comments
 (0)