Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2012 ARM Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef __ASM_COMPAT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define __ASM_COMPAT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <asm-generic/compat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifdef CONFIG_COMPAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * Architecture specific compatibility types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/sched/task_stack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define COMPAT_USER_HZ		100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #ifdef __AARCH64EB__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define COMPAT_UTS_MACHINE	"armv8b\0\0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define COMPAT_UTS_MACHINE	"armv8l\0\0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) typedef u16		__compat_uid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) typedef u16		__compat_gid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) typedef u16		__compat_uid16_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) typedef u16		__compat_gid16_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) typedef u32		__compat_uid32_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) typedef u32		__compat_gid32_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) typedef u16		compat_mode_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) typedef u32		compat_dev_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) typedef s32		compat_nlink_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) typedef u16		compat_ipc_pid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) typedef u32		compat_caddr_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) typedef __kernel_fsid_t	compat_fsid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) struct compat_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #ifdef __AARCH64EB__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	short		st_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	short		__pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	compat_dev_t	st_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	compat_ino_t	st_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	compat_mode_t	st_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	compat_ushort_t	st_nlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	__compat_uid16_t	st_uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	__compat_gid16_t	st_gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #ifdef __AARCH64EB__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	short		st_rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	short		__pad2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	compat_dev_t	st_rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	compat_off_t	st_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	compat_off_t	st_blksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	compat_off_t	st_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	old_time32_t	st_atime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	compat_ulong_t	st_atime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	old_time32_t	st_mtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	compat_ulong_t	st_mtime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	old_time32_t	st_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	compat_ulong_t	st_ctime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	compat_ulong_t	__unused4[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) struct compat_flock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	short		l_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	short		l_whence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	compat_off_t	l_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	compat_off_t	l_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	compat_pid_t	l_pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define F_GETLK64	12	/*  using 'struct flock64' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define F_SETLK64	13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define F_SETLKW64	14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) struct compat_flock64 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	short		l_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	short		l_whence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	compat_loff_t	l_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	compat_loff_t	l_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	compat_pid_t	l_pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) struct compat_statfs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	int		f_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	int		f_bsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	int		f_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	int		f_bfree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	int		f_bavail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	int		f_files;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	int		f_ffree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	compat_fsid_t	f_fsid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	int		f_namelen;	/* SunOS ignores this field. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	int		f_frsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	int		f_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	int		f_spare[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define COMPAT_RLIM_INFINITY		0xffffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) typedef u32		compat_old_sigset_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define _COMPAT_NSIG		64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define _COMPAT_NSIG_BPW	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) typedef u32		compat_sigset_word;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define COMPAT_OFF_T_MAX	0x7fffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define COMPAT_MINSIGSTKSZ	2048
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static inline void __user *arch_compat_alloc_user_space(long len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	return (void __user *)compat_user_stack_pointer() - len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct compat_ipc64_perm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	compat_key_t key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	__compat_uid32_t uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	__compat_gid32_t gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	__compat_uid32_t cuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	__compat_gid32_t cgid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	unsigned short mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	unsigned short __pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	unsigned short seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	unsigned short __pad2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	compat_ulong_t unused1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	compat_ulong_t unused2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct compat_semid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	struct compat_ipc64_perm sem_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	compat_ulong_t sem_otime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	compat_ulong_t sem_otime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	compat_ulong_t sem_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	compat_ulong_t sem_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	compat_ulong_t sem_nsems;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	compat_ulong_t __unused3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct compat_msqid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	struct compat_ipc64_perm msg_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	compat_ulong_t msg_stime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	compat_ulong_t msg_stime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	compat_ulong_t msg_rtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	compat_ulong_t msg_rtime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	compat_ulong_t msg_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	compat_ulong_t msg_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	compat_ulong_t msg_cbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	compat_ulong_t msg_qnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	compat_ulong_t msg_qbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	compat_pid_t   msg_lspid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	compat_pid_t   msg_lrpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	compat_ulong_t __unused5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct compat_shmid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct compat_ipc64_perm shm_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	compat_size_t  shm_segsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	compat_ulong_t shm_atime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	compat_ulong_t shm_atime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	compat_ulong_t shm_dtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	compat_ulong_t shm_dtime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	compat_ulong_t shm_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	compat_ulong_t shm_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	compat_pid_t   shm_cpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	compat_pid_t   shm_lpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	compat_ulong_t shm_nattch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	compat_ulong_t __unused5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) static inline int is_compat_task(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	return test_thread_flag(TIF_32BIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) static inline int is_compat_thread(struct thread_info *thread)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	return test_ti_thread_flag(thread, TIF_32BIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #else /* !CONFIG_COMPAT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) static inline int is_compat_thread(struct thread_info *thread)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #endif /* CONFIG_COMPAT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #endif /* __ASM_COMPAT_H */