forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
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,25 +30,34 @@
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));
33
+ DEFINE(TSK_TI_PREEMPT_LAZY, offsetof(struct task_struct, thread_info.preempt_lazy_count));
4534 DEFINE(TSK_TI_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit));
4635 #ifdef CONFIG_ARM64_SW_TTBR0_PAN
4736 DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0));
4837 #endif
4938 #ifdef CONFIG_SHADOW_CALL_STACK
50
- DEFINE(TSK_TI_SCS, offsetof(struct task_struct, thread_info.shadow_call_stack));
39
+ DEFINE(TSK_TI_SCS_BASE, offsetof(struct task_struct, thread_info.scs_base));
40
+ DEFINE(TSK_TI_SCS_SP, offsetof(struct task_struct, thread_info.scs_sp));
5141 #endif
5242 DEFINE(TSK_STACK, offsetof(struct task_struct, stack));
43
+#ifdef CONFIG_STACKPROTECTOR
44
+ DEFINE(TSK_STACK_CANARY, offsetof(struct task_struct, stack_canary));
45
+#endif
5346 BLANK();
5447 DEFINE(THREAD_CPU_CONTEXT, offsetof(struct task_struct, thread.cpu_context));
48
+ DEFINE(THREAD_SCTLR_USER, offsetof(struct task_struct, thread.sctlr_user));
49
+#ifdef CONFIG_ARM64_PTR_AUTH
50
+ DEFINE(THREAD_KEYS_USER, offsetof(struct task_struct, thread.keys_user));
51
+ DEFINE(THREAD_KEYS_KERNEL, offsetof(struct task_struct, thread.keys_kernel));
52
+#endif
53
+#ifdef CONFIG_ARM64_MTE
54
+ DEFINE(THREAD_MTE_CTRL, offsetof(struct task_struct, thread.mte_ctrl));
55
+#endif
5556 BLANK();
5657 DEFINE(S_X0, offsetof(struct pt_regs, regs[0]));
57
- DEFINE(S_X1, offsetof(struct pt_regs, regs[1]));
5858 DEFINE(S_X2, offsetof(struct pt_regs, regs[2]));
59
- DEFINE(S_X3, offsetof(struct pt_regs, regs[3]));
6059 DEFINE(S_X4, offsetof(struct pt_regs, regs[4]));
61
- DEFINE(S_X5, offsetof(struct pt_regs, regs[5]));
6260 DEFINE(S_X6, offsetof(struct pt_regs, regs[6]));
63
- DEFINE(S_X7, offsetof(struct pt_regs, regs[7]));
6461 DEFINE(S_X8, offsetof(struct pt_regs, regs[8]));
6562 DEFINE(S_X10, offsetof(struct pt_regs, regs[10]));
6663 DEFINE(S_X12, offsetof(struct pt_regs, regs[12]));
....@@ -72,16 +69,14 @@
7269 DEFINE(S_X24, offsetof(struct pt_regs, regs[24]));
7370 DEFINE(S_X26, offsetof(struct pt_regs, regs[26]));
7471 DEFINE(S_X28, offsetof(struct pt_regs, regs[28]));
72
+ DEFINE(S_FP, offsetof(struct pt_regs, regs[29]));
7573 DEFINE(S_LR, offsetof(struct pt_regs, regs[30]));
7674 DEFINE(S_SP, offsetof(struct pt_regs, sp));
77
-#ifdef CONFIG_COMPAT
78
- DEFINE(S_COMPAT_SP, offsetof(struct pt_regs, compat_sp));
79
-#endif
8075 DEFINE(S_PSTATE, offsetof(struct pt_regs, pstate));
8176 DEFINE(S_PC, offsetof(struct pt_regs, pc));
82
- DEFINE(S_ORIG_X0, offsetof(struct pt_regs, orig_x0));
8377 DEFINE(S_SYSCALLNO, offsetof(struct pt_regs, syscallno));
8478 DEFINE(S_ORIG_ADDR_LIMIT, offsetof(struct pt_regs, orig_addr_limit));
79
+ DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save));
8580 DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe));
8681 DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
8782 BLANK();
....@@ -99,68 +94,42 @@
9994 BLANK();
10095 DEFINE(PAGE_SZ, PAGE_SIZE);
10196 BLANK();
102
- DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
10397 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE);
10498 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE);
10599 BLANK();
106100 DEFINE(PREEMPT_DISABLE_OFFSET, PREEMPT_DISABLE_OFFSET);
107
- BLANK();
108
- DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
109
- DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
110
- DEFINE(CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_RAW);
111
- DEFINE(CLOCK_REALTIME_RES, offsetof(struct vdso_data, hrtimer_res));
112
- DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
113
- DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE);
114
- DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC);
115
- DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
116
- BLANK();
117
- DEFINE(VDSO_SEQ, offsetof(struct vdso_data, seq));
118
- DEFINE(VDSO_CLK_MODE, offsetof(struct vdso_data, clock_mode));
119
- DEFINE(VDSO_CYCLE_LAST, offsetof(struct vdso_data, cycle_last));
120
- DEFINE(VDSO_MASK, offsetof(struct vdso_data, mask));
121
- DEFINE(VDSO_MULT, offsetof(struct vdso_data, mult));
122
- DEFINE(VDSO_SHIFT, offsetof(struct vdso_data, shift));
123
- DEFINE(VDSO_REALTIME_SEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME].sec));
124
- DEFINE(VDSO_REALTIME_NSEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME].nsec));
125
- DEFINE(VDSO_MONO_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC].sec));
126
- DEFINE(VDSO_MONO_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC].nsec));
127
- DEFINE(VDSO_MONO_RAW_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_RAW].sec));
128
- DEFINE(VDSO_MONO_RAW_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_RAW].nsec));
129
- DEFINE(VDSO_BOOTTIME_SEC, offsetof(struct vdso_data, basetime[CLOCK_BOOTTIME].sec));
130
- DEFINE(VDSO_BOOTTIME_NSEC, offsetof(struct vdso_data, basetime[CLOCK_BOOTTIME].nsec));
131
- DEFINE(VDSO_TAI_SEC, offsetof(struct vdso_data, basetime[CLOCK_TAI].sec));
132
- DEFINE(VDSO_TAI_NSEC, offsetof(struct vdso_data, basetime[CLOCK_TAI].nsec));
133
- DEFINE(VDSO_RT_COARSE_SEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME_COARSE].sec));
134
- DEFINE(VDSO_RT_COARSE_NSEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME_COARSE].nsec));
135
- DEFINE(VDSO_MONO_COARSE_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_COARSE].sec));
136
- DEFINE(VDSO_MONO_COARSE_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_COARSE].nsec));
137
- DEFINE(VDSO_TZ_MINWEST, offsetof(struct vdso_data, tz_minuteswest));
138
- DEFINE(VDSO_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
139
- BLANK();
140
- DEFINE(TVAL_TV_SEC, offsetof(struct timeval, tv_sec));
141
- DEFINE(TVAL_TV_USEC, offsetof(struct timeval, tv_usec));
142
- DEFINE(TSPEC_TV_SEC, offsetof(struct timespec, tv_sec));
143
- DEFINE(TSPEC_TV_NSEC, offsetof(struct timespec, tv_nsec));
144
- BLANK();
145
- DEFINE(TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
146
- DEFINE(TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
101
+ DEFINE(SOFTIRQ_SHIFT, SOFTIRQ_SHIFT);
102
+ DEFINE(IRQ_CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
147103 BLANK();
148104 DEFINE(CPU_BOOT_STACK, offsetof(struct secondary_data, stack));
149105 DEFINE(CPU_BOOT_TASK, offsetof(struct secondary_data, task));
150106 BLANK();
151
-#ifdef CONFIG_KVM_ARM_HOST
107
+ DEFINE(FTR_OVR_VAL_OFFSET, offsetof(struct arm64_ftr_override, val));
108
+ DEFINE(FTR_OVR_MASK_OFFSET, offsetof(struct arm64_ftr_override, mask));
109
+ BLANK();
110
+#ifdef CONFIG_KVM
152111 DEFINE(VCPU_CONTEXT, offsetof(struct kvm_vcpu, arch.ctxt));
153112 DEFINE(VCPU_FAULT_DISR, offsetof(struct kvm_vcpu, arch.fault.disr_el1));
154113 DEFINE(VCPU_WORKAROUND_FLAGS, offsetof(struct kvm_vcpu, arch.workaround_flags));
155
- DEFINE(CPU_GP_REGS, offsetof(struct kvm_cpu_context, gp_regs));
156
- DEFINE(CPU_USER_PT_REGS, offsetof(struct kvm_regs, regs));
157
- DEFINE(CPU_FP_REGS, offsetof(struct kvm_regs, fp_regs));
158
- DEFINE(VCPU_FPEXC32_EL2, offsetof(struct kvm_vcpu, arch.ctxt.sys_regs[FPEXC32_EL2]));
159
- DEFINE(VCPU_HOST_CONTEXT, offsetof(struct kvm_vcpu, arch.host_cpu_context));
114
+ DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2));
115
+ DEFINE(CPU_USER_PT_REGS, offsetof(struct kvm_cpu_context, regs));
116
+ DEFINE(CPU_APIAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APIAKEYLO_EL1]));
117
+ DEFINE(CPU_APIBKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APIBKEYLO_EL1]));
118
+ DEFINE(CPU_APDAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APDAKEYLO_EL1]));
119
+ DEFINE(CPU_APDBKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APDBKEYLO_EL1]));
120
+ DEFINE(CPU_APGAKEYLO_EL1, offsetof(struct kvm_cpu_context, sys_regs[APGAKEYLO_EL1]));
160121 DEFINE(HOST_CONTEXT_VCPU, offsetof(struct kvm_cpu_context, __hyp_running_vcpu));
122
+ DEFINE(HOST_DATA_CONTEXT, offsetof(struct kvm_host_data, host_ctxt));
123
+ DEFINE(NVHE_INIT_MAIR_EL2, offsetof(struct kvm_nvhe_init_params, mair_el2));
124
+ DEFINE(NVHE_INIT_TCR_EL2, offsetof(struct kvm_nvhe_init_params, tcr_el2));
125
+ DEFINE(NVHE_INIT_TPIDR_EL2, offsetof(struct kvm_nvhe_init_params, tpidr_el2));
126
+ DEFINE(NVHE_INIT_STACK_HYP_VA, offsetof(struct kvm_nvhe_init_params, stack_hyp_va));
127
+ DEFINE(NVHE_INIT_PGD_PA, offsetof(struct kvm_nvhe_init_params, pgd_pa));
128
+ DEFINE(NVHE_INIT_HCR_EL2, offsetof(struct kvm_nvhe_init_params, hcr_el2));
129
+ DEFINE(NVHE_INIT_VTTBR, offsetof(struct kvm_nvhe_init_params, vttbr));
130
+ DEFINE(NVHE_INIT_VTCR, offsetof(struct kvm_nvhe_init_params, vtcr));
161131 #endif
162132 #ifdef CONFIG_CPU_PM
163
- DEFINE(CPU_SUSPEND_SZ, sizeof(struct cpu_suspend_ctx));
164133 DEFINE(CPU_CTX_SP, offsetof(struct cpu_suspend_ctx, sp));
165134 DEFINE(MPIDR_HASH_MASK, offsetof(struct mpidr_hash, mask));
166135 DEFINE(MPIDR_HASH_SHIFTS, offsetof(struct mpidr_hash, shift_aff));
....@@ -184,5 +153,10 @@
184153 DEFINE(SDEI_EVENT_INTREGS, offsetof(struct sdei_registered_event, interrupted_regs));
185154 DEFINE(SDEI_EVENT_PRIORITY, offsetof(struct sdei_registered_event, priority));
186155 #endif
156
+#ifdef CONFIG_ARM64_PTR_AUTH
157
+ DEFINE(PTRAUTH_USER_KEY_APIA, offsetof(struct ptrauth_keys_user, apia));
158
+ DEFINE(PTRAUTH_KERNEL_KEY_APIA, offsetof(struct ptrauth_keys_kernel, apia));
159
+ BLANK();
160
+#endif
187161 return 0;
188162 }