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

powerpc: Avoid circular header inclusion in mmu-hash.h

When activating CONFIG_THREAD_INFO_IN_TASK, linux/sched.h includes
asm/current.h. This generates a circular dependency. To avoid that,
asm/processor.h shall not be included in mmu-hash.h.

In order to do that, this patch moves into a new header called
asm/task_size_64/32.h all the TASK_SIZE related constants, which can
then be included in mmu-hash.h directly.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Split out all the TASK_SIZE constants not just 64-bit ones]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Christophe Leroy and committed by
Michael Ellerman
92ab45c5 c8e409a3

+108 -97
+1 -1
arch/powerpc/include/asm/book3s/64/mmu-hash.h
··· 23 23 */ 24 24 #include <asm/book3s/64/pgtable.h> 25 25 #include <asm/bug.h> 26 - #include <asm/processor.h> 26 + #include <asm/task_size_64.h> 27 27 #include <asm/cpu_has_feature.h> 28 28 29 29 /*
+6 -96
arch/powerpc/include/asm/processor.h
··· 77 77 78 78 #ifdef __KERNEL__ 79 79 80 + #ifdef CONFIG_PPC64 81 + #include <asm/task_size_64.h> 82 + #else 83 + #include <asm/task_size_32.h> 84 + #endif 85 + 80 86 struct task_struct; 81 87 void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp); 82 88 void release_thread(struct task_struct *); 83 - 84 - #ifdef CONFIG_PPC32 85 - 86 - #if CONFIG_TASK_SIZE > CONFIG_KERNEL_START 87 - #error User TASK_SIZE overlaps with KERNEL_START address 88 - #endif 89 - #define TASK_SIZE (CONFIG_TASK_SIZE) 90 - 91 - /* This decides where the kernel will search for a free chunk of vm 92 - * space during mmap's. 93 - */ 94 - #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) 95 - #endif 96 - 97 - #ifdef CONFIG_PPC64 98 - /* 99 - * 64-bit user address space can have multiple limits 100 - * For now supported values are: 101 - */ 102 - #define TASK_SIZE_64TB (0x0000400000000000UL) 103 - #define TASK_SIZE_128TB (0x0000800000000000UL) 104 - #define TASK_SIZE_512TB (0x0002000000000000UL) 105 - #define TASK_SIZE_1PB (0x0004000000000000UL) 106 - #define TASK_SIZE_2PB (0x0008000000000000UL) 107 - /* 108 - * With 52 bits in the address we can support 109 - * upto 4PB of range. 110 - */ 111 - #define TASK_SIZE_4PB (0x0010000000000000UL) 112 - 113 - /* 114 - * For now 512TB is only supported with book3s and 64K linux page size. 115 - */ 116 - #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES) 117 - /* 118 - * Max value currently used: 119 - */ 120 - #define TASK_SIZE_USER64 TASK_SIZE_4PB 121 - #define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB 122 - #define TASK_CONTEXT_SIZE TASK_SIZE_512TB 123 - #else 124 - #define TASK_SIZE_USER64 TASK_SIZE_64TB 125 - #define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB 126 - /* 127 - * We don't need to allocate extended context ids for 4K page size, because 128 - * we limit the max effective address on this config to 64TB. 129 - */ 130 - #define TASK_CONTEXT_SIZE TASK_SIZE_64TB 131 - #endif 132 - 133 - /* 134 - * 32-bit user address space is 4GB - 1 page 135 - * (this 1 page is needed so referencing of 0xFFFFFFFF generates EFAULT 136 - */ 137 - #define TASK_SIZE_USER32 (0x0000000100000000UL - (1*PAGE_SIZE)) 138 - 139 - #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \ 140 - TASK_SIZE_USER32 : TASK_SIZE_USER64) 141 - #define TASK_SIZE TASK_SIZE_OF(current) 142 - /* This decides where the kernel will search for a free chunk of vm 143 - * space during mmap's. 144 - */ 145 - #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) 146 - #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4)) 147 - 148 - #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \ 149 - TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) 150 - #endif 151 - 152 - /* 153 - * Initial task size value for user applications. For book3s 64 we start 154 - * with 128TB and conditionally enable upto 512TB 155 - */ 156 - #ifdef CONFIG_PPC_BOOK3S_64 157 - #define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ 158 - TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64) 159 - #else 160 - #define DEFAULT_MAP_WINDOW TASK_SIZE 161 - #endif 162 - 163 - #ifdef __powerpc64__ 164 - 165 - #define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64 166 - #define STACK_TOP_USER32 TASK_SIZE_USER32 167 - 168 - #define STACK_TOP (is_32bit_task() ? \ 169 - STACK_TOP_USER32 : STACK_TOP_USER64) 170 - 171 - #define STACK_TOP_MAX TASK_SIZE_USER64 172 - 173 - #else /* __powerpc64__ */ 174 - 175 - #define STACK_TOP TASK_SIZE 176 - #define STACK_TOP_MAX STACK_TOP 177 - 178 - #endif /* __powerpc64__ */ 179 89 180 90 typedef struct { 181 91 unsigned long seg;
+21
arch/powerpc/include/asm/task_size_32.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_POWERPC_TASK_SIZE_32_H 3 + #define _ASM_POWERPC_TASK_SIZE_32_H 4 + 5 + #if CONFIG_TASK_SIZE > CONFIG_KERNEL_START 6 + #error User TASK_SIZE overlaps with KERNEL_START address 7 + #endif 8 + 9 + #define TASK_SIZE (CONFIG_TASK_SIZE) 10 + 11 + /* 12 + * This decides where the kernel will search for a free chunk of vm space during 13 + * mmap's. 14 + */ 15 + #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) 16 + 17 + #define DEFAULT_MAP_WINDOW TASK_SIZE 18 + #define STACK_TOP TASK_SIZE 19 + #define STACK_TOP_MAX STACK_TOP 20 + 21 + #endif /* _ASM_POWERPC_TASK_SIZE_32_H */
+79
arch/powerpc/include/asm/task_size_64.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_POWERPC_TASK_SIZE_64_H 3 + #define _ASM_POWERPC_TASK_SIZE_64_H 4 + 5 + /* 6 + * 64-bit user address space can have multiple limits 7 + * For now supported values are: 8 + */ 9 + #define TASK_SIZE_64TB (0x0000400000000000UL) 10 + #define TASK_SIZE_128TB (0x0000800000000000UL) 11 + #define TASK_SIZE_512TB (0x0002000000000000UL) 12 + #define TASK_SIZE_1PB (0x0004000000000000UL) 13 + #define TASK_SIZE_2PB (0x0008000000000000UL) 14 + 15 + /* 16 + * With 52 bits in the address we can support up to 4PB of range. 17 + */ 18 + #define TASK_SIZE_4PB (0x0010000000000000UL) 19 + 20 + /* 21 + * For now 512TB is only supported with book3s and 64K linux page size. 22 + */ 23 + #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES) 24 + /* 25 + * Max value currently used: 26 + */ 27 + #define TASK_SIZE_USER64 TASK_SIZE_4PB 28 + #define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB 29 + #define TASK_CONTEXT_SIZE TASK_SIZE_512TB 30 + #else 31 + #define TASK_SIZE_USER64 TASK_SIZE_64TB 32 + #define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB 33 + 34 + /* 35 + * We don't need to allocate extended context ids for 4K page size, because we 36 + * limit the max effective address on this config to 64TB. 37 + */ 38 + #define TASK_CONTEXT_SIZE TASK_SIZE_64TB 39 + #endif 40 + 41 + /* 42 + * 32-bit user address space is 4GB - 1 page 43 + * (this 1 page is needed so referencing of 0xFFFFFFFF generates EFAULT 44 + */ 45 + #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE)) 46 + 47 + #define TASK_SIZE_OF(tsk) \ 48 + (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 : \ 49 + TASK_SIZE_USER64) 50 + 51 + #define TASK_SIZE TASK_SIZE_OF(current) 52 + 53 + #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) 54 + #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4)) 55 + 56 + /* 57 + * This decides where the kernel will search for a free chunk of vm space during 58 + * mmap's. 59 + */ 60 + #define TASK_UNMAPPED_BASE \ 61 + ((is_32bit_task()) ? TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64) 62 + 63 + /* 64 + * Initial task size value for user applications. For book3s 64 we start 65 + * with 128TB and conditionally enable upto 512TB 66 + */ 67 + #ifdef CONFIG_PPC_BOOK3S_64 68 + #define DEFAULT_MAP_WINDOW \ 69 + ((is_32bit_task()) ? TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64) 70 + #else 71 + #define DEFAULT_MAP_WINDOW TASK_SIZE 72 + #endif 73 + 74 + #define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64 75 + #define STACK_TOP_USER32 TASK_SIZE_USER32 76 + #define STACK_TOP_MAX TASK_SIZE_USER64 77 + #define STACK_TOP (is_32bit_task() ? STACK_TOP_USER32 : STACK_TOP_USER64) 78 + 79 + #endif /* _ASM_POWERPC_TASK_SIZE_64_H */
+1
arch/powerpc/kvm/book3s_hv_hmi.c
··· 24 24 #include <linux/compiler.h> 25 25 #include <asm/paca.h> 26 26 #include <asm/hmi.h> 27 + #include <asm/processor.h> 27 28 28 29 void wait_for_subcore_guest_exit(void) 29 30 {