.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * This program is used to generate definitions needed by |
---|
3 | 4 | * assembly language modules. |
---|
.. | .. |
---|
6 | 7 | * generate asm statements containing #defines, |
---|
7 | 8 | * compile this file to assembler, and then extract the |
---|
8 | 9 | * #defines from the assembly-language output. |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or |
---|
11 | | - * modify it under the terms of the GNU General Public License |
---|
12 | | - * as published by the Free Software Foundation; either version |
---|
13 | | - * 2 of the License, or (at your option) any later version. |
---|
14 | 10 | */ |
---|
| 11 | + |
---|
| 12 | +#define GENERATING_ASM_OFFSETS /* asm/smp.h */ |
---|
15 | 13 | |
---|
16 | 14 | #include <linux/compat.h> |
---|
17 | 15 | #include <linux/signal.h> |
---|
.. | .. |
---|
32 | 30 | |
---|
33 | 31 | #include <asm/io.h> |
---|
34 | 32 | #include <asm/page.h> |
---|
35 | | -#include <asm/pgtable.h> |
---|
36 | 33 | #include <asm/processor.h> |
---|
37 | 34 | #include <asm/cputable.h> |
---|
38 | 35 | #include <asm/thread_info.h> |
---|
.. | .. |
---|
72 | 69 | #include <asm/fixmap.h> |
---|
73 | 70 | #endif |
---|
74 | 71 | |
---|
| 72 | +#ifdef CONFIG_XMON |
---|
| 73 | +#include "../xmon/xmon_bpts.h" |
---|
| 74 | +#endif |
---|
| 75 | + |
---|
75 | 76 | #define STACK_PT_REGS_OFFSET(sym, val) \ |
---|
76 | 77 | DEFINE(sym, STACK_FRAME_OVERHEAD + offsetof(struct pt_regs, val)) |
---|
77 | 78 | |
---|
.. | .. |
---|
79 | 80 | { |
---|
80 | 81 | OFFSET(THREAD, task_struct, thread); |
---|
81 | 82 | OFFSET(MM, task_struct, mm); |
---|
| 83 | +#ifdef CONFIG_STACKPROTECTOR |
---|
| 84 | + OFFSET(TASK_CANARY, task_struct, stack_canary); |
---|
| 85 | +#ifdef CONFIG_PPC64 |
---|
| 86 | + OFFSET(PACA_CANARY, paca_struct, canary); |
---|
| 87 | +#endif |
---|
| 88 | +#endif |
---|
82 | 89 | OFFSET(MMCONTEXTID, mm_struct, context.id); |
---|
83 | 90 | #ifdef CONFIG_PPC64 |
---|
84 | 91 | DEFINE(SIGSEGV, SIGSEGV); |
---|
85 | 92 | DEFINE(NMI_MASK, NMI_MASK); |
---|
86 | | - OFFSET(TASKTHREADPPR, task_struct, thread.ppr); |
---|
87 | 93 | #else |
---|
88 | | - OFFSET(THREAD_INFO, task_struct, stack); |
---|
89 | | - DEFINE(THREAD_INFO_GAP, _ALIGN_UP(sizeof(struct thread_info), 16)); |
---|
90 | 94 | OFFSET(KSP_LIMIT, thread_struct, ksp_limit); |
---|
| 95 | +#ifdef CONFIG_PPC_RTAS |
---|
| 96 | + OFFSET(RTAS_SP, thread_struct, rtas_sp); |
---|
| 97 | +#endif |
---|
91 | 98 | #endif /* CONFIG_PPC64 */ |
---|
| 99 | + OFFSET(TASK_STACK, task_struct, stack); |
---|
| 100 | +#ifdef CONFIG_SMP |
---|
| 101 | + OFFSET(TASK_CPU, task_struct, cpu); |
---|
| 102 | +#endif |
---|
92 | 103 | |
---|
93 | 104 | #ifdef CONFIG_LIVEPATCH |
---|
94 | 105 | OFFSET(TI_livepatch_sp, thread_info, livepatch_sp); |
---|
.. | .. |
---|
119 | 130 | OFFSET(KSP_VSID, thread_struct, ksp_vsid); |
---|
120 | 131 | #else /* CONFIG_PPC64 */ |
---|
121 | 132 | OFFSET(PGDIR, thread_struct, pgdir); |
---|
| 133 | +#ifdef CONFIG_VMAP_STACK |
---|
| 134 | + OFFSET(SRR0, thread_struct, srr0); |
---|
| 135 | + OFFSET(SRR1, thread_struct, srr1); |
---|
| 136 | + OFFSET(DAR, thread_struct, dar); |
---|
| 137 | + OFFSET(DSISR, thread_struct, dsisr); |
---|
| 138 | +#ifdef CONFIG_PPC_BOOK3S_32 |
---|
| 139 | + OFFSET(THR0, thread_struct, r0); |
---|
| 140 | + OFFSET(THR3, thread_struct, r3); |
---|
| 141 | + OFFSET(THR4, thread_struct, r4); |
---|
| 142 | + OFFSET(THR5, thread_struct, r5); |
---|
| 143 | + OFFSET(THR6, thread_struct, r6); |
---|
| 144 | + OFFSET(THR8, thread_struct, r8); |
---|
| 145 | + OFFSET(THR9, thread_struct, r9); |
---|
| 146 | + OFFSET(THR11, thread_struct, r11); |
---|
| 147 | + OFFSET(THLR, thread_struct, lr); |
---|
| 148 | + OFFSET(THCTR, thread_struct, ctr); |
---|
| 149 | +#endif |
---|
| 150 | +#endif |
---|
122 | 151 | #ifdef CONFIG_SPE |
---|
123 | 152 | OFFSET(THREAD_EVR0, thread_struct, evr[0]); |
---|
124 | 153 | OFFSET(THREAD_ACC, thread_struct, acc); |
---|
.. | .. |
---|
135 | 164 | #if defined(CONFIG_KVM) && defined(CONFIG_BOOKE) |
---|
136 | 165 | OFFSET(THREAD_KVM_VCPU, thread_struct, kvm_vcpu); |
---|
137 | 166 | #endif |
---|
| 167 | +#if defined(CONFIG_PPC_BOOK3S_32) && defined(CONFIG_PPC_KUAP) |
---|
| 168 | + OFFSET(KUAP, thread_struct, kuap); |
---|
| 169 | +#endif |
---|
138 | 170 | |
---|
139 | 171 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
---|
140 | 172 | OFFSET(PACATMSCRATCH, paca_struct, tm_scratch); |
---|
.. | .. |
---|
144 | 176 | OFFSET(THREAD_TM_TAR, thread_struct, tm_tar); |
---|
145 | 177 | OFFSET(THREAD_TM_PPR, thread_struct, tm_ppr); |
---|
146 | 178 | OFFSET(THREAD_TM_DSCR, thread_struct, tm_dscr); |
---|
| 179 | + OFFSET(THREAD_TM_AMR, thread_struct, tm_amr); |
---|
147 | 180 | OFFSET(PT_CKPT_REGS, thread_struct, ckpt_regs); |
---|
148 | 181 | OFFSET(THREAD_CKVRSTATE, thread_struct, ckvr_state.vr); |
---|
149 | 182 | OFFSET(THREAD_CKVRSAVE, thread_struct, ckvrsave); |
---|
.. | .. |
---|
157 | 190 | OFFSET(TI_LOCAL_FLAGS, thread_info, local_flags); |
---|
158 | 191 | OFFSET(TI_PREEMPT, thread_info, preempt_count); |
---|
159 | 192 | OFFSET(TI_PREEMPT_LAZY, thread_info, preempt_lazy_count); |
---|
160 | | - OFFSET(TI_TASK, thread_info, task); |
---|
161 | | - OFFSET(TI_CPU, thread_info, cpu); |
---|
162 | 193 | |
---|
163 | 194 | #ifdef CONFIG_PPC64 |
---|
164 | 195 | OFFSET(DCACHEL1BLOCKSIZE, ppc64_caches, l1d.block_size); |
---|
.. | .. |
---|
173 | 204 | OFFSET(PACAPROCSTART, paca_struct, cpu_start); |
---|
174 | 205 | OFFSET(PACAKSAVE, paca_struct, kstack); |
---|
175 | 206 | OFFSET(PACACURRENT, paca_struct, __current); |
---|
| 207 | + DEFINE(PACA_THREAD_INFO, offsetof(struct paca_struct, __current) + |
---|
| 208 | + offsetof(struct task_struct, thread_info)); |
---|
176 | 209 | OFFSET(PACASAVEDMSR, paca_struct, saved_msr); |
---|
177 | | - OFFSET(PACASTABRR, paca_struct, stab_rr); |
---|
178 | 210 | OFFSET(PACAR1, paca_struct, saved_r1); |
---|
179 | 211 | OFFSET(PACATOC, paca_struct, kernel_toc); |
---|
180 | 212 | OFFSET(PACAKBASE, paca_struct, kernelbase); |
---|
.. | .. |
---|
213 | 245 | #ifdef CONFIG_PPC_BOOK3S_64 |
---|
214 | 246 | OFFSET(PACASLBCACHE, paca_struct, slb_cache); |
---|
215 | 247 | OFFSET(PACASLBCACHEPTR, paca_struct, slb_cache_ptr); |
---|
| 248 | + OFFSET(PACASTABRR, paca_struct, stab_rr); |
---|
216 | 249 | OFFSET(PACAVMALLOCSLLP, paca_struct, vmalloc_sllp); |
---|
217 | 250 | #ifdef CONFIG_PPC_MM_SLICES |
---|
218 | 251 | OFFSET(MMUPSIZESLLP, mmu_psize_def, sllp); |
---|
.. | .. |
---|
256 | 289 | OFFSET(ACCOUNT_STARTTIME_USER, paca_struct, accounting.starttime_user); |
---|
257 | 290 | OFFSET(ACCOUNT_USER_TIME, paca_struct, accounting.utime); |
---|
258 | 291 | OFFSET(ACCOUNT_SYSTEM_TIME, paca_struct, accounting.stime); |
---|
| 292 | +#ifdef CONFIG_PPC_BOOK3E |
---|
259 | 293 | OFFSET(PACA_TRAP_SAVE, paca_struct, trap_save); |
---|
260 | | - OFFSET(PACA_NAPSTATELOST, paca_struct, nap_state_lost); |
---|
| 294 | +#endif |
---|
261 | 295 | OFFSET(PACA_SPRG_VDSO, paca_struct, sprg_vdso); |
---|
262 | 296 | #else /* CONFIG_PPC64 */ |
---|
263 | 297 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE |
---|
.. | .. |
---|
274 | 308 | |
---|
275 | 309 | /* Interrupt register frame */ |
---|
276 | 310 | DEFINE(INT_FRAME_SIZE, STACK_INT_FRAME_SIZE); |
---|
277 | | - DEFINE(SWITCH_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs)); |
---|
278 | | -#ifdef CONFIG_PPC64 |
---|
279 | | - /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ |
---|
280 | | - DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); |
---|
281 | | - DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); |
---|
282 | | -#endif /* CONFIG_PPC64 */ |
---|
| 311 | + DEFINE(SWITCH_FRAME_SIZE, STACK_FRAME_WITH_PT_REGS); |
---|
283 | 312 | STACK_PT_REGS_OFFSET(GPR0, gpr[0]); |
---|
284 | 313 | STACK_PT_REGS_OFFSET(GPR1, gpr[1]); |
---|
285 | 314 | STACK_PT_REGS_OFFSET(GPR2, gpr[2]); |
---|
.. | .. |
---|
323 | 352 | STACK_PT_REGS_OFFSET(_ESR, dsisr); |
---|
324 | 353 | #else /* CONFIG_PPC64 */ |
---|
325 | 354 | STACK_PT_REGS_OFFSET(SOFTE, softe); |
---|
326 | | - |
---|
327 | | - /* These _only_ to be used with {PROM,RTAS}_FRAME_SIZE!!! */ |
---|
328 | | - DEFINE(_SRR0, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs)); |
---|
329 | | - DEFINE(_SRR1, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs)+8); |
---|
| 355 | + STACK_PT_REGS_OFFSET(_PPR, ppr); |
---|
330 | 356 | #endif /* CONFIG_PPC64 */ |
---|
| 357 | + |
---|
| 358 | +#ifdef CONFIG_PPC_KUAP |
---|
| 359 | + STACK_PT_REGS_OFFSET(STACK_REGS_KUAP, kuap); |
---|
| 360 | +#endif |
---|
331 | 361 | |
---|
332 | 362 | #if defined(CONFIG_PPC32) |
---|
333 | 363 | #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) |
---|
.. | .. |
---|
378 | 408 | OFFSET(CFG_SYSCALL_MAP32, vdso_data, syscall_map_32); |
---|
379 | 409 | OFFSET(WTOM_CLOCK_SEC, vdso_data, wtom_clock_sec); |
---|
380 | 410 | OFFSET(WTOM_CLOCK_NSEC, vdso_data, wtom_clock_nsec); |
---|
381 | | - OFFSET(STAMP_XTIME, vdso_data, stamp_xtime); |
---|
| 411 | + OFFSET(STAMP_XTIME_SEC, vdso_data, stamp_xtime_sec); |
---|
| 412 | + OFFSET(STAMP_XTIME_NSEC, vdso_data, stamp_xtime_nsec); |
---|
382 | 413 | OFFSET(STAMP_SEC_FRAC, vdso_data, stamp_sec_fraction); |
---|
383 | 414 | OFFSET(CLOCK_HRTIMER_RES, vdso_data, hrtimer_res); |
---|
| 415 | +#ifdef CONFIG_PPC64 |
---|
384 | 416 | OFFSET(CFG_ICACHE_BLOCKSZ, vdso_data, icache_block_size); |
---|
385 | 417 | OFFSET(CFG_DCACHE_BLOCKSZ, vdso_data, dcache_block_size); |
---|
386 | 418 | OFFSET(CFG_ICACHE_LOGBLOCKSZ, vdso_data, icache_log_block_size); |
---|
387 | 419 | OFFSET(CFG_DCACHE_LOGBLOCKSZ, vdso_data, dcache_log_block_size); |
---|
388 | | -#ifdef CONFIG_PPC64 |
---|
389 | 420 | OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); |
---|
390 | | - OFFSET(TVAL64_TV_SEC, timeval, tv_sec); |
---|
391 | | - OFFSET(TVAL64_TV_USEC, timeval, tv_usec); |
---|
392 | | - OFFSET(TVAL32_TV_SEC, compat_timeval, tv_sec); |
---|
393 | | - OFFSET(TVAL32_TV_USEC, compat_timeval, tv_usec); |
---|
394 | | - OFFSET(TSPC64_TV_SEC, timespec, tv_sec); |
---|
395 | | - OFFSET(TSPC64_TV_NSEC, timespec, tv_nsec); |
---|
396 | | - OFFSET(TSPC32_TV_SEC, compat_timespec, tv_sec); |
---|
397 | | - OFFSET(TSPC32_TV_NSEC, compat_timespec, tv_nsec); |
---|
398 | | -#else |
---|
399 | | - OFFSET(TVAL32_TV_SEC, timeval, tv_sec); |
---|
400 | | - OFFSET(TVAL32_TV_USEC, timeval, tv_usec); |
---|
401 | | - OFFSET(TSPC32_TV_SEC, timespec, tv_sec); |
---|
402 | | - OFFSET(TSPC32_TV_NSEC, timespec, tv_nsec); |
---|
| 421 | + OFFSET(TVAL64_TV_SEC, __kernel_old_timeval, tv_sec); |
---|
| 422 | + OFFSET(TVAL64_TV_USEC, __kernel_old_timeval, tv_usec); |
---|
403 | 423 | #endif |
---|
| 424 | + OFFSET(TSPC64_TV_SEC, __kernel_timespec, tv_sec); |
---|
| 425 | + OFFSET(TSPC64_TV_NSEC, __kernel_timespec, tv_nsec); |
---|
| 426 | + OFFSET(TVAL32_TV_SEC, old_timeval32, tv_sec); |
---|
| 427 | + OFFSET(TVAL32_TV_USEC, old_timeval32, tv_usec); |
---|
| 428 | + OFFSET(TSPC32_TV_SEC, old_timespec32, tv_sec); |
---|
| 429 | + OFFSET(TSPC32_TV_NSEC, old_timespec32, tv_nsec); |
---|
404 | 430 | /* timeval/timezone offsets for use by vdso */ |
---|
405 | 431 | OFFSET(TZONE_TZ_MINWEST, timezone, tz_minuteswest); |
---|
406 | 432 | OFFSET(TZONE_TZ_DSTTIME, timezone, tz_dsttime); |
---|
.. | .. |
---|
410 | 436 | DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); |
---|
411 | 437 | DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE); |
---|
412 | 438 | DEFINE(CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE); |
---|
| 439 | + DEFINE(CLOCK_MAX, CLOCK_TAI); |
---|
413 | 440 | DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); |
---|
| 441 | + DEFINE(EINVAL, EINVAL); |
---|
| 442 | + DEFINE(KTIME_LOW_RES, KTIME_LOW_RES); |
---|
414 | 443 | |
---|
415 | 444 | #ifdef CONFIG_BUG |
---|
416 | 445 | DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); |
---|
.. | .. |
---|
499 | 528 | OFFSET(KVM_VRMA_SLB_V, kvm, arch.vrma_slb_v); |
---|
500 | 529 | OFFSET(KVM_RADIX, kvm, arch.radix); |
---|
501 | 530 | OFFSET(KVM_FWNMI, kvm, arch.fwnmi_enabled); |
---|
| 531 | + OFFSET(KVM_SECURE_GUEST, kvm, arch.secure_guest); |
---|
502 | 532 | OFFSET(VCPU_DSISR, kvm_vcpu, arch.shregs.dsisr); |
---|
503 | 533 | OFFSET(VCPU_DAR, kvm_vcpu, arch.shregs.dar); |
---|
504 | 534 | OFFSET(VCPU_VPA, kvm_vcpu, arch.vpa.pinned_addr); |
---|
505 | 535 | OFFSET(VCPU_VPA_DIRTY, kvm_vcpu, arch.vpa.dirty); |
---|
506 | 536 | OFFSET(VCPU_HEIR, kvm_vcpu, arch.emul_inst); |
---|
| 537 | + OFFSET(VCPU_NESTED, kvm_vcpu, arch.nested); |
---|
507 | 538 | OFFSET(VCPU_CPU, kvm_vcpu, cpu); |
---|
508 | 539 | OFFSET(VCPU_THREAD_CPU, kvm_vcpu, arch.thread_cpu); |
---|
509 | 540 | #endif |
---|
.. | .. |
---|
530 | 561 | OFFSET(VCPU_IRQ_PENDING, kvm_vcpu, arch.irq_pending); |
---|
531 | 562 | OFFSET(VCPU_DBELL_REQ, kvm_vcpu, arch.doorbell_request); |
---|
532 | 563 | OFFSET(VCPU_MMCR, kvm_vcpu, arch.mmcr); |
---|
| 564 | + OFFSET(VCPU_MMCRA, kvm_vcpu, arch.mmcra); |
---|
| 565 | + OFFSET(VCPU_MMCRS, kvm_vcpu, arch.mmcrs); |
---|
533 | 566 | OFFSET(VCPU_PMC, kvm_vcpu, arch.pmc); |
---|
534 | 567 | OFFSET(VCPU_SPMC, kvm_vcpu, arch.spmc); |
---|
535 | 568 | OFFSET(VCPU_SIAR, kvm_vcpu, arch.siar); |
---|
.. | .. |
---|
667 | 700 | HSTATE_FIELD(HSTATE_SDAR, host_mmcr[4]); |
---|
668 | 701 | HSTATE_FIELD(HSTATE_MMCR2, host_mmcr[5]); |
---|
669 | 702 | HSTATE_FIELD(HSTATE_SIER, host_mmcr[6]); |
---|
| 703 | + HSTATE_FIELD(HSTATE_MMCR3, host_mmcr[7]); |
---|
| 704 | + HSTATE_FIELD(HSTATE_SIER2, host_mmcr[8]); |
---|
| 705 | + HSTATE_FIELD(HSTATE_SIER3, host_mmcr[9]); |
---|
670 | 706 | HSTATE_FIELD(HSTATE_PMC1, host_pmc[0]); |
---|
671 | 707 | HSTATE_FIELD(HSTATE_PMC2, host_pmc[1]); |
---|
672 | 708 | HSTATE_FIELD(HSTATE_PMC3, host_pmc[2]); |
---|
.. | .. |
---|
762 | 798 | OFFSET(VCPU_TIMING_LAST_ENTER_TBL, kvm_vcpu, arch.timing_last_enter.tv32.tbl); |
---|
763 | 799 | #endif |
---|
764 | 800 | |
---|
765 | | -#ifdef CONFIG_PPC_POWERNV |
---|
766 | | - OFFSET(PACA_CORE_IDLE_STATE_PTR, paca_struct, core_idle_state_ptr); |
---|
767 | | - OFFSET(PACA_THREAD_IDLE_STATE, paca_struct, thread_idle_state); |
---|
768 | | - OFFSET(PACA_THREAD_MASK, paca_struct, thread_mask); |
---|
769 | | - OFFSET(PACA_SUBCORE_SIBLING_MASK, paca_struct, subcore_sibling_mask); |
---|
770 | | - OFFSET(PACA_REQ_PSSCR, paca_struct, requested_psscr); |
---|
771 | | - OFFSET(PACA_DONT_STOP, paca_struct, dont_stop); |
---|
772 | | -#define STOP_SPR(x, f) OFFSET(x, paca_struct, stop_sprs.f) |
---|
773 | | - STOP_SPR(STOP_PID, pid); |
---|
774 | | - STOP_SPR(STOP_LDBAR, ldbar); |
---|
775 | | - STOP_SPR(STOP_FSCR, fscr); |
---|
776 | | - STOP_SPR(STOP_HFSCR, hfscr); |
---|
777 | | - STOP_SPR(STOP_MMCR1, mmcr1); |
---|
778 | | - STOP_SPR(STOP_MMCR2, mmcr2); |
---|
779 | | - STOP_SPR(STOP_MMCRA, mmcra); |
---|
780 | | -#endif |
---|
781 | | - |
---|
782 | 801 | DEFINE(PPC_DBELL_SERVER, PPC_DBELL_SERVER); |
---|
783 | 802 | DEFINE(PPC_DBELL_MSGTYPE, PPC_DBELL_MSGTYPE); |
---|
784 | 803 | |
---|
.. | .. |
---|
786 | 805 | DEFINE(VIRT_IMMR_BASE, (u64)__fix_to_virt(FIX_IMMR_BASE)); |
---|
787 | 806 | #endif |
---|
788 | 807 | |
---|
| 808 | +#ifdef CONFIG_XMON |
---|
| 809 | + DEFINE(BPT_SIZE, BPT_SIZE); |
---|
| 810 | +#endif |
---|
| 811 | + |
---|
789 | 812 | return 0; |
---|
790 | 813 | } |
---|