Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_POWERPC_TASK_SIZE_64_H
0003 #define _ASM_POWERPC_TASK_SIZE_64_H
0004 
0005 /*
0006  * 64-bit user address space can have multiple limits
0007  * For now supported values are:
0008  */
0009 #define TASK_SIZE_64TB  (0x0000400000000000UL)
0010 #define TASK_SIZE_128TB (0x0000800000000000UL)
0011 #define TASK_SIZE_512TB (0x0002000000000000UL)
0012 #define TASK_SIZE_1PB   (0x0004000000000000UL)
0013 #define TASK_SIZE_2PB   (0x0008000000000000UL)
0014 
0015 /*
0016  * With 52 bits in the address we can support up to 4PB of range.
0017  */
0018 #define TASK_SIZE_4PB   (0x0010000000000000UL)
0019 
0020 /*
0021  * For now 512TB is only supported with book3s and 64K linux page size.
0022  */
0023 #ifdef CONFIG_PPC_64K_PAGES
0024 /*
0025  * Max value currently used:
0026  */
0027 #define TASK_SIZE_USER64        TASK_SIZE_4PB
0028 #define DEFAULT_MAP_WINDOW_USER64   TASK_SIZE_128TB
0029 #define TASK_CONTEXT_SIZE       TASK_SIZE_512TB
0030 #else
0031 #define TASK_SIZE_USER64        TASK_SIZE_64TB
0032 #define DEFAULT_MAP_WINDOW_USER64   TASK_SIZE_64TB
0033 
0034 /*
0035  * We don't need to allocate extended context ids for 4K page size, because we
0036  * limit the max effective address on this config to 64TB.
0037  */
0038 #define TASK_CONTEXT_SIZE TASK_SIZE_64TB
0039 #endif
0040 
0041 /*
0042  * 32-bit user address space is 4GB - 1 page
0043  * (this 1 page is needed so referencing of 0xFFFFFFFF generates EFAULT
0044  */
0045 #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
0046 
0047 #define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)
0048 
0049 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
0050 #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
0051 
0052 /*
0053  * This decides where the kernel will search for a free chunk of vm space during
0054  * mmap's.
0055  */
0056 #define TASK_UNMAPPED_BASE  \
0057     ((is_32bit_task()) ? TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64)
0058 
0059 /*
0060  * Initial task size value for user applications. For book3s 64 we start
0061  * with 128TB and conditionally enable upto 512TB
0062  */
0063 #ifdef CONFIG_PPC_BOOK3S_64
0064 #define DEFAULT_MAP_WINDOW  \
0065     ((is_32bit_task()) ? TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64)
0066 #else
0067 #define DEFAULT_MAP_WINDOW  TASK_SIZE
0068 #endif
0069 
0070 #define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64
0071 #define STACK_TOP_USER32 TASK_SIZE_USER32
0072 #define STACK_TOP_MAX TASK_SIZE_USER64
0073 #define STACK_TOP (is_32bit_task() ? STACK_TOP_USER32 : STACK_TOP_USER64)
0074 
0075 #define arch_get_mmap_base(addr, base) \
0076     (((addr) > DEFAULT_MAP_WINDOW) ? (base) + TASK_SIZE - DEFAULT_MAP_WINDOW : (base))
0077 
0078 #define arch_get_mmap_end(addr, len, flags) \
0079     (((addr) > DEFAULT_MAP_WINDOW) || \
0080      (((flags) & MAP_FIXED) && ((addr) + (len) > DEFAULT_MAP_WINDOW)) ? TASK_SIZE : \
0081                                         DEFAULT_MAP_WINDOW)
0082 
0083 #endif /* _ASM_POWERPC_TASK_SIZE_64_H */