| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Based on arch/arm/kernel/asm-offsets.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 1995-2003 Russell King |
|---|
| 5 | 6 | * 2001-2002 Keith Owens |
|---|
| 6 | 7 | * 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/>. |
|---|
| 19 | 8 | */ |
|---|
| 20 | 9 | |
|---|
| 21 | 10 | #include <linux/arm_sdei.h> |
|---|
| .. | .. |
|---|
| 25 | 14 | #include <linux/kvm_host.h> |
|---|
| 26 | 15 | #include <linux/preempt.h> |
|---|
| 27 | 16 | #include <linux/suspend.h> |
|---|
| 28 | | -#include <vdso/datapage.h> |
|---|
| 29 | 17 | #include <asm/cpufeature.h> |
|---|
| 30 | 18 | #include <asm/fixmap.h> |
|---|
| 31 | 19 | #include <asm/thread_info.h> |
|---|
| .. | .. |
|---|
| 42 | 30 | BLANK(); |
|---|
| 43 | 31 | DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); |
|---|
| 44 | 32 | 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)); |
|---|
| 46 | 33 | DEFINE(TSK_TI_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit)); |
|---|
| 47 | 34 | #ifdef CONFIG_ARM64_SW_TTBR0_PAN |
|---|
| 48 | 35 | DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0)); |
|---|
| 49 | 36 | #endif |
|---|
| 50 | 37 | #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)); |
|---|
| 52 | 40 | #endif |
|---|
| 53 | 41 | 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 |
|---|
| 54 | 45 | BLANK(); |
|---|
| 55 | 46 | 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 |
|---|
| 56 | 55 | BLANK(); |
|---|
| 57 | 56 | DEFINE(S_X0, offsetof(struct pt_regs, regs[0])); |
|---|
| 58 | | - DEFINE(S_X1, offsetof(struct pt_regs, regs[1])); |
|---|
| 59 | 57 | DEFINE(S_X2, offsetof(struct pt_regs, regs[2])); |
|---|
| 60 | | - DEFINE(S_X3, offsetof(struct pt_regs, regs[3])); |
|---|
| 61 | 58 | DEFINE(S_X4, offsetof(struct pt_regs, regs[4])); |
|---|
| 62 | | - DEFINE(S_X5, offsetof(struct pt_regs, regs[5])); |
|---|
| 63 | 59 | DEFINE(S_X6, offsetof(struct pt_regs, regs[6])); |
|---|
| 64 | | - DEFINE(S_X7, offsetof(struct pt_regs, regs[7])); |
|---|
| 65 | 60 | DEFINE(S_X8, offsetof(struct pt_regs, regs[8])); |
|---|
| 66 | 61 | DEFINE(S_X10, offsetof(struct pt_regs, regs[10])); |
|---|
| 67 | 62 | DEFINE(S_X12, offsetof(struct pt_regs, regs[12])); |
|---|
| .. | .. |
|---|
| 73 | 68 | DEFINE(S_X24, offsetof(struct pt_regs, regs[24])); |
|---|
| 74 | 69 | DEFINE(S_X26, offsetof(struct pt_regs, regs[26])); |
|---|
| 75 | 70 | DEFINE(S_X28, offsetof(struct pt_regs, regs[28])); |
|---|
| 71 | + DEFINE(S_FP, offsetof(struct pt_regs, regs[29])); |
|---|
| 76 | 72 | DEFINE(S_LR, offsetof(struct pt_regs, regs[30])); |
|---|
| 77 | 73 | 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 |
|---|
| 81 | 74 | DEFINE(S_PSTATE, offsetof(struct pt_regs, pstate)); |
|---|
| 82 | 75 | DEFINE(S_PC, offsetof(struct pt_regs, pc)); |
|---|
| 83 | | - DEFINE(S_ORIG_X0, offsetof(struct pt_regs, orig_x0)); |
|---|
| 84 | 76 | DEFINE(S_SYSCALLNO, offsetof(struct pt_regs, syscallno)); |
|---|
| 85 | 77 | DEFINE(S_ORIG_ADDR_LIMIT, offsetof(struct pt_regs, orig_addr_limit)); |
|---|
| 78 | + DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save)); |
|---|
| 86 | 79 | DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe)); |
|---|
| 87 | 80 | DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); |
|---|
| 88 | 81 | BLANK(); |
|---|
| .. | .. |
|---|
| 100 | 93 | BLANK(); |
|---|
| 101 | 94 | DEFINE(PAGE_SZ, PAGE_SIZE); |
|---|
| 102 | 95 | BLANK(); |
|---|
| 103 | | - DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); |
|---|
| 104 | 96 | DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); |
|---|
| 105 | 97 | DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE); |
|---|
| 106 | 98 | BLANK(); |
|---|
| 107 | 99 | 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)); |
|---|
| 148 | 102 | BLANK(); |
|---|
| 149 | 103 | DEFINE(CPU_BOOT_STACK, offsetof(struct secondary_data, stack)); |
|---|
| 150 | 104 | DEFINE(CPU_BOOT_TASK, offsetof(struct secondary_data, task)); |
|---|
| 151 | 105 | 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 |
|---|
| 153 | 110 | DEFINE(VCPU_CONTEXT, offsetof(struct kvm_vcpu, arch.ctxt)); |
|---|
| 154 | 111 | DEFINE(VCPU_FAULT_DISR, offsetof(struct kvm_vcpu, arch.fault.disr_el1)); |
|---|
| 155 | 112 | 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])); |
|---|
| 161 | 120 | 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)); |
|---|
| 162 | 130 | #endif |
|---|
| 163 | 131 | #ifdef CONFIG_CPU_PM |
|---|
| 164 | | - DEFINE(CPU_SUSPEND_SZ, sizeof(struct cpu_suspend_ctx)); |
|---|
| 165 | 132 | DEFINE(CPU_CTX_SP, offsetof(struct cpu_suspend_ctx, sp)); |
|---|
| 166 | 133 | DEFINE(MPIDR_HASH_MASK, offsetof(struct mpidr_hash, mask)); |
|---|
| 167 | 134 | DEFINE(MPIDR_HASH_SHIFTS, offsetof(struct mpidr_hash, shift_aff)); |
|---|
| .. | .. |
|---|
| 185 | 152 | DEFINE(SDEI_EVENT_INTREGS, offsetof(struct sdei_registered_event, interrupted_regs)); |
|---|
| 186 | 153 | DEFINE(SDEI_EVENT_PRIORITY, offsetof(struct sdei_registered_event, priority)); |
|---|
| 187 | 154 | #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 |
|---|
| 188 | 160 | return 0; |
|---|
| 189 | 161 | } |
|---|