Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools headers: Update tools's copy of arm64/asm headers

tldr; Just FYI, I'm carrying this on the perf tools tree.

Full explanation:

There used to be no copies, with tools/ code using kernel headers
directly. From time to time tools/perf/ broke due to legitimate kernel
hacking. At some point Linus complained about such direct usage. Then we
adopted the current model.

The way these headers are used in perf are not restricted to just
including them to compile something.

There are sometimes used in scripts that convert defines into string
tables, etc, so some change may break one of these scripts, or new MSRs
may use some different #define pattern, etc.

E.g.:

$ ls -1 tools/perf/trace/beauty/*.sh | head -5
tools/perf/trace/beauty/arch_errno_names.sh
tools/perf/trace/beauty/drm_ioctl.sh
tools/perf/trace/beauty/fadvise.sh
tools/perf/trace/beauty/fsconfig.sh
tools/perf/trace/beauty/fsmount.sh
$
$ tools/perf/trace/beauty/fadvise.sh
static const char *fadvise_advices[] = {
[0] = "NORMAL",
[1] = "RANDOM",
[2] = "SEQUENTIAL",
[3] = "WILLNEED",
[4] = "DONTNEED",
[5] = "NOREUSE",
};
$

The tools/perf/check-headers.sh script, part of the tools/ build
process, points out changes in the original files.

So its important not to touch the copies in tools/ when doing changes in
the original kernel headers, that will be done later, when
check-headers.sh inform about the change to the perf tools hackers.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20231121225650.390246-9-namhyung@kernel.org

+42 -5
+4 -1
tools/arch/arm64/include/asm/cputype.h
··· 79 79 #define ARM_CPU_PART_CORTEX_A78AE 0xD42 80 80 #define ARM_CPU_PART_CORTEX_X1 0xD44 81 81 #define ARM_CPU_PART_CORTEX_A510 0xD46 82 + #define ARM_CPU_PART_CORTEX_A520 0xD80 82 83 #define ARM_CPU_PART_CORTEX_A710 0xD47 83 84 #define ARM_CPU_PART_CORTEX_A715 0xD4D 84 85 #define ARM_CPU_PART_CORTEX_X2 0xD48 85 86 #define ARM_CPU_PART_NEOVERSE_N2 0xD49 86 87 #define ARM_CPU_PART_CORTEX_A78C 0xD4B 87 88 88 - #define APM_CPU_PART_POTENZA 0x000 89 + #define APM_CPU_PART_XGENE 0x000 90 + #define APM_CPU_VAR_POTENZA 0x00 89 91 90 92 #define CAVIUM_CPU_PART_THUNDERX 0x0A1 91 93 #define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2 ··· 150 148 #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE) 151 149 #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1) 152 150 #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) 151 + #define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520) 153 152 #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) 154 153 #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715) 155 154 #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
+32
tools/arch/arm64/include/uapi/asm/kvm.h
··· 505 505 #define KVM_HYPERCALL_EXIT_SMC (1U << 0) 506 506 #define KVM_HYPERCALL_EXIT_16BIT (1U << 1) 507 507 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 + 508 540 #endif 509 541 510 542 #endif /* __ARM_KVM_H__ */
+6 -4
tools/arch/arm64/include/uapi/asm/perf_regs.h
··· 36 36 PERF_REG_ARM64_LR, 37 37 PERF_REG_ARM64_SP, 38 38 PERF_REG_ARM64_PC, 39 + PERF_REG_ARM64_MAX, 39 40 40 41 /* 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 45 44 }; 45 + 46 + #define PERF_REG_EXTENDED_MASK (1ULL << PERF_REG_ARM64_VG) 47 + 46 48 #endif /* _ASM_ARM64_PERF_REGS_H */