forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/arch/arm64/kernel/asm-offsets.c
....@@ -1,21 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Based on arch/arm/kernel/asm-offsets.c
34 *
45 * Copyright (C) 1995-2003 Russell King
56 * 2001-2002 Keith Owens
67 * Copyright (C) 2012 ARM Ltd.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
198 */
209
2110 #include <linux/arm_sdei.h>
....@@ -25,7 +14,6 @@
2514 #include <linux/kvm_host.h>
2615 #include <linux/preempt.h>
2716 #include <linux/suspend.h>
28
-#include <vdso/datapage.h>
2917 #include <asm/cpufeature.h>
3018 #include <asm/fixmap.h>
3119 #include <asm/thread_info.h>
....@@ -42,26 +30,33 @@
4230 BLANK();
4331 DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags));
4432 DEFINE(TSK_TI_PREEMPT, offsetof(struct task_struct, thread_info.preempt_count));
45
- DEFINE(TSK_TI_PREEMPT_LAZY, offsetof(struct task_struct, thread_info.preempt_lazy_count));
4633 DEFINE(TSK_TI_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit));
4734 #ifdef CONFIG_ARM64_SW_TTBR0_PAN
4835 DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0));
4936 #endif
5037 #ifdef CONFIG_SHADOW_CALL_STACK
51
- DEFINE(TSK_TI_SCS, offsetof(struct task_struct, thread_info.shadow_call_stack));
38
+ DEFINE(TSK_TI_SCS_BASE, offsetof(struct task_struct, thread_info.scs_base));
39
+ DEFINE(TSK_TI_SCS_SP, offsetof(struct task_struct, thread_info.scs_sp));
5240 #endif
5341 DEFINE(TSK_STACK, offsetof(struct task_struct, stack));
42
+#ifdef CONFIG_STACKPROTECTOR
43
+ DEFINE(TSK_STACK_CANARY, offsetof(struct task_struct, stack_canary));
44
+#endif
5445 BLANK();
5546 DEFINE(THREAD_CPU_CONTEXT, offsetof(struct task_struct, thread.cpu_context));
47
+ DEFINE(THREAD_SCTLR_USER, offsetof(struct task_struct, thread.sctlr_user));
48
+#ifdef CONFIG_ARM64_PTR_AUTH
49
+ DEFINE(THREAD_KEYS_USER, offsetof(struct task_struct, thread.keys_user));
50
+ DEFINE(THREAD_KEYS_KERNEL, offsetof(struct task_struct, thread.keys_kernel));
51
+#endif
52
+#ifdef CONFIG_ARM64_MTE
53
+ DEFINE(THREAD_MTE_CTRL, offsetof(struct task_struct, thread.mte_ctrl));
54
+#endif
5655 BLANK();
5756 DEFINE(S_X0, offsetof(struct pt_regs, regs[0]));
58
- DEFINE(S_X1, offsetof(struct pt_regs, regs[1]));
5957 DEFINE(S_X2, offsetof(struct pt_regs, regs[2]));
60
- DEFINE(S_X3, offsetof(struct pt_regs, regs[3]));
6158 DEFINE(S_X4, offsetof(struct pt_regs, regs[4]));
62
- DEFINE(S_X5, offsetof(struct pt_regs, regs[5]));
6359 DEFINE(S_X6, offsetof(struct pt_regs, regs[6]));
64
- DEFINE(S_X7, offsetof(struct pt_regs, regs[7]));
6560 DEFINE(S_X8, offsetof(struct pt_regs, regs[8]));
6661 DEFINE(S_X10, offsetof(struct pt_regs, regs[10]));
6762 DEFINE(S_X12, offsetof(struct pt_regs, regs[12]));
....@@ -73,16 +68,14 @@
7368 DEFINE(S_X24, offsetof(struct pt_regs, regs[24]));
7469 DEFINE(S_X26, offsetof(struct pt_regs, regs[26]));
7570 DEFINE(S_X28, offsetof(struct pt_regs, regs[28]));
71
+ DEFINE(S_FP, offsetof(struct pt_regs, regs[29]));
7672 DEFINE(S_LR, offsetof(struct pt_regs, regs[30]));
7773 DEFINE(S_SP, offsetof(struct pt_regs, sp));
78
-#ifdef CONFIG_COMPAT
79
- DEFINE(S_COMPAT_SP, offsetof(struct pt_regs, compat_sp));
80
-#endif
8174 DEFINE(S_PSTATE, offsetof(struct pt_regs, pstate));
8275 DEFINE(S_PC, offsetof(struct pt_regs, pc));
83
- DEFINE(S_ORIG_X0, offsetof(struct pt_regs, orig_x0));
8476 DEFINE(S_SYSCALLNO, offsetof(struct pt_regs, syscallno));
8577 DEFINE(S_ORIG_ADDR_LIMIT, offsetof(struct pt_regs, orig_addr_limit));
78
+ DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save));
8679 DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe));
8780 DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
8881 BLANK();
....@@ -100,68 +93,42 @@
10093 BLANK();
10194 DEFINE(PAGE_SZ, PAGE_SIZE);
10295 BLANK();
103
- DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
10496 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE);
10597 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE);
10698 BLANK();
10799 DEFINE(PREEMPT_DISABLE_OFFSET, PREEMPT_DISABLE_OFFSET);
108
- BLANK();
109
- DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
110
- DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
111
- DEFINE(CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_RAW);
112
- DEFINE(CLOCK_REALTIME_RES, offsetof(struct vdso_data, hrtimer_res));
113
- DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
114
- DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE);
115
- DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC);
116
- DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
117
- BLANK();
118
- DEFINE(VDSO_SEQ, offsetof(struct vdso_data, seq));
119
- DEFINE(VDSO_CLK_MODE, offsetof(struct vdso_data, clock_mode));
120
- DEFINE(VDSO_CYCLE_LAST, offsetof(struct vdso_data, cycle_last));
121
- DEFINE(VDSO_MASK, offsetof(struct vdso_data, mask));
122
- DEFINE(VDSO_MULT, offsetof(struct vdso_data, mult));
123
- DEFINE(VDSO_SHIFT, offsetof(struct vdso_data, shift));
124
- DEFINE(VDSO_REALTIME_SEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME].sec));
125
- DEFINE(VDSO_REALTIME_NSEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME].nsec));
126
- DEFINE(VDSO_MONO_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC].sec));
127
- DEFINE(VDSO_MONO_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC].nsec));
128
- DEFINE(VDSO_MONO_RAW_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_RAW].sec));
129
- DEFINE(VDSO_MONO_RAW_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_RAW].nsec));
130
- DEFINE(VDSO_BOOTTIME_SEC, offsetof(struct vdso_data, basetime[CLOCK_BOOTTIME].sec));
131
- DEFINE(VDSO_BOOTTIME_NSEC, offsetof(struct vdso_data, basetime[CLOCK_BOOTTIME].nsec));
132
- DEFINE(VDSO_TAI_SEC, offsetof(struct vdso_data, basetime[CLOCK_TAI].sec));
133
- DEFINE(VDSO_TAI_NSEC, offsetof(struct vdso_data, basetime[CLOCK_TAI].nsec));
134
- DEFINE(VDSO_RT_COARSE_SEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME_COARSE].sec));
135
- DEFINE(VDSO_RT_COARSE_NSEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME_COARSE].nsec));
136
- DEFINE(VDSO_MONO_COARSE_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_COARSE].sec));
137
- DEFINE(VDSO_MONO_COARSE_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_COARSE].nsec));
138
- DEFINE(VDSO_TZ_MINWEST, offsetof(struct vdso_data, tz_minuteswest));
139
- DEFINE(VDSO_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
140
- BLANK();
141
- DEFINE(TVAL_TV_SEC, offsetof(struct timeval, tv_sec));
142
- DEFINE(TVAL_TV_USEC, offsetof(struct timeval, tv_usec));
143
- DEFINE(TSPEC_TV_SEC, offsetof(struct timespec, tv_sec));
144
- DEFINE(TSPEC_TV_NSEC, offsetof(struct timespec, tv_nsec));
145
- BLANK();
146
- DEFINE(TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
147
- DEFINE(TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
100
+ DEFINE(SOFTIRQ_SHIFT, SOFTIRQ_SHIFT);
101
+ DEFINE(IRQ_CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
148102 BLANK();
149103 DEFINE(CPU_BOOT_STACK, offsetof(struct secondary_data, stack));
150104 DEFINE(CPU_BOOT_TASK, offsetof(struct secondary_data, task));
151105 BLANK();
152
-#ifdef CONFIG_KVM_ARM_HOST
106
+ DEFINE(FTR_OVR_VAL_OFFSET, offsetof(struct arm64_ftr_override, val));
107
+ DEFINE(FTR_OVR_MASK_OFFSET, offsetof(struct arm64_ftr_override, mask));
108
+ BLANK();
109
+#ifdef CONFIG_KVM
153110 DEFINE(VCPU_CONTEXT, offsetof(struct kvm_vcpu, arch.ctxt));
154111 DEFINE(VCPU_FAULT_DISR, offsetof(struct kvm_vcpu, arch.fault.disr_el1));
155112 DEFINE(VCPU_WORKAROUND_FLAGS, offsetof(struct kvm_vcpu, arch.workaround_flags));
156
- DEFINE(CPU_GP_REGS, offsetof(struct kvm_cpu_context, gp_regs));
157
- DEFINE(CPU_USER_PT_REGS, offsetof(struct kvm_regs, regs));
158
- DEFINE(CPU_FP_REGS, offsetof(struct kvm_regs, fp_regs));
159
- DEFINE(VCPU_FPEXC32_EL2, offsetof(struct kvm_vcpu, arch.ctxt.sys_regs[FPEXC32_EL2]));
160
- DEFINE(VCPU_HOST_CONTEXT, offsetof(struct kvm_vcpu, arch.host_cpu_context));
113
+ DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2));
114
+ DEFINE(CPU_USER_PT_REGS, offsetof(struct kvm_cpu_context, regs));
115
+ DEFINE(CPU_APIAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APIAKEYLO_EL1]));
116
+ DEFINE(CPU_APIBKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APIBKEYLO_EL1]));
117
+ DEFINE(CPU_APDAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APDAKEYLO_EL1]));
118
+ DEFINE(CPU_APDBKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APDBKEYLO_EL1]));
119
+ DEFINE(CPU_APGAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APGAKEYLO_EL1]));
161120 DEFINE(HOST_CONTEXT_VCPU, offsetof(struct kvm_cpu_context, __hyp_running_vcpu));
121
+ DEFINE(HOST_DATA_CONTEXT, offsetof(struct kvm_host_data, host_ctxt));
122
+ DEFINE(NVHE_INIT_MAIR_EL2, offsetof(struct kvm_nvhe_init_params, mair_el2));
123
+ DEFINE(NVHE_INIT_TCR_EL2, offsetof(struct kvm_nvhe_init_params, tcr_el2));
124
+ DEFINE(NVHE_INIT_TPIDR_EL2, offsetof(struct kvm_nvhe_init_params, tpidr_el2));
125
+ DEFINE(NVHE_INIT_STACK_HYP_VA, offsetof(struct kvm_nvhe_init_params, stack_hyp_va));
126
+ DEFINE(NVHE_INIT_PGD_PA, offsetof(struct kvm_nvhe_init_params, pgd_pa));
127
+ DEFINE(NVHE_INIT_HCR_EL2, offsetof(struct kvm_nvhe_init_params, hcr_el2));
128
+ DEFINE(NVHE_INIT_VTTBR, offsetof(struct kvm_nvhe_init_params, vttbr));
129
+ DEFINE(NVHE_INIT_VTCR, offsetof(struct kvm_nvhe_init_params, vtcr));
162130 #endif
163131 #ifdef CONFIG_CPU_PM
164
- DEFINE(CPU_SUSPEND_SZ, sizeof(struct cpu_suspend_ctx));
165132 DEFINE(CPU_CTX_SP, offsetof(struct cpu_suspend_ctx, sp));
166133 DEFINE(MPIDR_HASH_MASK, offsetof(struct mpidr_hash, mask));
167134 DEFINE(MPIDR_HASH_SHIFTS, offsetof(struct mpidr_hash, shift_aff));
....@@ -185,5 +152,10 @@
185152 DEFINE(SDEI_EVENT_INTREGS, offsetof(struct sdei_registered_event, interrupted_regs));
186153 DEFINE(SDEI_EVENT_PRIORITY, offsetof(struct sdei_registered_event, priority));
187154 #endif
155
+#ifdef CONFIG_ARM64_PTR_AUTH
156
+ DEFINE(PTRAUTH_USER_KEY_APIA, offsetof(struct ptrauth_keys_user, apia));
157
+ DEFINE(PTRAUTH_KERNEL_KEY_APIA, offsetof(struct ptrauth_keys_kernel, apia));
158
+ BLANK();
159
+#endif
188160 return 0;
189161 }