Skip to content

Commit d7a5aa4

Browse files
committed
Merge tag 'perf-tools-fixes-for-v6.11-2024-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools fixes from Namhyung Kim: "The usual header file sync-ups and one more build fix: - Add README file to explain why we copy the headers - Sync UAPI and other header files with kernel source - Fix build on MIPS 32-bit" * tag 'perf-tools-fixes-for-v6.11-2024-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: perf daemon: Fix the build on 32-bit architectures tools/include: Sync arm64 headers with the kernel sources tools/include: Sync x86 headers with the kernel sources tools/include: Sync filesystem headers with the kernel sources tools/include: Sync network socket headers with the kernel sources tools/include: Sync uapi/asm-generic/unistd.h with the kernel sources tools/include: Sync uapi/sound/asound.h with the kernel sources tools/include: Sync uapi/linux/perf.h with the kernel sources tools/include: Sync uapi/linux/kvm.h with the kernel sources tools/include: Sync uapi/drm/i915_drm.h with the kernel sources perf tools: Add tools/include/uapi/README
2 parents e724918 + 4bbe600 commit d7a5aa4

File tree

22 files changed

+814
-426
lines changed

22 files changed

+814
-426
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@
8686
#define ARM_CPU_PART_CORTEX_X2 0xD48
8787
#define ARM_CPU_PART_NEOVERSE_N2 0xD49
8888
#define ARM_CPU_PART_CORTEX_A78C 0xD4B
89+
#define ARM_CPU_PART_CORTEX_X1C 0xD4C
90+
#define ARM_CPU_PART_CORTEX_X3 0xD4E
8991
#define ARM_CPU_PART_NEOVERSE_V2 0xD4F
92+
#define ARM_CPU_PART_CORTEX_A720 0xD81
9093
#define ARM_CPU_PART_CORTEX_X4 0xD82
9194
#define ARM_CPU_PART_NEOVERSE_V3 0xD84
95+
#define ARM_CPU_PART_CORTEX_X925 0xD85
96+
#define ARM_CPU_PART_CORTEX_A725 0xD87
9297

9398
#define APM_CPU_PART_XGENE 0x000
9499
#define APM_CPU_VAR_POTENZA 0x00
@@ -162,9 +167,14 @@
162167
#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
163168
#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
164169
#define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C)
170+
#define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C)
171+
#define MIDR_CORTEX_X3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X3)
165172
#define MIDR_NEOVERSE_V2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V2)
173+
#define MIDR_CORTEX_A720 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A720)
166174
#define MIDR_CORTEX_X4 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X4)
167175
#define MIDR_NEOVERSE_V3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V3)
176+
#define MIDR_CORTEX_X925 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X925)
177+
#define MIDR_CORTEX_A725 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A725)
168178
#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
169179
#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
170180
#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ struct kvm_ppc_cpu_char {
645645
#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3)
646646
#define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4)
647647
#define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5)
648+
#define KVM_REG_PPC_DEXCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc6)
649+
#define KVM_REG_PPC_HASHKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc7)
650+
#define KVM_REG_PPC_HASHPKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc8)
648651

649652
/* Transactional Memory checkpointed state:
650653
* This is all GPRs, all VSX regs and a subset of SPRs

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

Lines changed: 403 additions & 400 deletions
Large diffs are not rendered by default.

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,12 @@
566566
#define MSR_RELOAD_PMC0 0x000014c1
567567
#define MSR_RELOAD_FIXED_CTR0 0x00001309
568568

569+
/* V6 PMON MSR range */
570+
#define MSR_IA32_PMC_V6_GP0_CTR 0x1900
571+
#define MSR_IA32_PMC_V6_GP0_CFG_A 0x1901
572+
#define MSR_IA32_PMC_V6_FX0_CTR 0x1980
573+
#define MSR_IA32_PMC_V6_STEP 4
574+
569575
/* KeyID partitioning between MKTME and TDX */
570576
#define MSR_IA32_MKTME_KEYID_PARTITIONING 0x00000087
571577

@@ -660,6 +666,8 @@
660666
#define MSR_AMD64_RMP_BASE 0xc0010132
661667
#define MSR_AMD64_RMP_END 0xc0010133
662668

669+
#define MSR_SVSM_CAA 0xc001f000
670+
663671
/* AMD Collaborative Processor Performance Control MSRs */
664672
#define MSR_AMD_CPPC_CAP1 0xc00102b0
665673
#define MSR_AMD_CPPC_ENABLE 0xc00102b1
@@ -781,6 +789,8 @@
781789
#define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
782790
#define MSR_K7_FID_VID_CTL 0xc0010041
783791
#define MSR_K7_FID_VID_STATUS 0xc0010042
792+
#define MSR_K7_HWCR_CPB_DIS_BIT 25
793+
#define MSR_K7_HWCR_CPB_DIS BIT_ULL(MSR_K7_HWCR_CPB_DIS_BIT)
784794

785795
/* K6 MSRs */
786796
#define MSR_K6_WHCR 0xc0000082
@@ -1164,6 +1174,7 @@
11641174
#define MSR_IA32_QM_CTR 0xc8e
11651175
#define MSR_IA32_PQR_ASSOC 0xc8f
11661176
#define MSR_IA32_L3_CBM_BASE 0xc90
1177+
#define MSR_RMID_SNC_CONFIG 0xca0
11671178
#define MSR_IA32_L2_CBM_BASE 0xd10
11681179
#define MSR_IA32_MBA_THRTL_BASE 0xd50
11691180

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ struct kvm_ioapic_state {
106106

107107
#define KVM_RUN_X86_SMM (1 << 0)
108108
#define KVM_RUN_X86_BUS_LOCK (1 << 1)
109+
#define KVM_RUN_X86_GUEST_MODE (1 << 2)
109110

110111
/* for KVM_GET_REGS and KVM_SET_REGS */
111112
struct kvm_regs {
@@ -697,6 +698,11 @@ enum sev_cmd_id {
697698
/* Second time is the charm; improved versions of the above ioctls. */
698699
KVM_SEV_INIT2,
699700

701+
/* SNP-specific commands */
702+
KVM_SEV_SNP_LAUNCH_START = 100,
703+
KVM_SEV_SNP_LAUNCH_UPDATE,
704+
KVM_SEV_SNP_LAUNCH_FINISH,
705+
700706
KVM_SEV_NR_MAX,
701707
};
702708

@@ -824,6 +830,48 @@ struct kvm_sev_receive_update_data {
824830
__u32 pad2;
825831
};
826832

833+
struct kvm_sev_snp_launch_start {
834+
__u64 policy;
835+
__u8 gosvw[16];
836+
__u16 flags;
837+
__u8 pad0[6];
838+
__u64 pad1[4];
839+
};
840+
841+
/* Kept in sync with firmware values for simplicity. */
842+
#define KVM_SEV_SNP_PAGE_TYPE_NORMAL 0x1
843+
#define KVM_SEV_SNP_PAGE_TYPE_ZERO 0x3
844+
#define KVM_SEV_SNP_PAGE_TYPE_UNMEASURED 0x4
845+
#define KVM_SEV_SNP_PAGE_TYPE_SECRETS 0x5
846+
#define KVM_SEV_SNP_PAGE_TYPE_CPUID 0x6
847+
848+
struct kvm_sev_snp_launch_update {
849+
__u64 gfn_start;
850+
__u64 uaddr;
851+
__u64 len;
852+
__u8 type;
853+
__u8 pad0;
854+
__u16 flags;
855+
__u32 pad1;
856+
__u64 pad2[4];
857+
};
858+
859+
#define KVM_SEV_SNP_ID_BLOCK_SIZE 96
860+
#define KVM_SEV_SNP_ID_AUTH_SIZE 4096
861+
#define KVM_SEV_SNP_FINISH_DATA_SIZE 32
862+
863+
struct kvm_sev_snp_launch_finish {
864+
__u64 id_block_uaddr;
865+
__u64 id_auth_uaddr;
866+
__u8 id_block_en;
867+
__u8 auth_key_en;
868+
__u8 vcek_disabled;
869+
__u8 host_data[KVM_SEV_SNP_FINISH_DATA_SIZE];
870+
__u8 pad0[3];
871+
__u16 flags;
872+
__u64 pad1[4];
873+
};
874+
827875
#define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0)
828876
#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1)
829877

@@ -874,5 +922,6 @@ struct kvm_hyperv_eventfd {
874922
#define KVM_X86_SW_PROTECTED_VM 1
875923
#define KVM_X86_SEV_VM 2
876924
#define KVM_X86_SEV_ES_VM 3
925+
#define KVM_X86_SNP_VM 4
877926

878927
#endif /* _ASM_X86_KVM_H */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
#define SVM_VMGEXIT_AP_CREATE_ON_INIT 0
116116
#define SVM_VMGEXIT_AP_CREATE 1
117117
#define SVM_VMGEXIT_AP_DESTROY 2
118+
#define SVM_VMGEXIT_SNP_RUN_VMPL 0x80000018
118119
#define SVM_VMGEXIT_HV_FEATURES 0x8000fffd
119120
#define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe
120121
#define SVM_VMGEXIT_TERM_REASON(reason_set, reason_code) \

tools/include/uapi/README

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
Why we want a copy of kernel headers in tools?
2+
==============================================
3+
4+
There used to be no copies, with tools/ code using kernel headers
5+
directly. From time to time tools/perf/ broke due to legitimate kernel
6+
hacking. At some point Linus complained about such direct usage. Then we
7+
adopted the current model.
8+
9+
The way these headers are used in perf are not restricted to just
10+
including them to compile something.
11+
12+
There are sometimes used in scripts that convert defines into string
13+
tables, etc, so some change may break one of these scripts, or new MSRs
14+
may use some different #define pattern, etc.
15+
16+
E.g.:
17+
18+
$ ls -1 tools/perf/trace/beauty/*.sh | head -5
19+
tools/perf/trace/beauty/arch_errno_names.sh
20+
tools/perf/trace/beauty/drm_ioctl.sh
21+
tools/perf/trace/beauty/fadvise.sh
22+
tools/perf/trace/beauty/fsconfig.sh
23+
tools/perf/trace/beauty/fsmount.sh
24+
$
25+
$ tools/perf/trace/beauty/fadvise.sh
26+
static const char *fadvise_advices[] = {
27+
[0] = "NORMAL",
28+
[1] = "RANDOM",
29+
[2] = "SEQUENTIAL",
30+
[3] = "WILLNEED",
31+
[4] = "DONTNEED",
32+
[5] = "NOREUSE",
33+
};
34+
$
35+
36+
The tools/perf/check-headers.sh script, part of the tools/ build
37+
process, points out changes in the original files.
38+
39+
So its important not to touch the copies in tools/ when doing changes in
40+
the original kernel headers, that will be done later, when
41+
check-headers.sh inform about the change to the perf tools hackers.
42+
43+
Another explanation from Ingo Molnar:
44+
It's better than all the alternatives we tried so far:
45+
46+
- Symbolic links and direct #includes: this was the original approach but
47+
was pushed back on from the kernel side, when tooling modified the
48+
headers and broke them accidentally for kernel builds.
49+
50+
- Duplicate self-defined ABI headers like glibc: double the maintenance
51+
burden, double the chance for mistakes, plus there's no tech-driven
52+
notification mechanism to look at new kernel side changes.
53+
54+
What we are doing now is a third option:
55+
56+
- A software-enforced copy-on-write mechanism of kernel headers to
57+
tooling, driven by non-fatal warnings on the tooling side build when
58+
kernel headers get modified:
59+
60+
Warning: Kernel ABI header differences:
61+
diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
62+
diff -u tools/include/uapi/linux/fs.h include/uapi/linux/fs.h
63+
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
64+
...
65+
66+
The tooling policy is to always pick up the kernel side headers as-is,
67+
and integate them into the tooling build. The warnings above serve as a
68+
notification to tooling maintainers that there's changes on the kernel
69+
side.
70+
71+
We've been using this for many years now, and it might seem hacky, but
72+
works surprisingly well.
73+

tools/include/uapi/asm-generic/unistd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ __SC_COMP(__NR_pselect6_time64, sys_pselect6, compat_sys_pselect6_time64)
737737
#define __NR_ppoll_time64 414
738738
__SC_COMP(__NR_ppoll_time64, sys_ppoll, compat_sys_ppoll_time64)
739739
#define __NR_io_pgetevents_time64 416
740-
__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents)
740+
__SC_COMP(__NR_io_pgetevents_time64, sys_io_pgetevents, compat_sys_io_pgetevents_time64)
741741
#define __NR_recvmmsg_time64 417
742742
__SC_COMP(__NR_recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64)
743743
#define __NR_mq_timedsend_time64 418

tools/include/uapi/drm/i915_drm.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,15 @@ struct drm_i915_gem_context_param {
21632163
* supports this per context flag.
21642164
*/
21652165
#define I915_CONTEXT_PARAM_LOW_LATENCY 0xe
2166+
2167+
/*
2168+
* I915_CONTEXT_PARAM_CONTEXT_IMAGE:
2169+
*
2170+
* Allows userspace to provide own context images.
2171+
*
2172+
* Note that this is a debug API not available on production kernel builds.
2173+
*/
2174+
#define I915_CONTEXT_PARAM_CONTEXT_IMAGE 0xf
21662175
/* Must be kept compact -- no holes and well documented */
21672176

21682177
/** @value: Context parameter value to be set or queried */
@@ -2564,6 +2573,24 @@ struct i915_context_param_engines {
25642573
struct i915_engine_class_instance engines[N__]; \
25652574
} __attribute__((packed)) name__
25662575

2576+
struct i915_gem_context_param_context_image {
2577+
/** @engine: Engine class & instance to be configured. */
2578+
struct i915_engine_class_instance engine;
2579+
2580+
/** @flags: One of the supported flags or zero. */
2581+
__u32 flags;
2582+
#define I915_CONTEXT_IMAGE_FLAG_ENGINE_INDEX (1u << 0)
2583+
2584+
/** @size: Size of the image blob pointed to by @image. */
2585+
__u32 size;
2586+
2587+
/** @mbz: Must be zero. */
2588+
__u32 mbz;
2589+
2590+
/** @image: Userspace memory containing the context image. */
2591+
__u64 image;
2592+
} __attribute__((packed));
2593+
25672594
/**
25682595
* struct drm_i915_gem_context_create_ext_setparam - Context parameter
25692596
* to set or query during context creation.

tools/include/uapi/linux/in.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ enum {
8181
#define IPPROTO_ETHERNET IPPROTO_ETHERNET
8282
IPPROTO_RAW = 255, /* Raw IP packets */
8383
#define IPPROTO_RAW IPPROTO_RAW
84+
IPPROTO_SMC = 256, /* Shared Memory Communications */
85+
#define IPPROTO_SMC IPPROTO_SMC
8486
IPPROTO_MPTCP = 262, /* Multipath TCP connection */
8587
#define IPPROTO_MPTCP IPPROTO_MPTCP
8688
IPPROTO_MAX

0 commit comments

Comments
 (0)