Skip to contentSkip to conversation

DRM GPUVA Manager & Nouveau VM_BIND UAPI

RFC PATCH Superseded Danilo Krummrich 12 participants 89 messages Jan 18, 2023 – Mar 16, 2023 Page 3 of 3

Subsystems (5)

v1 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#59 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

In reply to Danilo Krummrich
Thank you for the patch! Perhaps something to improve:

Hi Danilo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 0b45ac1170ea6416bc1d36798414c04870cd356d]

url:    https://github.com/intel-lab-lkp/linux/commits/Danilo-Krummrich/drm-execution-context-for-GEM-buffers/20230118-141552
base:   0b45ac1170ea6416bc1d36798414c04870cd356d
patch link:    https://lore.kernel.org/r/20230118061256.2689-14-dakr%40redhat.com
patch subject: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI
config: alpha-allyesconfig
compiler: alpha-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/85eb5d5193ee710b6ef76ec2a1b76e2254017a2d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Danilo-Krummrich/drm-execution-context-for-GEM-buffers/20230118-141552 git checkout 85eb5d5193ee710b6ef76ec2a1b76e2254017a2d
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/nouveau/nouveau_exec.c:153:5: warning: no previous prototype for 'nouveau_vm_bind' [-Wmissing-prototypes]
     153 | int nouveau_vm_bind(struct nouveau_exec_bind *bind)
         |     ^~~~~~~~~~~~~~~
--
>> drivers/gpu/drm/nouveau/nouveau_sched.c:173:1: warning: no previous prototype for 'nouveau_bind_job_submit' [-Wmissing-prototypes]
     173 | nouveau_bind_job_submit(struct nouveau_job *job)
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/nouveau/nouveau_sched.c:428:1: warning: no previous prototype for 'nouveau_exec_job_submit' [-Wmissing-prototypes]

428 | nouveau_exec_job_submit(struct nouveau_job *job)
| ^~~~~~~~~~~~~~~~~~~~~~~

vim +/nouveau_vm_bind +153 drivers/gpu/drm/nouveau/nouveau_exec.c

152

 > 153	int nouveau_vm_bind(struct nouveau_exec_bind *bind)

154 {
155 struct nouveau_bind_job *job;
156 int ret;
157
158 ret = nouveau_bind_job_init(&job, bind);
159 if (ret)
160 return ret;
161
162 ret = nouveau_job_submit(&job->base);
163 if (ret)
164 goto err_job_fini;
165
166 return 0;
167
168 err_job_fini:
169 nouveau_job_fini(&job->base);
170 return ret;
171 }
172

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

#
# Automatically generated file; DO NOT EDIT. # Linux/alpha 6.2.0-rc2 Kernel Configuration #
CONFIG_CC_VERSION_TEXT="alpha-linux-gcc (GCC) 12.1.0" CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120100 CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23800
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23800
CONFIG_LLD_VERSION=0 CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y CONFIG_PAHOLE_VERSION=123 CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_COMPILE_TEST=y
# CONFIG_WERROR is not set
CONFIG_LOCALVERSION=""
CONFIG_BUILD_SALT=""
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_WATCH_QUEUE=y
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_USELIB=y
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_AUTO_IRQ_AFFINITY=y
CONFIG_GENERIC_IRQ_INJECTION=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_SIM=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_IRQ_DEBUGFS=y

# end of IRQ subsystem

CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_TIME_KUNIT_TEST=y
CONFIG_CONTEXT_TRACKING=y
CONFIG_CONTEXT_TRACKING_IDLE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y

# end of Timers subsystem

CONFIG_BPF=y

#
# BPF subsystem
#
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_UNPRIV_DEFAULT_OFF=y
CONFIG_USERMODE_DRIVER=y

# end of BPF subsystem

CONFIG_PREEMPT_NONE_BUILD=y
CONFIG_PREEMPT_NONE=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_PSI=y
CONFIG_PSI_DEFAULT_DISABLED=y

# end of CPU/Task time and stats accounting

CONFIG_CPU_ISOLATION=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
CONFIG_RCU_EXPERT=y
CONFIG_SRCU=y
CONFIG_TREE_SRCU=y
CONFIG_TASKS_RCU_GENERIC=y
CONFIG_FORCE_TASKS_RCU=y
CONFIG_TASKS_RCU=y
CONFIG_FORCE_TASKS_RUDE_RCU=y
CONFIG_TASKS_RUDE_RCU=y
CONFIG_FORCE_TASKS_TRACE_RCU=y
CONFIG_TASKS_TRACE_RCU=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_NEED_SEGCBLIST=y
CONFIG_RCU_FANOUT=64
CONFIG_RCU_FANOUT_LEAF=16
CONFIG_RCU_NOCB_CPU=y
CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y
CONFIG_TASKS_TRACE_RCU_READ_MB=y
CONFIG_RCU_LAZY=y

# end of RCU Subsystem

CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_IKHEADERS=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13
CONFIG_PRINTK_INDEX=y

#
# Scheduler features
#

# end of Scheduler features

CONFIG_CC_HAS_INT128=y CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" CONFIG_GCC12_NO_ARRAY_BOUNDS=y CONFIG_CC_NO_ARRAY_BOUNDS=y
CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y CONFIG_CGROUP_FAVOR_DYNMODS=y
CONFIG_MEMCG=y
CONFIG_MEMCG_KMEM=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
CONFIG_CGROUP_MISC=y
CONFIG_CGROUP_DEBUG=y
CONFIG_SOCK_CGROUP_DATA=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_CHECKPOINT_RESTORE=y CONFIG_SCHED_AUTOGROUP=y CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y
CONFIG_RD_ZSTD=y
CONFIG_BOOT_CONFIG=y
CONFIG_BOOT_CONFIG_EMBED=y CONFIG_BOOT_CONFIG_EMBED_FILE="" CONFIG_INITRAMFS_PRESERVE_MTIME=y CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SYSCTL=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_EXPERT=y
CONFIG_MULTIUSER=y
CONFIG_SGETMASK_SYSCALL=y
CONFIG_SYSFS_SYSCALL=y
CONFIG_FHANDLE=y
CONFIG_POSIX_TIMERS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_IO_URING=y
CONFIG_ADVISE_SYSCALLS=y
CONFIG_MEMBARRIER=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_SELFTEST=y
CONFIG_KALLSYMS_ALL=y CONFIG_KALLSYMS_BASE_RELATIVE=y
CONFIG_KCMP=y
CONFIG_EMBEDDED=y
CONFIG_HAVE_PERF_EVENTS=y CONFIG_PERF_USE_VMALLOC=y
CONFIG_PC104=y

#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
CONFIG_DEBUG_PERF_USE_VMALLOC=y

# end of Kernel Performance Events And Counters

CONFIG_SYSTEM_DATA_VERIFICATION=y
CONFIG_PROFILING=y

# end of General setup

CONFIG_ALPHA=y
CONFIG_64BIT=y
CONFIG_MMU=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_PGTABLE_LEVELS=3
CONFIG_AUDIT_ARCH=y

#
# System setup
#
CONFIG_ALPHA_GENERIC=y
# CONFIG_ALPHA_ALCOR is not set
# CONFIG_ALPHA_XL is not set
# CONFIG_ALPHA_BOOK1 is not set
# CONFIG_ALPHA_AVANTI_CH is not set
# CONFIG_ALPHA_CABRIOLET is not set
# CONFIG_ALPHA_DP264 is not set
# CONFIG_ALPHA_EB164 is not set
# CONFIG_ALPHA_EB64P_CH is not set
# CONFIG_ALPHA_EB66 is not set
# CONFIG_ALPHA_EB66P is not set
# CONFIG_ALPHA_EIGER is not set
# CONFIG_ALPHA_JENSEN is not set
# CONFIG_ALPHA_LX164 is not set
# CONFIG_ALPHA_LYNX is not set
# CONFIG_ALPHA_MARVEL is not set
# CONFIG_ALPHA_MIATA is not set
# CONFIG_ALPHA_MIKASA is not set
# CONFIG_ALPHA_NAUTILUS is not set
# CONFIG_ALPHA_NONAME_CH is not set
# CONFIG_ALPHA_NORITAKE is not set
# CONFIG_ALPHA_PC164 is not set
# CONFIG_ALPHA_P2K is not set
# CONFIG_ALPHA_RAWHIDE is not set
# CONFIG_ALPHA_RUFFIAN is not set
# CONFIG_ALPHA_RX164 is not set
# CONFIG_ALPHA_SX164 is not set
# CONFIG_ALPHA_SABLE is not set
# CONFIG_ALPHA_SHARK is not set
# CONFIG_ALPHA_TAKARA is not set
# CONFIG_ALPHA_TITAN is not set
# CONFIG_ALPHA_WILDFIRE is not set
CONFIG_ISA=y
CONFIG_ISA_DMA_API=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ALPHA_BROKEN_IRQ_MASK=y
CONFIG_VGA_HOSE=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_SMP=y
CONFIG_NR_CPUS=32
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ALPHA_WTINT=y
CONFIG_VERBOSE_MCHECK=y
CONFIG_VERBOSE_MCHECK_ON=1
# CONFIG_HZ_32 is not set
# CONFIG_HZ_64 is not set
# CONFIG_HZ_128 is not set
# CONFIG_HZ_256 is not set
CONFIG_HZ_1024=y
# CONFIG_HZ_1200 is not set
CONFIG_HZ=1024
CONFIG_SRM_ENV=y

# end of System setup

CONFIG_DUMMY_CONSOLE=y

#
# General architecture-dependent options
#
CONFIG_CRASH_CORE=y
CONFIG_HAVE_64BIT_ALIGNED_ACCESS=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_ARCH_32BIT_USTAT_F_TINODE=y
CONFIG_HAVE_ASM_MODVERSIONS=y
CONFIG_MMU_GATHER_NO_RANGE=y
CONFIG_MMU_GATHER_MERGE_VMAS=y
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_LTO_NONE=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_MODULES_USE_ELF_RELA=y
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_ISA_BUS_API=y
CONFIG_ODD_RT_SIGACTION=y
CONFIG_OLD_SIGSUSPEND=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_ARCH_NO_PREEMPT=y
CONFIG_CPU_NO_EFFICIENT_FFS=y
CONFIG_LOCK_EVENT_COUNTS=y

#
# GCOV-based kernel profiling
#
CONFIG_GCOV_KERNEL=y

# end of GCOV-based kernel profiling

CONFIG_FUNCTION_ALIGNMENT=0

# end of General architecture-dependent options

CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULE_SIG_FORMAT=y
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODULE_UNLOAD_TAINT_TRACKING=y
CONFIG_MODVERSIONS=y
CONFIG_ASM_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG=y
CONFIG_MODULE_SIG_FORCE=y
CONFIG_MODULE_SIG_ALL=y
CONFIG_MODULE_SIG_SHA1=y
# CONFIG_MODULE_SIG_SHA224 is not set
# CONFIG_MODULE_SIG_SHA256 is not set
# CONFIG_MODULE_SIG_SHA384 is not set
# CONFIG_MODULE_SIG_SHA512 is not set
CONFIG_MODULE_SIG_HASH="sha1"
CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_GZIP is not set
# CONFIG_MODULE_COMPRESS_XZ is not set
# CONFIG_MODULE_COMPRESS_ZSTD is not set
CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y
CONFIG_MODPROBE_PATH="/sbin/modprobe"
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_BLOCK=y
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
CONFIG_BLK_RQ_ALLOC_TIME=y
CONFIG_BLK_CGROUP_RWSTAT=y
CONFIG_BLK_DEV_BSG_COMMON=y
CONFIG_BLK_ICQ=y
CONFIG_BLK_DEV_BSGLIB=y
CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_BLK_DEV_INTEGRITY_T10=y
CONFIG_BLK_DEV_ZONED=y
CONFIG_BLK_DEV_THROTTLING=y
CONFIG_BLK_DEV_THROTTLING_LOW=y
CONFIG_BLK_WBT=y
CONFIG_BLK_WBT_MQ=y
CONFIG_BLK_CGROUP_IOLATENCY=y
CONFIG_BLK_CGROUP_FC_APPID=y
CONFIG_BLK_CGROUP_IOCOST=y
CONFIG_BLK_CGROUP_IOPRIO=y
CONFIG_BLK_DEBUG_FS=y
CONFIG_BLK_DEBUG_FS_ZONED=y
CONFIG_BLK_SED_OPAL=y
CONFIG_BLK_INLINE_ENCRYPTION=y
CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
CONFIG_ACORN_PARTITION_CUMANA=y
CONFIG_ACORN_PARTITION_EESOX=y
CONFIG_ACORN_PARTITION_ICS=y
CONFIG_ACORN_PARTITION_ADFS=y
CONFIG_ACORN_PARTITION_POWERTEC=y
CONFIG_ACORN_PARTITION_RISCIX=y
CONFIG_AIX_PARTITION=y
CONFIG_OSF_PARTITION=y
CONFIG_AMIGA_PARTITION=y
CONFIG_ATARI_PARTITION=y
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_LDM_PARTITION=y
CONFIG_LDM_DEBUG=y
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
CONFIG_SUN_PARTITION=y
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_SYSV68_PARTITION=y
CONFIG_CMDLINE_PARTITION=y

# end of Partition Types

CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_BLOCK_HOLDER_DEPRECATED=y
CONFIG_BLK_MQ_STACKING=y

#
# IO Schedulers
#
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_MQ_IOSCHED_KYBER=y
CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BFQ_CGROUP_DEBUG=y

# end of IO Schedulers

CONFIG_PADATA=y
CONFIG_ASN1=y
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_FREEZER=y

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_ELF_KUNIT_TEST=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_BINFMT_MISC=y
CONFIG_COREDUMP=y

# end of Executable file formats

#
# Memory Management options
#
CONFIG_ZPOOL=y
CONFIG_SWAP=y
CONFIG_ZSWAP=y
CONFIG_ZSWAP_DEFAULT_ON=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE is not set CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842 is not set # CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4 is not set # CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC is not set # CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD is not set CONFIG_ZSWAP_COMPRESSOR_DEFAULT="lzo" CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD=y
# CONFIG_ZSWAP_ZPOOL_DEFAULT_Z3FOLD is not set # CONFIG_ZSWAP_ZPOOL_DEFAULT_ZSMALLOC is not set CONFIG_ZSWAP_ZPOOL_DEFAULT="zbud" CONFIG_ZBUD=y
CONFIG_Z3FOLD=y
CONFIG_ZSMALLOC=y
CONFIG_ZSMALLOC_STAT=y

#
# SLAB allocator options
#
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB_DEPRECATED is not set
CONFIG_SLUB_TINY=y
CONFIG_SLAB_MERGE_DEFAULT=y

# end of SLAB allocator options

CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
CONFIG_COMPAT_BRK=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MEMORY_BALLOON=y
CONFIG_BALLOON_COMPACTION=y
CONFIG_COMPACTION=y
CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1
CONFIG_PAGE_REPORTING=y
CONFIG_MIGRATION=y
CONFIG_CONTIG_ALLOC=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_MMU_NOTIFIER=y
CONFIG_KSM=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_FRONTSWAP=y
CONFIG_CMA=y
CONFIG_CMA_DEBUG=y
CONFIG_CMA_DEBUGFS=y
CONFIG_CMA_SYSFS=y
CONFIG_CMA_AREAS=7
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
CONFIG_PAGE_IDLE_FLAG=y
CONFIG_IDLE_PAGE_TRACKING=y
CONFIG_ZONE_DMA=y
CONFIG_HMM_MIRROR=y
CONFIG_GET_FREE_REGION=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PERCPU_STATS=y
CONFIG_GUP_TEST=y
CONFIG_ANON_VMA_NAME=y
CONFIG_USERFAULTFD=y
CONFIG_LRU_GEN=y
CONFIG_LRU_GEN_ENABLED=y
CONFIG_LRU_GEN_STATS=y

#
# Data Access Monitoring
#
CONFIG_DAMON=y
CONFIG_DAMON_KUNIT_TEST=y
CONFIG_DAMON_VADDR=y
CONFIG_DAMON_PADDR=y
CONFIG_DAMON_VADDR_KUNIT_TEST=y
CONFIG_DAMON_SYSFS=y
CONFIG_DAMON_DBGFS=y
CONFIG_DAMON_DBGFS_KUNIT_TEST=y
CONFIG_DAMON_RECLAIM=y
CONFIG_DAMON_LRU_SORT=y

# end of Data Access Monitoring
# end of Memory Management options

CONFIG_NET=y
CONFIG_NET_INGRESS=y
CONFIG_NET_EGRESS=y
CONFIG_NET_REDIRECT=y
CONFIG_SKB_EXTENSIONS=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_DIAG=y
CONFIG_UNIX=y
CONFIG_UNIX_SCM=y
CONFIG_AF_UNIX_OOB=y
CONFIG_UNIX_DIAG=y
CONFIG_TLS=y
CONFIG_TLS_DEVICE=y
CONFIG_TLS_TOE=y
CONFIG_XFRM=y
CONFIG_XFRM_OFFLOAD=y
CONFIG_XFRM_ALGO=y
CONFIG_XFRM_USER=y
CONFIG_XFRM_INTERFACE=y
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_XFRM_AH=y
CONFIG_XFRM_ESP=y
CONFIG_XFRM_IPCOMP=y
CONFIG_NET_KEY=y
CONFIG_NET_KEY_MIGRATE=y
CONFIG_XFRM_ESPINTCP=y
CONFIG_XDP_SOCKETS=y
CONFIG_XDP_SOCKETS_DIAG=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_FIB_TRIE_STATS=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_ROUTE_CLASSID=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IP_TUNNEL=y
CONFIG_NET_IPGRE=y
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE_COMMON=y
CONFIG_IP_MROUTE=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_SYN_COOKIES=y
CONFIG_NET_IPVTI=y
CONFIG_NET_UDP_TUNNEL=y
CONFIG_NET_FOU=y
CONFIG_NET_FOU_IP_TUNNELS=y
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
CONFIG_INET_ESP_OFFLOAD=y
CONFIG_INET_ESPINTCP=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_TABLE_PERTURB_ORDER=16
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
CONFIG_INET_UDP_DIAG=y
CONFIG_INET_RAW_DIAG=y
CONFIG_INET_DIAG_DESTROY=y
CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_BIC=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=y
CONFIG_TCP_CONG_HTCP=y
CONFIG_TCP_CONG_HSTCP=y
CONFIG_TCP_CONG_HYBLA=y
CONFIG_TCP_CONG_VEGAS=y
CONFIG_TCP_CONG_NV=y
CONFIG_TCP_CONG_SCALABLE=y
CONFIG_TCP_CONG_LP=y
CONFIG_TCP_CONG_VENO=y
CONFIG_TCP_CONG_YEAH=y
CONFIG_TCP_CONG_ILLINOIS=y
CONFIG_TCP_CONG_DCTCP=y
CONFIG_TCP_CONG_CDG=y
CONFIG_TCP_CONG_BBR=y
# CONFIG_DEFAULT_BIC is not set
CONFIG_DEFAULT_CUBIC=y
# CONFIG_DEFAULT_HTCP is not set
# CONFIG_DEFAULT_HYBLA is not set
# CONFIG_DEFAULT_VEGAS is not set
# CONFIG_DEFAULT_VENO is not set
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_DCTCP is not set
# CONFIG_DEFAULT_CDG is not set
# CONFIG_DEFAULT_BBR is not set
# CONFIG_DEFAULT_RENO is not set
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_TCP_MD5SIG=y
CONFIG_IPV6=y
CONFIG_IPV6_ROUTER_PREF=y
CONFIG_IPV6_ROUTE_INFO=y
CONFIG_IPV6_OPTIMISTIC_DAD=y
CONFIG_INET6_AH=y
CONFIG_INET6_ESP=y
CONFIG_INET6_ESP_OFFLOAD=y
CONFIG_INET6_ESPINTCP=y
CONFIG_INET6_IPCOMP=y
CONFIG_IPV6_MIP6=y
CONFIG_IPV6_ILA=y
CONFIG_INET6_XFRM_TUNNEL=y
CONFIG_INET6_TUNNEL=y
CONFIG_IPV6_VTI=y
CONFIG_IPV6_SIT=y
CONFIG_IPV6_SIT_6RD=y
CONFIG_IPV6_NDISC_NODETYPE=y
CONFIG_IPV6_TUNNEL=y
CONFIG_IPV6_GRE=y
CONFIG_IPV6_FOU=y
CONFIG_IPV6_FOU_TUNNEL=y
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
CONFIG_IPV6_PIMSM_V2=y
CONFIG_IPV6_SEG6_LWTUNNEL=y
CONFIG_IPV6_SEG6_HMAC=y
CONFIG_IPV6_SEG6_BPF=y
CONFIG_IPV6_RPL_LWTUNNEL=y
CONFIG_IPV6_IOAM6_LWTUNNEL=y
CONFIG_NETLABEL=y
CONFIG_MPTCP=y
CONFIG_INET_MPTCP_DIAG=y
CONFIG_MPTCP_IPV6=y
CONFIG_MPTCP_KUNIT_TEST=y
CONFIG_NETWORK_SECMARK=y
CONFIG_NET_PTP_CLASSIFY=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_BRIDGE_NETFILTER=y

#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_INGRESS=y
CONFIG_NETFILTER_EGRESS=y
CONFIG_NETFILTER_SKIP_EGRESS=y
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_FAMILY_BRIDGE=y
CONFIG_NETFILTER_FAMILY_ARP=y
CONFIG_NETFILTER_NETLINK_HOOK=y
CONFIG_NETFILTER_NETLINK_ACCT=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NETFILTER_NETLINK_OSF=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_LOG_SYSLOG=y
CONFIG_NETFILTER_CONNCOUNT=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_ZONES=y
CONFIG_NF_CONNTRACK_PROCFS=y
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_TIMEOUT=y
CONFIG_NF_CONNTRACK_TIMESTAMP=y
CONFIG_NF_CONNTRACK_LABELS=y
CONFIG_NF_CT_PROTO_DCCP=y
CONFIG_NF_CT_PROTO_GRE=y
CONFIG_NF_CT_PROTO_SCTP=y
CONFIG_NF_CT_PROTO_UDPLITE=y
CONFIG_NF_CONNTRACK_AMANDA=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_H323=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_BROADCAST=y
CONFIG_NF_CONNTRACK_NETBIOS_NS=y
CONFIG_NF_CONNTRACK_SNMP=y
CONFIG_NF_CONNTRACK_PPTP=y
CONFIG_NF_CONNTRACK_SANE=y
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CONNTRACK_TFTP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NF_CT_NETLINK_TIMEOUT=y
CONFIG_NF_CT_NETLINK_HELPER=y
CONFIG_NETFILTER_NETLINK_GLUE_CT=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_AMANDA=y
CONFIG_NF_NAT_FTP=y
CONFIG_NF_NAT_IRC=y
CONFIG_NF_NAT_SIP=y
CONFIG_NF_NAT_TFTP=y
CONFIG_NF_NAT_REDIRECT=y
CONFIG_NF_NAT_MASQUERADE=y
CONFIG_NF_NAT_OVS=y
CONFIG_NETFILTER_SYNPROXY=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_NUMGEN=y
CONFIG_NFT_CT=y
CONFIG_NFT_FLOW_OFFLOAD=y
CONFIG_NFT_CONNLIMIT=y
CONFIG_NFT_LOG=y
CONFIG_NFT_LIMIT=y
CONFIG_NFT_MASQ=y
CONFIG_NFT_REDIR=y
CONFIG_NFT_NAT=y
CONFIG_NFT_TUNNEL=y
CONFIG_NFT_QUEUE=y
CONFIG_NFT_QUOTA=y
CONFIG_NFT_REJECT=y
CONFIG_NFT_REJECT_INET=y
CONFIG_NFT_COMPAT=y
CONFIG_NFT_HASH=y
CONFIG_NFT_FIB=y
CONFIG_NFT_FIB_INET=y
CONFIG_NFT_XFRM=y
CONFIG_NFT_SOCKET=y
CONFIG_NFT_OSF=y
CONFIG_NFT_TPROXY=y
CONFIG_NFT_SYNPROXY=y
CONFIG_NF_DUP_NETDEV=y
CONFIG_NFT_DUP_NETDEV=y
CONFIG_NFT_FWD_NETDEV=y
CONFIG_NFT_FIB_NETDEV=y
CONFIG_NFT_REJECT_NETDEV=y
CONFIG_NF_FLOW_TABLE_INET=y
CONFIG_NF_FLOW_TABLE=y
CONFIG_NF_FLOW_TABLE_PROCFS=y
CONFIG_NETFILTER_XTABLES=y

#
# Xtables combined modules
#
CONFIG_NETFILTER_XT_MARK=y
CONFIG_NETFILTER_XT_CONNMARK=y
CONFIG_NETFILTER_XT_SET=y

#
# Xtables targets
#
CONFIG_NETFILTER_XT_TARGET_AUDIT=y
CONFIG_NETFILTER_XT_TARGET_CHECKSUM=y
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
CONFIG_NETFILTER_XT_TARGET_CT=y
CONFIG_NETFILTER_XT_TARGET_DSCP=y
CONFIG_NETFILTER_XT_TARGET_HL=y
CONFIG_NETFILTER_XT_TARGET_HMARK=y
CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
CONFIG_NETFILTER_XT_TARGET_LED=y
CONFIG_NETFILTER_XT_TARGET_LOG=y
CONFIG_NETFILTER_XT_TARGET_MARK=y
CONFIG_NETFILTER_XT_NAT=y
CONFIG_NETFILTER_XT_TARGET_NETMAP=y
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
CONFIG_NETFILTER_XT_TARGET_NOTRACK=y
CONFIG_NETFILTER_XT_TARGET_RATEEST=y
CONFIG_NETFILTER_XT_TARGET_REDIRECT=y
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
CONFIG_NETFILTER_XT_TARGET_TEE=y
CONFIG_NETFILTER_XT_TARGET_TPROXY=y
CONFIG_NETFILTER_XT_TARGET_TRACE=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=y

#
# Xtables matches
#
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_NETFILTER_XT_MATCH_BPF=y
CONFIG_NETFILTER_XT_MATCH_CGROUP=y
CONFIG_NETFILTER_XT_MATCH_CLUSTER=y
CONFIG_NETFILTER_XT_MATCH_COMMENT=y
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
CONFIG_NETFILTER_XT_MATCH_CONNLABEL=y
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_CPU=y
CONFIG_NETFILTER_XT_MATCH_DCCP=y
CONFIG_NETFILTER_XT_MATCH_DEVGROUP=y
CONFIG_NETFILTER_XT_MATCH_DSCP=y
CONFIG_NETFILTER_XT_MATCH_ECN=y
CONFIG_NETFILTER_XT_MATCH_ESP=y
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
CONFIG_NETFILTER_XT_MATCH_HELPER=y
CONFIG_NETFILTER_XT_MATCH_HL=y
CONFIG_NETFILTER_XT_MATCH_IPCOMP=y
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
CONFIG_NETFILTER_XT_MATCH_IPVS=y
CONFIG_NETFILTER_XT_MATCH_L2TP=y
CONFIG_NETFILTER_XT_MATCH_LENGTH=y
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
CONFIG_NETFILTER_XT_MATCH_MAC=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
CONFIG_NETFILTER_XT_MATCH_NFACCT=y
CONFIG_NETFILTER_XT_MATCH_OSF=y
CONFIG_NETFILTER_XT_MATCH_OWNER=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=y
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
CONFIG_NETFILTER_XT_MATCH_QUOTA=y
CONFIG_NETFILTER_XT_MATCH_RATEEST=y
CONFIG_NETFILTER_XT_MATCH_REALM=y
CONFIG_NETFILTER_XT_MATCH_RECENT=y
CONFIG_NETFILTER_XT_MATCH_SCTP=y
CONFIG_NETFILTER_XT_MATCH_SOCKET=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
CONFIG_NETFILTER_XT_MATCH_STRING=y
CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_TIME=y
CONFIG_NETFILTER_XT_MATCH_U32=y

# end of Core Netfilter Configuration

CONFIG_IP_SET=y
CONFIG_IP_SET_MAX=256
CONFIG_IP_SET_BITMAP_IP=y
CONFIG_IP_SET_BITMAP_IPMAC=y
CONFIG_IP_SET_BITMAP_PORT=y
CONFIG_IP_SET_HASH_IP=y
CONFIG_IP_SET_HASH_IPMARK=y
CONFIG_IP_SET_HASH_IPPORT=y
CONFIG_IP_SET_HASH_IPPORTIP=y
CONFIG_IP_SET_HASH_IPPORTNET=y
CONFIG_IP_SET_HASH_IPMAC=y
CONFIG_IP_SET_HASH_MAC=y
CONFIG_IP_SET_HASH_NETPORTNET=y
CONFIG_IP_SET_HASH_NET=y
CONFIG_IP_SET_HASH_NETNET=y
CONFIG_IP_SET_HASH_NETPORT=y
CONFIG_IP_SET_HASH_NETIFACE=y
CONFIG_IP_SET_LIST_SET=y
CONFIG_IP_VS=y
CONFIG_IP_VS_IPV6=y
CONFIG_IP_VS_DEBUG=y
CONFIG_IP_VS_TAB_BITS=12

#
# IPVS transport protocol load balancing support
#
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_AH_ESP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_PROTO_SCTP=y

#
# IPVS scheduler
#
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_FO=y
CONFIG_IP_VS_OVF=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_MH=y
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y
CONFIG_IP_VS_TWOS=y

#
# IPVS SH scheduler
#
CONFIG_IP_VS_SH_TAB_BITS=8

#
# IPVS MH scheduler
#
CONFIG_IP_VS_MH_TAB_INDEX=12

#
# IPVS application helper
#
CONFIG_IP_VS_FTP=y
CONFIG_IP_VS_NFCT=y
CONFIG_IP_VS_PE_SIP=y

#
# IP: Netfilter Configuration
#
CONFIG_NF_DEFRAG_IPV4=y
CONFIG_NF_SOCKET_IPV4=y
CONFIG_NF_TPROXY_IPV4=y
CONFIG_NF_TABLES_IPV4=y
CONFIG_NFT_REJECT_IPV4=y
CONFIG_NFT_DUP_IPV4=y
CONFIG_NFT_FIB_IPV4=y
CONFIG_NF_TABLES_ARP=y
CONFIG_NF_DUP_IPV4=y
CONFIG_NF_LOG_ARP=y
CONFIG_NF_LOG_IPV4=y
CONFIG_NF_REJECT_IPV4=y
CONFIG_NF_NAT_SNMP_BASIC=y
CONFIG_NF_NAT_PPTP=y
CONFIG_NF_NAT_H323=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_MATCH_AH=y
CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_RPFILTER=y
CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_SYNPROXY=y
CONFIG_IP_NF_NAT=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_NETMAP=y
CONFIG_IP_NF_TARGET_REDIRECT=y
CONFIG_IP_NF_MANGLE=y
CONFIG_IP_NF_TARGET_CLUSTERIP=y
CONFIG_IP_NF_TARGET_ECN=y
CONFIG_IP_NF_TARGET_TTL=y
CONFIG_IP_NF_RAW=y
CONFIG_IP_NF_SECURITY=y
CONFIG_IP_NF_ARPTABLES=y
CONFIG_IP_NF_ARPFILTER=y
CONFIG_IP_NF_ARP_MANGLE=y

# end of IP: Netfilter Configuration

#
# IPv6: Netfilter Configuration
#
CONFIG_NF_SOCKET_IPV6=y
CONFIG_NF_TPROXY_IPV6=y
CONFIG_NF_TABLES_IPV6=y
CONFIG_NFT_REJECT_IPV6=y
CONFIG_NFT_DUP_IPV6=y
CONFIG_NFT_FIB_IPV6=y
CONFIG_NF_DUP_IPV6=y
CONFIG_NF_REJECT_IPV6=y
CONFIG_NF_LOG_IPV6=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_MATCH_AH=y
CONFIG_IP6_NF_MATCH_EUI64=y
CONFIG_IP6_NF_MATCH_FRAG=y
CONFIG_IP6_NF_MATCH_OPTS=y
CONFIG_IP6_NF_MATCH_HL=y
CONFIG_IP6_NF_MATCH_IPV6HEADER=y
CONFIG_IP6_NF_MATCH_MH=y
CONFIG_IP6_NF_MATCH_RPFILTER=y
CONFIG_IP6_NF_MATCH_RT=y
CONFIG_IP6_NF_MATCH_SRH=y
CONFIG_IP6_NF_TARGET_HL=y
CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_TARGET_SYNPROXY=y
CONFIG_IP6_NF_MANGLE=y
CONFIG_IP6_NF_RAW=y
CONFIG_IP6_NF_SECURITY=y
CONFIG_IP6_NF_NAT=y
CONFIG_IP6_NF_TARGET_MASQUERADE=y
CONFIG_IP6_NF_TARGET_NPT=y

# end of IPv6: Netfilter Configuration

CONFIG_NF_DEFRAG_IPV6=y
CONFIG_NF_TABLES_BRIDGE=y
CONFIG_NFT_BRIDGE_META=y
CONFIG_NFT_BRIDGE_REJECT=y
CONFIG_NF_CONNTRACK_BRIDGE=y
CONFIG_BRIDGE_NF_EBTABLES=y
CONFIG_BRIDGE_EBT_BROUTE=y
CONFIG_BRIDGE_EBT_T_FILTER=y
CONFIG_BRIDGE_EBT_T_NAT=y
CONFIG_BRIDGE_EBT_802_3=y
CONFIG_BRIDGE_EBT_AMONG=y
CONFIG_BRIDGE_EBT_ARP=y
CONFIG_BRIDGE_EBT_IP=y
CONFIG_BRIDGE_EBT_IP6=y
CONFIG_BRIDGE_EBT_LIMIT=y
CONFIG_BRIDGE_EBT_MARK=y
CONFIG_BRIDGE_EBT_PKTTYPE=y
CONFIG_BRIDGE_EBT_STP=y
CONFIG_BRIDGE_EBT_VLAN=y
CONFIG_BRIDGE_EBT_ARPREPLY=y
CONFIG_BRIDGE_EBT_DNAT=y
CONFIG_BRIDGE_EBT_MARK_T=y
CONFIG_BRIDGE_EBT_REDIRECT=y
CONFIG_BRIDGE_EBT_SNAT=y
CONFIG_BRIDGE_EBT_LOG=y
CONFIG_BRIDGE_EBT_NFLOG=y
CONFIG_BPFILTER=y
CONFIG_IP_DCCP=y
CONFIG_INET_DCCP_DIAG=y

#
# DCCP CCIDs Configuration
#
CONFIG_IP_DCCP_CCID2_DEBUG=y
CONFIG_IP_DCCP_CCID3=y
CONFIG_IP_DCCP_CCID3_DEBUG=y
CONFIG_IP_DCCP_TFRC_LIB=y
CONFIG_IP_DCCP_TFRC_DEBUG=y

# end of DCCP CCIDs Configuration

#
# DCCP Kernel Hacking
#
CONFIG_IP_DCCP_DEBUG=y

# end of DCCP Kernel Hacking

CONFIG_IP_SCTP=y
CONFIG_SCTP_DBG_OBJCNT=y
CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y
# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set
# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set
CONFIG_SCTP_COOKIE_HMAC_MD5=y
CONFIG_SCTP_COOKIE_HMAC_SHA1=y
CONFIG_INET_SCTP_DIAG=y
CONFIG_RDS=y
CONFIG_RDS_TCP=y
CONFIG_RDS_DEBUG=y
CONFIG_TIPC=y
CONFIG_TIPC_MEDIA_UDP=y
CONFIG_TIPC_CRYPTO=y
CONFIG_TIPC_DIAG=y
CONFIG_ATM=y
CONFIG_ATM_CLIP=y
CONFIG_ATM_CLIP_NO_ICMP=y
CONFIG_ATM_LANE=y
CONFIG_ATM_MPOA=y
CONFIG_ATM_BR2684=y
CONFIG_ATM_BR2684_IPFILTER=y
CONFIG_L2TP=y
CONFIG_L2TP_DEBUGFS=y
CONFIG_L2TP_V3=y
CONFIG_L2TP_IP=y
CONFIG_L2TP_ETH=y
CONFIG_STP=y
CONFIG_GARP=y
CONFIG_MRP=y
CONFIG_BRIDGE=y
CONFIG_BRIDGE_IGMP_SNOOPING=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_BRIDGE_MRP=y
CONFIG_BRIDGE_CFM=y
CONFIG_NET_DSA=y
CONFIG_NET_DSA_TAG_NONE=y
CONFIG_NET_DSA_TAG_AR9331=y
CONFIG_NET_DSA_TAG_BRCM_COMMON=y
CONFIG_NET_DSA_TAG_BRCM=y
CONFIG_NET_DSA_TAG_BRCM_LEGACY=y
CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
CONFIG_NET_DSA_TAG_HELLCREEK=y
CONFIG_NET_DSA_TAG_GSWIP=y
CONFIG_NET_DSA_TAG_DSA_COMMON=y
CONFIG_NET_DSA_TAG_DSA=y
CONFIG_NET_DSA_TAG_EDSA=y
CONFIG_NET_DSA_TAG_MTK=y
CONFIG_NET_DSA_TAG_KSZ=y
CONFIG_NET_DSA_TAG_OCELOT=y
CONFIG_NET_DSA_TAG_OCELOT_8021Q=y
CONFIG_NET_DSA_TAG_QCA=y
CONFIG_NET_DSA_TAG_RTL4_A=y
CONFIG_NET_DSA_TAG_RTL8_4=y
CONFIG_NET_DSA_TAG_RZN1_A5PSW=y
CONFIG_NET_DSA_TAG_LAN9303=y
CONFIG_NET_DSA_TAG_SJA1105=y
CONFIG_NET_DSA_TAG_TRAILER=y
CONFIG_NET_DSA_TAG_XRS700X=y
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_LLC=y
CONFIG_LLC2=y
CONFIG_ATALK=y
CONFIG_DEV_APPLETALK=y
CONFIG_COPS=y
CONFIG_COPS_DAYNA=y
CONFIG_COPS_TANGENT=y
CONFIG_IPDDP=y
CONFIG_IPDDP_ENCAP=y
CONFIG_X25=y
CONFIG_LAPB=y
CONFIG_PHONET=y
CONFIG_6LOWPAN=y
CONFIG_6LOWPAN_DEBUGFS=y
CONFIG_6LOWPAN_NHC=y
CONFIG_6LOWPAN_NHC_DEST=y
CONFIG_6LOWPAN_NHC_FRAGMENT=y
CONFIG_6LOWPAN_NHC_HOP=y
CONFIG_6LOWPAN_NHC_IPV6=y
CONFIG_6LOWPAN_NHC_MOBILITY=y
CONFIG_6LOWPAN_NHC_ROUTING=y
CONFIG_6LOWPAN_NHC_UDP=y
CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=y
CONFIG_6LOWPAN_GHC_UDP=y
CONFIG_6LOWPAN_GHC_ICMPV6=y
CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=y
CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=y
CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=y
CONFIG_IEEE802154=y
CONFIG_IEEE802154_NL802154_EXPERIMENTAL=y
CONFIG_IEEE802154_SOCKET=y
CONFIG_IEEE802154_6LOWPAN=y
CONFIG_MAC802154=y
CONFIG_NET_SCHED=y

#
# Queueing/Scheduling
#
CONFIG_NET_SCH_CBQ=y
CONFIG_NET_SCH_HTB=y
CONFIG_NET_SCH_HFSC=y
CONFIG_NET_SCH_ATM=y
CONFIG_NET_SCH_PRIO=y
CONFIG_NET_SCH_MULTIQ=y
CONFIG_NET_SCH_RED=y
CONFIG_NET_SCH_SFB=y
CONFIG_NET_SCH_SFQ=y
CONFIG_NET_SCH_TEQL=y
CONFIG_NET_SCH_TBF=y
CONFIG_NET_SCH_CBS=y
CONFIG_NET_SCH_ETF=y
CONFIG_NET_SCH_TAPRIO=y
CONFIG_NET_SCH_GRED=y
CONFIG_NET_SCH_DSMARK=y
CONFIG_NET_SCH_NETEM=y
CONFIG_NET_SCH_DRR=y
CONFIG_NET_SCH_MQPRIO=y
CONFIG_NET_SCH_SKBPRIO=y
CONFIG_NET_SCH_CHOKE=y
CONFIG_NET_SCH_QFQ=y
CONFIG_NET_SCH_CODEL=y
CONFIG_NET_SCH_FQ_CODEL=y
CONFIG_NET_SCH_CAKE=y
CONFIG_NET_SCH_FQ=y
CONFIG_NET_SCH_HHF=y
CONFIG_NET_SCH_PIE=y
CONFIG_NET_SCH_FQ_PIE=y
CONFIG_NET_SCH_INGRESS=y
CONFIG_NET_SCH_PLUG=y
CONFIG_NET_SCH_ETS=y
CONFIG_NET_SCH_DEFAULT=y
# CONFIG_DEFAULT_FQ is not set
# CONFIG_DEFAULT_CODEL is not set
# CONFIG_DEFAULT_FQ_CODEL is not set
# CONFIG_DEFAULT_FQ_PIE is not set
# CONFIG_DEFAULT_SFQ is not set
CONFIG_DEFAULT_PFIFO_FAST=y
CONFIG_DEFAULT_NET_SCH="pfifo_fast"

#
# Classification
#
CONFIG_NET_CLS=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_TCINDEX=y
CONFIG_NET_CLS_ROUTE4=y
CONFIG_NET_CLS_FW=y
CONFIG_NET_CLS_U32=y
CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_RSVP=y
CONFIG_NET_CLS_RSVP6=y
CONFIG_NET_CLS_FLOW=y
CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NET_CLS_MATCHALL=y
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
CONFIG_NET_EMATCH_CMP=y
CONFIG_NET_EMATCH_NBYTE=y
CONFIG_NET_EMATCH_U32=y
CONFIG_NET_EMATCH_META=y
CONFIG_NET_EMATCH_TEXT=y
CONFIG_NET_EMATCH_CANID=y
CONFIG_NET_EMATCH_IPSET=y
CONFIG_NET_EMATCH_IPT=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=y
CONFIG_NET_ACT_GACT=y
CONFIG_GACT_PROB=y
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_SAMPLE=y
CONFIG_NET_ACT_IPT=y
CONFIG_NET_ACT_NAT=y
CONFIG_NET_ACT_PEDIT=y
CONFIG_NET_ACT_SIMP=y
CONFIG_NET_ACT_SKBEDIT=y
CONFIG_NET_ACT_CSUM=y
CONFIG_NET_ACT_MPLS=y
CONFIG_NET_ACT_VLAN=y
CONFIG_NET_ACT_BPF=y
CONFIG_NET_ACT_CONNMARK=y
CONFIG_NET_ACT_CTINFO=y
CONFIG_NET_ACT_SKBMOD=y
CONFIG_NET_ACT_IFE=y
CONFIG_NET_ACT_TUNNEL_KEY=y
CONFIG_NET_ACT_CT=y
CONFIG_NET_ACT_GATE=y
CONFIG_NET_IFE_SKBMARK=y
CONFIG_NET_IFE_SKBPRIO=y
CONFIG_NET_IFE_SKBTCINDEX=y
CONFIG_NET_TC_SKB_EXT=y
CONFIG_NET_SCH_FIFO=y
CONFIG_DCB=y
CONFIG_DNS_RESOLVER=y
CONFIG_BATMAN_ADV=y
CONFIG_BATMAN_ADV_BATMAN_V=y
CONFIG_BATMAN_ADV_BLA=y
CONFIG_BATMAN_ADV_DAT=y
CONFIG_BATMAN_ADV_NC=y
CONFIG_BATMAN_ADV_MCAST=y
CONFIG_BATMAN_ADV_DEBUG=y
CONFIG_OPENVSWITCH=y
CONFIG_OPENVSWITCH_GRE=y
CONFIG_OPENVSWITCH_VXLAN=y
CONFIG_OPENVSWITCH_GENEVE=y
CONFIG_VSOCKETS=y
CONFIG_VSOCKETS_DIAG=y
CONFIG_VSOCKETS_LOOPBACK=y
CONFIG_VIRTIO_VSOCKETS=y
CONFIG_VIRTIO_VSOCKETS_COMMON=y
CONFIG_NETLINK_DIAG=y
CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
CONFIG_MPLS_ROUTING=y
CONFIG_MPLS_IPTUNNEL=y
CONFIG_NET_NSH=y
CONFIG_HSR=y
CONFIG_NET_SWITCHDEV=y
CONFIG_NET_L3_MASTER_DEV=y
CONFIG_QRTR=y
CONFIG_QRTR_SMD=y
CONFIG_QRTR_TUN=y
CONFIG_QRTR_MHI=y
CONFIG_NET_NCSI=y
CONFIG_NCSI_OEM_CMD_GET_MAC=y
CONFIG_NCSI_OEM_CMD_KEEP_PHY=y
CONFIG_PCPU_DEV_REFCNT=y
CONFIG_RPS=y
CONFIG_RFS_ACCEL=y
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_XPS=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_CGROUP_NET_CLASSID=y
CONFIG_NET_RX_BUSY_POLL=y
CONFIG_BQL=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_NET_FLOW_LIMIT=y

#
# Network testing
#
CONFIG_NET_PKTGEN=y

# end of Network testing
# end of Networking options

CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
CONFIG_AX25=y
CONFIG_AX25_DAMA_SLAVE=y
CONFIG_NETROM=y
CONFIG_ROSE=y

#
# AX.25 network device drivers
#
CONFIG_MKISS=y
CONFIG_6PACK=y
CONFIG_BPQETHER=y
CONFIG_SCC=y
CONFIG_SCC_DELAY=y
CONFIG_SCC_TRXECHO=y
CONFIG_BAYCOM_SER_FDX=y
CONFIG_BAYCOM_SER_HDX=y
CONFIG_BAYCOM_PAR=y
CONFIG_YAM=y

# end of AX.25 network device drivers

CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
CONFIG_CAN_J1939=y
CONFIG_CAN_ISOTP=y
CONFIG_BT=y
CONFIG_BT_BREDR=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_CMTP=y
CONFIG_BT_HIDP=y
CONFIG_BT_HS=y
CONFIG_BT_LE=y
CONFIG_BT_LE_L2CAP_ECRED=y
CONFIG_BT_6LOWPAN=y
CONFIG_BT_LEDS=y
CONFIG_BT_MSFTEXT=y
CONFIG_BT_AOSPEXT=y
CONFIG_BT_DEBUGFS=y
CONFIG_BT_SELFTEST=y
CONFIG_BT_SELFTEST_ECDH=y
CONFIG_BT_SELFTEST_SMP=y

#
# Bluetooth device drivers
#
CONFIG_BT_INTEL=y
CONFIG_BT_BCM=y
CONFIG_BT_RTL=y
CONFIG_BT_QCA=y
CONFIG_BT_MTK=y
CONFIG_BT_HCIBTUSB=y
CONFIG_BT_HCIBTUSB_AUTOSUSPEND=y
CONFIG_BT_HCIBTUSB_POLL_SYNC=y
CONFIG_BT_HCIBTUSB_BCM=y
CONFIG_BT_HCIBTUSB_MTK=y
CONFIG_BT_HCIBTUSB_RTL=y
CONFIG_BT_HCIBTSDIO=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIUART_ATH3K=y
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_3WIRE=y
CONFIG_BT_HCIUART_INTEL=y
CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIUART_RTL=y
CONFIG_BT_HCIUART_QCA=y
CONFIG_BT_HCIUART_AG6XX=y
CONFIG_BT_HCIUART_MRVL=y
CONFIG_BT_HCIBCM203X=y
CONFIG_BT_HCIBCM4377=y
CONFIG_BT_HCIBPA10X=y
CONFIG_BT_HCIBFUSB=y
CONFIG_BT_HCIDTL1=y
CONFIG_BT_HCIBT3C=y
CONFIG_BT_HCIBLUECARD=y
CONFIG_BT_HCIVHCI=y
CONFIG_BT_MRVL=y
CONFIG_BT_MRVL_SDIO=y
CONFIG_BT_ATH3K=y
CONFIG_BT_MTKSDIO=y
CONFIG_BT_MTKUART=y
CONFIG_BT_QCOMSMD=y
CONFIG_BT_HCIRSI=y
CONFIG_BT_VIRTIO=y

# end of Bluetooth device drivers

CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_IPV6=y
CONFIG_AF_RXRPC_INJECT_LOSS=y
CONFIG_AF_RXRPC_DEBUG=y
CONFIG_RXKAD=y
CONFIG_RXPERF=y
CONFIG_AF_KCM=y
CONFIG_STREAM_PARSER=y
CONFIG_MCTP=y
CONFIG_MCTP_TEST=y
CONFIG_MCTP_FLOWS=y
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211=y
CONFIG_NL80211_TESTMODE=y
CONFIG_CFG80211_DEVELOPER_WARNINGS=y
CONFIG_CFG80211_CERTIFICATION_ONUS=y
CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y
CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y
CONFIG_CFG80211_EXTRA_REGDB_KEYDIR=""
CONFIG_CFG80211_REG_CELLULAR_HINTS=y
CONFIG_CFG80211_REG_RELAX_NO_IR=y
CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_CFG80211_DEBUGFS=y
CONFIG_CFG80211_CRDA_SUPPORT=y
CONFIG_CFG80211_WEXT=y
CONFIG_CFG80211_WEXT_EXPORT=y
CONFIG_LIB80211=y
CONFIG_LIB80211_CRYPT_WEP=y
CONFIG_LIB80211_CRYPT_CCMP=y
CONFIG_LIB80211_CRYPT_TKIP=y
CONFIG_LIB80211_DEBUG=y
CONFIG_MAC80211=y
CONFIG_MAC80211_HAS_RC=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
CONFIG_MAC80211_MESH=y
CONFIG_MAC80211_LEDS=y
CONFIG_MAC80211_DEBUGFS=y
CONFIG_MAC80211_MESSAGE_TRACING=y
CONFIG_MAC80211_DEBUG_MENU=y
CONFIG_MAC80211_NOINLINE=y
CONFIG_MAC80211_VERBOSE_DEBUG=y
CONFIG_MAC80211_MLME_DEBUG=y
CONFIG_MAC80211_STA_DEBUG=y
CONFIG_MAC80211_HT_DEBUG=y
CONFIG_MAC80211_OCB_DEBUG=y
CONFIG_MAC80211_IBSS_DEBUG=y
CONFIG_MAC80211_PS_DEBUG=y
CONFIG_MAC80211_MPL_DEBUG=y
CONFIG_MAC80211_MPATH_DEBUG=y
CONFIG_MAC80211_MHWMP_DEBUG=y
CONFIG_MAC80211_MESH_SYNC_DEBUG=y
CONFIG_MAC80211_MESH_CSA_DEBUG=y
CONFIG_MAC80211_MESH_PS_DEBUG=y
CONFIG_MAC80211_TDLS_DEBUG=y
CONFIG_MAC80211_DEBUG_COUNTERS=y
CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
CONFIG_RFKILL=y
CONFIG_RFKILL_LEDS=y
CONFIG_RFKILL_INPUT=y
CONFIG_RFKILL_GPIO=y
CONFIG_NET_9P=y
CONFIG_NET_9P_FD=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_9P_DEBUG=y
CONFIG_CAIF=y
CONFIG_CAIF_DEBUG=y
CONFIG_CAIF_NETDEV=y
CONFIG_CAIF_USB=y
CONFIG_CEPH_LIB=y
CONFIG_CEPH_LIB_PRETTYDEBUG=y
CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y
CONFIG_NFC=y
CONFIG_NFC_DIGITAL=y
CONFIG_NFC_NCI=y
CONFIG_NFC_NCI_SPI=y
CONFIG_NFC_NCI_UART=y
CONFIG_NFC_HCI=y
CONFIG_NFC_SHDLC=y

#
# Near Field Communication (NFC) devices
#
CONFIG_NFC_TRF7970A=y
CONFIG_NFC_SIM=y
CONFIG_NFC_PORT100=y
CONFIG_NFC_VIRTUAL_NCI=y
CONFIG_NFC_FDP=y
CONFIG_NFC_FDP_I2C=y
CONFIG_NFC_PN544=y
CONFIG_NFC_PN544_I2C=y
CONFIG_NFC_PN533=y
CONFIG_NFC_PN533_USB=y
CONFIG_NFC_PN533_I2C=y
CONFIG_NFC_PN532_UART=y
CONFIG_NFC_MICROREAD=y
CONFIG_NFC_MICROREAD_I2C=y
CONFIG_NFC_MRVL=y
CONFIG_NFC_MRVL_USB=y
CONFIG_NFC_MRVL_UART=y
CONFIG_NFC_MRVL_I2C=y
CONFIG_NFC_MRVL_SPI=y
CONFIG_NFC_ST21NFCA=y
CONFIG_NFC_ST21NFCA_I2C=y
CONFIG_NFC_ST_NCI=y
CONFIG_NFC_ST_NCI_I2C=y
CONFIG_NFC_ST_NCI_SPI=y
CONFIG_NFC_NXP_NCI=y
CONFIG_NFC_NXP_NCI_I2C=y
CONFIG_NFC_S3FWRN5=y
CONFIG_NFC_S3FWRN5_I2C=y
CONFIG_NFC_S3FWRN82_UART=y
CONFIG_NFC_ST95HF=y

# end of Near Field Communication (NFC) devices

CONFIG_PSAMPLE=y
CONFIG_NET_IFE=y
CONFIG_LWTUNNEL=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_DST_CACHE=y
CONFIG_GRO_CELLS=y
CONFIG_SOCK_VALIDATE_XMIT=y
CONFIG_NET_SELFTESTS=y
CONFIG_NET_SOCK_MSG=y
CONFIG_NET_DEVLINK=y
CONFIG_PAGE_POOL=y
CONFIG_PAGE_POOL_STATS=y
CONFIG_FAILOVER=y
CONFIG_ETHTOOL_NETLINK=y
CONFIG_NETDEV_ADDR_LIST_TEST=y

#
# Device Drivers
#
CONFIG_HAVE_EISA=y
CONFIG_EISA=y
CONFIG_EISA_PCI_EISA=y
CONFIG_EISA_VIRTUAL_ROOT=y
CONFIG_EISA_NAMES=y
CONFIG_HAVE_PCI=y
CONFIG_FORCE_PCI=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_SYSCALL=y
CONFIG_PCIEPORTBUS=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_PCIEAER=y
CONFIG_PCIEAER_INJECT=y
CONFIG_PCIE_ECRC=y
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_PCIE_DPC=y
CONFIG_PCIE_PTM=y
CONFIG_PCI_MSI=y
CONFIG_PCI_QUIRKS=y
CONFIG_PCI_DEBUG=y
CONFIG_PCI_REALLOC_ENABLE_AUTO=y
CONFIG_PCI_STUB=y
CONFIG_PCI_PF_STUB=y
CONFIG_PCI_ATS=y
CONFIG_PCI_DOE=y
CONFIG_PCI_ECAM=y
CONFIG_PCI_BRIDGE_EMUL=y
CONFIG_PCI_IOV=y
CONFIG_PCI_PRI=y
CONFIG_PCI_PASID=y
# CONFIG_PCIE_BUS_TUNE_OFF is not set
CONFIG_PCIE_BUS_DEFAULT=y
# CONFIG_PCIE_BUS_SAFE is not set
# CONFIG_PCIE_BUS_PERFORMANCE is not set
# CONFIG_PCIE_BUS_PEER2PEER is not set
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_SHPC=y

#
# PCI controller drivers
#
CONFIG_PCI_AARDVARK=y
CONFIG_PCIE_XILINX_NWL=y
CONFIG_PCI_FTPCI100=y
CONFIG_PCI_TEGRA=y
CONFIG_PCIE_RCAR_HOST=y
CONFIG_PCIE_RCAR_EP=y
CONFIG_PCI_HOST_COMMON=y
CONFIG_PCI_HOST_GENERIC=y
CONFIG_PCIE_XILINX=y
CONFIG_PCIE_XILINX_CPM=y
CONFIG_PCI_XGENE=y
CONFIG_PCI_XGENE_MSI=y
CONFIG_PCI_V3_SEMI=y
CONFIG_PCI_VERSATILE=y
CONFIG_PCIE_ALTERA=y
CONFIG_PCIE_ALTERA_MSI=y
CONFIG_PCI_HOST_THUNDER_PEM=y
CONFIG_PCI_HOST_THUNDER_ECAM=y
CONFIG_PCIE_ROCKCHIP=y
CONFIG_PCIE_ROCKCHIP_HOST=y
CONFIG_PCIE_ROCKCHIP_EP=y
CONFIG_PCIE_MEDIATEK=y
CONFIG_PCIE_MEDIATEK_GEN3=y
CONFIG_PCIE_BRCMSTB=y
CONFIG_PCI_LOONGSON=y
CONFIG_PCIE_MICROCHIP_HOST=y
CONFIG_PCIE_APPLE_MSI_DOORBELL_ADDR=0xfffff000
CONFIG_PCIE_APPLE=y
CONFIG_PCIE_MT7621=y

#
# DesignWare PCI Core Support
#
CONFIG_PCIE_DW=y
CONFIG_PCIE_DW_HOST=y
CONFIG_PCIE_DW_EP=y
CONFIG_PCI_DRA7XX=y
CONFIG_PCI_DRA7XX_HOST=y
CONFIG_PCI_DRA7XX_EP=y
CONFIG_PCIE_DW_PLAT=y
CONFIG_PCIE_DW_PLAT_HOST=y
CONFIG_PCIE_DW_PLAT_EP=y
CONFIG_PCI_EXYNOS=y
CONFIG_PCI_IMX6=y
CONFIG_PCIE_SPEAR13XX=y
CONFIG_PCI_KEYSTONE=y
CONFIG_PCI_KEYSTONE_HOST=y
CONFIG_PCI_KEYSTONE_EP=y
CONFIG_PCI_LAYERSCAPE=y
CONFIG_PCI_LAYERSCAPE_EP=y
CONFIG_PCI_HISI=y
CONFIG_PCIE_QCOM=y
CONFIG_PCIE_QCOM_EP=y
CONFIG_PCIE_ARMADA_8K=y
CONFIG_PCIE_ARTPEC6=y
CONFIG_PCIE_ARTPEC6_HOST=y
CONFIG_PCIE_ARTPEC6_EP=y
CONFIG_PCIE_ROCKCHIP_DW_HOST=y
CONFIG_PCIE_INTEL_GW=y
CONFIG_PCIE_KEEMBAY=y
CONFIG_PCIE_KEEMBAY_HOST=y
CONFIG_PCIE_KEEMBAY_EP=y
CONFIG_PCIE_KIRIN=y
CONFIG_PCIE_HISI_STB=y
CONFIG_PCI_MESON=y
CONFIG_PCIE_TEGRA194=y
CONFIG_PCIE_TEGRA194_HOST=y
CONFIG_PCIE_TEGRA194_EP=y
CONFIG_PCIE_VISCONTI_HOST=y
CONFIG_PCIE_UNIPHIER=y
CONFIG_PCIE_UNIPHIER_EP=y
CONFIG_PCIE_AL=y
CONFIG_PCIE_FU740=y

# end of DesignWare PCI Core Support

#
# Mobiveil PCIe Core Support
#
CONFIG_PCIE_MOBIVEIL=y
CONFIG_PCIE_MOBIVEIL_HOST=y
CONFIG_PCIE_MOBIVEIL_PLAT=y
CONFIG_PCIE_LAYERSCAPE_GEN4=y

# end of Mobiveil PCIe Core Support

#
# Cadence PCIe controllers support
#
CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=y
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
CONFIG_PCIE_CADENCE_PLAT_HOST=y
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCI_J721E=y
CONFIG_PCI_J721E_HOST=y
CONFIG_PCI_J721E_EP=y

# end of Cadence PCIe controllers support
# end of PCI controller drivers

#
# PCI Endpoint
#
CONFIG_PCI_ENDPOINT=y
CONFIG_PCI_ENDPOINT_CONFIGFS=y
CONFIG_PCI_EPF_TEST=y
CONFIG_PCI_EPF_NTB=y
CONFIG_PCI_EPF_VNTB=y

# end of PCI Endpoint

#
# PCI switch controller drivers
#
CONFIG_PCI_SW_SWITCHTEC=y

# end of PCI switch controller drivers

CONFIG_CXL_BUS=y
CONFIG_CXL_PCI=y
CONFIG_CXL_MEM_RAW_COMMANDS=y
CONFIG_CXL_PMEM=y
CONFIG_CXL_MEM=y
CONFIG_CXL_PORT=y
CONFIG_CXL_REGION=y
CONFIG_CXL_REGION_INVALIDATION_TEST=y
CONFIG_PCCARD=y
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
CONFIG_PD6729=y
CONFIG_I82092=y
CONFIG_I82365=y
CONFIG_TCIC=y
CONFIG_PCMCIA_PROBE=y
CONFIG_PCCARD_NONSTATIC=y
CONFIG_RAPIDIO=y
CONFIG_RAPIDIO_TSI721=y
CONFIG_RAPIDIO_DISC_TIMEOUT=30
CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS=y
CONFIG_RAPIDIO_DMA_ENGINE=y
CONFIG_RAPIDIO_DEBUG=y
CONFIG_RAPIDIO_ENUM_BASIC=y
CONFIG_RAPIDIO_CHMAN=y
CONFIG_RAPIDIO_MPORT_CDEV=y

#
# RapidIO Switch drivers
#
CONFIG_RAPIDIO_CPS_XX=y
CONFIG_RAPIDIO_CPS_GEN2=y
CONFIG_RAPIDIO_RXS_GEN3=y

# end of RapidIO Switch drivers

#
# Generic Driver Options
#
CONFIG_AUXILIARY_BUS=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_DEVTMPFS_SAFE=y
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y

#
# Firmware loader
#
CONFIG_FW_LOADER=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_FW_LOADER_SYSFS=y
CONFIG_EXTRA_FIRMWARE=""
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
CONFIG_FW_LOADER_COMPRESS=y
CONFIG_FW_LOADER_COMPRESS_XZ=y
CONFIG_FW_LOADER_COMPRESS_ZSTD=y
CONFIG_FW_UPLOAD=y

# end of Firmware loader

CONFIG_WANT_DEV_COREDUMP=y
CONFIG_ALLOW_DEV_COREDUMP=y
CONFIG_DEV_COREDUMP=y
CONFIG_DEBUG_DRIVER=y
CONFIG_DEBUG_DEVRES=y
CONFIG_DEBUG_TEST_DRIVER_REMOVE=y
CONFIG_PM_QOS_KUNIT_TEST=y
CONFIG_TEST_ASYNC_DRIVER_PROBE=m
CONFIG_DRIVER_PE_KUNIT_TEST=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_SOC_BUS=y
CONFIG_REGMAP=y
CONFIG_REGMAP_AC97=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SLIMBUS=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_SPMI=y
CONFIG_REGMAP_W1=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGMAP_IRQ=y
CONFIG_REGMAP_SOUNDWIRE=y
CONFIG_REGMAP_SOUNDWIRE_MBQ=y
CONFIG_REGMAP_SCCB=y
CONFIG_REGMAP_I3C=y
CONFIG_REGMAP_SPI_AVMM=y
CONFIG_DMA_SHARED_BUFFER=y
CONFIG_DMA_FENCE_TRACE=y

# end of Generic Driver Options

#
# Bus devices
#
CONFIG_ARM_INTEGRATOR_LM=y
CONFIG_BT1_APB=y
CONFIG_BT1_AXI=y
CONFIG_MOXTET=y
CONFIG_INTEL_IXP4XX_EB=y
CONFIG_QCOM_EBI2=y
CONFIG_MHI_BUS=y
CONFIG_MHI_BUS_DEBUG=y
CONFIG_MHI_BUS_PCI_GENERIC=y
CONFIG_MHI_BUS_EP=y

# end of Bus devices

CONFIG_CONNECTOR=y
CONFIG_PROC_EVENTS=y

#
# Firmware Drivers
#

#
# ARM System Control and Management Interface Protocol #
CONFIG_ARM_SCMI_PROTOCOL=y CONFIG_ARM_SCMI_HAVE_TRANSPORT=y CONFIG_ARM_SCMI_HAVE_SHMEM=y CONFIG_ARM_SCMI_HAVE_MSG=y CONFIG_ARM_SCMI_TRANSPORT_MAILBOX=y CONFIG_ARM_SCMI_TRANSPORT_VIRTIO=y CONFIG_ARM_SCMI_TRANSPORT_VIRTIO_VERSION1_COMPLIANCE=y CONFIG_ARM_SCMI_TRANSPORT_VIRTIO_ATOMIC_ENABLE=y CONFIG_ARM_SCMI_POWER_DOMAIN=y CONFIG_ARM_SCMI_POWER_CONTROL=y

# end of ARM System Control and Management Interface Protocol

CONFIG_ARM_SCPI_PROTOCOL=y
CONFIG_ARM_SCPI_POWER_DOMAIN=y
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_MTK_ADSP_IPC=y
CONFIG_QCOM_SCM=y
CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT=y
CONFIG_TURRIS_MOX_RWTM=y
CONFIG_BCM47XX_NVRAM=y
CONFIG_BCM47XX_SPROM=y
CONFIG_TEE_BNXT_FW=y
CONFIG_FW_CS_DSP=y
CONFIG_GOOGLE_FIRMWARE=y
CONFIG_GOOGLE_CBMEM=y
CONFIG_GOOGLE_COREBOOT_TABLE=y
CONFIG_GOOGLE_MEMCONSOLE=y
CONFIG_GOOGLE_MEMCONSOLE_COREBOOT=y
CONFIG_GOOGLE_VPD=y
CONFIG_IMX_DSP=y
CONFIG_IMX_SCU=y
CONFIG_IMX_SCU_PD=y

#
# Tegra firmware driver
#

# end of Tegra firmware driver
# end of Firmware Drivers

CONFIG_GNSS=y
CONFIG_GNSS_SERIAL=y
CONFIG_GNSS_MTK_SERIAL=y
CONFIG_GNSS_SIRF_SERIAL=y
CONFIG_GNSS_UBX_SERIAL=y
CONFIG_GNSS_USB=y
CONFIG_MTD=y
CONFIG_MTD_TESTS=m

#
# Partition parsers
#
CONFIG_MTD_AR7_PARTS=y
CONFIG_MTD_BCM63XX_PARTS=y
CONFIG_MTD_BRCM_U_BOOT=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_OF_PARTS=y
CONFIG_MTD_OF_PARTS_BCM4908=y
CONFIG_MTD_OF_PARTS_LINKSYS_NS=y
CONFIG_MTD_PARSER_IMAGETAG=y
CONFIG_MTD_PARSER_TPLINK_SAFELOADER=y
CONFIG_MTD_PARSER_TRX=y
CONFIG_MTD_SHARPSL_PARTS=y
CONFIG_MTD_REDBOOT_PARTS=y
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
CONFIG_MTD_REDBOOT_PARTS_READONLY=y
CONFIG_MTD_QCOMSMEM_PARTS=y

# end of Partition parsers

#
# User Modules And Translation Layers
#
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y

#
# Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK. #
CONFIG_FTL=y
CONFIG_NFTL=y
CONFIG_NFTL_RW=y
CONFIG_INFTL=y
CONFIG_RFD_FTL=y
CONFIG_SSFDC=y
CONFIG_SM_FTL=y
CONFIG_MTD_OOPS=y
CONFIG_MTD_PSTORE=y
CONFIG_MTD_SWAP=y
CONFIG_MTD_PARTITIONED_MASTER=y

#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
CONFIG_MTD_CFI_GEOMETRY=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_MAP_BANK_WIDTH_8=y
CONFIG_MTD_MAP_BANK_WIDTH_16=y
CONFIG_MTD_MAP_BANK_WIDTH_32=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CFI_I4=y
CONFIG_MTD_CFI_I8=y
CONFIG_MTD_OTP=y
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_STAA=y
CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_RAM=y
CONFIG_MTD_ROM=y
CONFIG_MTD_ABSENT=y

# end of RAM/ROM/Flash chip drivers

#
# Mapping drivers for chip access
#
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_COMPAT=y
CONFIG_MTD_PHYSMAP_START=0x8000000
CONFIG_MTD_PHYSMAP_LEN=0
CONFIG_MTD_PHYSMAP_BANKWIDTH=2
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_PHYSMAP_BT1_ROM=y
CONFIG_MTD_PHYSMAP_VERSATILE=y
CONFIG_MTD_PHYSMAP_GEMINI=y
CONFIG_MTD_PHYSMAP_GPIO_ADDR=y
CONFIG_MTD_SC520CDP=y
CONFIG_MTD_NETSC520=y
CONFIG_MTD_TS5500=y
CONFIG_MTD_PCI=y
CONFIG_MTD_PCMCIA=y
CONFIG_MTD_PCMCIA_ANONYMOUS=y
CONFIG_MTD_INTEL_VR_NOR=y
CONFIG_MTD_PLATRAM=y

# end of Mapping drivers for chip access

#
# Self-contained MTD device drivers
#
CONFIG_MTD_PMC551=y
CONFIG_MTD_PMC551_BUGFIX=y
CONFIG_MTD_PMC551_DEBUG=y
CONFIG_MTD_DATAFLASH=y
CONFIG_MTD_DATAFLASH_WRITE_VERIFY=y
CONFIG_MTD_DATAFLASH_OTP=y
CONFIG_MTD_MCHP23K256=y
CONFIG_MTD_MCHP48L640=y
CONFIG_MTD_SPEAR_SMI=y
CONFIG_MTD_SST25L=y
CONFIG_MTD_SLRAM=y
CONFIG_MTD_PHRAM=y
CONFIG_MTD_MTDRAM=y
CONFIG_MTDRAM_TOTAL_SIZE=4096
CONFIG_MTDRAM_ERASE_SIZE=128
CONFIG_MTD_BLOCK2MTD=y

#
# Disk-On-Chip Device Drivers
#
CONFIG_MTD_DOCG3=y
CONFIG_BCH_CONST_M=14
CONFIG_BCH_CONST_T=4

# end of Self-contained MTD device drivers

#
# NAND
#
CONFIG_MTD_NAND_CORE=y
CONFIG_MTD_ONENAND=y
CONFIG_MTD_ONENAND_VERIFY_WRITE=y
CONFIG_MTD_ONENAND_GENERIC=y
CONFIG_MTD_ONENAND_SAMSUNG=y
CONFIG_MTD_ONENAND_OTP=y
CONFIG_MTD_ONENAND_2X_PROGRAM=y
CONFIG_MTD_RAW_NAND=y

#
# Raw/parallel NAND flash controllers
#
CONFIG_MTD_NAND_DENALI=y
CONFIG_MTD_NAND_DENALI_PCI=y
CONFIG_MTD_NAND_DENALI_DT=y
CONFIG_MTD_NAND_AMS_DELTA=y
CONFIG_MTD_NAND_OMAP2=y
CONFIG_MTD_NAND_OMAP_BCH=y
CONFIG_MTD_NAND_OMAP_BCH_BUILD=y
CONFIG_MTD_NAND_SHARPSL=y
CONFIG_MTD_NAND_CAFE=y
CONFIG_MTD_NAND_ATMEL=y
CONFIG_MTD_NAND_MARVELL=y
CONFIG_MTD_NAND_SLC_LPC32XX=y
CONFIG_MTD_NAND_MLC_LPC32XX=y
CONFIG_MTD_NAND_BRCMNAND=y
CONFIG_MTD_NAND_BRCMNAND_BCM63XX=y
CONFIG_MTD_NAND_BRCMNAND_BCMA=y
CONFIG_MTD_NAND_BRCMNAND_BCMBCA=y
CONFIG_MTD_NAND_BRCMNAND_BRCMSTB=y
CONFIG_MTD_NAND_BRCMNAND_IPROC=y
CONFIG_MTD_NAND_BCM47XXNFLASH=y
CONFIG_MTD_NAND_OXNAS=y
CONFIG_MTD_NAND_GPMI_NAND=y
CONFIG_MTD_NAND_FSL_IFC=y
CONFIG_MTD_NAND_VF610_NFC=y
CONFIG_MTD_NAND_MXC=y
CONFIG_MTD_NAND_SH_FLCTL=y
CONFIG_MTD_NAND_DAVINCI=y
CONFIG_MTD_NAND_TXX9NDFMC=y
CONFIG_MTD_NAND_JZ4780=y
CONFIG_MTD_NAND_INGENIC_ECC=y
CONFIG_MTD_NAND_JZ4740_ECC=y
CONFIG_MTD_NAND_JZ4725B_BCH=y
CONFIG_MTD_NAND_JZ4780_BCH=y
CONFIG_MTD_NAND_FSMC=y
CONFIG_MTD_NAND_SUNXI=y
CONFIG_MTD_NAND_HISI504=y
CONFIG_MTD_NAND_QCOM=y
CONFIG_MTD_NAND_MTK=y
CONFIG_MTD_NAND_MXIC=y
CONFIG_MTD_NAND_TEGRA=y
CONFIG_MTD_NAND_STM32_FMC2=y
CONFIG_MTD_NAND_MESON=y
CONFIG_MTD_NAND_GPIO=y
CONFIG_MTD_NAND_PLATFORM=y
CONFIG_MTD_NAND_CADENCE=y
CONFIG_MTD_NAND_ARASAN=y
CONFIG_MTD_NAND_INTEL_LGM=y
CONFIG_MTD_NAND_RENESAS=y

#
# Misc
#
CONFIG_MTD_SM_COMMON=y
CONFIG_MTD_NAND_NANDSIM=y
CONFIG_MTD_NAND_RICOH=y
CONFIG_MTD_NAND_DISKONCHIP=y
CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADVANCED=y
CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS=0
CONFIG_MTD_NAND_DISKONCHIP_PROBE_HIGH=y
CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE=y
CONFIG_MTD_SPI_NAND=y

#
# ECC engine support
#
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
CONFIG_MTD_NAND_ECC_SW_HAMMING_SMC=y
CONFIG_MTD_NAND_ECC_SW_BCH=y
CONFIG_MTD_NAND_ECC_MXIC=y
CONFIG_MTD_NAND_ECC_MEDIATEK=y

# end of ECC engine support
# end of NAND

#
# LPDDR & LPDDR2 PCM memory drivers
#
CONFIG_MTD_LPDDR=y
CONFIG_MTD_QINFO_PROBE=y

# end of LPDDR & LPDDR2 PCM memory drivers

CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
# CONFIG_MTD_SPI_NOR_SWP_DISABLE is not set
CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE=y
# CONFIG_MTD_SPI_NOR_SWP_KEEP is not set
CONFIG_SPI_HISI_SFC=y
CONFIG_SPI_NXP_SPIFI=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_FASTMAP=y
CONFIG_MTD_UBI_GLUEBI=y
CONFIG_MTD_UBI_BLOCK=y
CONFIG_MTD_HYPERBUS=y
CONFIG_HBMC_AM654=y
CONFIG_DTC=y
CONFIG_OF=y
CONFIG_OF_UNITTEST=y
CONFIG_OF_ALL_DTBS=y
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_KOBJ=y
CONFIG_OF_DYNAMIC=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_IRQ=y
CONFIG_OF_RESERVED_MEM=y
CONFIG_OF_RESOLVE=y
CONFIG_OF_OVERLAY=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
CONFIG_PARPORT_SERIAL=y
CONFIG_PARPORT_PC_FIFO=y
CONFIG_PARPORT_PC_SUPERIO=y
CONFIG_PARPORT_PC_PCMCIA=y
CONFIG_PARPORT_AX88796=y
CONFIG_PARPORT_1284=y
CONFIG_PARPORT_NOT_PC=y
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_ISAPNP=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_NULL_BLK=y
CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION=y
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_DEV_FD_RAWCMD=y
CONFIG_CDROM=y
CONFIG_PARIDE=y

#
# Parallel IDE high-level drivers
#
CONFIG_PARIDE_PD=y
CONFIG_PARIDE_PCD=y
CONFIG_PARIDE_PF=y
CONFIG_PARIDE_PT=y
CONFIG_PARIDE_PG=y

#
# Parallel IDE protocol modules
#
CONFIG_PARIDE_ATEN=y
CONFIG_PARIDE_BPCK=y
CONFIG_PARIDE_COMM=y
CONFIG_PARIDE_DSTR=y
CONFIG_PARIDE_FIT2=y
CONFIG_PARIDE_FIT3=y
CONFIG_PARIDE_EPAT=y
CONFIG_PARIDE_EPATC8=y
CONFIG_PARIDE_EPIA=y
CONFIG_PARIDE_FRIQ=y
CONFIG_PARIDE_FRPW=y
CONFIG_PARIDE_KBIC=y
CONFIG_PARIDE_KTTI=y
CONFIG_PARIDE_ON20=y
CONFIG_PARIDE_ON26=y
CONFIG_BLK_DEV_PCIESSD_MTIP32XX=y
CONFIG_ZRAM=y
CONFIG_ZRAM_DEF_COMP_LZORLE=y
# CONFIG_ZRAM_DEF_COMP_ZSTD is not set
# CONFIG_ZRAM_DEF_COMP_LZ4 is not set
# CONFIG_ZRAM_DEF_COMP_LZO is not set
# CONFIG_ZRAM_DEF_COMP_LZ4HC is not set
# CONFIG_ZRAM_DEF_COMP_842 is not set
CONFIG_ZRAM_DEF_COMP="lzo-rle"
CONFIG_ZRAM_WRITEBACK=y
CONFIG_ZRAM_MEMORY_TRACKING=y
CONFIG_ZRAM_MULTI_COMP=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
CONFIG_BLK_DEV_DRBD=y
CONFIG_DRBD_FAULT_INJECTION=y
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_ATA_OVER_ETH=y
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_RBD=y
CONFIG_BLK_DEV_UBLK=y

#
# NVME Support
#
CONFIG_NVME_COMMON=y
CONFIG_NVME_CORE=y
CONFIG_BLK_DEV_NVME=y
CONFIG_NVME_MULTIPATH=y
CONFIG_NVME_VERBOSE_ERRORS=y
CONFIG_NVME_HWMON=y
CONFIG_NVME_FABRICS=y
CONFIG_NVME_FC=y
CONFIG_NVME_TCP=y
CONFIG_NVME_AUTH=y
CONFIG_NVME_APPLE=y
CONFIG_NVME_TARGET=y
CONFIG_NVME_TARGET_PASSTHRU=y
CONFIG_NVME_TARGET_LOOP=y
CONFIG_NVME_TARGET_FC=y
CONFIG_NVME_TARGET_FCLOOP=y
CONFIG_NVME_TARGET_TCP=y
CONFIG_NVME_TARGET_AUTH=y

# end of NVME Support

#
# Misc devices
#
CONFIG_SENSORS_LIS3LV02D=y
CONFIG_AD525X_DPOT=y
CONFIG_AD525X_DPOT_I2C=y
CONFIG_AD525X_DPOT_SPI=y
CONFIG_DUMMY_IRQ=y
CONFIG_PHANTOM=y
CONFIG_TIFM_CORE=y
CONFIG_TIFM_7XX1=y
CONFIG_ICS932S401=y
CONFIG_ATMEL_SSC=y
CONFIG_ENCLOSURE_SERVICES=y
CONFIG_SMPRO_ERRMON=y
CONFIG_SMPRO_MISC=y
CONFIG_GEHC_ACHC=y
CONFIG_HI6421V600_IRQ=y
CONFIG_HP_ILO=y
CONFIG_QCOM_COINCELL=y
CONFIG_QCOM_FASTRPC=y
CONFIG_APDS9802ALS=y
CONFIG_ISL29003=y
CONFIG_ISL29020=y
CONFIG_SENSORS_TSL2550=y
CONFIG_SENSORS_BH1770=y
CONFIG_SENSORS_APDS990X=y
CONFIG_HMC6352=y
CONFIG_DS1682=y
CONFIG_PCH_PHUB=y
CONFIG_LATTICE_ECP3_CONFIG=y
CONFIG_SRAM=y
CONFIG_DW_XDATA_PCIE=y
CONFIG_PCI_ENDPOINT_TEST=y
CONFIG_XILINX_SDFEC=y
CONFIG_MISC_RTSX=y
CONFIG_HISI_HIKEY_USB=y
CONFIG_OPEN_DICE=y
CONFIG_VCPU_STALL_DETECTOR=y
CONFIG_C2PORT=y

#
# EEPROM support
#
CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_AT25=y
CONFIG_EEPROM_LEGACY=y
CONFIG_EEPROM_MAX6875=y
CONFIG_EEPROM_93CX6=y
CONFIG_EEPROM_93XX46=y
CONFIG_EEPROM_IDT_89HPESX=y
CONFIG_EEPROM_EE1004=y

# end of EEPROM support

CONFIG_CB710_CORE=y
CONFIG_CB710_DEBUG=y
CONFIG_CB710_DEBUG_ASSUMPTIONS=y

#
# Texas Instruments shared transport line discipline #
CONFIG_TI_ST=y

# end of Texas Instruments shared transport line discipline

CONFIG_SENSORS_LIS3_SPI=y
CONFIG_SENSORS_LIS3_I2C=y
CONFIG_ALTERA_STAPL=y
CONFIG_GENWQE=y
CONFIG_GENWQE_PLATFORM_ERROR_RECOVERY=0
CONFIG_ECHO=y
CONFIG_BCM_VK=y
CONFIG_BCM_VK_TTY=y
CONFIG_MISC_ALCOR_PCI=y
CONFIG_MISC_RTSX_PCI=y
CONFIG_MISC_RTSX_USB=y
CONFIG_HABANA_AI=y
CONFIG_UACCE=y
CONFIG_PVPANIC=y
CONFIG_PVPANIC_MMIO=y
CONFIG_PVPANIC_PCI=y
CONFIG_GP_PCI1XXXX=y

# end of Misc devices

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
CONFIG_RAID_ATTRS=y
CONFIG_SCSI_COMMON=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_NETLINK=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
CONFIG_BLK_DEV_SR=y
CONFIG_CHR_DEV_SG=y
CONFIG_BLK_DEV_BSG=y
CONFIG_CHR_DEV_SCH=y
CONFIG_SCSI_ENCLOSURE=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_FC_ATTRS=y
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_SAS_HOST_SMP=y
CONFIG_SCSI_SRP_ATTRS=y

# end of SCSI Transports

CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_TCP=y
CONFIG_ISCSI_BOOT_SYSFS=y
CONFIG_SCSI_CXGB3_ISCSI=y
CONFIG_SCSI_CXGB4_ISCSI=y
CONFIG_SCSI_BNX2_ISCSI=y
CONFIG_SCSI_BNX2X_FCOE=y
CONFIG_BE2ISCSI=y
CONFIG_BLK_DEV_3W_XXXX_RAID=y
CONFIG_SCSI_HPSA=y
CONFIG_SCSI_3W_9XXX=y
CONFIG_SCSI_3W_SAS=y
CONFIG_SCSI_ACARD=y
CONFIG_SCSI_AHA152X=y
CONFIG_SCSI_AHA1542=y
CONFIG_SCSI_AHA1740=y
CONFIG_SCSI_AACRAID=y
CONFIG_SCSI_AIC7XXX=y
CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
CONFIG_AIC7XXX_RESET_DELAY_MS=5000
CONFIG_AIC7XXX_DEBUG_ENABLE=y
CONFIG_AIC7XXX_DEBUG_MASK=0
CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
CONFIG_SCSI_AIC79XX=y
CONFIG_AIC79XX_CMDS_PER_DEVICE=32
CONFIG_AIC79XX_RESET_DELAY_MS=5000
CONFIG_AIC79XX_DEBUG_ENABLE=y
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
CONFIG_SCSI_AIC94XX=y
CONFIG_AIC94XX_DEBUG=y
CONFIG_SCSI_HISI_SAS=y
CONFIG_SCSI_HISI_SAS_DEBUGFS_DEFAULT_ENABLE=y
CONFIG_SCSI_MVSAS=y
CONFIG_SCSI_MVSAS_DEBUG=y
CONFIG_SCSI_MVSAS_TASKLET=y
CONFIG_SCSI_MVUMI=y
CONFIG_SCSI_ADVANSYS=y
CONFIG_SCSI_ARCMSR=y
CONFIG_SCSI_ESAS2R=y
CONFIG_MEGARAID_NEWGEN=y
CONFIG_MEGARAID_MM=y
CONFIG_MEGARAID_MAILBOX=y
CONFIG_MEGARAID_LEGACY=y
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_MPT3SAS=y
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
CONFIG_SCSI_MPT2SAS=y
CONFIG_SCSI_MPI3MR=y
CONFIG_SCSI_SMARTPQI=y
CONFIG_SCSI_HPTIOP=y
CONFIG_SCSI_BUSLOGIC=y
CONFIG_SCSI_FLASHPOINT=y
CONFIG_SCSI_MYRB=y
CONFIG_SCSI_MYRS=y
CONFIG_LIBFC=y
CONFIG_LIBFCOE=y
CONFIG_FCOE=y
CONFIG_SCSI_SNIC=y
CONFIG_SCSI_SNIC_DEBUG_FS=y
CONFIG_SCSI_DMX3191D=y
CONFIG_SCSI_FDOMAIN=y
CONFIG_SCSI_FDOMAIN_PCI=y
CONFIG_SCSI_FDOMAIN_ISA=y
CONFIG_SCSI_GENERIC_NCR5380=y
CONFIG_SCSI_IPS=y
CONFIG_SCSI_INITIO=y
CONFIG_SCSI_INIA100=y
CONFIG_SCSI_PPA=y
CONFIG_SCSI_IMM=y
CONFIG_SCSI_IZIP_EPP16=y
CONFIG_SCSI_IZIP_SLOW_CTR=y
CONFIG_SCSI_STEX=y
CONFIG_SCSI_SYM53C8XX_2=y
CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
CONFIG_SCSI_SYM53C8XX_MMIO=y
CONFIG_SCSI_IPR=y
CONFIG_SCSI_IPR_TRACE=y
CONFIG_SCSI_IPR_DUMP=y
CONFIG_SCSI_QLOGIC_FAS=y
CONFIG_SCSI_QLOGIC_1280=y
CONFIG_SCSI_QLA_FC=y
CONFIG_TCM_QLA2XXX=y
CONFIG_TCM_QLA2XXX_DEBUG=y
CONFIG_SCSI_QLA_ISCSI=y
CONFIG_QEDI=y
CONFIG_QEDF=y
CONFIG_SCSI_EFCT=y
CONFIG_SCSI_SIM710=y
CONFIG_SCSI_DC395x=y
CONFIG_SCSI_AM53C974=y
CONFIG_SCSI_WD719X=y
CONFIG_SCSI_DEBUG=y
CONFIG_SCSI_PMCRAID=y
CONFIG_SCSI_PM8001=y
CONFIG_SCSI_BFA_FC=y
CONFIG_SCSI_VIRTIO=y
CONFIG_SCSI_CHELSIO_FCOE=y
CONFIG_SCSI_LOWLEVEL_PCMCIA=y
CONFIG_PCMCIA_AHA152X=m
CONFIG_PCMCIA_FDOMAIN=m
CONFIG_PCMCIA_NINJA_SCSI=m
CONFIG_PCMCIA_QLOGIC=m
CONFIG_PCMCIA_SYM53C500=m
CONFIG_SCSI_DH=y
CONFIG_SCSI_DH_RDAC=y
CONFIG_SCSI_DH_HP_SW=y
CONFIG_SCSI_DH_EMC=y
CONFIG_SCSI_DH_ALUA=y

# end of SCSI device support

CONFIG_ATA=y
CONFIG_SATA_HOST=y
CONFIG_PATA_TIMINGS=y
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_ATA_FORCE=y
CONFIG_SATA_PMP=y

#
# Controllers with non-SFF native interface
#
CONFIG_SATA_AHCI=y
CONFIG_SATA_MOBILE_LPM_POLICY=0
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_AHCI_BRCM=y
CONFIG_AHCI_DA850=y
CONFIG_AHCI_DM816=y
CONFIG_AHCI_DWC=y
CONFIG_AHCI_ST=y
CONFIG_AHCI_IMX=y
CONFIG_AHCI_CEVA=y
CONFIG_AHCI_MTK=y
CONFIG_AHCI_MVEBU=y
CONFIG_AHCI_SUNXI=y
CONFIG_AHCI_TEGRA=y
CONFIG_AHCI_XGENE=y
CONFIG_AHCI_QORIQ=y
CONFIG_SATA_FSL=y
CONFIG_SATA_GEMINI=y
CONFIG_SATA_AHCI_SEATTLE=y
CONFIG_SATA_INIC162X=y
CONFIG_SATA_ACARD_AHCI=y
CONFIG_SATA_SIL24=y
CONFIG_ATA_SFF=y

#
# SFF controllers with custom DMA interface
#
CONFIG_PDC_ADMA=y
CONFIG_SATA_QSTOR=y
CONFIG_SATA_SX4=y
CONFIG_ATA_BMDMA=y

#
# SATA SFF controllers with BMDMA
#
CONFIG_ATA_PIIX=y
CONFIG_SATA_DWC=y
CONFIG_SATA_DWC_OLD_DMA=y
CONFIG_SATA_HIGHBANK=y
CONFIG_SATA_MV=y
CONFIG_SATA_NV=y
CONFIG_SATA_PROMISE=y
CONFIG_SATA_RCAR=y
CONFIG_SATA_SIL=y
CONFIG_SATA_SIS=y
CONFIG_SATA_SVW=y
CONFIG_SATA_ULI=y
CONFIG_SATA_VIA=y
CONFIG_SATA_VITESSE=y

#
# PATA SFF controllers with BMDMA
#
CONFIG_PATA_ALI=y
CONFIG_PATA_AMD=y
CONFIG_PATA_ARASAN_CF=y
CONFIG_PATA_ARTOP=y
CONFIG_PATA_ATIIXP=y
CONFIG_PATA_ATP867X=y
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=y
CONFIG_PATA_CS5530=y
CONFIG_PATA_CS5536=y
CONFIG_PATA_CYPRESS=y
CONFIG_PATA_EFAR=y
CONFIG_PATA_FTIDE010=y
CONFIG_PATA_HPT366=y
CONFIG_PATA_HPT37X=y
CONFIG_PATA_HPT3X2N=y
CONFIG_PATA_HPT3X3=y
CONFIG_PATA_HPT3X3_DMA=y
CONFIG_PATA_IMX=y
CONFIG_PATA_IT8213=y
CONFIG_PATA_IT821X=y
CONFIG_PATA_JMICRON=y
CONFIG_PATA_MARVELL=y
CONFIG_PATA_NETCELL=y
CONFIG_PATA_NINJA32=y
CONFIG_PATA_NS87415=y
CONFIG_PATA_OLDPIIX=y
CONFIG_PATA_OPTIDMA=y
CONFIG_PATA_PDC2027X=y
CONFIG_PATA_PDC_OLD=y
CONFIG_PATA_RADISYS=y
CONFIG_PATA_RDC=y
CONFIG_PATA_SC1200=y
CONFIG_PATA_SCH=y
CONFIG_PATA_SERVERWORKS=y
CONFIG_PATA_SIL680=y
CONFIG_PATA_SIS=y
CONFIG_PATA_TOSHIBA=y
CONFIG_PATA_TRIFLEX=y
CONFIG_PATA_VIA=y
CONFIG_PATA_PXA=y
CONFIG_PATA_WINBOND=y

#
# PIO-only SFF controllers
#
CONFIG_PATA_CMD640_PCI=y
CONFIG_PATA_ISAPNP=y
CONFIG_PATA_IXP4XX_CF=y
CONFIG_PATA_MPIIX=y
CONFIG_PATA_NS87410=y
CONFIG_PATA_OPTI=y
CONFIG_PATA_PCMCIA=y
CONFIG_PATA_PLATFORM=y
CONFIG_PATA_OF_PLATFORM=y
CONFIG_PATA_QDI=y
CONFIG_PATA_RZ1000=y
CONFIG_PATA_SAMSUNG_CF=y
CONFIG_PATA_WINBOND_VLB=y

#
# Generic fallback / legacy drivers
#
CONFIG_ATA_GENERIC=y
CONFIG_PATA_LEGACY=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_AUTODETECT=y
CONFIG_MD_LINEAR=y
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_RAID456=y
CONFIG_MD_MULTIPATH=y
CONFIG_MD_FAULTY=y
CONFIG_MD_CLUSTER=y
CONFIG_BCACHE=y
CONFIG_BCACHE_DEBUG=y CONFIG_BCACHE_CLOSURES_DEBUG=y CONFIG_BCACHE_ASYNC_REGISTRATION=y CONFIG_BLK_DEV_DM_BUILTIN=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_DEBUG=y
CONFIG_DM_BUFIO=y CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING=y CONFIG_DM_BIO_PRISON=y CONFIG_DM_PERSISTENT_DATA=y CONFIG_DM_UNSTRIPED=y
CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_CACHE=y
CONFIG_DM_CACHE_SMQ=y
CONFIG_DM_WRITECACHE=y
CONFIG_DM_EBS=y
CONFIG_DM_ERA=y
CONFIG_DM_CLONE=y
CONFIG_DM_MIRROR=y
CONFIG_DM_LOG_USERSPACE=y
CONFIG_DM_RAID=y
CONFIG_DM_ZERO=y
CONFIG_DM_MULTIPATH=y
CONFIG_DM_MULTIPATH_QL=y CONFIG_DM_MULTIPATH_ST=y CONFIG_DM_MULTIPATH_HST=y CONFIG_DM_MULTIPATH_IOA=y
CONFIG_DM_DELAY=y
CONFIG_DM_DUST=y
CONFIG_DM_INIT=y
CONFIG_DM_UEVENT=y
CONFIG_DM_FLAKEY=y
CONFIG_DM_VERITY=y CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING=y CONFIG_DM_VERITY_FEC=y
CONFIG_DM_SWITCH=y
CONFIG_DM_LOG_WRITES=y
CONFIG_DM_INTEGRITY=y
CONFIG_DM_ZONED=y
CONFIG_DM_AUDIT=y
CONFIG_TARGET_CORE=y
CONFIG_TCM_IBLOCK=y
CONFIG_TCM_FILEIO=y
CONFIG_TCM_PSCSI=y
CONFIG_TCM_USER2=y
CONFIG_LOOPBACK_TARGET=y
CONFIG_TCM_FC=y
CONFIG_ISCSI_TARGET=y CONFIG_ISCSI_TARGET_CXGB4=y
CONFIG_SBP_TARGET=y
CONFIG_FUSION=y
CONFIG_FUSION_SPI=y
CONFIG_FUSION_FC=y
CONFIG_FUSION_SAS=y
CONFIG_FUSION_MAX_SGE=128
CONFIG_FUSION_CTL=y
CONFIG_FUSION_LAN=y
CONFIG_FUSION_LOGGING=y

#
# IEEE 1394 (FireWire) support
#
CONFIG_FIREWIRE=y
CONFIG_FIREWIRE_OHCI=y
CONFIG_FIREWIRE_SBP2=y
CONFIG_FIREWIRE_NET=y
CONFIG_FIREWIRE_NOSY=y

# end of IEEE 1394 (FireWire) support

CONFIG_NETDEVICES=y
CONFIG_MII=y
CONFIG_NET_CORE=y
CONFIG_BONDING=y
CONFIG_DUMMY=y
CONFIG_WIREGUARD=y
CONFIG_WIREGUARD_DEBUG=y
CONFIG_EQUALIZER=y
CONFIG_NET_FC=y
CONFIG_IFB=y
CONFIG_NET_TEAM=y
CONFIG_NET_TEAM_MODE_BROADCAST=y
CONFIG_NET_TEAM_MODE_ROUNDROBIN=y
CONFIG_NET_TEAM_MODE_RANDOM=y
CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=y
CONFIG_NET_TEAM_MODE_LOADBALANCE=y
CONFIG_MACVLAN=y
CONFIG_MACVTAP=y
CONFIG_IPVLAN_L3S=y
CONFIG_IPVLAN=y
CONFIG_IPVTAP=y
CONFIG_VXLAN=y
CONFIG_GENEVE=y
CONFIG_BAREUDP=y
CONFIG_GTP=y
CONFIG_AMT=y
CONFIG_MACSEC=y
CONFIG_NETCONSOLE=y
CONFIG_NETCONSOLE_DYNAMIC=y
CONFIG_NETPOLL=y
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_NTB_NETDEV=y
CONFIG_RIONET=y
CONFIG_RIONET_TX_SIZE=128
CONFIG_RIONET_RX_SIZE=128
CONFIG_TUN=y
CONFIG_TAP=y
CONFIG_TUN_VNET_CROSS_LE=y
CONFIG_VETH=y
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
CONFIG_NET_VRF=y
CONFIG_VSOCKMON=y
CONFIG_MHI_NET=y
CONFIG_SUNGEM_PHY=y
CONFIG_ARCNET=y
CONFIG_ARCNET_1201=y
CONFIG_ARCNET_1051=y
CONFIG_ARCNET_RAW=y
CONFIG_ARCNET_CAP=y
CONFIG_ARCNET_COM90xx=y
CONFIG_ARCNET_COM90xxIO=y
CONFIG_ARCNET_RIM_I=y
CONFIG_ARCNET_COM20020=y
CONFIG_ARCNET_COM20020_ISA=y
CONFIG_ARCNET_COM20020_PCI=y
CONFIG_ARCNET_COM20020_CS=y
CONFIG_ATM_DRIVERS=y
CONFIG_ATM_DUMMY=y
CONFIG_ATM_TCP=y
CONFIG_ATM_LANAI=y
CONFIG_ATM_ENI=y
CONFIG_ATM_ENI_DEBUG=y
CONFIG_ATM_ENI_TUNE_BURST=y
CONFIG_ATM_ENI_BURST_TX_16W=y
CONFIG_ATM_ENI_BURST_TX_8W=y
CONFIG_ATM_ENI_BURST_TX_4W=y
CONFIG_ATM_ENI_BURST_TX_2W=y
CONFIG_ATM_ENI_BURST_RX_16W=y
CONFIG_ATM_ENI_BURST_RX_8W=y
CONFIG_ATM_ENI_BURST_RX_4W=y
CONFIG_ATM_ENI_BURST_RX_2W=y
CONFIG_ATM_NICSTAR=y
CONFIG_ATM_NICSTAR_USE_SUNI=y
CONFIG_ATM_NICSTAR_USE_IDT77105=y
CONFIG_ATM_IDT77252=y
CONFIG_ATM_IDT77252_DEBUG=y
CONFIG_ATM_IDT77252_RCV_ALL=y
CONFIG_ATM_IDT77252_USE_SUNI=y
CONFIG_ATM_IA=y
CONFIG_ATM_IA_DEBUG=y
CONFIG_ATM_FORE200E=y
CONFIG_ATM_FORE200E_USE_TASKLET=y
CONFIG_ATM_FORE200E_TX_RETRY=16
CONFIG_ATM_FORE200E_DEBUG=0
CONFIG_ATM_HE=y
CONFIG_ATM_HE_USE_SUNI=y
CONFIG_ATM_SOLOS=y
CONFIG_CAIF_DRIVERS=y
CONFIG_CAIF_TTY=y
CONFIG_CAIF_VIRTIO=y

#
# Distributed Switch Architecture drivers
#
CONFIG_B53=y
CONFIG_B53_SPI_DRIVER=y
CONFIG_B53_MDIO_DRIVER=y
CONFIG_B53_MMAP_DRIVER=y
CONFIG_B53_SRAB_DRIVER=y
CONFIG_B53_SERDES=y
CONFIG_NET_DSA_BCM_SF2=y
CONFIG_NET_DSA_LOOP=y
CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK=y
CONFIG_NET_DSA_LANTIQ_GSWIP=y
CONFIG_NET_DSA_MT7530=y
CONFIG_NET_DSA_MV88E6060=y
CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON=y
CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C=y
CONFIG_NET_DSA_MICROCHIP_KSZ_SPI=y
CONFIG_NET_DSA_MICROCHIP_KSZ8863_SMI=y
CONFIG_NET_DSA_MV88E6XXX=y
CONFIG_NET_DSA_MV88E6XXX_PTP=y
CONFIG_NET_DSA_MSCC_FELIX=y
CONFIG_NET_DSA_MSCC_SEVILLE=y
CONFIG_NET_DSA_AR9331=y
CONFIG_NET_DSA_QCA8K=y
CONFIG_NET_DSA_SJA1105=y
CONFIG_NET_DSA_SJA1105_PTP=y
CONFIG_NET_DSA_SJA1105_TAS=y
CONFIG_NET_DSA_SJA1105_VL=y
CONFIG_NET_DSA_XRS700X=y
CONFIG_NET_DSA_XRS700X_I2C=y
CONFIG_NET_DSA_XRS700X_MDIO=y
CONFIG_NET_DSA_REALTEK=y
CONFIG_NET_DSA_REALTEK_MDIO=y
CONFIG_NET_DSA_REALTEK_SMI=y
CONFIG_NET_DSA_REALTEK_RTL8365MB=y
CONFIG_NET_DSA_REALTEK_RTL8366RB=y
CONFIG_NET_DSA_SMSC_LAN9303=y
CONFIG_NET_DSA_SMSC_LAN9303_I2C=y
CONFIG_NET_DSA_SMSC_LAN9303_MDIO=y
CONFIG_NET_DSA_VITESSE_VSC73XX=y
CONFIG_NET_DSA_VITESSE_VSC73XX_SPI=y
CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM=y

# end of Distributed Switch Architecture drivers

CONFIG_ETHERNET=y
CONFIG_MDIO=y
CONFIG_NET_VENDOR_3COM=y
CONFIG_EL3=y
CONFIG_3C515=y
CONFIG_PCMCIA_3C574=y
CONFIG_PCMCIA_3C589=y
CONFIG_VORTEX=y
CONFIG_TYPHOON=y
CONFIG_NET_VENDOR_ACTIONS=y
CONFIG_OWL_EMAC=y
CONFIG_NET_VENDOR_ADAPTEC=y
CONFIG_ADAPTEC_STARFIRE=y
CONFIG_NET_VENDOR_AGERE=y
CONFIG_ET131X=y
CONFIG_NET_VENDOR_ALACRITECH=y
CONFIG_SLICOSS=y
CONFIG_NET_VENDOR_ALTEON=y
CONFIG_ACENIC=y
CONFIG_ACENIC_OMIT_TIGON_I=y
CONFIG_ALTERA_TSE=y
CONFIG_NET_VENDOR_AMAZON=y
CONFIG_ENA_ETHERNET=y
CONFIG_NET_VENDOR_AMD=y
CONFIG_AMD8111_ETH=y
CONFIG_LANCE=y
CONFIG_PCNET32=y
CONFIG_PCMCIA_NMCLAN=y
CONFIG_AMD_XGBE=y
CONFIG_AMD_XGBE_DCB=y
CONFIG_NET_XGENE=y
CONFIG_NET_XGENE_V2=y
CONFIG_NET_VENDOR_AQUANTIA=y
CONFIG_AQTION=y
CONFIG_NET_VENDOR_ARC=y
CONFIG_ARC_EMAC_CORE=y
CONFIG_ARC_EMAC=y
CONFIG_EMAC_ROCKCHIP=y
CONFIG_NET_VENDOR_ASIX=y
CONFIG_SPI_AX88796C=y
CONFIG_SPI_AX88796C_COMPRESSION=y
CONFIG_NET_VENDOR_ATHEROS=y
CONFIG_ATL2=y
CONFIG_ATL1=y
CONFIG_ATL1E=y
CONFIG_ATL1C=y
CONFIG_ALX=y
CONFIG_CX_ECAT=y
CONFIG_NET_VENDOR_BROADCOM=y
CONFIG_B44=y
CONFIG_B44_PCI_AUTOSELECT=y
CONFIG_B44_PCICORE_AUTOSELECT=y
CONFIG_B44_PCI=y
CONFIG_BCM4908_ENET=y
CONFIG_BCMGENET=y
CONFIG_BNX2=y
CONFIG_CNIC=y
CONFIG_TIGON3=y
CONFIG_TIGON3_HWMON=y
CONFIG_BNX2X=y
CONFIG_BNX2X_SRIOV=y
CONFIG_BGMAC=y
CONFIG_BGMAC_BCMA=y
CONFIG_BGMAC_PLATFORM=y
CONFIG_SYSTEMPORT=y
CONFIG_BNXT=y
CONFIG_BNXT_SRIOV=y
CONFIG_BNXT_FLOWER_OFFLOAD=y
CONFIG_BNXT_DCB=y
CONFIG_BNXT_HWMON=y
CONFIG_NET_VENDOR_CADENCE=y
CONFIG_MACB=y
CONFIG_MACB_USE_HWSTAMP=y
CONFIG_MACB_PCI=y
CONFIG_NET_CALXEDA_XGMAC=y
CONFIG_NET_VENDOR_CAVIUM=y
CONFIG_THUNDER_NIC_PF=y
CONFIG_THUNDER_NIC_VF=y
CONFIG_THUNDER_NIC_BGX=y
CONFIG_THUNDER_NIC_RGX=y
CONFIG_CAVIUM_PTP=y
CONFIG_LIQUIDIO=y
CONFIG_LIQUIDIO_VF=y
CONFIG_NET_VENDOR_CHELSIO=y
CONFIG_CHELSIO_T1=y
CONFIG_CHELSIO_T1_1G=y
CONFIG_CHELSIO_T3=y
CONFIG_CHELSIO_T4=y
CONFIG_CHELSIO_T4_DCB=y
CONFIG_CHELSIO_T4_FCOE=y
CONFIG_CHELSIO_T4VF=y
CONFIG_CHELSIO_LIB=y
CONFIG_CHELSIO_INLINE_CRYPTO=y
CONFIG_CRYPTO_DEV_CHELSIO_TLS=y
CONFIG_CHELSIO_IPSEC_INLINE=y
CONFIG_CHELSIO_TLS_DEVICE=y
CONFIG_NET_VENDOR_CIRRUS=y
CONFIG_CS89x0=y
CONFIG_CS89x0_PLATFORM=y
CONFIG_EP93XX_ETH=y
CONFIG_NET_VENDOR_CISCO=y
CONFIG_ENIC=y
CONFIG_NET_VENDOR_CORTINA=y
CONFIG_GEMINI_ETHERNET=y
CONFIG_NET_VENDOR_DAVICOM=y
CONFIG_DM9000=y
CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL=y
CONFIG_DM9051=y
CONFIG_DNET=y
CONFIG_NET_VENDOR_DEC=y
CONFIG_NET_TULIP=y
CONFIG_DE2104X=y
CONFIG_DE2104X_DSL=0
CONFIG_TULIP=y
CONFIG_TULIP_MWI=y
CONFIG_TULIP_MMIO=y
CONFIG_TULIP_NAPI=y
CONFIG_TULIP_NAPI_HW_MITIGATION=y
CONFIG_WINBOND_840=y
CONFIG_DM9102=y
CONFIG_ULI526X=y
CONFIG_PCMCIA_XIRCOM=y
CONFIG_NET_VENDOR_DLINK=y
CONFIG_DL2K=y
CONFIG_SUNDANCE=y
CONFIG_SUNDANCE_MMIO=y
CONFIG_NET_VENDOR_EMULEX=y
CONFIG_BE2NET=y
CONFIG_BE2NET_HWMON=y
CONFIG_BE2NET_BE2=y
CONFIG_BE2NET_BE3=y
CONFIG_BE2NET_LANCER=y
CONFIG_BE2NET_SKYHAWK=y
CONFIG_NET_VENDOR_ENGLEDER=y
CONFIG_TSNEP=y
CONFIG_TSNEP_SELFTESTS=y
CONFIG_NET_VENDOR_EZCHIP=y
CONFIG_EZCHIP_NPS_MANAGEMENT_ENET=y
CONFIG_NET_VENDOR_FARADAY=y
CONFIG_NET_VENDOR_FREESCALE=y
CONFIG_FEC=y
CONFIG_FSL_FMAN=y
CONFIG_FSL_PQ_MDIO=y
CONFIG_FSL_XGMAC_MDIO=y
CONFIG_GIANFAR=y
CONFIG_FSL_DPAA2_SWITCH=y
CONFIG_FSL_ENETC=y
CONFIG_FSL_ENETC_VF=y
CONFIG_FSL_ENETC_IERB=y
CONFIG_FSL_ENETC_MDIO=y
CONFIG_FSL_ENETC_PTP_CLOCK=y
CONFIG_FSL_ENETC_QOS=y
CONFIG_NET_VENDOR_FUJITSU=y
CONFIG_PCMCIA_FMVJ18X=y
CONFIG_NET_VENDOR_FUNGIBLE=y
CONFIG_FUN_CORE=y
CONFIG_FUN_ETH=y
CONFIG_NET_VENDOR_GOOGLE=y
CONFIG_NET_VENDOR_HISILICON=y
CONFIG_HIX5HD2_GMAC=y
CONFIG_HISI_FEMAC=y
CONFIG_HIP04_ETH=y
CONFIG_HI13X1_GMAC=y
CONFIG_HNS_MDIO=y
CONFIG_HNS=y
CONFIG_HNS_DSAF=y
CONFIG_HNS_ENET=y
CONFIG_HNS3=y
CONFIG_HNS3_HCLGE=y
CONFIG_HNS3_DCB=y
CONFIG_HNS3_HCLGEVF=y
CONFIG_HNS3_ENET=y
CONFIG_NET_VENDOR_HUAWEI=y
CONFIG_NET_VENDOR_I825XX=y
CONFIG_NET_VENDOR_INTEL=y
CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y
CONFIG_IGB=y
CONFIG_IGB_HWMON=y
CONFIG_IGBVF=y
CONFIG_IXGB=y
CONFIG_IXGBE=y
CONFIG_IXGBE_HWMON=y
CONFIG_IXGBE_DCB=y
CONFIG_IXGBE_IPSEC=y
CONFIG_IXGBEVF=y
CONFIG_IXGBEVF_IPSEC=y
CONFIG_I40E=y
CONFIG_I40E_DCB=y
CONFIG_IAVF=y
CONFIG_I40EVF=y
CONFIG_ICE=y
CONFIG_ICE_SWITCHDEV=y
CONFIG_FM10K=y
CONFIG_IGC=y
CONFIG_NET_VENDOR_WANGXUN=y
CONFIG_LIBWX=y
CONFIG_NGBE=y
CONFIG_TXGBE=y
CONFIG_JME=y
CONFIG_KORINA=y
CONFIG_NET_VENDOR_ADI=y
CONFIG_ADIN1110=y
CONFIG_NET_VENDOR_LITEX=y
CONFIG_LITEX_LITEETH=y
CONFIG_NET_VENDOR_MARVELL=y
CONFIG_MV643XX_ETH=y
CONFIG_MVMDIO=y
CONFIG_MVNETA=y
CONFIG_MVPP2=y
CONFIG_MVPP2_PTP=y
CONFIG_PXA168_ETH=y
CONFIG_SKGE=y
CONFIG_SKGE_DEBUG=y
CONFIG_SKGE_GENESIS=y
CONFIG_SKY2=y
CONFIG_SKY2_DEBUG=y
CONFIG_OCTEONTX2_MBOX=y
CONFIG_OCTEONTX2_AF=y
CONFIG_NDC_DIS_DYNAMIC_CACHING=y
CONFIG_OCTEONTX2_PF=y
CONFIG_OCTEONTX2_VF=y
CONFIG_OCTEON_EP=y
CONFIG_PRESTERA=y
CONFIG_PRESTERA_PCI=y
CONFIG_NET_VENDOR_MEDIATEK=y
CONFIG_NET_MEDIATEK_SOC_WED=y
CONFIG_NET_MEDIATEK_SOC=y
CONFIG_NET_MEDIATEK_STAR_EMAC=y
CONFIG_NET_VENDOR_MELLANOX=y
CONFIG_MLX4_EN=y
CONFIG_MLX4_EN_DCB=y
CONFIG_MLX4_CORE=y
CONFIG_MLX4_DEBUG=y
CONFIG_MLX4_CORE_GEN2=y
CONFIG_MLX5_CORE=y
CONFIG_MLX5_FPGA=y
CONFIG_MLX5_CORE_EN=y
CONFIG_MLX5_EN_ARFS=y
CONFIG_MLX5_EN_RXNFC=y
CONFIG_MLX5_MPFS=y
CONFIG_MLX5_ESWITCH=y
CONFIG_MLX5_BRIDGE=y
CONFIG_MLX5_CLS_ACT=y
CONFIG_MLX5_TC_CT=y
CONFIG_MLX5_TC_SAMPLE=y
CONFIG_MLX5_CORE_EN_DCB=y
CONFIG_MLX5_CORE_IPOIB=y
CONFIG_MLX5_EN_MACSEC=y
CONFIG_MLX5_EN_IPSEC=y
CONFIG_MLX5_EN_TLS=y
CONFIG_MLX5_SW_STEERING=y
CONFIG_MLX5_SF=y
CONFIG_MLX5_SF_MANAGER=y
CONFIG_MLXSW_CORE=y
CONFIG_MLXSW_CORE_HWMON=y
CONFIG_MLXSW_CORE_THERMAL=y
CONFIG_MLXSW_PCI=y
CONFIG_MLXSW_I2C=y
CONFIG_MLXSW_SPECTRUM=y
CONFIG_MLXSW_SPECTRUM_DCB=y
CONFIG_MLXSW_MINIMAL=y
CONFIG_MLXFW=y
CONFIG_MLXBF_GIGE=y
CONFIG_NET_VENDOR_MICREL=y
CONFIG_KS8842=y
CONFIG_KS8851=y
CONFIG_KS8851_MLL=y
CONFIG_KSZ884X_PCI=y
CONFIG_NET_VENDOR_MICROCHIP=y
CONFIG_ENC28J60=y
CONFIG_ENC28J60_WRITEVERIFY=y
CONFIG_ENCX24J600=y
CONFIG_LAN743X=y
CONFIG_LAN966X_SWITCH=y
CONFIG_SPARX5_SWITCH=y
CONFIG_SPARX5_DCB=y
CONFIG_VCAP=y
CONFIG_VCAP_KUNIT_TEST=y
CONFIG_NET_VENDOR_MICROSEMI=y
CONFIG_MSCC_OCELOT_SWITCH_LIB=y
CONFIG_MSCC_OCELOT_SWITCH=y
CONFIG_NET_VENDOR_MICROSOFT=y
CONFIG_NET_VENDOR_MYRI=y
CONFIG_MYRI10GE=y
CONFIG_NET_VENDOR_NI=y
CONFIG_NI_XGE_MANAGEMENT_ENET=y
CONFIG_NET_VENDOR_NATSEMI=y
CONFIG_NATSEMI=y
CONFIG_NS83820=y
CONFIG_NET_VENDOR_NETERION=y
CONFIG_S2IO=y
CONFIG_NET_VENDOR_NETRONOME=y
CONFIG_NFP=y
CONFIG_NFP_APP_FLOWER=y
CONFIG_NFP_APP_ABM_NIC=y
CONFIG_NFP_NET_IPSEC=y
CONFIG_NFP_DEBUG=y
CONFIG_NET_VENDOR_8390=y
CONFIG_PCMCIA_AXNET=y
CONFIG_AX88796=y
CONFIG_AX88796_93CX6=y
CONFIG_NE2000=y
CONFIG_NE2K_PCI=y
CONFIG_PCMCIA_PCNET=y
CONFIG_ULTRA=y
CONFIG_WD80x3=y
CONFIG_NET_VENDOR_NVIDIA=y
CONFIG_FORCEDETH=y
CONFIG_LPC_ENET=y
CONFIG_NET_VENDOR_OKI=y
CONFIG_PCH_GBE=y
CONFIG_ETHOC=y
CONFIG_NET_VENDOR_PACKET_ENGINES=y
CONFIG_HAMACHI=y
CONFIG_YELLOWFIN=y
CONFIG_NET_VENDOR_PENSANDO=y
CONFIG_IONIC=y
CONFIG_NET_VENDOR_QLOGIC=y
CONFIG_QLA3XXX=y
CONFIG_QLCNIC=y
CONFIG_QLCNIC_SRIOV=y
CONFIG_QLCNIC_DCB=y
CONFIG_QLCNIC_HWMON=y
CONFIG_NETXEN_NIC=y
CONFIG_QED=y
CONFIG_QED_LL2=y
CONFIG_QED_SRIOV=y
CONFIG_QEDE=y
CONFIG_QED_ISCSI=y
CONFIG_QED_FCOE=y
CONFIG_QED_OOO=y
CONFIG_NET_VENDOR_BROCADE=y
CONFIG_BNA=y
CONFIG_NET_VENDOR_QUALCOMM=y
CONFIG_QCA7000=y
CONFIG_QCA7000_SPI=y
CONFIG_QCA7000_UART=y
CONFIG_QCOM_EMAC=y
CONFIG_RMNET=y
CONFIG_NET_VENDOR_RDC=y
CONFIG_R6040=y
CONFIG_NET_VENDOR_REALTEK=y
CONFIG_8139CP=y
CONFIG_8139TOO=y
CONFIG_8139TOO_PIO=y
CONFIG_8139TOO_TUNE_TWISTER=y
CONFIG_8139TOO_8129=y
CONFIG_8139_OLD_RX_RESET=y
CONFIG_R8169=y
CONFIG_NET_VENDOR_RENESAS=y
CONFIG_SH_ETH=y
CONFIG_RAVB=y
CONFIG_RENESAS_ETHER_SWITCH=y
CONFIG_NET_VENDOR_ROCKER=y
CONFIG_ROCKER=y
CONFIG_NET_VENDOR_SAMSUNG=y
CONFIG_SXGBE_ETH=y
CONFIG_NET_VENDOR_SEEQ=y
CONFIG_NET_VENDOR_SILAN=y
CONFIG_SC92031=y
CONFIG_NET_VENDOR_SIS=y
CONFIG_SIS900=y
CONFIG_SIS190=y
CONFIG_NET_VENDOR_SOLARFLARE=y
CONFIG_SFC=y
CONFIG_SFC_MTD=y
CONFIG_SFC_MCDI_MON=y
CONFIG_SFC_SRIOV=y
CONFIG_SFC_MCDI_LOGGING=y
CONFIG_SFC_FALCON=y
CONFIG_SFC_FALCON_MTD=y
CONFIG_SFC_SIENA=y
CONFIG_SFC_SIENA_MTD=y
CONFIG_SFC_SIENA_MCDI_MON=y
CONFIG_SFC_SIENA_SRIOV=y
CONFIG_SFC_SIENA_MCDI_LOGGING=y
CONFIG_NET_VENDOR_SMSC=y
CONFIG_SMC9194=y
CONFIG_SMC91X=y
CONFIG_PCMCIA_SMC91C92=y
CONFIG_EPIC100=y
CONFIG_SMSC911X=y
CONFIG_SMSC9420=y
CONFIG_NET_VENDOR_SOCIONEXT=y
CONFIG_SNI_AVE=y
CONFIG_SNI_NETSEC=y
CONFIG_NET_VENDOR_STMICRO=y
CONFIG_STMMAC_ETH=y
CONFIG_STMMAC_SELFTESTS=y
CONFIG_STMMAC_PLATFORM=y
CONFIG_DWMAC_DWC_QOS_ETH=y
CONFIG_DWMAC_GENERIC=y
CONFIG_DWMAC_ANARION=y
CONFIG_DWMAC_INGENIC=y
CONFIG_DWMAC_IPQ806X=y
CONFIG_DWMAC_LPC18XX=y
CONFIG_DWMAC_MEDIATEK=y
CONFIG_DWMAC_MESON=y
CONFIG_DWMAC_OXNAS=y
CONFIG_DWMAC_QCOM_ETHQOS=y
CONFIG_DWMAC_ROCKCHIP=y
CONFIG_DWMAC_SOCFPGA=y
CONFIG_DWMAC_STI=y
CONFIG_DWMAC_STM32=y
CONFIG_DWMAC_SUNXI=y
CONFIG_DWMAC_SUN8I=y
CONFIG_DWMAC_IMX8=y
CONFIG_DWMAC_INTEL_PLAT=y
CONFIG_DWMAC_TEGRA=y
CONFIG_DWMAC_VISCONTI=y
CONFIG_DWMAC_LOONGSON=y
CONFIG_STMMAC_PCI=y
CONFIG_NET_VENDOR_SUN=y
CONFIG_HAPPYMEAL=y
CONFIG_SUNGEM=y
CONFIG_CASSINI=y
CONFIG_NIU=y
CONFIG_NET_VENDOR_SUNPLUS=y
CONFIG_SP7021_EMAC=y
CONFIG_NET_VENDOR_SYNOPSYS=y
CONFIG_DWC_XLGMAC=y
CONFIG_DWC_XLGMAC_PCI=y
CONFIG_NET_VENDOR_TEHUTI=y
CONFIG_TEHUTI=y
CONFIG_NET_VENDOR_TI=y
CONFIG_TI_DAVINCI_EMAC=y
CONFIG_TI_DAVINCI_MDIO=y
CONFIG_TI_CPSW_PHY_SEL=y
CONFIG_TI_CPSW=y
CONFIG_TI_CPSW_SWITCHDEV=y
CONFIG_TI_CPTS=y
CONFIG_TLAN=y
CONFIG_NET_VENDOR_VERTEXCOM=y
CONFIG_MSE102X=y
CONFIG_NET_VENDOR_VIA=y
CONFIG_VIA_RHINE=y
CONFIG_VIA_RHINE_MMIO=y
CONFIG_VIA_VELOCITY=y
CONFIG_NET_VENDOR_WIZNET=y
CONFIG_WIZNET_W5100=y
CONFIG_WIZNET_W5300=y
# CONFIG_WIZNET_BUS_DIRECT is not set
# CONFIG_WIZNET_BUS_INDIRECT is not set
CONFIG_WIZNET_BUS_ANY=y
CONFIG_WIZNET_W5100_SPI=y
CONFIG_NET_VENDOR_XILINX=y
CONFIG_XILINX_EMACLITE=y
CONFIG_XILINX_AXI_EMAC=y
CONFIG_XILINX_LL_TEMAC=y
CONFIG_NET_VENDOR_XIRCOM=y
CONFIG_PCMCIA_XIRC2PS=y
CONFIG_FDDI=y
CONFIG_DEFXX=y
CONFIG_SKFP=y
CONFIG_HIPPI=y
CONFIG_ROADRUNNER=y
CONFIG_ROADRUNNER_LARGE_RINGS=y
CONFIG_QCOM_IPA=y
CONFIG_NET_SB1000=y
CONFIG_PHYLINK=y
CONFIG_PHYLIB=y
CONFIG_SWPHY=y
CONFIG_LED_TRIGGER_PHY=y
CONFIG_FIXED_PHY=y
CONFIG_SFP=y

#
# MII PHY device drivers
#
CONFIG_AMD_PHY=y
CONFIG_MESON_GXL_PHY=y
CONFIG_ADIN_PHY=y
CONFIG_ADIN1100_PHY=y
CONFIG_AQUANTIA_PHY=y
CONFIG_AX88796B_PHY=y
CONFIG_BROADCOM_PHY=y
CONFIG_BCM54140_PHY=y
CONFIG_BCM63XX_PHY=y
CONFIG_BCM7XXX_PHY=y
CONFIG_BCM84881_PHY=y
CONFIG_BCM87XX_PHY=y
CONFIG_BCM_CYGNUS_PHY=y
CONFIG_BCM_NET_PHYLIB=y
CONFIG_BCM_NET_PHYPTP=y
CONFIG_CICADA_PHY=y
CONFIG_CORTINA_PHY=y
CONFIG_DAVICOM_PHY=y
CONFIG_ICPLUS_PHY=y
CONFIG_LXT_PHY=y
CONFIG_INTEL_XWAY_PHY=y
CONFIG_LSI_ET1011C_PHY=y
CONFIG_MARVELL_PHY=y
CONFIG_MARVELL_10G_PHY=y
CONFIG_MARVELL_88X2222_PHY=y
CONFIG_MAXLINEAR_GPHY=y
CONFIG_MEDIATEK_GE_PHY=y
CONFIG_MICREL_PHY=y
CONFIG_MICROCHIP_PHY=y
CONFIG_MICROCHIP_T1_PHY=y
CONFIG_MICROSEMI_PHY=y
CONFIG_MOTORCOMM_PHY=y
CONFIG_NATIONAL_PHY=y
CONFIG_NXP_C45_TJA11XX_PHY=y
CONFIG_NXP_TJA11XX_PHY=y
CONFIG_AT803X_PHY=y
CONFIG_QSEMI_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_RENESAS_PHY=y
CONFIG_ROCKCHIP_PHY=y
CONFIG_SMSC_PHY=y
CONFIG_STE10XP=y
CONFIG_TERANETICS_PHY=y
CONFIG_DP83822_PHY=y
CONFIG_DP83TC811_PHY=y
CONFIG_DP83848_PHY=y
CONFIG_DP83867_PHY=y
CONFIG_DP83869_PHY=y
CONFIG_DP83TD510_PHY=y
CONFIG_VITESSE_PHY=y
CONFIG_XILINX_GMII2RGMII=y
CONFIG_MICREL_KS8995MA=y
CONFIG_PSE_CONTROLLER=y
CONFIG_PSE_REGULATOR=y
CONFIG_CAN_DEV=y
CONFIG_CAN_VCAN=y
CONFIG_CAN_VXCAN=y
CONFIG_CAN_NETLINK=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_RX_OFFLOAD=y
CONFIG_CAN_AT91=y
CONFIG_CAN_CAN327=y
CONFIG_CAN_FLEXCAN=y
CONFIG_CAN_GRCAN=y
CONFIG_CAN_JANZ_ICAN3=y
CONFIG_CAN_KVASER_PCIEFD=y
CONFIG_CAN_SLCAN=y
CONFIG_CAN_SUN4I=y
CONFIG_CAN_XILINXCAN=y
CONFIG_CAN_C_CAN=y
CONFIG_CAN_C_CAN_PLATFORM=y
CONFIG_CAN_C_CAN_PCI=y
CONFIG_CAN_CC770=y
CONFIG_CAN_CC770_ISA=y
CONFIG_CAN_CC770_PLATFORM=y
CONFIG_CAN_CTUCANFD=y
CONFIG_CAN_CTUCANFD_PCI=y
CONFIG_CAN_CTUCANFD_PLATFORM=y
CONFIG_CAN_IFI_CANFD=y
CONFIG_CAN_M_CAN=y
CONFIG_CAN_M_CAN_PCI=y
CONFIG_CAN_M_CAN_PLATFORM=y
CONFIG_CAN_M_CAN_TCAN4X5X=y
CONFIG_CAN_PEAK_PCIEFD=y
CONFIG_CAN_RCAR=y
CONFIG_CAN_RCAR_CANFD=y
CONFIG_CAN_SJA1000=y
CONFIG_CAN_EMS_PCI=y
CONFIG_CAN_EMS_PCMCIA=y
CONFIG_CAN_F81601=y
CONFIG_CAN_KVASER_PCI=y
CONFIG_CAN_PEAK_PCI=y
CONFIG_CAN_PEAK_PCIEC=y
CONFIG_CAN_PEAK_PCMCIA=y
CONFIG_CAN_PLX_PCI=y
CONFIG_CAN_SJA1000_ISA=y
CONFIG_CAN_SJA1000_PLATFORM=y
CONFIG_CAN_TSCAN1=y
CONFIG_CAN_SOFTING=y
CONFIG_CAN_SOFTING_CS=y

#
# CAN SPI interfaces
#
CONFIG_CAN_HI311X=y
CONFIG_CAN_MCP251X=y
CONFIG_CAN_MCP251XFD=y
CONFIG_CAN_MCP251XFD_SANITY=y

# end of CAN SPI interfaces

#
# CAN USB interfaces
#
CONFIG_CAN_8DEV_USB=y
CONFIG_CAN_EMS_USB=y
CONFIG_CAN_ESD_USB=y
CONFIG_CAN_ETAS_ES58X=y
CONFIG_CAN_GS_USB=y
CONFIG_CAN_KVASER_USB=y
CONFIG_CAN_MCBA_USB=y
CONFIG_CAN_PEAK_USB=y
CONFIG_CAN_UCAN=y

# end of CAN USB interfaces

CONFIG_CAN_DEBUG_DEVICES=y

#
# MCTP Device Drivers
#
CONFIG_MCTP_SERIAL=y
CONFIG_MCTP_TRANSPORT_I2C=y

# end of MCTP Device Drivers

CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_BUS=y
CONFIG_FWNODE_MDIO=y
CONFIG_OF_MDIO=y
CONFIG_MDIO_DEVRES=y
CONFIG_MDIO_SUN4I=y
CONFIG_MDIO_XGENE=y
CONFIG_MDIO_ASPEED=y
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_BCM_IPROC=y
CONFIG_MDIO_BCM_UNIMAC=y
CONFIG_MDIO_CAVIUM=y
CONFIG_MDIO_GPIO=y
CONFIG_MDIO_HISI_FEMAC=y
CONFIG_MDIO_I2C=y
CONFIG_MDIO_MVUSB=y
CONFIG_MDIO_MSCC_MIIM=y
CONFIG_MDIO_MOXART=y
CONFIG_MDIO_OCTEON=y
CONFIG_MDIO_IPQ4019=y
CONFIG_MDIO_IPQ8064=y
CONFIG_MDIO_THUNDER=y

#
# MDIO Multiplexers
#
CONFIG_MDIO_BUS_MUX=y
CONFIG_MDIO_BUS_MUX_MESON_G12A=y
CONFIG_MDIO_BUS_MUX_BCM6368=y
CONFIG_MDIO_BUS_MUX_BCM_IPROC=y
CONFIG_MDIO_BUS_MUX_GPIO=y
CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y
CONFIG_MDIO_BUS_MUX_MMIOREG=y

#
# PCS device drivers
#
CONFIG_PCS_XPCS=y
CONFIG_PCS_LYNX=y
CONFIG_PCS_RZN1_MIIC=y
CONFIG_PCS_ALTERA_TSE=y

# end of PCS device drivers

CONFIG_PLIP=y
CONFIG_PPP=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_MPPE=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPPOATM=y
CONFIG_PPPOE=y
CONFIG_PPTP=y
CONFIG_PPPOL2TP=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_SLIP=y
CONFIG_SLHC=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLIP_SMART=y
CONFIG_SLIP_MODE_SLIP6=y
CONFIG_USB_NET_DRIVERS=y
CONFIG_USB_CATC=y
CONFIG_USB_KAWETH=y
CONFIG_USB_PEGASUS=y
CONFIG_USB_RTL8150=y
CONFIG_USB_RTL8152=y
CONFIG_USB_LAN78XX=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_AX88179_178A=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_HUAWEI_CDC_NCM=y
CONFIG_USB_NET_CDC_MBIM=y
CONFIG_USB_NET_DM9601=y
CONFIG_USB_NET_SR9700=y
CONFIG_USB_NET_SR9800=y
CONFIG_USB_NET_SMSC75XX=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_NET_GL620A=y
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_PLUSB=y
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET_ENABLE=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_ALI_M5632=y
CONFIG_USB_AN2720=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_EPSON2888=y
CONFIG_USB_KC2190=y
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_NET_CX82310_ETH=y
CONFIG_USB_NET_KALMIA=y
CONFIG_USB_NET_QMI_WWAN=y
CONFIG_USB_HSO=y
CONFIG_USB_NET_INT51X1=y
CONFIG_USB_CDC_PHONET=y
CONFIG_USB_IPHETH=y
CONFIG_USB_SIERRA_NET=y
CONFIG_USB_VL600=y
CONFIG_USB_NET_CH9200=y
CONFIG_USB_NET_AQC111=y
CONFIG_USB_RTL8153_ECM=y
CONFIG_WLAN=y
CONFIG_WLAN_VENDOR_ADMTEK=y
CONFIG_ADM8211=y
CONFIG_ATH_COMMON=y
CONFIG_WLAN_VENDOR_ATH=y
CONFIG_ATH_DEBUG=y
CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS=y
CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING=y
CONFIG_ATH5K=y
CONFIG_ATH5K_DEBUG=y
CONFIG_ATH5K_PCI=y
CONFIG_ATH5K_TEST_CHANNELS=y
CONFIG_ATH9K_HW=y
CONFIG_ATH9K_COMMON=y
CONFIG_ATH9K_COMMON_DEBUG=y
CONFIG_ATH9K_DFS_DEBUGFS=y
CONFIG_ATH9K_BTCOEX_SUPPORT=y
CONFIG_ATH9K=y
CONFIG_ATH9K_PCI=y
CONFIG_ATH9K_AHB=y
CONFIG_ATH9K_DEBUGFS=y
CONFIG_ATH9K_STATION_STATISTICS=y
CONFIG_ATH9K_TX99=y
CONFIG_ATH9K_DFS_CERTIFIED=y
CONFIG_ATH9K_DYNACK=y
CONFIG_ATH9K_RFKILL=y
CONFIG_ATH9K_CHANNEL_CONTEXT=y
CONFIG_ATH9K_PCOEM=y
CONFIG_ATH9K_PCI_NO_EEPROM=y
CONFIG_ATH9K_HTC=y
CONFIG_ATH9K_HTC_DEBUGFS=y
CONFIG_ATH9K_HWRNG=y
CONFIG_ATH9K_COMMON_SPECTRAL=y
CONFIG_CARL9170=y
CONFIG_CARL9170_LEDS=y
CONFIG_CARL9170_DEBUGFS=y
CONFIG_CARL9170_WPC=y
CONFIG_CARL9170_HWRNG=y
CONFIG_ATH6KL=y
CONFIG_ATH6KL_SDIO=y
CONFIG_ATH6KL_USB=y
CONFIG_ATH6KL_DEBUG=y
CONFIG_ATH6KL_REGDOMAIN=y
CONFIG_AR5523=y
CONFIG_WIL6210=y
CONFIG_WIL6210_ISR_COR=y
CONFIG_WIL6210_DEBUGFS=y
CONFIG_ATH10K=y
CONFIG_ATH10K_CE=y
CONFIG_ATH10K_PCI=y
CONFIG_ATH10K_AHB=y
CONFIG_ATH10K_SDIO=y
CONFIG_ATH10K_USB=y
CONFIG_ATH10K_SNOC=y
CONFIG_ATH10K_DEBUG=y
CONFIG_ATH10K_DEBUGFS=y
CONFIG_ATH10K_SPECTRAL=y
CONFIG_ATH10K_DFS_CERTIFIED=y
CONFIG_WCN36XX=y
CONFIG_WCN36XX_DEBUGFS=y
CONFIG_ATH11K=y
CONFIG_ATH11K_AHB=y
CONFIG_ATH11K_PCI=y
CONFIG_ATH11K_DEBUG=y
CONFIG_ATH11K_DEBUGFS=y
CONFIG_ATH11K_SPECTRAL=y
CONFIG_WLAN_VENDOR_ATMEL=y
CONFIG_ATMEL=y
CONFIG_PCI_ATMEL=y
CONFIG_PCMCIA_ATMEL=y
CONFIG_AT76C50X_USB=y
CONFIG_WLAN_VENDOR_BROADCOM=y
CONFIG_B43=y
CONFIG_B43_BCMA=y
CONFIG_B43_SSB=y
CONFIG_B43_BUSES_BCMA_AND_SSB=y
# CONFIG_B43_BUSES_BCMA is not set
# CONFIG_B43_BUSES_SSB is not set
CONFIG_B43_PCI_AUTOSELECT=y
CONFIG_B43_PCICORE_AUTOSELECT=y
CONFIG_B43_SDIO=y
CONFIG_B43_BCMA_PIO=y
CONFIG_B43_PIO=y
CONFIG_B43_PHY_G=y
CONFIG_B43_PHY_N=y
CONFIG_B43_PHY_LP=y
CONFIG_B43_PHY_HT=y
CONFIG_B43_LEDS=y
CONFIG_B43_HWRNG=y
CONFIG_B43_DEBUG=y
CONFIG_B43LEGACY=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
CONFIG_B43LEGACY_LEDS=y
CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y
# CONFIG_B43LEGACY_DMA_MODE is not set
# CONFIG_B43LEGACY_PIO_MODE is not set
CONFIG_BRCMUTIL=y
CONFIG_BRCMSMAC=y
CONFIG_BRCMSMAC_LEDS=y
CONFIG_BRCMFMAC=y
CONFIG_BRCMFMAC_PROTO_BCDC=y
CONFIG_BRCMFMAC_PROTO_MSGBUF=y
CONFIG_BRCMFMAC_SDIO=y
CONFIG_BRCMFMAC_USB=y
CONFIG_BRCMFMAC_PCIE=y
CONFIG_BRCM_TRACING=y
CONFIG_BRCMDBG=y
CONFIG_WLAN_VENDOR_CISCO=y
CONFIG_AIRO=y
CONFIG_AIRO_CS=y
CONFIG_WLAN_VENDOR_INTEL=y
CONFIG_IPW2100=y
CONFIG_IPW2100_MONITOR=y
CONFIG_IPW2100_DEBUG=y
CONFIG_IPW2200=y
CONFIG_IPW2200_MONITOR=y
CONFIG_IPW2200_RADIOTAP=y
CONFIG_IPW2200_PROMISCUOUS=y
CONFIG_IPW2200_QOS=y
CONFIG_IPW2200_DEBUG=y
CONFIG_LIBIPW=y
CONFIG_LIBIPW_DEBUG=y
CONFIG_IWLEGACY=y
CONFIG_IWL4965=y
CONFIG_IWL3945=y

#

# iwl3945 / iwl4965 Debugging Options
#
CONFIG_IWLEGACY_DEBUG=y
CONFIG_IWLEGACY_DEBUGFS=y
# end of iwl3945 / iwl4965 Debugging Options

CONFIG_IWLWIFI=y
CONFIG_IWLWIFI_LEDS=y
CONFIG_IWLDVM=y
CONFIG_IWLMVM=y

#
# Debugging Options
#
CONFIG_IWLWIFI_DEBUG=y
CONFIG_IWLWIFI_DEBUGFS=y

# end of Debugging Options

CONFIG_WLAN_VENDOR_INTERSIL=y
CONFIG_HOSTAP=y
CONFIG_HOSTAP_FIRMWARE=y
CONFIG_HOSTAP_FIRMWARE_NVRAM=y
CONFIG_HOSTAP_PLX=y
CONFIG_HOSTAP_PCI=y
CONFIG_HOSTAP_CS=y
CONFIG_HERMES=y
CONFIG_HERMES_PRISM=y
CONFIG_HERMES_CACHE_FW_ON_INIT=y
CONFIG_PLX_HERMES=y
CONFIG_TMD_HERMES=y
CONFIG_NORTEL_HERMES=y
CONFIG_PCI_HERMES=y
CONFIG_PCMCIA_HERMES=y
CONFIG_PCMCIA_SPECTRUM=y
CONFIG_ORINOCO_USB=y
CONFIG_P54_COMMON=y
CONFIG_P54_USB=y
CONFIG_P54_PCI=y
CONFIG_P54_SPI=y
CONFIG_P54_SPI_DEFAULT_EEPROM=y
CONFIG_P54_LEDS=y
CONFIG_WLAN_VENDOR_MARVELL=y
CONFIG_LIBERTAS=y
CONFIG_LIBERTAS_USB=y
CONFIG_LIBERTAS_CS=y
CONFIG_LIBERTAS_SDIO=y
CONFIG_LIBERTAS_SPI=y
CONFIG_LIBERTAS_DEBUG=y
CONFIG_LIBERTAS_MESH=y
CONFIG_LIBERTAS_THINFIRM=y
CONFIG_LIBERTAS_THINFIRM_DEBUG=y
CONFIG_LIBERTAS_THINFIRM_USB=y
CONFIG_MWIFIEX=y
CONFIG_MWIFIEX_SDIO=y
CONFIG_MWIFIEX_PCIE=y
CONFIG_MWIFIEX_USB=y
CONFIG_MWL8K=y
CONFIG_WLAN_VENDOR_MEDIATEK=y
CONFIG_MT7601U=y
CONFIG_MT76_CORE=y
CONFIG_MT76_LEDS=y
CONFIG_MT76_USB=y
CONFIG_MT76_SDIO=y
CONFIG_MT76x02_LIB=y
CONFIG_MT76x02_USB=y
CONFIG_MT76_CONNAC_LIB=y
CONFIG_MT76x0_COMMON=y
CONFIG_MT76x0U=y
CONFIG_MT76x0E=y
CONFIG_MT76x2_COMMON=y
CONFIG_MT76x2E=y
CONFIG_MT76x2U=y
CONFIG_MT7603E=y
CONFIG_MT7615_COMMON=y
CONFIG_MT7615E=y
CONFIG_MT7622_WMAC=y
CONFIG_MT7663_USB_SDIO_COMMON=y
CONFIG_MT7663U=y
CONFIG_MT7663S=y
CONFIG_MT7915E=y
CONFIG_MT7986_WMAC=y
CONFIG_MT7921_COMMON=y
CONFIG_MT7921E=y
CONFIG_MT7921S=y
CONFIG_MT7921U=y
CONFIG_MT7996E=y
CONFIG_WLAN_VENDOR_MICROCHIP=y
CONFIG_WILC1000=y
CONFIG_WILC1000_SDIO=y
CONFIG_WILC1000_SPI=y
CONFIG_WILC1000_HW_OOB_INTR=y
CONFIG_WLAN_VENDOR_PURELIFI=y
CONFIG_PLFXLC=y
CONFIG_WLAN_VENDOR_RALINK=y
CONFIG_RT2X00=y
CONFIG_RT2400PCI=y
CONFIG_RT2500PCI=y
CONFIG_RT61PCI=y
CONFIG_RT2800PCI=y
CONFIG_RT2800PCI_RT33XX=y
CONFIG_RT2800PCI_RT35XX=y
CONFIG_RT2800PCI_RT53XX=y
CONFIG_RT2800PCI_RT3290=y
CONFIG_RT2500USB=y
CONFIG_RT73USB=y
CONFIG_RT2800USB=y
CONFIG_RT2800USB_RT33XX=y
CONFIG_RT2800USB_RT35XX=y
CONFIG_RT2800USB_RT3573=y
CONFIG_RT2800USB_RT53XX=y
CONFIG_RT2800USB_RT55XX=y
CONFIG_RT2800USB_UNKNOWN=y
CONFIG_RT2800_LIB=y
CONFIG_RT2800_LIB_MMIO=y
CONFIG_RT2X00_LIB_MMIO=y
CONFIG_RT2X00_LIB_PCI=y
CONFIG_RT2X00_LIB_USB=y
CONFIG_RT2X00_LIB=y
CONFIG_RT2X00_LIB_FIRMWARE=y
CONFIG_RT2X00_LIB_CRYPTO=y
CONFIG_RT2X00_LIB_LEDS=y
CONFIG_RT2X00_LIB_DEBUGFS=y
CONFIG_RT2X00_DEBUG=y
CONFIG_WLAN_VENDOR_REALTEK=y
CONFIG_RTL8180=y
CONFIG_RTL8187=y
CONFIG_RTL8187_LEDS=y
CONFIG_RTL_CARDS=y
CONFIG_RTL8192CE=y
CONFIG_RTL8192SE=y
CONFIG_RTL8192DE=y
CONFIG_RTL8723AE=y
CONFIG_RTL8723BE=y
CONFIG_RTL8188EE=y
CONFIG_RTL8192EE=y
CONFIG_RTL8821AE=y
CONFIG_RTL8192CU=y
CONFIG_RTLWIFI=y
CONFIG_RTLWIFI_PCI=y
CONFIG_RTLWIFI_USB=y
CONFIG_RTLWIFI_DEBUG=y
CONFIG_RTL8192C_COMMON=y
CONFIG_RTL8723_COMMON=y
CONFIG_RTLBTCOEXIST=y
CONFIG_RTL8XXXU=y
CONFIG_RTL8XXXU_UNTESTED=y
CONFIG_RTW88=y
CONFIG_RTW88_CORE=y
CONFIG_RTW88_PCI=y
CONFIG_RTW88_USB=y
CONFIG_RTW88_8822B=y
CONFIG_RTW88_8822C=y
CONFIG_RTW88_8723D=y
CONFIG_RTW88_8821C=y
CONFIG_RTW88_8822BE=y
CONFIG_RTW88_8822BU=y
CONFIG_RTW88_8822CE=y
CONFIG_RTW88_8822CU=y
CONFIG_RTW88_8723DE=y
CONFIG_RTW88_8723DU=y
CONFIG_RTW88_8821CE=y
CONFIG_RTW88_8821CU=y
CONFIG_RTW88_DEBUG=y
CONFIG_RTW88_DEBUGFS=y
CONFIG_RTW89=y
CONFIG_RTW89_CORE=y
CONFIG_RTW89_PCI=y
CONFIG_RTW89_8852A=y
CONFIG_RTW89_8852B=y
CONFIG_RTW89_8852C=y
CONFIG_RTW89_8852AE=y
CONFIG_RTW89_8852BE=y
CONFIG_RTW89_8852CE=y
CONFIG_RTW89_DEBUG=y
CONFIG_RTW89_DEBUGMSG=y
CONFIG_RTW89_DEBUGFS=y
CONFIG_WLAN_VENDOR_RSI=y
CONFIG_RSI_91X=y
CONFIG_RSI_DEBUGFS=y
CONFIG_RSI_SDIO=y
CONFIG_RSI_USB=y
CONFIG_RSI_COEX=y
CONFIG_WLAN_VENDOR_SILABS=y
CONFIG_WFX=y
CONFIG_WLAN_VENDOR_ST=y
CONFIG_CW1200=y
CONFIG_CW1200_WLAN_SDIO=y
CONFIG_CW1200_WLAN_SPI=y
CONFIG_WLAN_VENDOR_TI=y
CONFIG_WL1251=y
CONFIG_WL1251_SPI=y
CONFIG_WL1251_SDIO=y
CONFIG_WL12XX=y
CONFIG_WL18XX=y
CONFIG_WLCORE=y
CONFIG_WLCORE_SPI=y
CONFIG_WLCORE_SDIO=y
CONFIG_WLAN_VENDOR_ZYDAS=y
CONFIG_USB_ZD1201=y
CONFIG_ZD1211RW=y
CONFIG_ZD1211RW_DEBUG=y
CONFIG_WLAN_VENDOR_QUANTENNA=y
CONFIG_QTNFMAC=y
CONFIG_QTNFMAC_PCIE=y
CONFIG_PCMCIA_RAYCS=y
CONFIG_PCMCIA_WL3501=y
CONFIG_MAC80211_HWSIM=y
CONFIG_USB_NET_RNDIS_WLAN=y
CONFIG_VIRT_WIFI=y
CONFIG_WAN=y
CONFIG_HDLC=y
CONFIG_HDLC_RAW=y
CONFIG_HDLC_RAW_ETH=y
CONFIG_HDLC_CISCO=y
CONFIG_HDLC_FR=y
CONFIG_HDLC_PPP=y
CONFIG_HDLC_X25=y
CONFIG_PCI200SYN=y
CONFIG_WANXL=y
CONFIG_PC300TOO=y
CONFIG_N2=y
CONFIG_C101=y
CONFIG_FARSYNC=y
CONFIG_FSL_UCC_HDLC=y
CONFIG_SLIC_DS26522=y
CONFIG_LAPBETHER=y
CONFIG_IEEE802154_DRIVERS=y
CONFIG_IEEE802154_FAKELB=y
CONFIG_IEEE802154_AT86RF230=y
CONFIG_IEEE802154_MRF24J40=y
CONFIG_IEEE802154_CC2520=y
CONFIG_IEEE802154_ATUSB=y
CONFIG_IEEE802154_ADF7242=y
CONFIG_IEEE802154_CA8210=y
CONFIG_IEEE802154_CA8210_DEBUGFS=y
CONFIG_IEEE802154_MCR20A=y
CONFIG_IEEE802154_HWSIM=y

#
# Wireless WAN
#
CONFIG_WWAN=y
CONFIG_WWAN_DEBUGFS=y
CONFIG_WWAN_HWSIM=y
CONFIG_MHI_WWAN_CTRL=y
CONFIG_MHI_WWAN_MBIM=y
CONFIG_QCOM_BAM_DMUX=y
CONFIG_RPMSG_WWAN_CTRL=y
CONFIG_IOSM=y
CONFIG_MTK_T7XX=y

# end of Wireless WAN

CONFIG_VMXNET3=y
CONFIG_USB4_NET=y
CONFIG_NETDEVSIM=y
CONFIG_NET_FAILOVER=y
CONFIG_NETDEV_LEGACY_INIT=y
CONFIG_ISDN=y
CONFIG_ISDN_CAPI=y
CONFIG_CAPI_TRACE=y
CONFIG_ISDN_CAPI_MIDDLEWARE=y
CONFIG_MISDN=y
CONFIG_MISDN_DSP=y
CONFIG_MISDN_L1OIP=y

#
# mISDN hardware drivers
#
CONFIG_MISDN_HFCPCI=y
CONFIG_MISDN_HFCMULTI=y
CONFIG_MISDN_HFCUSB=y
CONFIG_MISDN_AVMFRITZ=y
CONFIG_MISDN_SPEEDFAX=y
CONFIG_MISDN_INFINEON=y
CONFIG_MISDN_W6692=y
CONFIG_MISDN_NETJET=y
CONFIG_MISDN_HDLC=y
CONFIG_MISDN_IPAC=y
CONFIG_MISDN_ISAR=y

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_LEDS=y
CONFIG_INPUT_FF_MEMLESS=y
CONFIG_INPUT_SPARSEKMAP=y
CONFIG_INPUT_MATRIXKMAP=y
CONFIG_INPUT_VIVALDIFMAP=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
CONFIG_INPUT_JOYDEV=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ADC=y
CONFIG_KEYBOARD_ADP5520=y
CONFIG_KEYBOARD_ADP5588=y
CONFIG_KEYBOARD_ADP5589=y
CONFIG_KEYBOARD_ATKBD=y
CONFIG_KEYBOARD_QT1050=y
CONFIG_KEYBOARD_QT1070=y
CONFIG_KEYBOARD_QT2160=y
CONFIG_KEYBOARD_CLPS711X=y
CONFIG_KEYBOARD_DLINK_DIR685=y
CONFIG_KEYBOARD_LKKBD=y
CONFIG_KEYBOARD_EP93XX=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_GPIO_POLLED=y
CONFIG_KEYBOARD_TCA6416=y
CONFIG_KEYBOARD_TCA8418=y
CONFIG_KEYBOARD_MATRIX=y
CONFIG_KEYBOARD_LM8323=y
CONFIG_KEYBOARD_LM8333=y
CONFIG_KEYBOARD_LPC32XX=y
CONFIG_KEYBOARD_MAX7359=y
CONFIG_KEYBOARD_MCS=y
CONFIG_KEYBOARD_MPR121=y
CONFIG_KEYBOARD_SNVS_PWRKEY=y
CONFIG_KEYBOARD_IMX=y
CONFIG_KEYBOARD_IMX_SC_KEY=y
CONFIG_KEYBOARD_NEWTON=y
CONFIG_KEYBOARD_NOMADIK=y
CONFIG_KEYBOARD_TEGRA=y
CONFIG_KEYBOARD_OPENCORES=y
CONFIG_KEYBOARD_PINEPHONE=y
CONFIG_KEYBOARD_PXA27x=y
CONFIG_KEYBOARD_PMIC8XXX=y
CONFIG_KEYBOARD_SAMSUNG=y
CONFIG_KEYBOARD_GOLDFISH_EVENTS=y
CONFIG_KEYBOARD_STOWAWAY=y
CONFIG_KEYBOARD_ST_KEYSCAN=y
CONFIG_KEYBOARD_SUNKBD=y
CONFIG_KEYBOARD_SH_KEYSC=y
CONFIG_KEYBOARD_STMPE=y
CONFIG_KEYBOARD_IQS62X=y
CONFIG_KEYBOARD_OMAP4=y
CONFIG_KEYBOARD_SPEAR=y
CONFIG_KEYBOARD_TC3589X=y
CONFIG_KEYBOARD_TM2_TOUCHKEY=y
CONFIG_KEYBOARD_TWL4030=y
CONFIG_KEYBOARD_XTKBD=y
CONFIG_KEYBOARD_CROS_EC=y
CONFIG_KEYBOARD_CAP11XX=y
CONFIG_KEYBOARD_BCM=y
CONFIG_KEYBOARD_MT6779=y
CONFIG_KEYBOARD_MTK_PMIC=y
CONFIG_KEYBOARD_CYPRESS_SF=y
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_BYD=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y
CONFIG_MOUSE_PS2_CYPRESS=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_MOUSE_PS2_ELANTECH_SMBUS=y
CONFIG_MOUSE_PS2_SENTELIC=y
CONFIG_MOUSE_PS2_TOUCHKIT=y
CONFIG_MOUSE_PS2_FOCALTECH=y
CONFIG_MOUSE_PS2_SMBUS=y
CONFIG_MOUSE_SERIAL=y
CONFIG_MOUSE_APPLETOUCH=y
CONFIG_MOUSE_BCM5974=y
CONFIG_MOUSE_CYAPA=y
CONFIG_MOUSE_ELAN_I2C=y
CONFIG_MOUSE_ELAN_I2C_I2C=y
CONFIG_MOUSE_ELAN_I2C_SMBUS=y
CONFIG_MOUSE_INPORT=y
CONFIG_MOUSE_ATIXL=y
CONFIG_MOUSE_LOGIBM=y
CONFIG_MOUSE_PC110PAD=y
CONFIG_MOUSE_VSXXXAA=y
CONFIG_MOUSE_GPIO=y
CONFIG_MOUSE_SYNAPTICS_I2C=y
CONFIG_MOUSE_SYNAPTICS_USB=y
CONFIG_INPUT_JOYSTICK=y
CONFIG_JOYSTICK_ANALOG=y
CONFIG_JOYSTICK_A3D=y
CONFIG_JOYSTICK_ADC=y
CONFIG_JOYSTICK_ADI=y
CONFIG_JOYSTICK_COBRA=y
CONFIG_JOYSTICK_GF2K=y
CONFIG_JOYSTICK_GRIP=y
CONFIG_JOYSTICK_GRIP_MP=y
CONFIG_JOYSTICK_GUILLEMOT=y
CONFIG_JOYSTICK_INTERACT=y
CONFIG_JOYSTICK_SIDEWINDER=y
CONFIG_JOYSTICK_TMDC=y
CONFIG_JOYSTICK_IFORCE=y
CONFIG_JOYSTICK_IFORCE_USB=y
CONFIG_JOYSTICK_IFORCE_232=y
CONFIG_JOYSTICK_WARRIOR=y
CONFIG_JOYSTICK_MAGELLAN=y
CONFIG_JOYSTICK_SPACEORB=y
CONFIG_JOYSTICK_SPACEBALL=y
CONFIG_JOYSTICK_STINGER=y
CONFIG_JOYSTICK_TWIDJOY=y
CONFIG_JOYSTICK_ZHENHUA=y
CONFIG_JOYSTICK_DB9=y
CONFIG_JOYSTICK_GAMECON=y
CONFIG_JOYSTICK_TURBOGRAFX=y
CONFIG_JOYSTICK_AS5011=y
CONFIG_JOYSTICK_JOYDUMP=y
CONFIG_JOYSTICK_XPAD=y
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y
CONFIG_JOYSTICK_WALKERA0701=y
CONFIG_JOYSTICK_PSXPAD_SPI=y
CONFIG_JOYSTICK_PSXPAD_SPI_FF=y
CONFIG_JOYSTICK_PXRC=y
CONFIG_JOYSTICK_QWIIC=y
CONFIG_JOYSTICK_FSIA6B=y
CONFIG_JOYSTICK_SENSEHAT=y
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
CONFIG_TABLET_USB_AIPTEK=y
CONFIG_TABLET_USB_HANWANG=y
CONFIG_TABLET_USB_KBTAB=y
CONFIG_TABLET_USB_PEGASUS=y
CONFIG_TABLET_SERIAL_WACOM4=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_88PM860X=y
CONFIG_TOUCHSCREEN_ADS7846=y
CONFIG_TOUCHSCREEN_AD7877=y
CONFIG_TOUCHSCREEN_AD7879=y
CONFIG_TOUCHSCREEN_AD7879_I2C=y
CONFIG_TOUCHSCREEN_AD7879_SPI=y
CONFIG_TOUCHSCREEN_ADC=y
CONFIG_TOUCHSCREEN_AR1021_I2C=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=y
CONFIG_TOUCHSCREEN_ATMEL_MXT_T37=y
CONFIG_TOUCHSCREEN_AUO_PIXCIR=y
CONFIG_TOUCHSCREEN_BU21013=y
CONFIG_TOUCHSCREEN_BU21029=y
CONFIG_TOUCHSCREEN_CHIPONE_ICN8318=y
CONFIG_TOUCHSCREEN_CY8CTMA140=y
CONFIG_TOUCHSCREEN_CY8CTMG110=y
CONFIG_TOUCHSCREEN_CYTTSP_CORE=y
CONFIG_TOUCHSCREEN_CYTTSP_I2C=y
CONFIG_TOUCHSCREEN_CYTTSP_SPI=y
CONFIG_TOUCHSCREEN_CYTTSP4_CORE=y
CONFIG_TOUCHSCREEN_CYTTSP4_I2C=y
CONFIG_TOUCHSCREEN_CYTTSP4_SPI=y
CONFIG_TOUCHSCREEN_CYTTSP5=y
CONFIG_TOUCHSCREEN_DA9034=y
CONFIG_TOUCHSCREEN_DA9052=y
CONFIG_TOUCHSCREEN_DYNAPRO=y
CONFIG_TOUCHSCREEN_HAMPSHIRE=y
CONFIG_TOUCHSCREEN_EETI=y
CONFIG_TOUCHSCREEN_EGALAX=y
CONFIG_TOUCHSCREEN_EGALAX_SERIAL=y
CONFIG_TOUCHSCREEN_EXC3000=y
CONFIG_TOUCHSCREEN_FUJITSU=y
CONFIG_TOUCHSCREEN_GOODIX=y
CONFIG_TOUCHSCREEN_HIDEEP=y
CONFIG_TOUCHSCREEN_HYCON_HY46XX=y
CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX=y
CONFIG_TOUCHSCREEN_ILI210X=y
CONFIG_TOUCHSCREEN_ILITEK=y
CONFIG_TOUCHSCREEN_IPROC=y
CONFIG_TOUCHSCREEN_S6SY761=y
CONFIG_TOUCHSCREEN_GUNZE=y
CONFIG_TOUCHSCREEN_EKTF2127=y
CONFIG_TOUCHSCREEN_ELAN=y
CONFIG_TOUCHSCREEN_ELO=y
CONFIG_TOUCHSCREEN_WACOM_W8001=y
CONFIG_TOUCHSCREEN_WACOM_I2C=y
CONFIG_TOUCHSCREEN_MAX11801=y
CONFIG_TOUCHSCREEN_MCS5000=y
CONFIG_TOUCHSCREEN_MMS114=y
CONFIG_TOUCHSCREEN_MELFAS_MIP4=y
CONFIG_TOUCHSCREEN_MSG2638=y
CONFIG_TOUCHSCREEN_MTOUCH=y
CONFIG_TOUCHSCREEN_IMAGIS=y
CONFIG_TOUCHSCREEN_IMX6UL_TSC=y
CONFIG_TOUCHSCREEN_INEXIO=y
CONFIG_TOUCHSCREEN_MK712=y
CONFIG_TOUCHSCREEN_HTCPEN=y
CONFIG_TOUCHSCREEN_PENMOUNT=y
CONFIG_TOUCHSCREEN_EDT_FT5X06=y
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=y
CONFIG_TOUCHSCREEN_MIGOR=y
CONFIG_TOUCHSCREEN_TOUCHRIGHT=y
CONFIG_TOUCHSCREEN_TOUCHWIN=y
CONFIG_TOUCHSCREEN_TI_AM335X_TSC=y
CONFIG_TOUCHSCREEN_UCB1400=y
CONFIG_TOUCHSCREEN_PIXCIR=y
CONFIG_TOUCHSCREEN_WDT87XX_I2C=y
CONFIG_TOUCHSCREEN_WM831X=y
CONFIG_TOUCHSCREEN_WM97XX=y
CONFIG_TOUCHSCREEN_WM9705=y
CONFIG_TOUCHSCREEN_WM9712=y
CONFIG_TOUCHSCREEN_WM9713=y
CONFIG_TOUCHSCREEN_USB_COMPOSITE=y
CONFIG_TOUCHSCREEN_MXS_LRADC=y
CONFIG_TOUCHSCREEN_MX25=y
CONFIG_TOUCHSCREEN_MC13783=y
CONFIG_TOUCHSCREEN_USB_EGALAX=y
CONFIG_TOUCHSCREEN_USB_PANJIT=y
CONFIG_TOUCHSCREEN_USB_3M=y
CONFIG_TOUCHSCREEN_USB_ITM=y
CONFIG_TOUCHSCREEN_USB_ETURBO=y
CONFIG_TOUCHSCREEN_USB_GUNZE=y
CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y
CONFIG_TOUCHSCREEN_USB_IRTOUCH=y
CONFIG_TOUCHSCREEN_USB_IDEALTEK=y
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
CONFIG_TOUCHSCREEN_USB_GOTOP=y
CONFIG_TOUCHSCREEN_USB_JASTEC=y
CONFIG_TOUCHSCREEN_USB_ELO=y
CONFIG_TOUCHSCREEN_USB_E2I=y
CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y
CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y
CONFIG_TOUCHSCREEN_USB_NEXIO=y
CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y
CONFIG_TOUCHSCREEN_TOUCHIT213=y
CONFIG_TOUCHSCREEN_TS4800=y
CONFIG_TOUCHSCREEN_TSC_SERIO=y
CONFIG_TOUCHSCREEN_TSC200X_CORE=y
CONFIG_TOUCHSCREEN_TSC2004=y
CONFIG_TOUCHSCREEN_TSC2005=y
CONFIG_TOUCHSCREEN_TSC2007=y
CONFIG_TOUCHSCREEN_TSC2007_IIO=y
CONFIG_TOUCHSCREEN_PCAP=y
CONFIG_TOUCHSCREEN_RM_TS=y
CONFIG_TOUCHSCREEN_SILEAD=y
CONFIG_TOUCHSCREEN_SIS_I2C=y
CONFIG_TOUCHSCREEN_ST1232=y
CONFIG_TOUCHSCREEN_STMFTS=y
CONFIG_TOUCHSCREEN_STMPE=y
CONFIG_TOUCHSCREEN_SUN4I=y
CONFIG_TOUCHSCREEN_SUR40=y
CONFIG_TOUCHSCREEN_SURFACE3_SPI=y
CONFIG_TOUCHSCREEN_SX8654=y
CONFIG_TOUCHSCREEN_TPS6507X=y
CONFIG_TOUCHSCREEN_ZET6223=y
CONFIG_TOUCHSCREEN_ZFORCE=y
CONFIG_TOUCHSCREEN_COLIBRI_VF50=y
CONFIG_TOUCHSCREEN_ROHM_BU21023=y
CONFIG_TOUCHSCREEN_IQS5XX=y
CONFIG_TOUCHSCREEN_ZINITIX=y
CONFIG_TOUCHSCREEN_HIMAX_HX83112B=y
CONFIG_INPUT_MISC=y
CONFIG_INPUT_88PM860X_ONKEY=y
CONFIG_INPUT_88PM80X_ONKEY=y
CONFIG_INPUT_AD714X=y
CONFIG_INPUT_AD714X_I2C=y
CONFIG_INPUT_AD714X_SPI=y
CONFIG_INPUT_ARIEL_PWRBUTTON=y
CONFIG_INPUT_ARIZONA_HAPTICS=y
CONFIG_INPUT_ATC260X_ONKEY=y
CONFIG_INPUT_ATMEL_CAPTOUCH=y
CONFIG_INPUT_BMA150=y
CONFIG_INPUT_E3X0_BUTTON=y
CONFIG_INPUT_PCSPKR=y
CONFIG_INPUT_PM8941_PWRKEY=y
CONFIG_INPUT_PM8XXX_VIBRATOR=y
CONFIG_INPUT_PMIC8XXX_PWRKEY=y
CONFIG_INPUT_MAX77650_ONKEY=y
CONFIG_INPUT_MAX77693_HAPTIC=y
CONFIG_INPUT_MAX8925_ONKEY=y
CONFIG_INPUT_MAX8997_HAPTIC=y
CONFIG_INPUT_MC13783_PWRBUTTON=y
CONFIG_INPUT_MMA8450=y
CONFIG_INPUT_GPIO_BEEPER=y
CONFIG_INPUT_GPIO_DECODER=y
CONFIG_INPUT_GPIO_VIBRA=y
CONFIG_INPUT_CPCAP_PWRBUTTON=y
CONFIG_INPUT_ATI_REMOTE2=y
CONFIG_INPUT_KEYSPAN_REMOTE=y
CONFIG_INPUT_KXTJ9=y
CONFIG_INPUT_POWERMATE=y
CONFIG_INPUT_YEALINK=y
CONFIG_INPUT_CM109=y
CONFIG_INPUT_REGULATOR_HAPTIC=y
CONFIG_INPUT_RETU_PWRBUTTON=y
CONFIG_INPUT_TPS65218_PWRBUTTON=y
CONFIG_INPUT_TPS65219_PWRBUTTON=y
CONFIG_INPUT_AXP20X_PEK=y
CONFIG_INPUT_TWL4030_PWRBUTTON=y
CONFIG_INPUT_TWL4030_VIBRA=y
CONFIG_INPUT_TWL6040_VIBRA=y
CONFIG_INPUT_UINPUT=y
CONFIG_INPUT_PALMAS_PWRBUTTON=y
CONFIG_INPUT_PCF50633_PMU=y
CONFIG_INPUT_PCF8574=y
CONFIG_INPUT_PWM_BEEPER=y
CONFIG_INPUT_PWM_VIBRA=y
CONFIG_INPUT_RK805_PWRKEY=y
CONFIG_INPUT_GPIO_ROTARY_ENCODER=y
CONFIG_INPUT_DA7280_HAPTICS=y
CONFIG_INPUT_DA9052_ONKEY=y
CONFIG_INPUT_DA9055_ONKEY=y
CONFIG_INPUT_DA9063_ONKEY=y
CONFIG_INPUT_WM831X_ON=y
CONFIG_INPUT_PCAP=y
CONFIG_INPUT_ADXL34X=y
CONFIG_INPUT_ADXL34X_I2C=y
CONFIG_INPUT_ADXL34X_SPI=y
CONFIG_INPUT_IBM_PANEL=y
CONFIG_INPUT_IMS_PCU=y
CONFIG_INPUT_IQS269A=y
CONFIG_INPUT_IQS626A=y
CONFIG_INPUT_IQS7222=y
CONFIG_INPUT_CMA3000=y
CONFIG_INPUT_CMA3000_I2C=y
CONFIG_INPUT_IDEAPAD_SLIDEBAR=y
CONFIG_INPUT_DRV260X_HAPTICS=y
CONFIG_INPUT_DRV2665_HAPTICS=y
CONFIG_INPUT_DRV2667_HAPTICS=y
CONFIG_INPUT_HISI_POWERKEY=y
CONFIG_INPUT_RAVE_SP_PWRBUTTON=y
CONFIG_INPUT_SC27XX_VIBRA=y
CONFIG_INPUT_RT5120_PWRKEY=y
CONFIG_INPUT_STPMIC1_ONKEY=y
CONFIG_RMI4_CORE=y
CONFIG_RMI4_I2C=y
CONFIG_RMI4_SPI=y
CONFIG_RMI4_SMB=y
CONFIG_RMI4_F03=y
CONFIG_RMI4_F03_SERIO=y
CONFIG_RMI4_2D_SENSOR=y
CONFIG_RMI4_F11=y
CONFIG_RMI4_F12=y
CONFIG_RMI4_F30=y
CONFIG_RMI4_F34=y
CONFIG_RMI4_F3A=y
CONFIG_RMI4_F54=y
CONFIG_RMI4_F55=y

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_PARKBD=y
CONFIG_SERIO_PCIPS2=y
CONFIG_SERIO_LIBPS2=y
CONFIG_SERIO_RAW=y
CONFIG_SERIO_ALTERA_PS2=y
CONFIG_SERIO_PS2MULT=y
CONFIG_SERIO_ARC_PS2=y
CONFIG_SERIO_APBPS2=y
CONFIG_SERIO_OLPC_APSP=y
CONFIG_SERIO_SUN4I_PS2=y
CONFIG_SERIO_GPIO_PS2=y
CONFIG_USERIO=y
CONFIG_GAMEPORT=y
CONFIG_GAMEPORT_NS558=y
CONFIG_GAMEPORT_L4=y
CONFIG_GAMEPORT_EMU10K1=y
CONFIG_GAMEPORT_FM801=y

# end of Hardware I/O ports
# end of Input device support

#
# Character devices
#
CONFIG_TTY=y
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_LEGACY_TIOCSTI=y
CONFIG_LDISC_AUTOLOAD=y

#
# Serial drivers
#
CONFIG_SERIAL_EARLYCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_16550A_VARIANTS=y
CONFIG_SERIAL_8250_FINTEK=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_EXAR=y
CONFIG_SERIAL_8250_CS=y
CONFIG_SERIAL_8250_MEN_MCB=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_FOURPORT=y
CONFIG_SERIAL_8250_ACCENT=y
CONFIG_SERIAL_8250_ASPEED_VUART=y
CONFIG_SERIAL_8250_BOCA=y
CONFIG_SERIAL_8250_EXAR_ST16C554=y
CONFIG_SERIAL_8250_HUB6=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y
CONFIG_SERIAL_8250_DWLIB=y
CONFIG_SERIAL_8250_BCM2835AUX=y
CONFIG_SERIAL_8250_FSL=y
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_8250_EM=y
CONFIG_SERIAL_8250_IOC3=y
CONFIG_SERIAL_8250_RT288X=y
CONFIG_SERIAL_8250_OMAP=y
CONFIG_SERIAL_8250_OMAP_TTYO_FIXUP=y
CONFIG_SERIAL_8250_LPC18XX=y
CONFIG_SERIAL_8250_MT6577=y
CONFIG_SERIAL_8250_UNIPHIER=y
CONFIG_SERIAL_8250_INGENIC=y
CONFIG_SERIAL_8250_LPSS=y
CONFIG_SERIAL_8250_MID=y
CONFIG_SERIAL_8250_PERICOM=y
CONFIG_SERIAL_8250_PXA=y
CONFIG_SERIAL_8250_TEGRA=y
CONFIG_SERIAL_8250_BCM7271=y
CONFIG_SERIAL_OF_PLATFORM=y

#
# Non-8250 serial port support
#
CONFIG_SERIAL_AMBA_PL010=y
CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
CONFIG_SERIAL_ATMEL_PDC=y
CONFIG_SERIAL_ATMEL_TTYAT=y
CONFIG_SERIAL_MESON=y
CONFIG_SERIAL_MESON_CONSOLE=y
CONFIG_SERIAL_CLPS711X=y
CONFIG_SERIAL_CLPS711X_CONSOLE=y
CONFIG_SERIAL_SAMSUNG=y
CONFIG_SERIAL_SAMSUNG_UARTS_4=y
CONFIG_SERIAL_SAMSUNG_UARTS=4
CONFIG_SERIAL_SAMSUNG_CONSOLE=y
CONFIG_SERIAL_TEGRA=y
CONFIG_SERIAL_TEGRA_TCU=y
CONFIG_SERIAL_TEGRA_TCU_CONSOLE=y
CONFIG_SERIAL_MAX3100=y
CONFIG_SERIAL_MAX310X=y
CONFIG_SERIAL_IMX=y
CONFIG_SERIAL_IMX_CONSOLE=y
CONFIG_SERIAL_IMX_EARLYCON=y
CONFIG_SERIAL_UARTLITE=y
CONFIG_SERIAL_UARTLITE_CONSOLE=y
CONFIG_SERIAL_UARTLITE_NR_UARTS=1
CONFIG_SERIAL_SH_SCI=y
CONFIG_SERIAL_SH_SCI_NR_UARTS=2
CONFIG_SERIAL_SH_SCI_CONSOLE=y
CONFIG_SERIAL_SH_SCI_EARLYCON=y
CONFIG_SERIAL_SH_SCI_DMA=y
CONFIG_SERIAL_HS_LPC32XX=y
CONFIG_SERIAL_HS_LPC32XX_CONSOLE=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_SERIAL_ICOM=y
CONFIG_SERIAL_JSM=y
CONFIG_SERIAL_MSM=y
CONFIG_SERIAL_MSM_CONSOLE=y
CONFIG_SERIAL_QCOM_GENI=y
CONFIG_SERIAL_QCOM_GENI_CONSOLE=y
CONFIG_SERIAL_VT8500=y
CONFIG_SERIAL_VT8500_CONSOLE=y
CONFIG_SERIAL_OMAP=y
CONFIG_SERIAL_OMAP_CONSOLE=y
CONFIG_SERIAL_SIFIVE=y
CONFIG_SERIAL_SIFIVE_CONSOLE=y
CONFIG_SERIAL_LANTIQ=y
CONFIG_SERIAL_LANTIQ_CONSOLE=y
CONFIG_SERIAL_QE=y
CONFIG_SERIAL_SCCNXP=y
CONFIG_SERIAL_SCCNXP_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX_CORE=y
CONFIG_SERIAL_SC16IS7XX=y
CONFIG_SERIAL_SC16IS7XX_I2C=y
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_TIMBERDALE=y
CONFIG_SERIAL_BCM63XX=y
CONFIG_SERIAL_BCM63XX_CONSOLE=y
CONFIG_SERIAL_ALTERA_JTAGUART=y
CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE=y
CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS=y
CONFIG_SERIAL_ALTERA_UART=y
CONFIG_SERIAL_ALTERA_UART_MAXPORTS=4
CONFIG_SERIAL_ALTERA_UART_BAUDRATE=115200
CONFIG_SERIAL_ALTERA_UART_CONSOLE=y
CONFIG_SERIAL_PCH_UART=y
CONFIG_SERIAL_PCH_UART_CONSOLE=y
CONFIG_SERIAL_MXS_AUART=y
CONFIG_SERIAL_MXS_AUART_CONSOLE=y
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
CONFIG_SERIAL_MPS2_UART_CONSOLE=y
CONFIG_SERIAL_MPS2_UART=y
CONFIG_SERIAL_ARC=y
CONFIG_SERIAL_ARC_CONSOLE=y
CONFIG_SERIAL_ARC_NR_PORTS=1
CONFIG_SERIAL_RP2=y
CONFIG_SERIAL_RP2_NR_UARTS=32
CONFIG_SERIAL_FSL_LPUART=y
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
CONFIG_SERIAL_FSL_LINFLEXUART=y
CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE=y
CONFIG_SERIAL_CONEXANT_DIGICOLOR=y
CONFIG_SERIAL_CONEXANT_DIGICOLOR_CONSOLE=y
CONFIG_SERIAL_ST_ASC=y
CONFIG_SERIAL_ST_ASC_CONSOLE=y
CONFIG_SERIAL_MEN_Z135=y
CONFIG_SERIAL_SPRD=y
CONFIG_SERIAL_SPRD_CONSOLE=y
CONFIG_SERIAL_STM32=y
CONFIG_SERIAL_STM32_CONSOLE=y
CONFIG_SERIAL_MVEBU_UART=y
CONFIG_SERIAL_MVEBU_CONSOLE=y
CONFIG_SERIAL_OWL=y
CONFIG_SERIAL_OWL_CONSOLE=y
CONFIG_SERIAL_RDA=y
CONFIG_SERIAL_RDA_CONSOLE=y
CONFIG_SERIAL_MILBEAUT_USIO=y
CONFIG_SERIAL_MILBEAUT_USIO_PORTS=4
CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE=y
CONFIG_SERIAL_LITEUART=y
CONFIG_SERIAL_LITEUART_MAX_PORTS=1
CONFIG_SERIAL_LITEUART_CONSOLE=y
CONFIG_SERIAL_SUNPLUS=y
CONFIG_SERIAL_SUNPLUS_CONSOLE=y

# end of Serial drivers

CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_MOXA_INTELLIO=y
CONFIG_MOXA_SMARTIO=y
CONFIG_SYNCLINK_GT=y
CONFIG_N_HDLC=y
CONFIG_GOLDFISH_TTY=y
CONFIG_GOLDFISH_TTY_EARLY_CONSOLE=y
CONFIG_N_GSM=y
CONFIG_NOZOMI=y
CONFIG_NULL_TTY=y
CONFIG_HVC_DRIVER=y
CONFIG_RPMSG_TTY=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
CONFIG_TTY_PRINTK=y
CONFIG_TTY_PRINTK_LEVEL=6
CONFIG_PRINTER=y
CONFIG_LP_CONSOLE=y
CONFIG_PPDEV=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_IPMI_HANDLER=y
CONFIG_IPMI_PLAT_DATA=y
CONFIG_IPMI_PANIC_EVENT=y
CONFIG_IPMI_PANIC_STRING=y
CONFIG_IPMI_DEVICE_INTERFACE=y
CONFIG_IPMI_SI=y
CONFIG_IPMI_SSIF=y
CONFIG_IPMI_IPMB=y
CONFIG_IPMI_WATCHDOG=y
CONFIG_IPMI_POWEROFF=y
CONFIG_IPMI_KCS_BMC=y
CONFIG_ASPEED_KCS_IPMI_BMC=y
CONFIG_NPCM7XX_KCS_IPMI_BMC=y
CONFIG_IPMI_KCS_BMC_CDEV_IPMI=y
CONFIG_IPMI_KCS_BMC_SERIO=y
CONFIG_ASPEED_BT_IPMI_BMC=y
CONFIG_SSIF_IPMI_BMC=y
CONFIG_IPMB_DEVICE_INTERFACE=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_TIMERIOMEM=y
CONFIG_HW_RANDOM_ATMEL=y
CONFIG_HW_RANDOM_BA431=y
CONFIG_HW_RANDOM_BCM2835=y
CONFIG_HW_RANDOM_IPROC_RNG200=y
CONFIG_HW_RANDOM_IXP4XX=y
CONFIG_HW_RANDOM_OMAP=y
CONFIG_HW_RANDOM_OMAP3_ROM=y
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_HW_RANDOM_IMX_RNGC=y
CONFIG_HW_RANDOM_NOMADIK=y
CONFIG_HW_RANDOM_STM32=y
CONFIG_HW_RANDOM_POLARFIRE_SOC=y
CONFIG_HW_RANDOM_MESON=y
CONFIG_HW_RANDOM_MTK=y
CONFIG_HW_RANDOM_EXYNOS=y
CONFIG_HW_RANDOM_NPCM=y
CONFIG_HW_RANDOM_KEYSTONE=y
CONFIG_HW_RANDOM_CCTRNG=y
CONFIG_HW_RANDOM_XIPHERA=y
CONFIG_HW_RANDOM_CN10K=y
CONFIG_DTLK=y
CONFIG_APPLICOM=y

#
# PCMCIA character devices
#
CONFIG_SYNCLINK_CS=y
CONFIG_CARDMAN_4000=y
CONFIG_CARDMAN_4040=y
CONFIG_SCR24X=y
CONFIG_IPWIRELESS=y

# end of PCMCIA character devices

CONFIG_DEVMEM=y
CONFIG_DEVPORT=y
CONFIG_TCG_TPM=y
CONFIG_HW_RANDOM_TPM=y
CONFIG_TCG_TIS_CORE=y
CONFIG_TCG_TIS=y
CONFIG_TCG_TIS_SPI=y
CONFIG_TCG_TIS_SPI_CR50=y
CONFIG_TCG_TIS_I2C=y
CONFIG_TCG_TIS_SYNQUACER=y
CONFIG_TCG_TIS_I2C_CR50=y
CONFIG_TCG_TIS_I2C_ATMEL=y
CONFIG_TCG_TIS_I2C_INFINEON=y
CONFIG_TCG_TIS_I2C_NUVOTON=y
CONFIG_TCG_ATMEL=y
CONFIG_TCG_INFINEON=y
CONFIG_TCG_VTPM_PROXY=y
CONFIG_TCG_TIS_ST33ZP24=y
CONFIG_TCG_TIS_ST33ZP24_I2C=y
CONFIG_TCG_TIS_ST33ZP24_SPI=y
CONFIG_XILLYBUS_CLASS=y
CONFIG_XILLYBUS=y
CONFIG_XILLYBUS_PCIE=y
CONFIG_XILLYBUS_OF=y
CONFIG_XILLYUSB=y

# end of Character devices

#
# I2C support
#
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

#
# Multiplexer I2C Chip support
#
CONFIG_I2C_ARB_GPIO_CHALLENGE=y
CONFIG_I2C_MUX_GPIO=y
CONFIG_I2C_MUX_GPMUX=y
CONFIG_I2C_MUX_LTC4306=y
CONFIG_I2C_MUX_PCA9541=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_MUX_PINCTRL=y
CONFIG_I2C_MUX_REG=y
CONFIG_I2C_DEMUX_PINCTRL=y
CONFIG_I2C_MUX_MLXCPLD=y

# end of Multiplexer I2C Chip support

CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=y
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_ALGOPCA=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
CONFIG_I2C_CCGX_UCSI=y
CONFIG_I2C_ALI1535=y
CONFIG_I2C_ALI1563=y
CONFIG_I2C_ALI15X3=y
CONFIG_I2C_AMD756=y
CONFIG_I2C_AMD8111=y
CONFIG_I2C_HIX5HD2=y
CONFIG_I2C_I801=y
CONFIG_I2C_ISCH=y
CONFIG_I2C_PIIX4=y
CONFIG_I2C_NFORCE2=y
CONFIG_I2C_NVIDIA_GPU=y
CONFIG_I2C_SIS5595=y
CONFIG_I2C_SIS630=y
CONFIG_I2C_SIS96X=y
CONFIG_I2C_VIA=y
CONFIG_I2C_VIAPRO=y

#
# I2C system bus drivers (mostly embedded / system-on-chip) #
CONFIG_I2C_ALTERA=y
CONFIG_I2C_ASPEED=y
CONFIG_I2C_AT91=y CONFIG_I2C_AT91_SLAVE_EXPERIMENTAL=y CONFIG_I2C_AXXIA=y
CONFIG_I2C_BCM2835=y
CONFIG_I2C_BCM_IPROC=y
CONFIG_I2C_BCM_KONA=y
CONFIG_I2C_BRCMSTB=y
CONFIG_I2C_CADENCE=y
CONFIG_I2C_CBUS_GPIO=y
CONFIG_I2C_DAVINCI=y
CONFIG_I2C_DESIGNWARE_CORE=y CONFIG_I2C_DESIGNWARE_SLAVE=y CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_I2C_DESIGNWARE_PCI=y
CONFIG_I2C_DIGICOLOR=y
CONFIG_I2C_EG20T=y
CONFIG_I2C_EMEV2=y
CONFIG_I2C_EXYNOS5=y
CONFIG_I2C_GPIO=y
CONFIG_I2C_GPIO_FAULT_INJECTOR=y CONFIG_I2C_HIGHLANDER=y
CONFIG_I2C_HISI=y
CONFIG_I2C_IMG=y
CONFIG_I2C_IMX=y
CONFIG_I2C_IMX_LPI2C=y
CONFIG_I2C_IOP3XX=y
CONFIG_I2C_JZ4780=y
CONFIG_I2C_KEMPLD=y
CONFIG_I2C_LPC2K=y
CONFIG_I2C_MESON=y
CONFIG_I2C_MICROCHIP_CORE=y
CONFIG_I2C_MT65XX=y
CONFIG_I2C_MT7621=y
CONFIG_I2C_MV64XXX=y
CONFIG_I2C_MXS=y
CONFIG_I2C_NPCM=y
CONFIG_I2C_OCORES=y
CONFIG_I2C_OMAP=y
CONFIG_I2C_OWL=y
CONFIG_I2C_APPLE=y
CONFIG_I2C_PCA_PLATFORM=y
CONFIG_I2C_PNX=y
CONFIG_I2C_PXA=y
CONFIG_I2C_PXA_SLAVE=y
CONFIG_I2C_QCOM_CCI=y
CONFIG_I2C_QCOM_GENI=y
CONFIG_I2C_QUP=y
CONFIG_I2C_RIIC=y
CONFIG_I2C_RK3X=y
CONFIG_I2C_RZV2M=y
CONFIG_I2C_S3C2410=y
CONFIG_I2C_SH_MOBILE=y
CONFIG_I2C_SIMTEC=y
CONFIG_I2C_SPRD=y
CONFIG_I2C_ST=y
CONFIG_I2C_STM32F4=y
CONFIG_I2C_STM32F7=y
CONFIG_I2C_SUN6I_P2WI=y
CONFIG_I2C_SYNQUACER=y
CONFIG_I2C_TEGRA_BPMP=y
CONFIG_I2C_UNIPHIER=y
CONFIG_I2C_UNIPHIER_F=y
CONFIG_I2C_VERSATILE=y
CONFIG_I2C_WMT=y
CONFIG_I2C_THUNDERX=y
CONFIG_I2C_XILINX=y
CONFIG_I2C_XLP9XX=y
CONFIG_I2C_RCAR=y

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_DIOLAN_U2C=y
CONFIG_I2C_DLN2=y
CONFIG_I2C_CP2615=y
CONFIG_I2C_PARPORT=y
CONFIG_I2C_PCI1XXXX=y
CONFIG_I2C_ROBOTFUZZ_OSIF=y
CONFIG_I2C_TAOS_EVM=y
CONFIG_I2C_TINY_USB=y
CONFIG_I2C_VIPERBOARD=y

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_MLXCPLD=y
CONFIG_I2C_PCA_ISA=y
CONFIG_I2C_CROS_EC_TUNNEL=y
CONFIG_I2C_FSI=y
CONFIG_I2C_VIRTIO=y

# end of I2C Hardware Bus support

CONFIG_I2C_STUB=m
CONFIG_I2C_SLAVE=y
CONFIG_I2C_SLAVE_EEPROM=y
CONFIG_I2C_SLAVE_TESTUNIT=y
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y

# end of I2C support

CONFIG_I3C=y
CONFIG_MIPI_I3C_HCI=y
CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_MEM=y

#
# SPI Master Controller Drivers
#
CONFIG_SPI_ALTERA=y
CONFIG_SPI_ALTERA_CORE=y
CONFIG_SPI_ALTERA_DFL=y
CONFIG_SPI_AR934X=y
CONFIG_SPI_ATH79=y
CONFIG_SPI_ARMADA_3700=y
CONFIG_SPI_ASPEED_SMC=y
CONFIG_SPI_ATMEL=y
CONFIG_SPI_AT91_USART=y
CONFIG_SPI_ATMEL_QUADSPI=y
CONFIG_SPI_AXI_SPI_ENGINE=y
CONFIG_SPI_BCM2835=y
CONFIG_SPI_BCM2835AUX=y
CONFIG_SPI_BCM63XX=y
CONFIG_SPI_BCM63XX_HSSPI=y
CONFIG_SPI_BCM_QSPI=y
CONFIG_SPI_BITBANG=y
CONFIG_SPI_BUTTERFLY=y
CONFIG_SPI_CADENCE=y
CONFIG_SPI_CADENCE_QUADSPI=y
CONFIG_SPI_CADENCE_XSPI=y
CONFIG_SPI_CLPS711X=y
CONFIG_SPI_DESIGNWARE=y
CONFIG_SPI_DW_DMA=y
CONFIG_SPI_DW_PCI=y
CONFIG_SPI_DW_MMIO=y
CONFIG_SPI_DW_BT1=y
CONFIG_SPI_DW_BT1_DIRMAP=y
CONFIG_SPI_DLN2=y
CONFIG_SPI_EP93XX=y
CONFIG_SPI_FSI=y
CONFIG_SPI_FSL_LPSPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_SPI_GXP=y
CONFIG_SPI_HISI_KUNPENG=y
CONFIG_SPI_HISI_SFC_V3XX=y
CONFIG_SPI_NXP_FLEXSPI=y
CONFIG_SPI_GPIO=y
CONFIG_SPI_IMG_SPFI=y
CONFIG_SPI_IMX=y
CONFIG_SPI_INGENIC=y
CONFIG_SPI_INTEL=y
CONFIG_SPI_INTEL_PCI=y
CONFIG_SPI_INTEL_PLATFORM=y
CONFIG_SPI_JCORE=y
CONFIG_SPI_LM70_LLP=y
CONFIG_SPI_LP8841_RTC=y
CONFIG_SPI_FSL_LIB=y
CONFIG_SPI_FSL_SPI=y
CONFIG_SPI_FSL_DSPI=y
CONFIG_SPI_MESON_SPICC=y
CONFIG_SPI_MESON_SPIFC=y
CONFIG_SPI_MICROCHIP_CORE=y
CONFIG_SPI_MICROCHIP_CORE_QSPI=y
CONFIG_SPI_MT65XX=y
CONFIG_SPI_MT7621=y
CONFIG_SPI_MTK_NOR=y
CONFIG_SPI_MTK_SNFI=y
CONFIG_SPI_WPCM_FIU=y
CONFIG_SPI_NPCM_FIU=y
CONFIG_SPI_NPCM_PSPI=y
CONFIG_SPI_LANTIQ_SSC=y
CONFIG_SPI_OC_TINY=y
CONFIG_SPI_OMAP24XX=y
CONFIG_SPI_TI_QSPI=y
CONFIG_SPI_OMAP_100K=y
CONFIG_SPI_ORION=y
CONFIG_SPI_PCI1XXXX=y
CONFIG_SPI_PIC32=y
CONFIG_SPI_PIC32_SQI=y
CONFIG_SPI_PXA2XX=y
CONFIG_SPI_PXA2XX_PCI=y
CONFIG_SPI_ROCKCHIP=y
CONFIG_SPI_ROCKCHIP_SFC=y
CONFIG_SPI_RPCIF=y
CONFIG_SPI_RSPI=y
CONFIG_SPI_QUP=y
CONFIG_SPI_QCOM_GENI=y
CONFIG_SPI_S3C64XX=y
CONFIG_SPI_SC18IS602=y
CONFIG_SPI_SH_MSIOF=y
CONFIG_SPI_SH=y
CONFIG_SPI_SH_HSPI=y
CONFIG_SPI_SIFIVE=y
CONFIG_SPI_SLAVE_MT27XX=y
CONFIG_SPI_SN_F_OSPI=y
CONFIG_SPI_SPRD=y
CONFIG_SPI_SPRD_ADI=y
CONFIG_SPI_STM32=y
CONFIG_SPI_STM32_QSPI=y
CONFIG_SPI_ST_SSC4=y
CONFIG_SPI_SUN4I=y
CONFIG_SPI_SUN6I=y
CONFIG_SPI_SUNPLUS_SP7021=y
CONFIG_SPI_SYNQUACER=y
CONFIG_SPI_MXIC=y
CONFIG_SPI_TEGRA210_QUAD=y
CONFIG_SPI_TEGRA114=y
CONFIG_SPI_TEGRA20_SFLASH=y
CONFIG_SPI_TEGRA20_SLINK=y
CONFIG_SPI_THUNDERX=y
CONFIG_SPI_TOPCLIFF_PCH=y
CONFIG_SPI_UNIPHIER=y
CONFIG_SPI_XCOMM=y
CONFIG_SPI_XILINX=y
CONFIG_SPI_XLP=y
CONFIG_SPI_XTENSA_XTFPGA=y
CONFIG_SPI_ZYNQ_QSPI=y
CONFIG_SPI_ZYNQMP_GQSPI=y
CONFIG_SPI_AMD=y

#
# SPI Multiplexer support
#
CONFIG_SPI_MUX=y

#
# SPI Protocol Masters
#
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_LOOPBACK_TEST=m
CONFIG_SPI_TLE62X0=y
CONFIG_SPI_SLAVE=y
CONFIG_SPI_SLAVE_TIME=y
CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y
CONFIG_SPI_DYNAMIC=y
CONFIG_SPMI=y
CONFIG_SPMI_HISI3670=y
CONFIG_SPMI_MSM_PMIC_ARB=y
CONFIG_SPMI_MTK_PMIF=y
CONFIG_HSI=y
CONFIG_HSI_BOARDINFO=y

#
# HSI controllers
#

#
# HSI clients
#
CONFIG_HSI_CHAR=y
CONFIG_PPS=y
CONFIG_PPS_DEBUG=y

#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=y
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_PARPORT=y
CONFIG_PPS_CLIENT_GPIO=y

#
# PPS generators support
#

#
# PTP clock support
#
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_PTP_1588_CLOCK_DTE=y
CONFIG_PTP_1588_CLOCK_QORIQ=y
CONFIG_DP83640_PHY=y
CONFIG_PTP_1588_CLOCK_INES=y
CONFIG_PTP_1588_CLOCK_PCH=y
CONFIG_PTP_1588_CLOCK_IDT82P33=y
CONFIG_PTP_1588_CLOCK_IDTCM=y
CONFIG_PTP_1588_CLOCK_OCP=y

# end of PTP clock support

CONFIG_PINCTRL=y
CONFIG_GENERIC_PINCTRL_GROUPS=y
CONFIG_PINMUX=y
CONFIG_GENERIC_PINMUX_FUNCTIONS=y
CONFIG_PINCONF=y
CONFIG_GENERIC_PINCONF=y
CONFIG_DEBUG_PINCTRL=y
CONFIG_PINCTRL_AMD=y
CONFIG_PINCTRL_AS3722=y
CONFIG_PINCTRL_AT91PIO4=y
CONFIG_PINCTRL_AXP209=y
CONFIG_PINCTRL_BM1880=y
CONFIG_PINCTRL_CY8C95X0=y
CONFIG_PINCTRL_DA850_PUPD=y
CONFIG_PINCTRL_DA9062=y
CONFIG_PINCTRL_EQUILIBRIUM=y
CONFIG_PINCTRL_INGENIC=y
CONFIG_PINCTRL_LOONGSON2=y
CONFIG_PINCTRL_LPC18XX=y
CONFIG_PINCTRL_MAX77620=y
CONFIG_PINCTRL_MCP23S08_I2C=y
CONFIG_PINCTRL_MCP23S08_SPI=y
CONFIG_PINCTRL_MCP23S08=y
CONFIG_PINCTRL_MICROCHIP_SGPIO=y
CONFIG_PINCTRL_OCELOT=y
CONFIG_PINCTRL_PALMAS=y
CONFIG_PINCTRL_PISTACHIO=y
CONFIG_PINCTRL_RK805=y
CONFIG_PINCTRL_ROCKCHIP=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PINCTRL_STMFX=y
CONFIG_PINCTRL_SX150X=y
CONFIG_PINCTRL_OWL=y
CONFIG_PINCTRL_S500=y
CONFIG_PINCTRL_S700=y
CONFIG_PINCTRL_S900=y
CONFIG_PINCTRL_ASPEED=y
CONFIG_PINCTRL_ASPEED_G4=y
CONFIG_PINCTRL_ASPEED_G5=y
CONFIG_PINCTRL_ASPEED_G6=y
CONFIG_PINCTRL_BCM281XX=y
CONFIG_PINCTRL_BCM2835=y
CONFIG_PINCTRL_BCM4908=y
CONFIG_PINCTRL_BCM63XX=y
CONFIG_PINCTRL_BCM6318=y
CONFIG_PINCTRL_BCM6328=y
CONFIG_PINCTRL_BCM6358=y
CONFIG_PINCTRL_BCM6362=y
CONFIG_PINCTRL_BCM6368=y
CONFIG_PINCTRL_BCM63268=y
CONFIG_PINCTRL_IPROC_GPIO=y
CONFIG_PINCTRL_CYGNUS_MUX=y
CONFIG_PINCTRL_NS=y
CONFIG_PINCTRL_NSP_GPIO=y
CONFIG_PINCTRL_NS2_MUX=y
CONFIG_PINCTRL_NSP_MUX=y
CONFIG_PINCTRL_BERLIN=y
CONFIG_PINCTRL_AS370=y
CONFIG_PINCTRL_BERLIN_BG4CT=y
CONFIG_PINCTRL_LOCHNAGAR=y
CONFIG_PINCTRL_MADERA=y
CONFIG_PINCTRL_CS47L15=y
CONFIG_PINCTRL_CS47L35=y
CONFIG_PINCTRL_CS47L85=y
CONFIG_PINCTRL_CS47L90=y
CONFIG_PINCTRL_CS47L92=y
CONFIG_PINCTRL_IMX=y
CONFIG_PINCTRL_IMX8MM=y
CONFIG_PINCTRL_IMX8MN=y
CONFIG_PINCTRL_IMX8MP=y
CONFIG_PINCTRL_IMX8MQ=y

#
# Intel pinctrl drivers
#

# end of Intel pinctrl drivers

#
# MediaTek pinctrl drivers
#
CONFIG_EINT_MTK=y
CONFIG_PINCTRL_MTK=y
CONFIG_PINCTRL_MTK_V2=y
CONFIG_PINCTRL_MTK_MOORE=y
CONFIG_PINCTRL_MTK_PARIS=y
CONFIG_PINCTRL_MT2701=y
CONFIG_PINCTRL_MT7623=y
CONFIG_PINCTRL_MT7629=y
CONFIG_PINCTRL_MT8135=y
CONFIG_PINCTRL_MT8127=y
CONFIG_PINCTRL_MT2712=y
CONFIG_PINCTRL_MT6765=y
CONFIG_PINCTRL_MT6779=y
CONFIG_PINCTRL_MT6795=y
CONFIG_PINCTRL_MT6797=y
CONFIG_PINCTRL_MT7622=y
CONFIG_PINCTRL_MT7986=y
CONFIG_PINCTRL_MT8167=y
CONFIG_PINCTRL_MT8173=y
CONFIG_PINCTRL_MT8183=y
CONFIG_PINCTRL_MT8186=y
CONFIG_PINCTRL_MT8188=y
CONFIG_PINCTRL_MT8192=y
CONFIG_PINCTRL_MT8195=y
CONFIG_PINCTRL_MT8365=y
CONFIG_PINCTRL_MT8516=y
CONFIG_PINCTRL_MT6397=y

# end of MediaTek pinctrl drivers

CONFIG_PINCTRL_MESON=y
CONFIG_PINCTRL_WPCM450=y
CONFIG_PINCTRL_NPCM7XX=y
CONFIG_PINCTRL_PXA=y
CONFIG_PINCTRL_PXA25X=y
CONFIG_PINCTRL_PXA27X=y
CONFIG_PINCTRL_MSM=y
CONFIG_PINCTRL_APQ8064=y
CONFIG_PINCTRL_APQ8084=y
CONFIG_PINCTRL_IPQ4019=y
CONFIG_PINCTRL_IPQ8064=y
CONFIG_PINCTRL_IPQ8074=y
CONFIG_PINCTRL_IPQ6018=y
CONFIG_PINCTRL_MSM8226=y
CONFIG_PINCTRL_MSM8660=y
CONFIG_PINCTRL_MSM8960=y
CONFIG_PINCTRL_MDM9607=y
CONFIG_PINCTRL_MDM9615=y
CONFIG_PINCTRL_MSM8X74=y
CONFIG_PINCTRL_MSM8909=y
CONFIG_PINCTRL_MSM8916=y
CONFIG_PINCTRL_MSM8953=y
CONFIG_PINCTRL_MSM8976=y
CONFIG_PINCTRL_MSM8994=y
CONFIG_PINCTRL_MSM8996=y
CONFIG_PINCTRL_MSM8998=y
CONFIG_PINCTRL_QCM2290=y
CONFIG_PINCTRL_QCS404=y
CONFIG_PINCTRL_QCOM_SPMI_PMIC=y
CONFIG_PINCTRL_QCOM_SSBI_PMIC=y
CONFIG_PINCTRL_SC7180=y
CONFIG_PINCTRL_SC7280=y
CONFIG_PINCTRL_SC7280_LPASS_LPI=y
CONFIG_PINCTRL_SC8180X=y
CONFIG_PINCTRL_SC8280XP=y
CONFIG_PINCTRL_SDM660=y
CONFIG_PINCTRL_SDM670=y
CONFIG_PINCTRL_SDM845=y
CONFIG_PINCTRL_SDX55=y
CONFIG_PINCTRL_SM6115=y
CONFIG_PINCTRL_SM6125=y
CONFIG_PINCTRL_SM6350=y
CONFIG_PINCTRL_SM6375=y
CONFIG_PINCTRL_SDX65=y
CONFIG_PINCTRL_SM8150=y
CONFIG_PINCTRL_SM8250=y
CONFIG_PINCTRL_SM8250_LPASS_LPI=y
CONFIG_PINCTRL_SM8350=y
CONFIG_PINCTRL_SM8450=y
CONFIG_PINCTRL_SM8450_LPASS_LPI=y
CONFIG_PINCTRL_SC8280XP_LPASS_LPI=y
CONFIG_PINCTRL_LPASS_LPI=y

#
# Renesas pinctrl drivers
#
CONFIG_PINCTRL_RENESAS=y
CONFIG_PINCTRL_SH_PFC=y
CONFIG_PINCTRL_SH_PFC_GPIO=y
CONFIG_PINCTRL_SH_FUNC_GPIO=y
CONFIG_PINCTRL_PFC_EMEV2=y
CONFIG_PINCTRL_PFC_R8A77995=y
CONFIG_PINCTRL_PFC_R8A7794=y
CONFIG_PINCTRL_PFC_R8A77990=y
CONFIG_PINCTRL_PFC_R8A7779=y
CONFIG_PINCTRL_PFC_R8A7790=y
CONFIG_PINCTRL_PFC_R8A77950=y
CONFIG_PINCTRL_PFC_R8A77951=y
CONFIG_PINCTRL_PFC_R8A7778=y
CONFIG_PINCTRL_PFC_R8A7793=y
CONFIG_PINCTRL_PFC_R8A7791=y
CONFIG_PINCTRL_PFC_R8A77965=y
CONFIG_PINCTRL_PFC_R8A77960=y
CONFIG_PINCTRL_PFC_R8A77961=y
CONFIG_PINCTRL_PFC_R8A779F0=y
CONFIG_PINCTRL_PFC_R8A7792=y
CONFIG_PINCTRL_PFC_R8A77980=y
CONFIG_PINCTRL_PFC_R8A77970=y
CONFIG_PINCTRL_PFC_R8A779A0=y
CONFIG_PINCTRL_PFC_R8A779G0=y
CONFIG_PINCTRL_PFC_R8A7740=y
CONFIG_PINCTRL_PFC_R8A73A4=y
CONFIG_PINCTRL_RZA1=y
CONFIG_PINCTRL_RZA2=y
CONFIG_PINCTRL_RZG2L=y
CONFIG_PINCTRL_PFC_R8A77470=y
CONFIG_PINCTRL_PFC_R8A7745=y
CONFIG_PINCTRL_PFC_R8A7742=y
CONFIG_PINCTRL_PFC_R8A7743=y
CONFIG_PINCTRL_PFC_R8A7744=y
CONFIG_PINCTRL_PFC_R8A774C0=y
CONFIG_PINCTRL_PFC_R8A774E1=y
CONFIG_PINCTRL_PFC_R8A774A1=y
CONFIG_PINCTRL_PFC_R8A774B1=y
CONFIG_PINCTRL_RZN1=y
CONFIG_PINCTRL_RZV2M=y
CONFIG_PINCTRL_PFC_SH7203=y
CONFIG_PINCTRL_PFC_SH7264=y
CONFIG_PINCTRL_PFC_SH7269=y
CONFIG_PINCTRL_PFC_SH7720=y
CONFIG_PINCTRL_PFC_SH7722=y
CONFIG_PINCTRL_PFC_SH7734=y
CONFIG_PINCTRL_PFC_SH7757=y
CONFIG_PINCTRL_PFC_SH7785=y
CONFIG_PINCTRL_PFC_SH7786=y
CONFIG_PINCTRL_PFC_SH73A0=y
CONFIG_PINCTRL_PFC_SH7723=y
CONFIG_PINCTRL_PFC_SH7724=y
CONFIG_PINCTRL_PFC_SHX3=y

# end of Renesas pinctrl drivers

CONFIG_PINCTRL_SAMSUNG=y
CONFIG_PINCTRL_EXYNOS=y
CONFIG_PINCTRL_EXYNOS_ARM=y
CONFIG_PINCTRL_EXYNOS_ARM64=y
CONFIG_PINCTRL_S3C24XX=y
CONFIG_PINCTRL_S3C64XX=y
CONFIG_PINCTRL_SPRD=y
CONFIG_PINCTRL_SPRD_SC9860=y
CONFIG_PINCTRL_STARFIVE_JH7100=y
CONFIG_PINCTRL_STM32=y
CONFIG_PINCTRL_STM32F429=y
CONFIG_PINCTRL_STM32F469=y
CONFIG_PINCTRL_STM32F746=y
CONFIG_PINCTRL_STM32F769=y
CONFIG_PINCTRL_STM32H743=y
CONFIG_PINCTRL_STM32MP135=y
CONFIG_PINCTRL_STM32MP157=y
CONFIG_PINCTRL_TI_IODELAY=y
CONFIG_PINCTRL_UNIPHIER=y
CONFIG_PINCTRL_UNIPHIER_LD4=y
CONFIG_PINCTRL_UNIPHIER_PRO4=y
CONFIG_PINCTRL_UNIPHIER_SLD8=y
CONFIG_PINCTRL_UNIPHIER_PRO5=y
CONFIG_PINCTRL_UNIPHIER_PXS2=y
CONFIG_PINCTRL_UNIPHIER_LD6B=y
CONFIG_PINCTRL_UNIPHIER_LD11=y
CONFIG_PINCTRL_UNIPHIER_LD20=y
CONFIG_PINCTRL_UNIPHIER_PXS3=y
CONFIG_PINCTRL_UNIPHIER_NX1=y
CONFIG_PINCTRL_VISCONTI=y
CONFIG_PINCTRL_TMPV7700=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_OF_GPIO=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_DEBUG_GPIO=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_CDEV=y
CONFIG_GPIO_CDEV_V1=y
CONFIG_GPIO_GENERIC=y
CONFIG_GPIO_REGMAP=y
CONFIG_GPIO_MAX730X=y
CONFIG_GPIO_IDIO_16=y

#
# Memory mapped GPIO drivers
#
CONFIG_GPIO_74XX_MMIO=y
CONFIG_GPIO_ALTERA=y
CONFIG_GPIO_ASPEED=y
CONFIG_GPIO_ASPEED_SGPIO=y
CONFIG_GPIO_ATH79=y
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_GPIO_BCM_KONA=y
CONFIG_GPIO_BCM_XGS_IPROC=y
CONFIG_GPIO_BRCMSTB=y
CONFIG_GPIO_CADENCE=y
CONFIG_GPIO_CLPS711X=y
CONFIG_GPIO_DWAPB=y
CONFIG_GPIO_EIC_SPRD=y
CONFIG_GPIO_EM=y
CONFIG_GPIO_EXAR=y
CONFIG_GPIO_FTGPIO010=y
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_GPIO_GRGPIO=y
CONFIG_GPIO_HISI=y
CONFIG_GPIO_HLWD=y
CONFIG_GPIO_IMX_SCU=y
CONFIG_GPIO_IOP=y
CONFIG_GPIO_LOGICVC=y
CONFIG_GPIO_LPC18XX=y
CONFIG_GPIO_LPC32XX=y
CONFIG_GPIO_MB86S7X=y
CONFIG_GPIO_MENZ127=y
CONFIG_GPIO_MPC8XXX=y
CONFIG_GPIO_MT7621=y
CONFIG_GPIO_MXC=y
CONFIG_GPIO_MXS=y
CONFIG_GPIO_PMIC_EIC_SPRD=y
CONFIG_GPIO_PXA=y
CONFIG_GPIO_RCAR=y
CONFIG_GPIO_RDA=y
CONFIG_GPIO_ROCKCHIP=y
CONFIG_GPIO_SAMA5D2_PIOBU=y
CONFIG_GPIO_SIFIVE=y
CONFIG_GPIO_SIOX=y
CONFIG_GPIO_SNPS_CREG=y
CONFIG_GPIO_SPRD=y
CONFIG_GPIO_STP_XWAY=y
CONFIG_GPIO_SYSCON=y
CONFIG_GPIO_TEGRA=y
CONFIG_GPIO_TEGRA186=y
CONFIG_GPIO_TS4800=y
CONFIG_GPIO_THUNDERX=y
CONFIG_GPIO_UNIPHIER=y
CONFIG_GPIO_VISCONTI=y
CONFIG_GPIO_VX855=y
CONFIG_GPIO_WCD934X=y
CONFIG_GPIO_XGENE_SB=y
CONFIG_GPIO_XILINX=y
CONFIG_GPIO_XLP=y
CONFIG_GPIO_AMD_FCH=y
CONFIG_GPIO_IDT3243X=y

# end of Memory mapped GPIO drivers

#
# I2C GPIO expanders
#
CONFIG_GPIO_ADNP=y
CONFIG_GPIO_GW_PLD=y
CONFIG_GPIO_MAX7300=y
CONFIG_GPIO_MAX732X=y
CONFIG_GPIO_MAX732X_IRQ=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_GPIO_PCA9570=y
CONFIG_GPIO_PCF857X=y
CONFIG_GPIO_TPIC2810=y
CONFIG_GPIO_TS4900=y

# end of I2C GPIO expanders

#
# MFD GPIO expanders
#
CONFIG_GPIO_ADP5520=y
CONFIG_GPIO_ARIZONA=y
CONFIG_GPIO_BD71815=y
CONFIG_GPIO_BD71828=y
CONFIG_GPIO_BD9571MWV=y
CONFIG_GPIO_CRYSTAL_COVE=y
CONFIG_GPIO_DA9052=y
CONFIG_GPIO_DA9055=y
CONFIG_GPIO_DLN2=y
CONFIG_GPIO_JANZ_TTL=y
CONFIG_GPIO_KEMPLD=y
CONFIG_GPIO_LP3943=y
CONFIG_GPIO_LP873X=y
CONFIG_GPIO_LP87565=y
CONFIG_GPIO_MADERA=y
CONFIG_GPIO_MAX77620=y
CONFIG_GPIO_MAX77650=y
CONFIG_GPIO_PALMAS=y
CONFIG_GPIO_RC5T583=y
CONFIG_GPIO_SL28CPLD=y
CONFIG_GPIO_STMPE=y
CONFIG_GPIO_TC3589X=y
CONFIG_GPIO_TIMBERDALE=y
CONFIG_GPIO_TPS65086=y
CONFIG_GPIO_TPS65218=y
CONFIG_GPIO_TPS6586X=y
CONFIG_GPIO_TPS65910=y
CONFIG_GPIO_TPS65912=y
CONFIG_GPIO_TQMX86=y
CONFIG_GPIO_TWL4030=y
CONFIG_GPIO_TWL6040=y
CONFIG_GPIO_UCB1400=y
CONFIG_GPIO_WM831X=y
CONFIG_GPIO_WM8350=y
CONFIG_GPIO_WM8994=y

# end of MFD GPIO expanders

#
# PCI GPIO expanders
#
CONFIG_GPIO_AMD8111=y
CONFIG_GPIO_MLXBF=y
CONFIG_GPIO_MLXBF2=y
CONFIG_GPIO_ML_IOH=y
CONFIG_GPIO_PCH=y
CONFIG_GPIO_PCI_IDIO_16=y
CONFIG_GPIO_PCIE_IDIO_24=y
CONFIG_GPIO_RDC321X=y

# end of PCI GPIO expanders

#
# SPI GPIO expanders
#
CONFIG_GPIO_74X164=y
CONFIG_GPIO_MAX3191X=y
CONFIG_GPIO_MAX7301=y
CONFIG_GPIO_MC33880=y
CONFIG_GPIO_PISOSR=y
CONFIG_GPIO_XRA1403=y
CONFIG_GPIO_MOXTET=y

# end of SPI GPIO expanders

#
# USB GPIO expanders
#
CONFIG_GPIO_VIPERBOARD=y

# end of USB GPIO expanders

#
# Virtual GPIO drivers
#
CONFIG_GPIO_AGGREGATOR=y
CONFIG_GPIO_LATCH=y
CONFIG_GPIO_MOCKUP=y
CONFIG_GPIO_VIRTIO=y
CONFIG_GPIO_SIM=y

# end of Virtual GPIO drivers

CONFIG_W1=y
CONFIG_W1_CON=y

#
# 1-wire Bus Masters
#
CONFIG_W1_MASTER_MATROX=y
CONFIG_W1_MASTER_DS2490=y
CONFIG_W1_MASTER_DS2482=y
CONFIG_W1_MASTER_MXC=y
CONFIG_W1_MASTER_DS1WM=y
CONFIG_W1_MASTER_GPIO=y
CONFIG_W1_MASTER_SGI=y

# end of 1-wire Bus Masters

#
# 1-wire Slaves
#
CONFIG_W1_SLAVE_THERM=y
CONFIG_W1_SLAVE_SMEM=y
CONFIG_W1_SLAVE_DS2405=y
CONFIG_W1_SLAVE_DS2408=y
CONFIG_W1_SLAVE_DS2408_READBACK=y
CONFIG_W1_SLAVE_DS2413=y
CONFIG_W1_SLAVE_DS2406=y
CONFIG_W1_SLAVE_DS2423=y
CONFIG_W1_SLAVE_DS2805=y
CONFIG_W1_SLAVE_DS2430=y
CONFIG_W1_SLAVE_DS2431=y
CONFIG_W1_SLAVE_DS2433=y
CONFIG_W1_SLAVE_DS2433_CRC=y
CONFIG_W1_SLAVE_DS2438=y
CONFIG_W1_SLAVE_DS250X=y
CONFIG_W1_SLAVE_DS2780=y
CONFIG_W1_SLAVE_DS2781=y
CONFIG_W1_SLAVE_DS28E04=y
CONFIG_W1_SLAVE_DS28E17=y

# end of 1-wire Slaves

CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_AS3722=y
CONFIG_POWER_RESET_ATC260X=y
CONFIG_POWER_RESET_BRCMKONA=y
CONFIG_POWER_RESET_BRCMSTB=y
CONFIG_POWER_RESET_GEMINI_POWEROFF=y
CONFIG_POWER_RESET_GPIO=y
CONFIG_POWER_RESET_GPIO_RESTART=y
CONFIG_POWER_RESET_LINKSTATION=y
CONFIG_POWER_RESET_OCELOT_RESET=y
CONFIG_POWER_RESET_PIIX4_POWEROFF=y
CONFIG_POWER_RESET_LTC2952=y
CONFIG_POWER_RESET_MT6323=y
CONFIG_POWER_RESET_REGULATOR=y
CONFIG_POWER_RESET_RESTART=y
CONFIG_POWER_RESET_TPS65086=y
CONFIG_POWER_RESET_KEYSTONE=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_POWER_RESET_SYSCON_POWEROFF=y
CONFIG_POWER_RESET_RMOBILE=y
CONFIG_REBOOT_MODE=y
CONFIG_SYSCON_REBOOT_MODE=y
CONFIG_POWER_RESET_SC27XX=y
CONFIG_NVMEM_REBOOT_MODE=y
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
CONFIG_POWER_SUPPLY_HWMON=y
CONFIG_PDA_POWER=y
CONFIG_GENERIC_ADC_BATTERY=y
CONFIG_IP5XXX_POWER=y
CONFIG_MAX8925_POWER=y
CONFIG_WM831X_BACKUP=y
CONFIG_WM831X_POWER=y
CONFIG_WM8350_POWER=y
CONFIG_TEST_POWER=y
CONFIG_BATTERY_88PM860X=y
CONFIG_CHARGER_ADP5061=y
CONFIG_BATTERY_ACT8945A=y
CONFIG_BATTERY_CPCAP=y
CONFIG_BATTERY_CW2015=y
CONFIG_BATTERY_DS2760=y
CONFIG_BATTERY_DS2780=y
CONFIG_BATTERY_DS2781=y
CONFIG_BATTERY_DS2782=y
CONFIG_BATTERY_LEGO_EV3=y
CONFIG_BATTERY_OLPC=y
CONFIG_BATTERY_SAMSUNG_SDI=y
CONFIG_BATTERY_INGENIC=y
CONFIG_BATTERY_WM97XX=y
CONFIG_BATTERY_SBS=y
CONFIG_CHARGER_SBS=y
CONFIG_MANAGER_SBS=y
CONFIG_BATTERY_BQ27XXX=y
CONFIG_BATTERY_BQ27XXX_I2C=y
CONFIG_BATTERY_BQ27XXX_HDQ=y
CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM=y
CONFIG_BATTERY_DA9030=y
CONFIG_BATTERY_DA9052=y
CONFIG_CHARGER_DA9150=y
CONFIG_BATTERY_DA9150=y
CONFIG_CHARGER_AXP20X=y
CONFIG_BATTERY_AXP20X=y
CONFIG_AXP20X_POWER=y
CONFIG_BATTERY_MAX17040=y
CONFIG_BATTERY_MAX17042=y
CONFIG_BATTERY_MAX1721X=y
CONFIG_BATTERY_TWL4030_MADC=y
CONFIG_CHARGER_88PM860X=y
CONFIG_CHARGER_PCF50633=y
CONFIG_BATTERY_RX51=y
CONFIG_CHARGER_CPCAP=y
CONFIG_CHARGER_ISP1704=y
CONFIG_CHARGER_MAX8903=y
CONFIG_CHARGER_TWL4030=y
CONFIG_CHARGER_LP8727=y
CONFIG_CHARGER_LP8788=y
CONFIG_CHARGER_GPIO=y
CONFIG_CHARGER_MANAGER=y
CONFIG_CHARGER_LT3651=y
CONFIG_CHARGER_LTC4162L=y
CONFIG_CHARGER_MAX14577=y
CONFIG_CHARGER_DETECTOR_MAX14656=y
CONFIG_CHARGER_MAX77650=y
CONFIG_CHARGER_MAX77693=y
CONFIG_CHARGER_MAX77976=y
CONFIG_CHARGER_MAX8997=y
CONFIG_CHARGER_MAX8998=y
CONFIG_CHARGER_MP2629=y
CONFIG_CHARGER_MT6360=y
CONFIG_CHARGER_MT6370=y
CONFIG_CHARGER_QCOM_SMBB=y
CONFIG_CHARGER_BQ2415X=y
CONFIG_CHARGER_BQ24190=y
CONFIG_CHARGER_BQ24257=y
CONFIG_CHARGER_BQ24735=y
CONFIG_CHARGER_BQ2515X=y
CONFIG_CHARGER_BQ25890=y
CONFIG_CHARGER_BQ25980=y
CONFIG_CHARGER_BQ256XX=y
CONFIG_CHARGER_RK817=y
CONFIG_CHARGER_SMB347=y
CONFIG_CHARGER_TPS65090=y
CONFIG_CHARGER_TPS65217=y
CONFIG_BATTERY_GAUGE_LTC2941=y
CONFIG_BATTERY_GOLDFISH=y
CONFIG_BATTERY_RT5033=y
CONFIG_CHARGER_RT9455=y
CONFIG_CHARGER_CROS_USBPD=y
CONFIG_CHARGER_CROS_PCHG=y
CONFIG_CHARGER_SC2731=y
CONFIG_FUEL_GAUGE_SC27XX=y
CONFIG_CHARGER_UCS1002=y
CONFIG_CHARGER_BD99954=y
CONFIG_RN5T618_POWER=y
CONFIG_BATTERY_ACER_A500=y
CONFIG_BATTERY_UG3105=y
CONFIG_HWMON=y
CONFIG_HWMON_VID=y
CONFIG_HWMON_DEBUG_CHIP=y

#
# Native drivers
#
CONFIG_SENSORS_SMPRO=y CONFIG_SENSORS_AD7314=y CONFIG_SENSORS_AD7414=y CONFIG_SENSORS_AD7418=y CONFIG_SENSORS_ADM1025=y CONFIG_SENSORS_ADM1026=y CONFIG_SENSORS_ADM1029=y CONFIG_SENSORS_ADM1031=y CONFIG_SENSORS_ADM1177=y CONFIG_SENSORS_ADM9240=y CONFIG_SENSORS_ADT7X10=y CONFIG_SENSORS_ADT7310=y CONFIG_SENSORS_ADT7410=y CONFIG_SENSORS_ADT7411=y CONFIG_SENSORS_ADT7462=y CONFIG_SENSORS_ADT7470=y CONFIG_SENSORS_ADT7475=y CONFIG_SENSORS_AHT10=y CONFIG_SENSORS_AQUACOMPUTER_D5NEXT=y CONFIG_SENSORS_AS370=y CONFIG_SENSORS_ASC7621=y CONFIG_SENSORS_AXI_FAN_CONTROL=y CONFIG_SENSORS_ARM_SCMI=y CONFIG_SENSORS_ARM_SCPI=y CONFIG_SENSORS_ASB100=y CONFIG_SENSORS_ASPEED=y CONFIG_SENSORS_ATXP1=y CONFIG_SENSORS_BT1_PVT=y CONFIG_SENSORS_BT1_PVT_ALARMS=y CONFIG_SENSORS_CORSAIR_CPRO=y CONFIG_SENSORS_CORSAIR_PSU=y CONFIG_SENSORS_DRIVETEMP=y CONFIG_SENSORS_DS620=y CONFIG_SENSORS_DS1621=y CONFIG_SENSORS_DA9052_ADC=y CONFIG_SENSORS_DA9055=y CONFIG_SENSORS_I5K_AMB=y CONFIG_SENSORS_SPARX5=y CONFIG_SENSORS_F71805F=y CONFIG_SENSORS_F71882FG=y CONFIG_SENSORS_F75375S=y CONFIG_SENSORS_GSC=y CONFIG_SENSORS_MC13783_ADC=y CONFIG_SENSORS_FSCHMD=y CONFIG_SENSORS_FTSTEUTATES=y CONFIG_SENSORS_GL518SM=y CONFIG_SENSORS_GL520SM=y CONFIG_SENSORS_G760A=y CONFIG_SENSORS_G762=y CONFIG_SENSORS_GPIO_FAN=y CONFIG_SENSORS_HIH6130=y CONFIG_SENSORS_IBMAEM=y CONFIG_SENSORS_IBMPEX=y CONFIG_SENSORS_IIO_HWMON=y CONFIG_SENSORS_IT87=y CONFIG_SENSORS_JC42=y CONFIG_SENSORS_POWR1220=y CONFIG_SENSORS_LAN966X=y CONFIG_SENSORS_LINEAGE=y CONFIG_SENSORS_LOCHNAGAR=y CONFIG_SENSORS_LTC2945=y CONFIG_SENSORS_LTC2947=y CONFIG_SENSORS_LTC2947_I2C=y CONFIG_SENSORS_LTC2947_SPI=y CONFIG_SENSORS_LTC2990=y CONFIG_SENSORS_LTC2992=y CONFIG_SENSORS_LTC4151=y CONFIG_SENSORS_LTC4215=y CONFIG_SENSORS_LTC4222=y CONFIG_SENSORS_LTC4245=y CONFIG_SENSORS_LTC4260=y CONFIG_SENSORS_LTC4261=y CONFIG_SENSORS_MAX1111=y CONFIG_SENSORS_MAX127=y CONFIG_SENSORS_MAX16065=y CONFIG_SENSORS_MAX1619=y CONFIG_SENSORS_MAX1668=y CONFIG_SENSORS_MAX197=y CONFIG_SENSORS_MAX31722=y CONFIG_SENSORS_MAX31730=y CONFIG_SENSORS_MAX31760=y CONFIG_SENSORS_MAX6620=y CONFIG_SENSORS_MAX6621=y CONFIG_SENSORS_MAX6639=y CONFIG_SENSORS_MAX6650=y CONFIG_SENSORS_MAX6697=y CONFIG_SENSORS_MAX31790=y CONFIG_SENSORS_MCP3021=y CONFIG_SENSORS_MLXREG_FAN=y CONFIG_SENSORS_TC654=y CONFIG_SENSORS_TPS23861=y CONFIG_SENSORS_MENF21BMC_HWMON=y CONFIG_SENSORS_MR75203=y CONFIG_SENSORS_ADCXX=y CONFIG_SENSORS_LM63=y CONFIG_SENSORS_LM70=y CONFIG_SENSORS_LM73=y CONFIG_SENSORS_LM75=y CONFIG_SENSORS_LM77=y CONFIG_SENSORS_LM78=y CONFIG_SENSORS_LM80=y CONFIG_SENSORS_LM83=y CONFIG_SENSORS_LM85=y CONFIG_SENSORS_LM87=y CONFIG_SENSORS_LM90=y CONFIG_SENSORS_LM92=y CONFIG_SENSORS_LM93=y CONFIG_SENSORS_LM95234=y CONFIG_SENSORS_LM95241=y CONFIG_SENSORS_LM95245=y CONFIG_SENSORS_PC87360=y CONFIG_SENSORS_PC87427=y CONFIG_SENSORS_NTC_THERMISTOR=y CONFIG_SENSORS_NCT6683=y CONFIG_SENSORS_NCT6775_CORE=y CONFIG_SENSORS_NCT6775=y CONFIG_SENSORS_NCT6775_I2C=y CONFIG_SENSORS_NCT7802=y CONFIG_SENSORS_NCT7904=y CONFIG_SENSORS_NPCM7XX=y CONFIG_SENSORS_NSA320=y CONFIG_SENSORS_NZXT_KRAKEN2=y CONFIG_SENSORS_NZXT_SMART2=y CONFIG_SENSORS_OCC_P8_I2C=y CONFIG_SENSORS_OCC_P9_SBE=y CONFIG_SENSORS_OCC=y CONFIG_SENSORS_PCF8591=y CONFIG_SENSORS_PECI_CPUTEMP=y CONFIG_SENSORS_PECI_DIMMTEMP=y CONFIG_SENSORS_PECI=y
CONFIG_PMBUS=y
CONFIG_SENSORS_PMBUS=y CONFIG_SENSORS_ADM1266=y CONFIG_SENSORS_ADM1275=y CONFIG_SENSORS_BEL_PFE=y CONFIG_SENSORS_BPA_RS600=y CONFIG_SENSORS_DELTA_AHE50DC_FAN=y CONFIG_SENSORS_FSP_3Y=y CONFIG_SENSORS_IBM_CFFPS=y CONFIG_SENSORS_DPS920AB=y CONFIG_SENSORS_INSPUR_IPSPS=y CONFIG_SENSORS_IR35221=y CONFIG_SENSORS_IR36021=y CONFIG_SENSORS_IR38064=y CONFIG_SENSORS_IR38064_REGULATOR=y CONFIG_SENSORS_IRPS5401=y CONFIG_SENSORS_ISL68137=y CONFIG_SENSORS_LM25066=y CONFIG_SENSORS_LM25066_REGULATOR=y CONFIG_SENSORS_LT7182S=y CONFIG_SENSORS_LTC2978=y CONFIG_SENSORS_LTC2978_REGULATOR=y CONFIG_SENSORS_LTC3815=y CONFIG_SENSORS_MAX15301=y CONFIG_SENSORS_MAX16064=y CONFIG_SENSORS_MAX16601=y CONFIG_SENSORS_MAX20730=y CONFIG_SENSORS_MAX20751=y CONFIG_SENSORS_MAX31785=y CONFIG_SENSORS_MAX34440=y CONFIG_SENSORS_MAX8688=y CONFIG_SENSORS_MP2888=y CONFIG_SENSORS_MP2975=y CONFIG_SENSORS_MP5023=y CONFIG_SENSORS_PIM4328=y CONFIG_SENSORS_PLI1209BC=y CONFIG_SENSORS_PLI1209BC_REGULATOR=y CONFIG_SENSORS_PM6764TR=y CONFIG_SENSORS_PXE1610=y CONFIG_SENSORS_Q54SJ108A2=y CONFIG_SENSORS_STPDDC60=y CONFIG_SENSORS_TPS40422=y CONFIG_SENSORS_TPS53679=y CONFIG_SENSORS_TPS546D24=y CONFIG_SENSORS_UCD9000=y CONFIG_SENSORS_UCD9200=y CONFIG_SENSORS_XDPE152=y CONFIG_SENSORS_XDPE122=y CONFIG_SENSORS_XDPE122_REGULATOR=y CONFIG_SENSORS_ZL6100=y CONFIG_SENSORS_PWM_FAN=y CONFIG_SENSORS_RASPBERRYPI_HWMON=y CONFIG_SENSORS_SL28CPLD=y CONFIG_SENSORS_SBTSI=y CONFIG_SENSORS_SBRMI=y CONFIG_SENSORS_SHT15=y CONFIG_SENSORS_SHT21=y CONFIG_SENSORS_SHT3x=y CONFIG_SENSORS_SHT4x=y CONFIG_SENSORS_SHTC1=y CONFIG_SENSORS_SIS5595=y CONFIG_SENSORS_SY7636A=y CONFIG_SENSORS_DME1737=y CONFIG_SENSORS_EMC1403=y CONFIG_SENSORS_EMC2103=y CONFIG_SENSORS_EMC2305=y CONFIG_SENSORS_EMC6W201=y CONFIG_SENSORS_SMSC47M1=y CONFIG_SENSORS_SMSC47M192=y CONFIG_SENSORS_SMSC47B397=y CONFIG_SENSORS_SCH56XX_COMMON=y CONFIG_SENSORS_SCH5627=y CONFIG_SENSORS_SCH5636=y CONFIG_SENSORS_STTS751=y CONFIG_SENSORS_SMM665=y CONFIG_SENSORS_ADC128D818=y CONFIG_SENSORS_ADS7828=y CONFIG_SENSORS_ADS7871=y CONFIG_SENSORS_AMC6821=y CONFIG_SENSORS_INA209=y CONFIG_SENSORS_INA2XX=y CONFIG_SENSORS_INA238=y CONFIG_SENSORS_INA3221=y CONFIG_SENSORS_TC74=y CONFIG_SENSORS_THMC50=y CONFIG_SENSORS_TMP102=y CONFIG_SENSORS_TMP103=y CONFIG_SENSORS_TMP108=y CONFIG_SENSORS_TMP401=y CONFIG_SENSORS_TMP421=y CONFIG_SENSORS_TMP464=y CONFIG_SENSORS_TMP513=y CONFIG_SENSORS_VIA686A=y CONFIG_SENSORS_VT1211=y CONFIG_SENSORS_VT8231=y CONFIG_SENSORS_W83773G=y CONFIG_SENSORS_W83781D=y CONFIG_SENSORS_W83791D=y CONFIG_SENSORS_W83792D=y CONFIG_SENSORS_W83793=y CONFIG_SENSORS_W83795=y CONFIG_SENSORS_W83795_FANCTRL=y CONFIG_SENSORS_W83L785TS=y CONFIG_SENSORS_W83L786NG=y CONFIG_SENSORS_W83627HF=y CONFIG_SENSORS_W83627EHF=y CONFIG_SENSORS_WM831X=y CONFIG_SENSORS_WM8350=y CONFIG_SENSORS_INTEL_M10_BMC_HWMON=y CONFIG_THERMAL=y
CONFIG_THERMAL_NETLINK=y CONFIG_THERMAL_STATISTICS=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y
CONFIG_THERMAL_OF=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set # CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set CONFIG_THERMAL_GOV_FAIR_SHARE=y CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_GOV_BANG_BANG=y CONFIG_THERMAL_GOV_USER_SPACE=y CONFIG_CPU_THERMAL=y CONFIG_DEVFREQ_THERMAL=y CONFIG_THERMAL_EMULATION=y CONFIG_THERMAL_MMIO=y CONFIG_HISI_THERMAL=y
CONFIG_IMX_THERMAL=y CONFIG_IMX_SC_THERMAL=y CONFIG_IMX8MM_THERMAL=y CONFIG_K3_THERMAL=y CONFIG_MAX77620_THERMAL=y CONFIG_QORIQ_THERMAL=y CONFIG_SPEAR_THERMAL=y CONFIG_SUN8I_THERMAL=y CONFIG_ROCKCHIP_THERMAL=y CONFIG_RCAR_THERMAL=y CONFIG_RCAR_GEN3_THERMAL=y CONFIG_RZG2L_THERMAL=y CONFIG_KIRKWOOD_THERMAL=y CONFIG_DOVE_THERMAL=y CONFIG_ARMADA_THERMAL=y CONFIG_DA9062_THERMAL=y CONFIG_MTK_THERMAL=y

#
# Intel thermal drivers
#

#
# ACPI INT340X thermal drivers
#

# end of ACPI INT340X thermal drivers
# end of Intel thermal drivers

#
# Broadcom thermal drivers
#
CONFIG_BCM2711_THERMAL=y
CONFIG_BCM2835_THERMAL=y
CONFIG_BRCMSTB_THERMAL=y
CONFIG_BCM_NS_THERMAL=y
CONFIG_BCM_SR_THERMAL=y

# end of Broadcom thermal drivers

#
# Texas Instruments thermal drivers
#
CONFIG_TI_SOC_THERMAL=y
CONFIG_TI_THERMAL=y
CONFIG_OMAP3_THERMAL=y
CONFIG_OMAP4_THERMAL=y
CONFIG_OMAP5_THERMAL=y
CONFIG_DRA752_THERMAL=y

# end of Texas Instruments thermal drivers

#
# Samsung thermal drivers
#
CONFIG_EXYNOS_THERMAL=y

# end of Samsung thermal drivers

#
# NVIDIA Tegra thermal drivers
#
CONFIG_TEGRA_SOCTHERM=y
CONFIG_TEGRA_BPMP_THERMAL=y
CONFIG_TEGRA30_TSENSOR=y

# end of NVIDIA Tegra thermal drivers

CONFIG_GENERIC_ADC_THERMAL=y

#
# Qualcomm thermal drivers
#
CONFIG_QCOM_TSENS=y
CONFIG_QCOM_SPMI_ADC_TM5=y
CONFIG_QCOM_SPMI_TEMP_ALARM=y

# end of Qualcomm thermal drivers

CONFIG_UNIPHIER_THERMAL=y
CONFIG_SPRD_THERMAL=y
CONFIG_KHADAS_MCU_FAN_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
CONFIG_WATCHDOG_NOWAYOUT=y
CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y
CONFIG_WATCHDOG_OPEN_TIMEOUT=0
CONFIG_WATCHDOG_SYSFS=y
CONFIG_WATCHDOG_HRTIMER_PRETIMEOUT=y

#
# Watchdog Pretimeout Governors
#
CONFIG_WATCHDOG_PRETIMEOUT_GOV=y CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP=y CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y
# CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP is not set CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC=y

#
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=y
CONFIG_SOFT_WATCHDOG_PRETIMEOUT=y
CONFIG_BD957XMUF_WATCHDOG=y
CONFIG_DA9052_WATCHDOG=y
CONFIG_DA9055_WATCHDOG=y
CONFIG_DA9063_WATCHDOG=y
CONFIG_DA9062_WATCHDOG=y
CONFIG_GPIO_WATCHDOG=y
CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y
CONFIG_MENF21BMC_WATCHDOG=y
CONFIG_MENZ069_WATCHDOG=y
CONFIG_WM831X_WATCHDOG=y
CONFIG_WM8350_WATCHDOG=y
CONFIG_XILINX_WATCHDOG=y
CONFIG_ZIIRAVE_WATCHDOG=y
CONFIG_RAVE_SP_WATCHDOG=y
CONFIG_MLX_WDT=y
CONFIG_SL28CPLD_WATCHDOG=y
CONFIG_ARMADA_37XX_WATCHDOG=y
CONFIG_ASM9260_WATCHDOG=y
CONFIG_AT91RM9200_WATCHDOG=y
CONFIG_AT91SAM9X_WATCHDOG=y
CONFIG_SAMA5D4_WATCHDOG=y
CONFIG_CADENCE_WATCHDOG=y
CONFIG_FTWDT010_WATCHDOG=y
CONFIG_S3C2410_WATCHDOG=y
CONFIG_DW_WATCHDOG=y
CONFIG_EP93XX_WATCHDOG=y
CONFIG_OMAP_WATCHDOG=y
CONFIG_PNX4008_WATCHDOG=y
CONFIG_DAVINCI_WATCHDOG=y
CONFIG_K3_RTI_WATCHDOG=y
CONFIG_RN5T618_WATCHDOG=y
CONFIG_SUNXI_WATCHDOG=y
CONFIG_NPCM7XX_WATCHDOG=y
CONFIG_TWL4030_WATCHDOG=y
CONFIG_STMP3XXX_RTC_WATCHDOG=y
CONFIG_TS4800_WATCHDOG=y
CONFIG_TS72XX_WATCHDOG=y
CONFIG_MAX63XX_WATCHDOG=y
CONFIG_MAX77620_WATCHDOG=y
CONFIG_IMX2_WDT=y
CONFIG_IMX7ULP_WDT=y
CONFIG_RETU_WATCHDOG=y
CONFIG_MOXART_WDT=y
CONFIG_ST_LPC_WATCHDOG=y
CONFIG_TEGRA_WATCHDOG=y
CONFIG_QCOM_WDT=y
CONFIG_MESON_GXBB_WATCHDOG=y
CONFIG_MESON_WATCHDOG=y
CONFIG_MEDIATEK_WATCHDOG=y
CONFIG_DIGICOLOR_WATCHDOG=y
CONFIG_LPC18XX_WATCHDOG=y
CONFIG_RENESAS_WDT=y
CONFIG_RENESAS_RZAWDT=y
CONFIG_RENESAS_RZN1WDT=y
CONFIG_RENESAS_RZG2LWDT=y
CONFIG_ASPEED_WATCHDOG=y
CONFIG_STPMIC1_WATCHDOG=y
CONFIG_UNIPHIER_WATCHDOG=y
CONFIG_RTD119X_WATCHDOG=y
CONFIG_REALTEK_OTTO_WDT=y
CONFIG_SPRD_WATCHDOG=y
CONFIG_PM8916_WATCHDOG=y
CONFIG_VISCONTI_WATCHDOG=y
CONFIG_MSC313E_WATCHDOG=y
CONFIG_APPLE_WATCHDOG=y
CONFIG_SUNPLUS_WATCHDOG=y
CONFIG_ALIM7101_WDT=y
CONFIG_SC520_WDT=y
CONFIG_I6300ESB_WDT=y
CONFIG_KEMPLD_WDT=y
CONFIG_RDC321X_WDT=y
CONFIG_BCM47XX_WDT=y
CONFIG_BCM2835_WDT=y
CONFIG_BCM_KONA_WDT=y
CONFIG_BCM_KONA_WDT_DEBUG=y
CONFIG_BCM7038_WDT=y
CONFIG_IMGPDC_WDT=y
CONFIG_MPC5200_WDT=y
CONFIG_MEN_A21_WDT=y
CONFIG_UML_WATCHDOG=y

#
# ISA-based Watchdog Cards
#
CONFIG_PCWATCHDOG=y
CONFIG_MIXCOMWD=y
CONFIG_WDT=y

#
# PCI-based Watchdog Cards
#
CONFIG_PCIPCWATCHDOG=y
CONFIG_WDTPCI=y

#
# USB-based Watchdog Cards
#
CONFIG_USBPCWATCHDOG=y
CONFIG_SSB_POSSIBLE=y
CONFIG_SSB=y
CONFIG_SSB_SPROM=y
CONFIG_SSB_BLOCKIO=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
CONFIG_SSB_B43_PCI_BRIDGE=y
CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
CONFIG_SSB_PCMCIAHOST=y
CONFIG_SSB_SDIOHOST_POSSIBLE=y
CONFIG_SSB_SDIOHOST=y
CONFIG_SSB_HOST_SOC=y
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
CONFIG_SSB_DRIVER_PCICORE=y
CONFIG_SSB_DRIVER_GPIO=y
CONFIG_BCMA_POSSIBLE=y
CONFIG_BCMA=y
CONFIG_BCMA_BLOCKIO=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
CONFIG_BCMA_HOST_PCI=y
CONFIG_BCMA_HOST_SOC=y
CONFIG_BCMA_DRIVER_PCI=y
CONFIG_BCMA_DRIVER_MIPS=y
CONFIG_BCMA_PFLASH=y
CONFIG_BCMA_SFLASH=y
CONFIG_BCMA_NFLASH=y
CONFIG_BCMA_DRIVER_GMAC_CMN=y
CONFIG_BCMA_DRIVER_GPIO=y
CONFIG_BCMA_DEBUG=y

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
CONFIG_MFD_ACT8945A=y
CONFIG_MFD_AS3711=y
CONFIG_MFD_SMPRO=y
CONFIG_MFD_AS3722=y
CONFIG_PMIC_ADP5520=y
CONFIG_MFD_AAT2870_CORE=y
CONFIG_MFD_AT91_USART=y
CONFIG_MFD_ATMEL_FLEXCOM=y
CONFIG_MFD_ATMEL_HLCDC=y
CONFIG_MFD_ATMEL_SMC=y
CONFIG_MFD_BCM590XX=y
CONFIG_MFD_BD9571MWV=y
CONFIG_MFD_AXP20X=y
CONFIG_MFD_AXP20X_I2C=y
CONFIG_MFD_CROS_EC_DEV=y
CONFIG_MFD_MADERA=y
CONFIG_MFD_MADERA_I2C=y
CONFIG_MFD_MADERA_SPI=y
CONFIG_MFD_CS47L15=y
CONFIG_MFD_CS47L35=y
CONFIG_MFD_CS47L85=y
CONFIG_MFD_CS47L90=y
CONFIG_MFD_CS47L92=y
CONFIG_MFD_ASIC3=y
CONFIG_PMIC_DA903X=y
CONFIG_PMIC_DA9052=y
CONFIG_MFD_DA9052_SPI=y
CONFIG_MFD_DA9052_I2C=y
CONFIG_MFD_DA9055=y
CONFIG_MFD_DA9062=y
CONFIG_MFD_DA9063=y
CONFIG_MFD_DA9150=y
CONFIG_MFD_DLN2=y
CONFIG_MFD_ENE_KB3930=y
CONFIG_MFD_EXYNOS_LPASS=y
CONFIG_MFD_GATEWORKS_GSC=y
CONFIG_MFD_MC13XXX=y
CONFIG_MFD_MC13XXX_SPI=y
CONFIG_MFD_MC13XXX_I2C=y
CONFIG_MFD_MP2629=y
CONFIG_MFD_MXS_LRADC=y
CONFIG_MFD_MX25_TSADC=y
CONFIG_MFD_HI6421_PMIC=y
CONFIG_MFD_HI6421_SPMI=y
CONFIG_MFD_HI655X_PMIC=y
CONFIG_HTC_PASIC3=y
CONFIG_LPC_ICH=y
CONFIG_LPC_SCH=y
CONFIG_INTEL_SOC_PMIC=y
CONFIG_MFD_IQS62X=y
CONFIG_MFD_JANZ_CMODIO=y
CONFIG_MFD_KEMPLD=y
CONFIG_MFD_88PM800=y
CONFIG_MFD_88PM805=y
CONFIG_MFD_88PM860X=y
CONFIG_MFD_MAX14577=y
CONFIG_MFD_MAX77620=y
CONFIG_MFD_MAX77650=y
CONFIG_MFD_MAX77686=y
CONFIG_MFD_MAX77693=y
CONFIG_MFD_MAX77714=y
CONFIG_MFD_MAX77843=y
CONFIG_MFD_MAX8907=y
CONFIG_MFD_MAX8925=y
CONFIG_MFD_MAX8997=y
CONFIG_MFD_MAX8998=y
CONFIG_MFD_MT6360=y
CONFIG_MFD_MT6370=y
CONFIG_MFD_MT6397=y
CONFIG_MFD_MENF21BMC=y
CONFIG_MFD_OCELOT=y
CONFIG_EZX_PCAP=y
CONFIG_MFD_CPCAP=y
CONFIG_MFD_VIPERBOARD=y
CONFIG_MFD_NTXEC=y
CONFIG_MFD_RETU=y
CONFIG_MFD_PCF50633=y
CONFIG_PCF50633_ADC=y
CONFIG_PCF50633_GPIO=y
CONFIG_UCB1400_CORE=y
CONFIG_MFD_PM8XXX=y
CONFIG_MFD_SPMI_PMIC=y
CONFIG_MFD_SY7636A=y
CONFIG_MFD_RDC321X=y
CONFIG_MFD_RT4831=y
CONFIG_MFD_RT5033=y
CONFIG_MFD_RT5120=y
CONFIG_MFD_RC5T583=y
CONFIG_MFD_RK808=y
CONFIG_MFD_RN5T618=y
CONFIG_MFD_SEC_CORE=y
CONFIG_MFD_SI476X_CORE=y
CONFIG_MFD_SIMPLE_MFD_I2C=y
CONFIG_MFD_SL28CPLD=y
CONFIG_MFD_SM501=y
CONFIG_MFD_SM501_GPIO=y
CONFIG_MFD_SKY81452=y
CONFIG_MFD_SC27XX_PMIC=y
CONFIG_ABX500_CORE=y
CONFIG_MFD_STMPE=y

#
# STMicroelectronics STMPE Interface Drivers
#
CONFIG_STMPE_I2C=y
CONFIG_STMPE_SPI=y

# end of STMicroelectronics STMPE Interface Drivers

7,531 lines not shown · raw message

Part of this message is not shown here. View the raw message.

#60 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

In reply to Danilo Krummrich
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
  Documentation/gpu/driver-uapi.rst       |   3 +
  drivers/gpu/drm/nouveau/Kbuild          |   2 +
  drivers/gpu/drm/nouveau/Kconfig         |   2 +
  drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
  drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
  drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
  drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
  drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
  drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
  drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
  drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
  11 files changed, 1295 insertions(+), 4 deletions(-)

create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 9 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+	struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+	struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+	struct bind_job_op *op;
+	int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks,

Thomas

Quoted 672 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +568 -0
+	nouveau_uvmm_lock(uvmm);
+	list_for_each_op(op, &bind_job->ops) {
+		switch (op->op) {
+		case OP_ALLOC: {
+			bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;
+
+			ret = nouveau_uvma_region_new(uvmm,
+						      op->va.addr,
+						      op->va.range,
+						      sparse);
+			if (ret)
+				goto out_unlock;
+			break;
+		}
+		case OP_FREE:
+			ret = nouveau_uvma_region_destroy(uvmm,
+							  op->va.addr,
+							  op->va.range);
+			if (ret)
+				goto out_unlock;
+			break;
+		case OP_MAP:
+			ret = nouveau_uvmm_sm_map(uvmm,
+						  op->va.addr, op->va.range,
+						  op->gem.obj, op->gem.offset,
+						  op->flags && 0xff);
+			if (ret)
+				goto out_unlock;
+			break;
+		case OP_UNMAP:
+			ret = nouveau_uvmm_sm_unmap(uvmm,
+						    op->va.addr,
+						    op->va.range);
+			if (ret)
+				goto out_unlock;
+			break;
+		}
+	}
+
+out_unlock:
+	nouveau_uvmm_unlock(uvmm);
+	if (ret)
+		NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+	return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+	struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+	struct bind_job_op *op, *next;
+
+	list_for_each_op_safe(op, next, &bind_job->ops) {
+		struct drm_gem_object *obj = op->gem.obj;
+
+		if (obj)
+			drm_gem_object_put(obj);
+
+		list_del(&op->entry);
+		kfree(op);
+	}
+
+	nouveau_base_job_free(job);
+	kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+	.submit = nouveau_bind_job_submit,
+	.run = nouveau_bind_job_run,
+	.free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+		     struct drm_nouveau_vm_bind_op *uop)
+{
+	struct bind_job_op *op;
+
+	op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+	if (!op)
+		return -ENOMEM;
+
+	op->op = uop->op;
+	op->flags = uop->flags;
+	op->va.addr = uop->addr;
+	op->va.range = uop->range;
+
+	if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+		op->gem.handle = uop->handle;
+		op->gem.offset = uop->bo_offset;
+	}
+
+	return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+	struct bind_job_op *op, *next;
+
+	list_for_each_op_safe(op, next, ops) {
+		list_del(&op->entry);
+		kfree(op);
+	}
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+		      struct nouveau_exec_bind *bind)
+{
+	struct nouveau_bind_job *job;
+	struct bind_job_op *op;
+	int i, ret;
+
+	job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+	if (!job)
+		return -ENOMEM;
+
+	INIT_LIST_HEAD(&job->ops);
+
+	for (i = 0; i < bind->op.count; i++) {
+		ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+		if (ret)
+			goto err_free;
+
+		list_add_tail(&op->entry, &job->ops);
+	}
+
+	job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+	job->base.ops = &nouveau_bind_job_ops;
+
+	ret = nouveau_base_job_init(&job->base, &bind->base);
+	if (ret)
+		goto err_free;
+
+	return 0;
+
+err_free:
+	bind_job_ops_free(&job->ops);
+	kfree(job);
+	*pjob = NULL;
+
+	return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+		struct drm_nouveau_sync *sync,
+		struct dma_fence **fence)
+{
+	u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+	u64 point = 0;
+	int ret;
+
+	if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+	    stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+		return -EOPNOTSUPP;
+
+	if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+		point = sync->timeline_value;
+
+	ret = drm_syncobj_find_fence(job->file_priv,
+				     sync->handle, point,
+				     sync->flags, fence);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+	struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+	struct nouveau_cli *cli = exec_job->base.cli;
+	struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+	signed long ret;
+	int i;
+
+	for (i = 0; i < job->in_sync.count; i++) {
+		struct nouveau_job *it;
+		struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+		struct dma_fence *fence;
+		bool found;
+
+		ret = sync_find_fence(job, sync, &fence);
+		if (ret)
+			return ret;
+
+		mutex_lock(&bind_entity->job.mutex);
+		found = false;
+		list_for_each_entry(it, &bind_entity->job.list, head) {
+			if (fence == it->done_fence) {
+				found = true;
+				break;
+			}
+		}
+		mutex_unlock(&bind_entity->job.mutex);
+
+		/* If the fence is not from a VM_BIND job, don't wait for it. */
+		if (!found)
+			continue;
+
+		ret = dma_fence_wait_timeout(fence, true,
+					     msecs_to_jiffies(500));
+		if (ret < 0)
+			return ret;
+		else if (ret == 0)
+			return -ETIMEDOUT;
+	}
+
+	return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+	struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+	struct nouveau_cli *cli = exec_job->base.cli;
+	struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+	struct drm_exec *exec = &job->exec;
+	struct drm_gem_object *obj;
+	unsigned long index;
+	int ret;
+
+	ret = exec_job_binds_wait(job);
+	if (ret)
+		return ret;
+
+	nouveau_uvmm_lock(uvmm);
+	drm_exec_while_not_all_locked(exec) {
+		struct drm_gpuva *va;
+
+		drm_gpuva_for_each_va(va, &uvmm->umgr) {
+			ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+			drm_exec_break_on_contention(exec);
+			if (ret)
+				return ret;
+		}
+	}
+	nouveau_uvmm_unlock(uvmm);
+
+	drm_exec_for_each_locked_object(exec, index, obj) {
+		struct dma_resv *resv = obj->resv;
+		struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+		ret = nouveau_bo_validate(nvbo, true, false);
+		if (ret)
+			return ret;
+
+		dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+	}
+
+	return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+	struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+	struct nouveau_fence *fence;
+	int i, ret;
+
+	ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+	if (ret) {
+		NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+		return ERR_PTR(ret);
+	}
+
+	for (i = 0; i < exec_job->push.count; i++) {
+		nv50_dma_push(job->chan, exec_job->push.s[i].va,
+			      exec_job->push.s[i].va_len);
+	}
+
+	ret = nouveau_fence_new(job->chan, false, &fence);
+	if (ret) {
+		NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+		WIND_RING(job->chan);
+		return ERR_PTR(ret);
+	}
+
+	return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+	struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+	nouveau_base_job_free(job);
+
+	kfree(exec_job->push.s);
+	kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+	.submit = nouveau_exec_job_submit,
+	.run = nouveau_exec_job_run,
+	.free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+		      struct nouveau_exec *exec)
+{
+	struct nouveau_exec_job *job;
+	int ret;
+
+	job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+	if (!job)
+		return -ENOMEM;
+
+	job->push.count = exec->push.count;
+	job->push.s = kmemdup(exec->push.s,
+			      sizeof(*exec->push.s) *
+			      exec->push.count,
+			      GFP_KERNEL);
+	if (!job->push.s) {
+		ret = -ENOMEM;
+		goto err_free_job;
+	}
+
+	job->base.ops = &nouveau_exec_job_ops;
+	ret = nouveau_base_job_init(&job->base, &exec->base);
+	if (ret)
+		goto err_free_pushs;
+
+	return 0;
+
+err_free_pushs:
+	kfree(job->push.s);
+err_free_job:
+	kfree(job);
+	*pjob = NULL;
+
+	return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+	dma_fence_put(job->done_fence);
+	drm_sched_job_cleanup(&job->base);
+	job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+	struct dma_fence *in_fence = NULL;
+	int ret, i;
+
+	for (i = 0; i < job->in_sync.count; i++) {
+		struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+		ret = sync_find_fence(job, sync, &in_fence);
+		if (ret) {
+			NV_PRINTK(warn, job->cli,
+				  "Failed to find syncobj (-> in): handle=%d\n",
+				  sync->handle);
+			return ret;
+		}
+
+		ret = drm_sched_job_add_dependency(&job->base, in_fence);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence *fence)
+{
+	struct drm_syncobj *out_sync;
+	int i;
+
+	for (i = 0; i < job->out_sync.count; i++) {
+		struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+		u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+		if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+		    stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+			return -EOPNOTSUPP;
+
+		out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+		if (!out_sync) {
+			NV_PRINTK(warn, job->cli,
+				  "Failed to find syncobj (-> out): handle=%d\n",
+				  sync->handle);
+			return -ENOENT;
+		}
+
+		if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+			struct dma_fence_chain *chain;
+
+			chain = dma_fence_chain_alloc();
+			if (!chain) {
+				drm_syncobj_put(out_sync);
+				return -ENOMEM;
+			}
+
+			drm_syncobj_add_point(out_sync, chain, fence,
+					      sync->timeline_value);
+		} else {
+			drm_syncobj_replace_fence(out_sync, fence);
+		}
+
+		drm_syncobj_put(out_sync);
+	}
+
+	return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+	return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+	struct dma_fence *fence;
+	int ret;
+
+	fence = nouveau_job_run(job);
+	if (IS_ERR(fence)) {
+		return PTR_ERR(fence);
+	} else if (fence) {
+		ret = dma_fence_wait(fence, true);
+		if (ret)
+			return ret;
+	}
+
+	dma_fence_signal(job->done_fence);
+
+	return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+	struct nouveau_sched_entity *entity = to_nouveau_sched_entity(job->base.entity);
+	int ret;
+
+	drm_exec_init(&job->exec, true);
+
+	ret = nouveau_job_add_deps(job);
+	if (ret)
+		goto out;
+
+	drm_sched_job_arm(&job->base);
+	job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+	ret = nouveau_job_fence_attach(job, job->done_fence);
+	if (ret)
+		goto out;
+
+	if (job->ops->submit) {
+		ret = job->ops->submit(job);
+		if (ret)
+			goto out;
+	}
+
+	if (job->sync) {
+		drm_exec_fini(&job->exec);
+
+		/* We're requested to run a synchronous job, hence don't push
+		 * the job, bypassing the job scheduler, and execute the jobs
+		 * run() function right away.
+		 *
+		 * As a consequence of bypassing the job scheduler we need to
+		 * handle fencing and job cleanup ourselfes.
+		 */
+		ret = nouveau_job_run_sync(job);
+
+		/* If the job fails, the caller will do the cleanup for us. */
+		if (!ret)
+			nouveau_job_fini(job);
+
+		return ret;
+	} else {
+		mutex_lock(&entity->job.mutex);
+		drm_sched_entity_push_job(&job->base);
+		list_add_tail(&job->head, &entity->job.list);
+		mutex_unlock(&entity->job.mutex);
+	}
+
+out:
+	drm_exec_fini(&job->exec);
+	return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+	struct nouveau_job *job = to_nouveau_job(sched_job);
+
+	return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+	struct nouveau_job *job = to_nouveau_job(sched_job);
+	struct nouveau_channel *chan = job->chan;
+
+	if (unlikely(!atomic_read(&chan->killed)))
+		nouveau_channel_kill(chan);
+
+	NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+		  chan->chid);
+
+	nouveau_sched_entity_fini(job->entity);
+
+	return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+	struct nouveau_job *job = to_nouveau_job(sched_job);
+	struct nouveau_sched_entity *entity = job->entity;
+
+	mutex_lock(&entity->job.mutex);
+	list_del(&job->head);
+	mutex_unlock(&entity->job.mutex);
+
+	nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+			      struct drm_gpu_scheduler *sched)
+{
+
+	INIT_LIST_HEAD(&entity->job.list);
+	mutex_init(&entity->job.mutex);
+
+	return drm_sched_entity_init(&entity->base,
+				     DRM_SCHED_PRIORITY_NORMAL,
+				     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+	drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+	.run_job = nouveau_sched_run_job,
+	.timedout_job = nouveau_sched_timedout_job,
+	.free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+		       struct nouveau_drm *drm)
+{
+	long job_hang_limit = msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);
+
+	return drm_sched_init(sched, &nouveau_sched_ops,
+			      NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+			      NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+	drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)		\
+		container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)		\
+		container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)		\
+		container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+	struct drm_sched_job base;
+	struct list_head head;
+
+	struct nouveau_sched_entity *entity;
+
+	struct drm_file *file_priv;
+	struct nouveau_cli *cli;
+	struct nouveau_channel *chan;
+
+	struct drm_exec exec;
+	struct dma_fence *done_fence;
+
+	bool sync;
+
+	struct {
+		struct drm_nouveau_sync *s;
+		u32 count;
+	} in_sync;
+
+	struct {
+		struct drm_nouveau_sync *s;
+		u32 count;
+	} out_sync;
+
+	struct nouveau_job_ops {
+		int (*submit)(struct nouveau_job *);
+		struct dma_fence *(*run)(struct nouveau_job *);
+		void (*free)(struct nouveau_job *);
+	} *ops;
+};
+
+struct nouveau_exec_job {
+	struct nouveau_job base;
+
+	struct {
+		struct drm_nouveau_exec_push *s;
+		u32 count;
+	} push;
+};
+
+struct nouveau_bind_job {
+	struct nouveau_job base;
+
+	/* struct bind_job_op */
+	struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+			  struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+			  struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)		\
+		container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+	struct drm_sched_entity base;
+	struct {
+		struct list_head list;
+		struct mutex mutex;
+	} job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+			      struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+		       struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#61 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
  Documentation/gpu/driver-uapi.rst       |   3 + drivers/gpu/drm/nouveau/Kbuild          |   2 + drivers/gpu/drm/nouveau/Kconfig         |   2 + drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 + drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 + drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +- drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +- drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++ drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++ drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++ drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++

  11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 11 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 2 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Regarding the locking, anything specific that makes it look suspicious to you?

Quoted 682 lines

Thanks,

Thomas

Quoted 675 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence 

*fence)

drivers/gpu/drm/nouveau/nouveau_sched.c new file +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity = 

to_nouveau_sched_entity(job->base.entity);
+    int ret;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit = 

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

drivers/gpu/drm/nouveau/nouveau_sched.c new file +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#62 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
  Documentation/gpu/driver-uapi.rst       |   3 + drivers/gpu/drm/nouveau/Kbuild          |   2 + drivers/gpu/drm/nouveau/Kconfig         |   2 + drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 + drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 + drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +- drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +- drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++ drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++ drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++ drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++

  11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

drivers/gpu/drm/nouveau/nouveau_sched.c new file +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

drivers/gpu/drm/nouveau/nouveau_sched.c new file +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#63 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 93 lines · Matthew Brost
Quoted 58 lines · Danilo Krummrich
Quoted 42 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
   Documentation/gpu/driver-uapi.rst       |   3 +
   drivers/gpu/drm/nouveau/Kbuild          |   2 +
   drivers/gpu/drm/nouveau/Kconfig         |   2 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
   drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
   drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
   11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 13 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 8 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Quoted 7 lines
Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Yes, that was what looked suspicious to me, although I haven't either looked at the code in detail to say for sure.

But starting by annotating this with dma_fence_[begin | end]_signalling() would help find all issues with this.

FWIW, by coincidence I  discussed drm-scheduler dma-fence annotation with Daniel Vetter yesterday and it appears he has a patch-set to enable that, at least for drivers that want to opt-in. We probably should try to get that merged and then we'd be able to catch this type of things earlier.

Thanks,

Thomas

Quoted 684 lines

Matt

Quoted 681 lines
Quoted 681 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

drivers/gpu/drm/nouveau/nouveau_sched.c new file +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

drivers/gpu/drm/nouveau/nouveau_sched.c new file +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#64 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

In reply to Matthew Brost
Quoted 92 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
   Documentation/gpu/driver-uapi.rst       |   3 +
   drivers/gpu/drm/nouveau/Kbuild          |   2 +
   drivers/gpu/drm/nouveau/Kconfig         |   2 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
   drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
   drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
   11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Anyway, I should be able to get rid of all the allocations to make this safe.

Quoted 5 lines

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Sounds great!

Quoted 9 lines
Quoted 4 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Oh, sure. I already checked that, luckily there aren't any further allocations under this lock, so this should be safe once I changed to run_job() parts to pre-allocation in submit().

Quoted 688 lines

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

drivers/gpu/drm/nouveau/nouveau_sched.c new file +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

drivers/gpu/drm/nouveau/nouveau_sched.c new file +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#65 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 96 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
   Documentation/gpu/driver-uapi.rst       |   3 +
   drivers/gpu/drm/nouveau/Kbuild          |   2 +
   drivers/gpu/drm/nouveau/Kconfig         |   2 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
   drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
   drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
   11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Quoted 8 lines

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Can we not use drm_gpuvs_manager in a similar manner to generate the ops + update the VM's VMA structure early? Again maybe I missing something here as I haven't fully studied the drm_gpuva_manager.

Matt

Quoted 713 lines

Anyway, I should be able to get rid of all the allocations to make this safe.

Quoted 5 lines

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Sounds great!

Quoted 8 lines
Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Oh, sure. I already checked that, luckily there aren't any further allocations under this lock, so this should be safe once I changed to run_job() parts to pre-allocation in submit().

Quoted 688 lines

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

drivers/gpu/drm/nouveau/nouveau_sched.c new file +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

drivers/gpu/drm/nouveau/nouveau_sched.c new file +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#66 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 101 lines · Matthew Brost
Quoted 100 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
    Documentation/gpu/driver-uapi.rst       |   3 +
    drivers/gpu/drm/nouveau/Kbuild          |   2 +
    drivers/gpu/drm/nouveau/Kconfig         |   2 +
    drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
    drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
    drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
    drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
    drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
    drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
    drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
    drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
    11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

Quoted 7 lines
Quoted 4 lines

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

The limitation I mentioned above doesn't really come from the drm_gpuva_manager, but from how the driver executes the jobs.

Quoted 10 lines

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 6 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Ok, so you're not only generating the split/merge steps without updating the view of the VA space (which would cause the issue I described) but also already change the view of the VA space in the IOCTL, before the actual page table update happens later on, right?

Currently, in nouveau I do both, the actual page table update and the range allocator update, in run_job(), such that walking the allocator always represents the actual page table layout.

How do you handle map/unmap on BO eviction?

Quoted 4 lines

Can we not use drm_gpuvs_manager in a similar manner to generate the ops + update the VM's VMA structure early? Again maybe I missing something here as I haven't fully studied the drm_gpuva_manager.

You can use the drm_gpuvs_manager in exactly the way you just described. Though, in your concrete example it would generate just 1 unbind and 1 bind, which it would combine in a re-bind operation. A re-bind operation always has 1 unbind and up to 2 (but a minimum of 1) bind (sub-)operations.

Rebind:
1. unbind 0x0000-0x3000
2. NULL
3. bind 0x1000-0x3000

It's then up to the driver to remove the old gpuva entry and add a new one. With the given re-bind operation the driver can conclude to just do a partial page table update from 0x0000-0x1000.

- Danilo

Quoted 717 lines

Matt

Quoted 713 lines

Anyway, I should be able to get rid of all the allocations to make this safe.

Quoted 5 lines

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Sounds great!

Quoted 8 lines
Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Oh, sure. I already checked that, luckily there aren't any further allocations under this lock, so this should be safe once I changed to run_job() parts to pre-allocation in submit().

Quoted 688 lines

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

drivers/gpu/drm/nouveau/nouveau_sched.c new file +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

drivers/gpu/drm/nouveau/nouveau_sched.c new file +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

drivers/gpu/drm/nouveau/nouveau_sched.c new file +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#67 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 132 lines · Danilo Krummrich
Quoted 101 lines · Matthew Brost
Quoted 100 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
    Documentation/gpu/driver-uapi.rst       |   3 +
    drivers/gpu/drm/nouveau/Kbuild          |   2 +
    drivers/gpu/drm/nouveau/Kconfig         |   2 +
    drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
    drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
    drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
    drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
    drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
    drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
    drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
    drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
    11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

Quoted 7 lines
Quoted 4 lines

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

The limitation I mentioned above doesn't really come from the drm_gpuva_manager, but from how the driver executes the jobs.

Quoted 10 lines

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 6 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Quoted 5 lines

Ok, so you're not only generating the split/merge steps without updating the view of the VA space (which would cause the issue I described) but also already change the view of the VA space in the IOCTL, before the actual page table update happens later on, right?

Yes, we generate the operations + update the view VA space in the IOCTL while the actual page table update on the GPU occurs later if there are dependencies.

Quoted 4 lines

Currently, in nouveau I do both, the actual page table update and the range allocator update, in run_job(), such that walking the allocator always represents the actual page table layout.

In Xe the VA view is always if all submited bind / unbind ops has completed even if some are pending.

Also you may want to take a look at generic page walker Thomas Hellstrom wrote for Xe which we use to program the page tables. It is pretty slick and probably could use in Nouveau:
https://patchwork.freedesktop.org/patch/515856/?series=112188&rev=1

In Xe xe_pt.c is the wrapper for this, it can map, unmap, and invalidate VA:
https://cgit.freedesktop.org/drm/drm-xe/tree/drivers/gpu/drm/xe/xe_pt.c?h=drm-xe-next

Quoted 2 lines

How do you handle map/unmap on BO eviction?

We use the dma-resv slots to order all of this.

Basically exec/map/unmap wait on pending BOs (I believe moves are in the KERNEL slot) and BOs moves wait on pending exec/map/unmaps (I believe these are BOOKKEEP slot).

I think more details are in the Xe kernel doc, see 'dma-resv usage':
https://cgit.freedesktop.org/drm/drm-xe/tree/drivers/gpu/drm/xe/xe_vm_doc.h?h=drm-xe-next

This might be a little stale, we dropped the idea of DMA_RESV_USAGE_PREEMPT_FENCE and is now just in the BOOKKEEP but I think everything else is corret.

Quoted 10 lines
Quoted 4 lines

Can we not use drm_gpuvs_manager in a similar manner to generate the ops + update the VM's VMA structure early? Again maybe I missing something here as I haven't fully studied the drm_gpuva_manager.

You can use the drm_gpuvs_manager in exactly the way you just described. Though, in your concrete example it would generate just 1 unbind and 1 bind, which it would combine in a re-bind operation. A re-bind operation always has 1 unbind and up to 2 (but a minimum of 1) bind (sub-)operations.

Cool this is what I wanted to hear. Hopefully we can get around to building our VM / VMA management on top the drm_gpuvs_manager soon.

Matt

Quoted 729 lines

Rebind:
1. unbind 0x0000-0x3000
2. NULL
3. bind 0x1000-0x3000

It's then up to the driver to remove the old gpuva entry and add a new one. With the given re-bind operation the driver can conclude to just do a partial page table update from 0x0000-0x1000.

- Danilo

Quoted 717 lines

Matt

Quoted 713 lines

Anyway, I should be able to get rid of all the allocations to make this safe.

Quoted 5 lines

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Sounds great!

Quoted 8 lines
Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Oh, sure. I already checked that, luckily there aren't any further allocations under this lock, so this should be safe once I changed to run_job() parts to pre-allocation in submit().

Quoted 688 lines

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

(quoted diff) +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

(quoted diff) +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

(quoted diff) +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

(quoted diff) +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#68 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 143 lines · Matthew Brost
Quoted 132 lines · Danilo Krummrich
Quoted 101 lines · Matthew Brost
Quoted 100 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
     Documentation/gpu/driver-uapi.rst       |   3 +
     drivers/gpu/drm/nouveau/Kbuild          |   2 +
     drivers/gpu/drm/nouveau/Kconfig         |   2 +
     drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
     drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
     drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
     drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
     drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
     drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
     drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
     drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
     11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

Quoted 7 lines
Quoted 4 lines

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

The limitation I mentioned above doesn't really come from the drm_gpuva_manager, but from how the driver executes the jobs.

Quoted 10 lines

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 6 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Quoted 5 lines

Ok, so you're not only generating the split/merge steps without updating the view of the VA space (which would cause the issue I described) but also already change the view of the VA space in the IOCTL, before the actual page table update happens later on, right?

Yes, we generate the operations + update the view VA space in the IOCTL while the actual page table update on the GPU occurs later if there are dependencies.

Quoted 7 lines
Quoted 4 lines

Currently, in nouveau I do both, the actual page table update and the range allocator update, in run_job(), such that walking the allocator always represents the actual page table layout.

In Xe the VA view is always if all submited bind / unbind ops has completed even if some are pending.

If they're completed, yes. But in the time frame from the VA space update until the GPU actually updated the page tables it isn't? Not that I think it's a problem, just curious.

Quoted 19 lines

Also you may want to take a look at generic page walker Thomas Hellstrom wrote for Xe which we use to program the page tables. It is pretty slick and probably could use in Nouveau:
https://patchwork.freedesktop.org/patch/515856/?series=112188&rev=1

In Xe xe_pt.c is the wrapper for this, it can map, unmap, and invalidate VA:
https://cgit.freedesktop.org/drm/drm-xe/tree/drivers/gpu/drm/xe/xe_pt.c?h=drm-xe-next

Quoted 2 lines

How do you handle map/unmap on BO eviction?

We use the dma-resv slots to order all of this.

Basically exec/map/unmap wait on pending BOs (I believe moves are in the KERNEL slot) and BOs moves wait on pending exec/map/unmaps (I believe these are BOOKKEEP slot).

Quoted 6 lines

I think more details are in the Xe kernel doc, see 'dma-resv usage':
https://cgit.freedesktop.org/drm/drm-xe/tree/drivers/gpu/drm/xe/xe_vm_doc.h?h=drm-xe-next

This might be a little stale, we dropped the idea of DMA_RESV_USAGE_PREEMPT_FENCE and is now just in the BOOKKEEP but I think everything else is corret.

If a BO is currently eviceted, did you consider to just add it to your rebind list rather than calling ttm_bo_validate() and creating the actual mapping right away?

I was thinking about this kind of "lazy mapping" approach for cases like partial unbind requests, where I wouldn't expect the application to need the mapping right away, but also for normal bind requests. I mean, when there is already memory pressure, why making the situation worse until an actual EXEC is requested?

Also, if I see it correctly unmaps caused by xe_bo_move_notify() happen on the CPU, right?

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Can we not use drm_gpuvs_manager in a similar manner to generate the ops + update the VM's VMA structure early? Again maybe I missing something here as I haven't fully studied the drm_gpuva_manager.

Quoted 8 lines
Quoted 5 lines

You can use the drm_gpuvs_manager in exactly the way you just described. Though, in your concrete example it would generate just 1 unbind and 1 bind, which it would combine in a re-bind operation. A re-bind operation always has 1 unbind and up to 2 (but a minimum of 1) bind (sub-)operations.

Cool this is what I wanted to hear. Hopefully we can get around to building our VM / VMA management on top the drm_gpuvs_manager soon.

I will re-work the drm_gpuva_manager memory allocation parts first, since those changes will influence it's API. How the internal allocator works, if it's drm_mm or something else, shouldn't matter to users of the drm_gpuva_manager from an API PoV.

- Danilo

Quoted 733 lines

Matt

Quoted 729 lines

Rebind:
1. unbind 0x0000-0x3000
2. NULL
3. bind 0x1000-0x3000

It's then up to the driver to remove the old gpuva entry and add a new one. With the given re-bind operation the driver can conclude to just do a partial page table update from 0x0000-0x1000.

- Danilo

Quoted 717 lines

Matt

Quoted 713 lines

Anyway, I should be able to get rid of all the allocations to make this safe.

Quoted 5 lines

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Sounds great!

Quoted 8 lines
Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Oh, sure. I already checked that, luckily there aren't any further allocations under this lock, so this should be safe once I changed to run_job() parts to pre-allocation in submit().

Quoted 688 lines

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

(quoted diff) +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

(quoted diff) +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

(quoted diff) +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

(quoted diff) +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#69 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 149 lines · Danilo Krummrich
Quoted 148 lines · Matthew Brost
Quoted 132 lines · Danilo Krummrich
Quoted 101 lines · Matthew Brost
Quoted 100 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
     Documentation/gpu/driver-uapi.rst       |   3 +
     drivers/gpu/drm/nouveau/Kbuild          |   2 +
     drivers/gpu/drm/nouveau/Kconfig         |   2 +
     drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
     drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
     drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
     drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
     drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
     drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
     drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
     drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
     11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

Quoted 7 lines
Quoted 4 lines

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

The limitation I mentioned above doesn't really come from the drm_gpuva_manager, but from how the driver executes the jobs.

Quoted 10 lines

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 6 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Quoted 5 lines

Ok, so you're not only generating the split/merge steps without updating the view of the VA space (which would cause the issue I described) but also already change the view of the VA space in the IOCTL, before the actual page table update happens later on, right?

Yes, we generate the operations + update the view VA space in the IOCTL while the actual page table update on the GPU occurs later if there are dependencies.

Quoted 4 lines

Currently, in nouveau I do both, the actual page table update and the range allocator update, in run_job(), such that walking the allocator always represents the actual page table layout.

Quoted 7 lines
Quoted 2 lines

In Xe the VA view is always if all submited bind / unbind ops has completed even if some are pending.

If they're completed, yes. But in the time frame from the VA space update until the GPU actually updated the page tables it isn't? Not that I think it's a problem, just curious.

There is a window where the VA space and actual page tables are not in sync. This is definitely is fine as we've tested Xe quite thoroughly. Essentially we are just pipelining the VA space in step with the actual GPU page tables update in the another. The GPU page table update step doesn't look of VA space rather the VA space step provides all the information (statically) so the GPU page table can occur.

Quoted 22 lines
Quoted 22 lines

Also you may want to take a look at generic page walker Thomas Hellstrom wrote for Xe which we use to program the page tables. It is pretty slick and probably could use in Nouveau:
https://patchwork.freedesktop.org/patch/515856/?series=112188&rev=1

In Xe xe_pt.c is the wrapper for this, it can map, unmap, and invalidate VA:
https://cgit.freedesktop.org/drm/drm-xe/tree/drivers/gpu/drm/xe/xe_pt.c?h=drm-xe-next

Quoted 2 lines

How do you handle map/unmap on BO eviction?

We use the dma-resv slots to order all of this.

Basically exec/map/unmap wait on pending BOs (I believe moves are in the KERNEL slot) and BOs moves wait on pending exec/map/unmaps (I believe these are BOOKKEEP slot).

I think more details are in the Xe kernel doc, see 'dma-resv usage':
https://cgit.freedesktop.org/drm/drm-xe/tree/drivers/gpu/drm/xe/xe_vm_doc.h?h=drm-xe-next

Quoted 8 lines
Quoted 3 lines

This might be a little stale, we dropped the idea of DMA_RESV_USAGE_PREEMPT_FENCE and is now just in the BOOKKEEP but I think everything else is corret.

If a BO is currently eviceted, did you consider to just add it to your rebind list rather than calling ttm_bo_validate() and creating the actual mapping right away?

No, but that is good idea. We probably should look at this optimization.

Quoted 9 lines

I was thinking about this kind of "lazy mapping" approach for cases like partial unbind requests, where I wouldn't expect the application to need the mapping right away, but also for normal bind requests. I mean, when there is already memory pressure, why making the situation worse until an actual EXEC is requested?

Also, if I see it correctly unmaps caused by xe_bo_move_notify() happen on the CPU, right?

I'm not exactly sure what you asking here, but we have 3 cases here.

1. Fault mode, we just blow away the page tables, will get a fault on next use, and then trigger a rebind.

2. Compute mode, trigger the preempt fences (kicks everything using the BO off the hardware before the move), the rebind worker will issue a rebind and resume execution.

3. dma-fence mode, the BO move is scheduled behind any pending execs, the next exec IOCTL will issue the rebind.

In all case before the rebind the BO validated again perhap triggering another move, all rebinds are scheduled behind the move.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

Can we not use drm_gpuvs_manager in a similar manner to generate the ops + update the VM's VMA structure early? Again maybe I missing something here as I haven't fully studied the drm_gpuva_manager.

You can use the drm_gpuvs_manager in exactly the way you just described. Though, in your concrete example it would generate just 1 unbind and 1 bind, which it would combine in a re-bind operation. A re-bind operation always has 1 unbind and up to 2 (but a minimum of 1) bind (sub-)operations.

Quoted 8 lines
Quoted 2 lines

Cool this is what I wanted to hear. Hopefully we can get around to building our VM / VMA management on top the drm_gpuvs_manager soon.

I will re-work the drm_gpuva_manager memory allocation parts first, since those changes will influence it's API. How the internal allocator works, if it's drm_mm or something else, shouldn't matter to users of the drm_gpuva_manager from an API PoV.

Definitely work out the API changes first as we can work on / optimize the internals later. If Christian can provide the benchmarks / WL that do tons of binds we may be able to run these on Xe to help find the best solution for the internals. VK is mostly working for Xe.

Matt

Quoted 735 lines

- Danilo

Quoted 732 lines

Matt

Quoted 729 lines

Rebind:
1. unbind 0x0000-0x3000
2. NULL
3. bind 0x1000-0x3000

It's then up to the driver to remove the old gpuva entry and add a new one. With the given re-bind operation the driver can conclude to just do a partial page table update from 0x0000-0x1000.

- Danilo

Quoted 717 lines

Matt

Quoted 713 lines

Anyway, I should be able to get rid of all the allocations to make this safe.

Quoted 5 lines

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Sounds great!

Quoted 8 lines
Quoted 3 lines

Regarding the locking, anything specific that makes it look suspicious to you?

I haven't looked into this too but almost certainly Thomas is suggesting that if you allocate memory anywhere under the nouveau_uvmm_lock then you can't use this lock in the run_job() callback as this in the dma-fencing path.

Oh, sure. I already checked that, luckily there aren't any further allocations under this lock, so this should be safe once I changed to run_job() parts to pre-allocation in submit().

Quoted 688 lines

Matt

Quoted 684 lines
Quoted 683 lines

Thanks,

Thomas

Quoted 676 lines

+    nouveau_uvmm_lock(uvmm);
+    list_for_each_op(op, &bind_job->ops) {
+        switch (op->op) {
+        case OP_ALLOC: {
+            bool sparse = op->flags & DRM_NOUVEAU_VM_BIND_SPARSE;

(quoted diff) +366 -0
+
+            ret = nouveau_uvma_region_new(uvmm,
+                              op->va.addr,
+                              op->va.range,
+                              sparse);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+        case OP_FREE:
+            ret = nouveau_uvma_region_destroy(uvmm,
+                              op->va.addr,
+                              op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_MAP:
+            ret = nouveau_uvmm_sm_map(uvmm,
+                          op->va.addr, op->va.range,
+                          op->gem.obj, op->gem.offset,
+                          op->flags && 0xff);
+            if (ret)
+                goto out_unlock;
+            break;
+        case OP_UNMAP:
+            ret = nouveau_uvmm_sm_unmap(uvmm,
+                            op->va.addr,
+                            op->va.range);
+            if (ret)
+                goto out_unlock;
+            break;
+        }
+    }
+
+out_unlock:
+    nouveau_uvmm_unlock(uvmm);
+    if (ret)
+        NV_PRINTK(err, job->cli, "bind job failed: %d\n", ret);
+    return ERR_PTR(ret);
+}
+
+static void
+nouveau_bind_job_free(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, &bind_job->ops) {
+        struct drm_gem_object *obj = op->gem.obj;
+
+        if (obj)
+            drm_gem_object_put(obj);
+
+        list_del(&op->entry);
+        kfree(op);
+    }
+
+    nouveau_base_job_free(job);
+    kfree(bind_job);
+}
+
+static struct nouveau_job_ops nouveau_bind_job_ops = {
+    .submit = nouveau_bind_job_submit,
+    .run = nouveau_bind_job_run,
+    .free = nouveau_bind_job_free,
+};
+
+static int
+bind_job_op_from_uop(struct bind_job_op **pop,
+             struct drm_nouveau_vm_bind_op *uop)
+{
+    struct bind_job_op *op;
+
+    op = *pop = kzalloc(sizeof(*op), GFP_KERNEL);
+    if (!op)
+        return -ENOMEM;
+
+    op->op = uop->op;
+    op->flags = uop->flags;
+    op->va.addr = uop->addr;
+    op->va.range = uop->range;
+
+    if (op->op == DRM_NOUVEAU_VM_BIND_OP_MAP) {
+        op->gem.handle = uop->handle;
+        op->gem.offset = uop->bo_offset;
+    }
+
+    return 0;
+}
+
+static void
+bind_job_ops_free(struct list_head *ops)
+{
+    struct bind_job_op *op, *next;
+
+    list_for_each_op_safe(op, next, ops) {
+        list_del(&op->entry);
+        kfree(op);
+    }
+}
+
+int
+nouveau_bind_job_init(struct nouveau_bind_job **pjob,
+              struct nouveau_exec_bind *bind)
+{
+    struct nouveau_bind_job *job;
+    struct bind_job_op *op;
+    int i, ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    INIT_LIST_HEAD(&job->ops);
+
+    for (i = 0; i < bind->op.count; i++) {
+        ret = bind_job_op_from_uop(&op, &bind->op.s[i]);
+        if (ret)
+            goto err_free;
+
+        list_add_tail(&op->entry, &job->ops);
+    }
+
+    job->base.sync = !(bind->flags & DRM_NOUVEAU_VM_BIND_RUN_ASYNC);
+    job->base.ops = &nouveau_bind_job_ops;
+
+    ret = nouveau_base_job_init(&job->base, &bind->base);
+    if (ret)
+        goto err_free;
+
+    return 0;
+
+err_free:
+    bind_job_ops_free(&job->ops);
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+static int
+sync_find_fence(struct nouveau_job *job,
+        struct drm_nouveau_sync *sync,
+        struct dma_fence **fence)
+{
+    u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+    u64 point = 0;
+    int ret;
+
+    if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+        stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        return -EOPNOTSUPP;
+
+    if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+        point = sync->timeline_value;
+
+    ret = drm_syncobj_find_fence(job->file_priv,
+                     sync->handle, point,
+                     sync->flags, fence);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+static int
+exec_job_binds_wait(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_sched_entity *bind_entity = &cli->sched_entity;
+    signed long ret;
+    int i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct nouveau_job *it;
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+        struct dma_fence *fence;
+        bool found;
+
+        ret = sync_find_fence(job, sync, &fence);
+        if (ret)
+            return ret;
+
+        mutex_lock(&bind_entity->job.mutex);
+        found = false;
+        list_for_each_entry(it, &bind_entity->job.list, head) {
+            if (fence == it->done_fence) {
+                found = true;
+                break;
+            }
+        }
+        mutex_unlock(&bind_entity->job.mutex);
+
+        /* If the fence is not from a VM_BIND job, don't wait for it. */
+        if (!found)
+            continue;
+
+        ret = dma_fence_wait_timeout(fence, true,
+                         msecs_to_jiffies(500));
+        if (ret < 0)
+            return ret;
+        else if (ret == 0)
+            return -ETIMEDOUT;
+    }
+
+    return 0;
+}
+
+int
+nouveau_exec_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_cli *cli = exec_job->base.cli;
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+    struct drm_exec *exec = &job->exec;
+    struct drm_gem_object *obj;
+    unsigned long index;
+    int ret;
+
+    ret = exec_job_binds_wait(job);
+    if (ret)
+        return ret;
+
+    nouveau_uvmm_lock(uvmm);
+    drm_exec_while_not_all_locked(exec) {
+        struct drm_gpuva *va;
+
+        drm_gpuva_for_each_va(va, &uvmm->umgr) {
+            ret = drm_exec_prepare_obj(exec, va->gem.obj, 1);
+            drm_exec_break_on_contention(exec);
+            if (ret)
+                return ret;
+        }
+    }
+    nouveau_uvmm_unlock(uvmm);
+
+    drm_exec_for_each_locked_object(exec, index, obj) {
+        struct dma_resv *resv = obj->resv;
+        struct nouveau_bo *nvbo = nouveau_gem_object(obj);
+
+        ret = nouveau_bo_validate(nvbo, true, false);
+        if (ret)
+            return ret;
+
+        dma_resv_add_fence(resv, job->done_fence, DMA_RESV_USAGE_WRITE);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_exec_job_run(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+    struct nouveau_fence *fence;
+    int i, ret;
+
+    ret = nouveau_dma_wait(job->chan, exec_job->push.count + 1, 16);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret);
+        return ERR_PTR(ret);
+    }
+
+    for (i = 0; i < exec_job->push.count; i++) {
+        nv50_dma_push(job->chan, exec_job->push.s[i].va,
+                  exec_job->push.s[i].va_len);
+    }
+
+    ret = nouveau_fence_new(job->chan, false, &fence);
+    if (ret) {
+        NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret);
+        WIND_RING(job->chan);
+        return ERR_PTR(ret);
+    }
+
+    return &fence->base;
+}
+static void
+nouveau_exec_job_free(struct nouveau_job *job)
+{
+    struct nouveau_exec_job *exec_job = to_nouveau_exec_job(job);
+
+    nouveau_base_job_free(job);
+
+    kfree(exec_job->push.s);
+    kfree(exec_job);
+}
+
+static struct nouveau_job_ops nouveau_exec_job_ops = {
+    .submit = nouveau_exec_job_submit,
+    .run = nouveau_exec_job_run,
+    .free = nouveau_exec_job_free,
+};
+
+int
+nouveau_exec_job_init(struct nouveau_exec_job **pjob,
+              struct nouveau_exec *exec)
+{
+    struct nouveau_exec_job *job;
+    int ret;
+
+    job = *pjob = kzalloc(sizeof(*job), GFP_KERNEL);
+    if (!job)
+        return -ENOMEM;
+
+    job->push.count = exec->push.count;
+    job->push.s = kmemdup(exec->push.s,
+                  sizeof(*exec->push.s) *
+                  exec->push.count,
+                  GFP_KERNEL);
+    if (!job->push.s) {
+        ret = -ENOMEM;
+        goto err_free_job;
+    }
+
+    job->base.ops = &nouveau_exec_job_ops;
+    ret = nouveau_base_job_init(&job->base, &exec->base);
+    if (ret)
+        goto err_free_pushs;
+
+    return 0;
+
+err_free_pushs:
+    kfree(job->push.s);
+err_free_job:
+    kfree(job);
+    *pjob = NULL;
+
+    return ret;
+}
+
+void nouveau_job_fini(struct nouveau_job *job)
+{
+    dma_fence_put(job->done_fence);
+    drm_sched_job_cleanup(&job->base);
+    job->ops->free(job);
+}
+
+static int
+nouveau_job_add_deps(struct nouveau_job *job)
+{
+    struct dma_fence *in_fence = NULL;
+    int ret, i;
+
+    for (i = 0; i < job->in_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->in_sync.s[i];
+
+        ret = sync_find_fence(job, sync, &in_fence);
+        if (ret) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> in): handle=%d\n",
+                  sync->handle);
+            return ret;
+        }
+
+        ret = drm_sched_job_add_dependency(&job->base, in_fence);
+        if (ret)
+            return ret;
+    }
+
+    return 0;
+}
+
+static int
+nouveau_job_fence_attach(struct nouveau_job *job, struct dma_fence

*fence)

(quoted diff) +71 -0
+{
+    struct drm_syncobj *out_sync;
+    int i;
+
+    for (i = 0; i < job->out_sync.count; i++) {
+        struct drm_nouveau_sync *sync = &job->out_sync.s[i];
+        u32 stype = sync->flags & DRM_NOUVEAU_SYNC_TYPE_MASK;
+
+        if (stype != DRM_NOUVEAU_SYNC_SYNCOBJ &&
+            stype != DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ)
+            return -EOPNOTSUPP;
+
+        out_sync = drm_syncobj_find(job->file_priv, sync->handle);
+        if (!out_sync) {
+            NV_PRINTK(warn, job->cli,
+                  "Failed to find syncobj (-> out): handle=%d\n",
+                  sync->handle);
+            return -ENOENT;
+        }
+
+        if (stype == DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ) {
+            struct dma_fence_chain *chain;
+
+            chain = dma_fence_chain_alloc();
+            if (!chain) {
+                drm_syncobj_put(out_sync);
+                return -ENOMEM;
+            }
+
+            drm_syncobj_add_point(out_sync, chain, fence,
+                          sync->timeline_value);
+        } else {
+            drm_syncobj_replace_fence(out_sync, fence);
+        }
+
+        drm_syncobj_put(out_sync);
+    }
+
+    return 0;
+}
+
+static struct dma_fence *
+nouveau_job_run(struct nouveau_job *job)
+{
+    return job->ops->run(job);
+}
+
+static int
+nouveau_job_run_sync(struct nouveau_job *job)
+{
+    struct dma_fence *fence;
+    int ret;
+
+    fence = nouveau_job_run(job);
+    if (IS_ERR(fence)) {
+        return PTR_ERR(fence);
+    } else if (fence) {
+        ret = dma_fence_wait(fence, true);
+        if (ret)
+            return ret;
+    }
+
+    dma_fence_signal(job->done_fence);
+
+    return 0;
+}
+
+int
+nouveau_job_submit(struct nouveau_job *job)
+{
+    struct nouveau_sched_entity *entity =

to_nouveau_sched_entity(job->base.entity);
+    int ret;

(quoted diff) +115 -0
+
+    drm_exec_init(&job->exec, true);
+
+    ret = nouveau_job_add_deps(job);
+    if (ret)
+        goto out;
+
+    drm_sched_job_arm(&job->base);
+    job->done_fence = dma_fence_get(&job->base.s_fence->finished);
+
+    ret = nouveau_job_fence_attach(job, job->done_fence);
+    if (ret)
+        goto out;
+
+    if (job->ops->submit) {
+        ret = job->ops->submit(job);
+        if (ret)
+            goto out;
+    }
+
+    if (job->sync) {
+        drm_exec_fini(&job->exec);
+
+        /* We're requested to run a synchronous job, hence don't push
+         * the job, bypassing the job scheduler, and execute the jobs
+         * run() function right away.
+         *
+         * As a consequence of bypassing the job scheduler we need to
+         * handle fencing and job cleanup ourselfes.
+         */
+        ret = nouveau_job_run_sync(job);
+
+        /* If the job fails, the caller will do the cleanup for us. */
+        if (!ret)
+            nouveau_job_fini(job);
+
+        return ret;
+    } else {
+        mutex_lock(&entity->job.mutex);
+        drm_sched_entity_push_job(&job->base);
+        list_add_tail(&job->head, &entity->job.list);
+        mutex_unlock(&entity->job.mutex);
+    }
+
+out:
+    drm_exec_fini(&job->exec);
+    return ret;
+}
+
+static struct dma_fence *
+nouveau_sched_run_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+
+    return nouveau_job_run(job);
+}
+
+static enum drm_gpu_sched_stat
+nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_channel *chan = job->chan;
+
+    if (unlikely(!atomic_read(&chan->killed)))
+        nouveau_channel_kill(chan);
+
+    NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n",
+          chan->chid);
+
+    nouveau_sched_entity_fini(job->entity);
+
+    return DRM_GPU_SCHED_STAT_ENODEV;
+}
+
+static void
+nouveau_sched_free_job(struct drm_sched_job *sched_job)
+{
+    struct nouveau_job *job = to_nouveau_job(sched_job);
+    struct nouveau_sched_entity *entity = job->entity;
+
+    mutex_lock(&entity->job.mutex);
+    list_del(&job->head);
+    mutex_unlock(&entity->job.mutex);
+
+    nouveau_job_fini(job);
+}
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched)
+{
+
+    INIT_LIST_HEAD(&entity->job.list);
+    mutex_init(&entity->job.mutex);
+
+    return drm_sched_entity_init(&entity->base,
+                     DRM_SCHED_PRIORITY_NORMAL,
+                     &sched, 1, NULL);
+}
+
+void
+nouveau_sched_entity_fini(struct nouveau_sched_entity *entity)
+{
+    drm_sched_entity_destroy(&entity->base);
+}
+
+static const struct drm_sched_backend_ops nouveau_sched_ops = {
+    .run_job = nouveau_sched_run_job,
+    .timedout_job = nouveau_sched_timedout_job,
+    .free_job = nouveau_sched_free_job,
+};
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm)
+{
+    long job_hang_limit =

msecs_to_jiffies(NOUVEAU_SCHED_JOB_TIMEOUT_MS);

(quoted diff) +10 -0
+
+    return drm_sched_init(sched, &nouveau_sched_ops,
+                  NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
+                  NULL, NULL, "nouveau", drm->dev->dev);
+}
+
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched)
+{
+    drm_sched_fini(sched);
+}
drivers/gpu/drm/nouveau/nouveau_sched.h new file +98 -0
new file mode 100644
index 000000000000..7fc5b7eea810
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: MIT
+
+#ifndef NOUVEAU_SCHED_H
+#define NOUVEAU_SCHED_H
+
+#include <linux/types.h>
+
+#include <drm/drm_exec.h>
+#include <drm/gpu_scheduler.h>
+
+#include "nouveau_drv.h"
+#include "nouveau_exec.h"
+
+#define to_nouveau_job(sched_job)        \
+        container_of((sched_job), struct nouveau_job, base)
+
+#define to_nouveau_exec_job(job)        \
+        container_of((job), struct nouveau_exec_job, base)
+
+#define to_nouveau_bind_job(job)        \
+        container_of((job), struct nouveau_bind_job, base)
+
+struct nouveau_job {
+    struct drm_sched_job base;
+    struct list_head head;
+
+    struct nouveau_sched_entity *entity;
+
+    struct drm_file *file_priv;
+    struct nouveau_cli *cli;
+    struct nouveau_channel *chan;
+
+    struct drm_exec exec;
+    struct dma_fence *done_fence;
+
+    bool sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } in_sync;
+
+    struct {
+        struct drm_nouveau_sync *s;
+        u32 count;
+    } out_sync;
+
+    struct nouveau_job_ops {
+        int (*submit)(struct nouveau_job *);
+        struct dma_fence *(*run)(struct nouveau_job *);
+        void (*free)(struct nouveau_job *);
+    } *ops;
+};
+
+struct nouveau_exec_job {
+    struct nouveau_job base;
+
+    struct {
+        struct drm_nouveau_exec_push *s;
+        u32 count;
+    } push;
+};
+
+struct nouveau_bind_job {
+    struct nouveau_job base;
+
+    /* struct bind_job_op */
+    struct list_head ops;
+};
+
+int nouveau_bind_job_init(struct nouveau_bind_job **job,
+              struct nouveau_exec_bind *bind);
+int nouveau_exec_job_init(struct nouveau_exec_job **job,
+              struct nouveau_exec *exec);
+
+int nouveau_job_submit(struct nouveau_job *job);
+void nouveau_job_fini(struct nouveau_job *job);
+
+#define to_nouveau_sched_entity(entity)        \
+        container_of((entity), struct nouveau_sched_entity, base)
+
+struct nouveau_sched_entity {
+    struct drm_sched_entity base;
+    struct {
+        struct list_head list;
+        struct mutex mutex;
+    } job;
+};
+
+int nouveau_sched_entity_init(struct nouveau_sched_entity *entity,
+                  struct drm_gpu_scheduler *sched);
+void nouveau_sched_entity_fini(struct nouveau_sched_entity *entity);
+
+int nouveau_sched_init(struct drm_gpu_scheduler *sched,
+               struct nouveau_drm *drm);
+void nouveau_sched_fini(struct drm_gpu_scheduler *sched);
+
+#endif
#70 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

In reply to Matthew Brost
Quoted 118 lines · On Thu, 19 Jan 2023 16:38:06 +0000 Matthew Brost <[email protected]>…
Quoted 96 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
   Documentation/gpu/driver-uapi.rst       |   3 +
   drivers/gpu/drm/nouveau/Kbuild          |   2 +
   drivers/gpu/drm/nouveau/Kconfig         |   2 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
   drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
   drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
   11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

drivers/gpu/drm/nouveau/nouveau_sched.c line 212

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_sched.c new file +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+  

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Quoted 8 lines

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 7 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Ok, so I've been contemplating the idea of pre-reserving memory for any future page-table updates, so I can guarantee the bind/unbind op in ->run_job() never fails (that's actually made more complicated in my case, because we don't directly control the page table updates, but defer that to the iommu/iopagetbl framework which does the allocation, so I didn't really go as far as you did). But with bind ops happening in a queue with dependencies to wait on, guessing what the page-table will look like is a bit challenging. Sure, we can pre-allocate pages for all levels needed to reach the leaf node(s) we're trying to insert or plan for the worst case scenario in case of 2MB -> 4K block splits for partial unmaps, but it sounds like a lot of memory reservation, especially if we get lot of bind requests queued. Just curious to hear how you solved that.

#71 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 129 lines · Boris Brezillon
Quoted 118 lines · On Thu, 19 Jan 2023 16:38:06 +0000 Matthew Brost <[email protected]>…
Quoted 96 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
   Documentation/gpu/driver-uapi.rst       |   3 +
   drivers/gpu/drm/nouveau/Kbuild          |   2 +
   drivers/gpu/drm/nouveau/Kconfig         |   2 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
   drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
   drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
   11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+  

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Quoted 8 lines

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 7 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Quoted 13 lines

Ok, so I've been contemplating the idea of pre-reserving memory for any future page-table updates, so I can guarantee the bind/unbind op in ->run_job() never fails (that's actually made more complicated in my case, because we don't directly control the page table updates, but defer that to the iommu/iopagetbl framework which does the allocation, so I didn't really go as far as you did). But with bind ops happening in a queue with dependencies to wait on, guessing what the page-table will look like is a bit challenging. Sure, we can pre-allocate pages for all levels needed to reach the leaf node(s) we're trying to insert or plan for the worst case scenario in case of 2MB -> 4K block splits for partial unmaps, but it sounds like a lot of memory reservation, especially if we get lot of bind requests queued. Just curious to hear how you solved that.

A few thing here.

First the reason we always do an unbind and possibly 2 rebinds is because we might crossing the 1GB / 2MB page boundary size. In the example I gave we could just unbind 0x1000-0x2000 and call it day but we'd have to build smarts into to our code to know that is ok which we don't have at this time.

e.g. This wouldn't ok just to do an unbind as the page size goes from 2MB to 4k:

Map 0x000000-0x200000 -> 2MB page
Unmap 0x100000-0x200000 -> need 256 4k pages now

For simplity we always do a unbind + 2 possible rebinds. Maybe we will be a little smarter in the future if needed.

WRT to the memory allocations, we haven't really thought about consequences of reserving memory for pending binds. My initial reaction is I don't think this an issue. Page table memory should be relatively small compared to user memory so having a bunch queue'd up shouldn't really be an issue, right? Going from 2MB -> 4k splits on either side is just another 2 4k allocs on either side. Maybe I'm wrong, I just don't see this being a major issue. If the user abusing the VM bind interface, e.g. Allocatiing misaligned huge chunks of data, that is kinda on them.

Matt

#72 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

Quoted 152 lines · On Sun, 22 Jan 2023 17:48:37 +0000 Matthew Brost <[email protected]>…
Quoted 129 lines · Boris Brezillon
Quoted 118 lines · On Thu, 19 Jan 2023 16:38:06 +0000 Matthew Brost <[email protected]>…
Quoted 96 lines · Danilo Krummrich
Quoted 91 lines · Matthew Brost
Quoted 63 lines · Danilo Krummrich
Quoted 44 lines · Thomas Hellström (Intel)
Quoted 40 lines · Danilo Krummrich

This commit provides the implementation for the new uapi motivated by the Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl. UMDs can request the named operations to be processed either synchronously or asynchronously. It supports DRM syncobjs (incl. timelines) as synchronization mechanism. The management of the GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The execution happens asynchronously. It supports DRM syncobj (incl. timelines) as synchronization mechanism. DRM GEM object locking is handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM GPU scheduler for the asynchronous paths.

---
   Documentation/gpu/driver-uapi.rst       |   3 +
   drivers/gpu/drm/nouveau/Kbuild          |   2 +
   drivers/gpu/drm/nouveau/Kconfig         |   2 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c |  16 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h |   1 +
   drivers/gpu/drm/nouveau/nouveau_drm.c   |  23 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h   |   9 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c  | 310 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_exec.h  |  55 ++
   drivers/gpu/drm/nouveau/nouveau_sched.c | 780 ++++++++++++++++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h |  98 +++
   11 files changed, 1295 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h

...

Quoted 1 line
Quoted 14 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+static struct dma_fence *
+nouveau_bind_job_run(struct nouveau_job *job)
+{
+    struct nouveau_bind_job *bind_job = to_nouveau_bind_job(job);
+    struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(job->cli);
+    struct bind_job_op *op;
+    int ret = 0;
+    

I was looking at how nouveau does the async binding compared to how xe does it.
It looks to me that this function being a scheduler run_job callback is the main part of the VM_BIND dma-fence signalling critical section for the job's done_fence and if so, needs to be annotated as such?

Yes, that's the case.

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

For example nouveau_uvma_region_new allocates memory, which is not allowed if in a dma_fence signalling critical section and the locking also looks suspicious?

Thanks for pointing this out, I missed that somehow.

I will change it to pre-allocate new regions, mappings and page tables within the job's submit() function.

Yea that what we basically do in Xe, in the IOCTL step allocate all the backing store for new page tables, populate new page tables (these are not yet visible in the page table structure), and in last step which is executed after all the dependencies are satified program all the leaf entires making the new binding visible.

We screwed have this up by defering most of the IOCTL to a worker but will fix this fix this one way or another soon - get rid of worker or introduce a type of sync that is signaled after the worker + publish the dma-fence in the worker. I'd like to close on this one soon.

Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 3 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Quoted 8 lines

I think we can't really ask for the split/merge steps before actually running the job, since it requires the particular VA space not to change while performing those operations.

E.g. if we'd run the split/merge steps at job submit() time the underlying VA space could be changed by other bind jobs executing before this one, which would make the calculated split/merge steps obsolete and wrong.

Hmm, maybe I'm not understanding this implementation, admittedly I haven't studied the gpuva manager code in detail.

Let me explain what we are doing in Xe.

Map 0x0000 - 0x3000 -> this resolves into 1 bind operation and 1 VMA Unmap 0x1000-0x2000 -> this resolves into 1 unbind and 2 rebind operations

1. unbind 0x0000-0x3000 -> destroy old VMA
2. rebind 0x0000-0x1000 -> new VMA
3. rebind 0x2000-0x3000 -> new VMA

Quoted 7 lines

All of the above steps resolving the operations can be done in the IOCTL phase and VM's VMA structure is also updated. When the dependencies are resolved the actual bindings are done on the GPU. We use the BO's dma-resv slots to ensure there is never a window 0x0000-0x1000 and 0x2000-0x3000 are never mapped with respect to execs (I forget the exact details of how we do this but if you want to know I'll explain further).

Quoted 13 lines

Ok, so I've been contemplating the idea of pre-reserving memory for any future page-table updates, so I can guarantee the bind/unbind op in ->run_job() never fails (that's actually made more complicated in my case, because we don't directly control the page table updates, but defer that to the iommu/iopagetbl framework which does the allocation, so I didn't really go as far as you did). But with bind ops happening in a queue with dependencies to wait on, guessing what the page-table will look like is a bit challenging. Sure, we can pre-allocate pages for all levels needed to reach the leaf node(s) we're trying to insert or plan for the worst case scenario in case of 2MB -> 4K block splits for partial unmaps, but it sounds like a lot of memory reservation, especially if we get lot of bind requests queued. Just curious to hear how you solved that.

A few thing here.

First the reason we always do an unbind and possibly 2 rebinds is because we might crossing the 1GB / 2MB page boundary size. In the example I gave we could just unbind 0x1000-0x2000 and call it day but we'd have to build smarts into to our code to know that is ok which we don't have at this time.

Quoted 8 lines

e.g. This wouldn't ok just to do an unbind as the page size goes from 2MB to 4k:

Map 0x000000-0x200000 -> 2MB page
Unmap 0x100000-0x200000 -> need 256 4k pages now

For simplity we always do a unbind + 2 possible rebinds. Maybe we will be a little smarter in the future if needed.

Yeah, I see why you're doing that, but it's not really an option in pancsf, because this is hidden behind the io_pgtable abstract, which deals with splits/merges of PTEs on its own. So, when we call io_pgtable_ops->unmap(0x1000-0x2000), what happens in practice is:

1/ allocate an L3 page table
2/ populate the 0x000000-0x001000 and 0x002000-0x200000 range in this
new L3 page table
3/ update the L2 page table entry to point to the L3 one

In that regards, the io_pgtable abstraction makes it simpler for the driver, but that also means we don't control memory allocation, and both map and unmap operations can fail.

Quoted 7 lines

WRT to the memory allocations, we haven't really thought about consequences of reserving memory for pending binds. My initial reaction is I don't think this an issue. Page table memory should be relatively small compared to user memory so having a bunch queue'd up shouldn't really be an issue, right? Going from 2MB -> 4k splits on either side is just another 2 4k allocs on either side.

Well, yes, for unmap ops, you'd probably need a maximum of 2 pages, but for a map op, if you need to allocate L1 and L2 tables (they might not exist when the map request reaches time of execution, and it's pretty hard to predict the state of the page-table), that's actually more than just 2 pages. It depends on the size of the mapping actually. And yes, I agree it's not much compared to the amount of user memory, but if you have plenty of map/unmap requests queued, pre-reserving those pages can still consume a non-negligible amount of memory. But maybe we'll have bigger problems if the amount of queued VM_BIND requests grows to the point where the amount of memory reserved for future page-table updates is a problem, dunno.

#73 lore raw

Re: [PATCH drm-next 13/14] drm/nouveau: implement new VM_BIND UAPI

In reply to Matthew Brost
Quoted 7 lines · On Thu, 19 Jan 2023 04:58:48 +0000 Matthew Brost <[email protected]>…
Quoted 6 lines

For the ops structures the drm_gpuva_manager allocates for reporting the split/merge steps back to the driver I have ideas to entirely avoid allocations, which also is a good thing in respect of Christians feedback regarding the huge amount of mapping requests some applications seem to generate.

Quoted 8 lines

It should be fine to have allocations to report the split/merge step as this step should be before a dma-fence is published, but yea if possible to avoid extra allocs as that is always better.

Also BTW, great work on drm_gpuva_manager too. We will almost likely pick this up in Xe rather than open coding all of this as we currently do. We should probably start the port to this soon so we can contribute to the implementation and get both of our drivers upstream sooner.

Also quite interested in using this drm_gpuva_manager for pancsf, since I've been open-coding something similar. Didn't have the gpuva_region concept to make sure VA mapping/unmapping requests don't don't go outside a pre-reserved region, but it seems to automate some of the stuff I've been doing quite nicely.

#74 lore raw

PATCH 14/14 drm/nouveau: debugfs: implement DRM GPU VA debugfs

In reply to Danilo Krummrich

Provide the driver indirection iterating over all DRM GPU VA spaces to enable the common 'gpuvas' debugfs file for dumping DRM GPU VA spaces.

---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 24 +++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +24 -0
index 2a36d1ca8fda..7f6ccc5d1d86 100644
@@ -202,6 +202,29 @@ nouveau_debugfs_pstate_open(struct inode *inode, struct file *file)
 	return single_open(file, nouveau_debugfs_pstate_get, inode->i_private);
 }
 
+static int
+nouveau_debugfs_gpuva(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct nouveau_drm *drm = nouveau_drm(node->minor->dev);
+	struct nouveau_cli *cli;
+
+	mutex_lock(&drm->clients_lock);
+	list_for_each_entry(cli, &drm->clients, head) {
+		struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli);
+
+		if (!uvmm)
+			continue;
+
+		nouveau_uvmm_lock(uvmm);
+		drm_debugfs_gpuva_info(m, &uvmm->umgr);
+		nouveau_uvmm_unlock(uvmm);
+	}
+	mutex_unlock(&drm->clients_lock);
+
+	return 0;
+}
+
 static const struct file_operations nouveau_pstate_fops = {
 	.owner = THIS_MODULE,
 	.open = nouveau_debugfs_pstate_open,
@@ -213,6 +236,7 @@ static const struct file_operations nouveau_pstate_fops = {
 static struct drm_info_list nouveau_debugfs_list[] = {
 	{ "vbios.rom",  nouveau_debugfs_vbios_image, 0, NULL },
 	{ "strap_peek", nouveau_debugfs_strap_peek, 0, NULL },
+	DRM_DEBUGFS_GPUVA_INFO(nouveau_debugfs_gpuva, NULL),
 };
 #define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
 
Signature · 1 line
2.39.0
maintainer
#75 lore raw
In reply to Danilo Krummrich

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 6 lines

This patch series provides a new UAPI for the Nouveau driver in order to support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to keep track of GPU virtual address (VA) mappings in a more generic way.

Quoted 6 lines

The DRM GPUVA manager is indented to help drivers implement userspace-manageable GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it serves the following purposes in this context.

1) Provide a dedicated range allocator to track GPU VA allocations and mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

Regards,
Christian.

Quoted 137 lines

2) Generically connect GPU VA mappings to their backing buffers, in particular DRM GEM objects.

3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and merging of GPU VA mappings, e.g. for intersecting mapping requests or partial unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself providing the following new interfaces.

1) Initialize a GPU VA space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM scheduler to queue jobs and support asynchronous processing with DRM syncobjs as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context for GEM buffers) by Christian König. Since the patch implementing drm_exec was not yet merged into drm-next it is part of this series, as well as a small fix for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU VA manager's logic through Nouveau's new UAPI and should be considered just as helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test cases for the DRM GPUVA manager, once and if we agree on it's usefulness and design.

[1] https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3] https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to this patch series.

Christian König (1):
drm: execution context for GEM buffers

Danilo Krummrich (13):
drm/exec: fix memory leak in drm_exec_prepare_obj()
drm: manager to keep track of GPUs VA mappings
drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
drm/nouveau: debugfs: implement DRM GPU VA debugfs

  Documentation/gpu/driver-uapi.rst             |   11 +
  Documentation/gpu/drm-mm.rst                  |   43 +
  drivers/gpu/drm/Kconfig                       |    6 +
  drivers/gpu/drm/Makefile                      |    3 +
  drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 +
  drivers/gpu/drm/drm_debugfs.c                 |   56 +
  drivers/gpu/drm/drm_exec.c                    |  294 ++++
  drivers/gpu/drm/drm_gem.c                     |    3 +
  drivers/gpu/drm/drm_gpuva_mgr.c               | 1323 +++++++++++++++++
  drivers/gpu/drm/nouveau/Kbuild                |    3 +
  drivers/gpu/drm/nouveau/Kconfig               |    2 +
  drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +-
  drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +-
  .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 +
  drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 +
  drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 +
  drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +-
  drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +-
  drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +-
  drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 +
  drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 +
  drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +-
  drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +-
  drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++
  drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 +
  drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 +
  drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +-
  drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +
  drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
  drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++
  drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +-
  drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++
  drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 +
  drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +-
  drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 +
  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +-
  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 +
  include/drm/drm_debugfs.h                     |   25 +
  include/drm/drm_drv.h                         |    6 +
  include/drm/drm_exec.h                        |  144 ++
  include/drm/drm_gem.h                         |   75 +
  include/drm/drm_gpuva_mgr.h                   |  527 +++++++
  include/uapi/drm/nouveau_drm.h                |  216 +++
  47 files changed, 5266 insertions(+), 126 deletions(-)

create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

#76 lore raw

Hi Christian,

Quoted 7 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 6 lines

This patch series provides a new UAPI for the Nouveau driver in order to support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to keep track of GPU virtual address (VA) mappings in a more generic way.

Quoted 8 lines
Quoted 6 lines

The DRM GPUVA manager is indented to help drivers implement userspace-manageable GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it serves the following purposes in this context.

     1) Provide a dedicated range allocator to track GPU VA allocations and mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

No, it's just for keeping track of the ranges userspace has allocated.

- Danilo

Quoted 142 lines

Regards,
Christian.

Quoted 137 lines

     2) Generically connect GPU VA mappings to their backing buffers, in particular DRM GEM objects.

     3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and merging of GPU VA mappings, e.g. for intersecting mapping requests or partial unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself providing the following new interfaces.

     1) Initialize a GPU VA space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

     2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl.

     3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM scheduler to queue jobs and support asynchronous processing with DRM syncobjs as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context for GEM buffers) by Christian König. Since the patch implementing drm_exec was not yet merged into drm-next it is part of this series, as well as a small fix for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU VA manager's logic through Nouveau's new UAPI and should be considered just as helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test cases for the DRM GPUVA manager, once and if we agree on it's usefulness and design.

[1] https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
     https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3] https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to this patch series.

Christian König (1):
   drm: execution context for GEM buffers

Danilo Krummrich (13):
   drm/exec: fix memory leak in drm_exec_prepare_obj()
   drm: manager to keep track of GPUs VA mappings
   drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
   drm/nouveau: debugfs: implement DRM GPU VA debugfs

  Documentation/gpu/driver-uapi.rst             |   11 + Documentation/gpu/drm-mm.rst                  |   43 + drivers/gpu/drm/Kconfig                       |    6 + drivers/gpu/drm/Makefile                      |    3 + drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 + drivers/gpu/drm/drm_debugfs.c                 |   56 + drivers/gpu/drm/drm_exec.c                    |  294 ++++ drivers/gpu/drm/drm_gem.c                     |    3 + drivers/gpu/drm/drm_gpuva_mgr.c               | 1323 +++++++++++++++++ drivers/gpu/drm/nouveau/Kbuild                |    3 + drivers/gpu/drm/nouveau/Kconfig               |    2 + drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +- drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +- .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 + drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 + drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 + drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +- drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +- drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +- drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 + drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 + drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +- drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +- drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++ drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 + drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 + drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +- drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +- drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +

  drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
  drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++

  drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +- drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++ drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 + drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +- drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 + include/drm/drm_debugfs.h                     |   25 + include/drm/drm_drv.h                         |    6 + include/drm/drm_exec.h                        |  144 ++ include/drm/drm_gem.h                         |   75 + include/drm/drm_gpuva_mgr.h                   |  527 +++++++ include/uapi/drm/nouveau_drm.h                |  216 +++

  47 files changed, 5266 insertions(+), 126 deletions(-)

  create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
  create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

maintainer
#77 lore raw

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 14 lines

Hi Christian,

Quoted 11 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 10 lines

This patch series provides a new UAPI for the Nouveau driver in order to support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it serves the following purposes in this context.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

     1) Provide a dedicated range allocator to track GPU VA allocations and mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Regards,
Christian.

Quoted 147 lines

- Danilo

Quoted 143 lines

Regards,
Christian.

Quoted 138 lines

     2) Generically connect GPU VA mappings to their backing buffers, in particular DRM GEM objects.

     3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and merging of GPU VA mappings, e.g. for intersecting mapping requests or partial unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself providing the following new interfaces.

     1) Initialize a GPU VA space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

     2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl.

     3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM scheduler to queue jobs and support asynchronous processing with DRM syncobjs as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context for GEM buffers) by Christian König. Since the patch implementing drm_exec was not yet merged into drm-next it is part of this series, as well as a small fix for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU VA manager's logic through Nouveau's new UAPI and should be considered just as helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test cases for the DRM GPUVA manager, once and if we agree on it's usefulness and design.

[1] https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3] https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to this patch series.

Christian König (1):
   drm: execution context for GEM buffers

Danilo Krummrich (13):
   drm/exec: fix memory leak in drm_exec_prepare_obj()
   drm: manager to keep track of GPUs VA mappings
   drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
   drm/nouveau: debugfs: implement DRM GPU VA debugfs

  Documentation/gpu/driver-uapi.rst             |   11 + Documentation/gpu/drm-mm.rst                  |   43 + drivers/gpu/drm/Kconfig                       |    6 + drivers/gpu/drm/Makefile                      |    3 + drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 + drivers/gpu/drm/drm_debugfs.c                 |   56 + drivers/gpu/drm/drm_exec.c                    |  294 ++++ drivers/gpu/drm/drm_gem.c                     |    3 + drivers/gpu/drm/drm_gpuva_mgr.c               | 1323
+++++++++++++++++
  drivers/gpu/drm/nouveau/Kbuild                |    3 + drivers/gpu/drm/nouveau/Kconfig               |    2 + drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +- drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +- .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 + drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 + drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 + drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +- drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +- drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +- drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 + drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 + drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +- drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +- drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++ drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 + drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 + drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +- drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +- drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +

  drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
  drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++

  drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +- drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++ drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 + drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +- drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 + include/drm/drm_debugfs.h                     |   25 + include/drm/drm_drv.h                         |    6 + include/drm/drm_exec.h                        |  144 ++ include/drm/drm_gem.h                         |   75 + include/drm/drm_gpuva_mgr.h                   |  527 +++++++ include/uapi/drm/nouveau_drm.h                |  216 +++

  47 files changed, 5266 insertions(+), 126 deletions(-)

  create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
  create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

#78 lore raw
Quoted 18 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 17 lines

Hi Christian,

Quoted 14 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 12 lines

This patch series provides a new UAPI for the Nouveau driver in order to support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it serves the following purposes in this context.

     1) Provide a dedicated range allocator to track GPU VA allocations and mappings, making use of the drm_mm range allocator.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range,
the kernel really just keeps track of things. Though, writing a UAPI on
top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Quoted 152 lines

Regards,
Christian.

Quoted 147 lines

- Danilo

Quoted 143 lines

Regards,
Christian.

Quoted 138 lines

     2) Generically connect GPU VA mappings to their backing buffers, in particular DRM GEM objects.

     3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and merging of GPU VA mappings, e.g. for intersecting mapping requests or partial unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself providing the following new interfaces.

     1) Initialize a GPU VA space via the new DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA space managed by the kernel and userspace, respectively.

     2) Allocate and free a VA space region as well as bind and unbind memory to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl.

     3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM scheduler to queue jobs and support asynchronous processing with DRM syncobjs as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context for GEM buffers) by Christian König. Since the patch implementing drm_exec was not yet merged into drm-next it is part of this series, as well as a small fix for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU VA manager's logic through Nouveau's new UAPI and should be considered just as helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test cases for the DRM GPUVA manager, once and if we agree on it's usefulness and design.

[1] https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3] https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to this patch series.

Christian König (1):
   drm: execution context for GEM buffers

Danilo Krummrich (13):
   drm/exec: fix memory leak in drm_exec_prepare_obj()
   drm: manager to keep track of GPUs VA mappings
   drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
   drm/nouveau: debugfs: implement DRM GPU VA debugfs

  Documentation/gpu/driver-uapi.rst             |   11 + Documentation/gpu/drm-mm.rst                  |   43 + drivers/gpu/drm/Kconfig                       |    6 + drivers/gpu/drm/Makefile                      |    3 + drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 + drivers/gpu/drm/drm_debugfs.c                 |   56 + drivers/gpu/drm/drm_exec.c                    |  294 ++++ drivers/gpu/drm/drm_gem.c                     |    3 + drivers/gpu/drm/drm_gpuva_mgr.c               | 1323
+++++++++++++++++
  drivers/gpu/drm/nouveau/Kbuild                |    3 + drivers/gpu/drm/nouveau/Kconfig               |    2 + drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +- drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +- .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 + drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 + drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 + drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +- drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +- drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +- drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 + drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 + drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +- drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +- drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++ drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 + drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 + drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +- drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +- drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +

  drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
  drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++

  drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +- drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++ drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 + drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +- drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 + include/drm/drm_debugfs.h                     |   25 + include/drm/drm_drv.h                         |    6 + include/drm/drm_exec.h                        |  144 ++ include/drm/drm_gem.h                         |   75 + include/drm/drm_gpuva_mgr.h                   |  527 +++++++ include/uapi/drm/nouveau_drm.h                |  216 +++

  47 files changed, 5266 insertions(+), 126 deletions(-)

  create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
  create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

#79 lore raw
Quoted 41 lines · Danilo Krummrich
Quoted 26 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 25 lines

Hi Christian,

Quoted 21 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 14 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

Quoted 3 lines

1) Provide a dedicated range allocator to track GPU VA
allocations and
mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

Quoted 6 lines
Quoted 1 line

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range, the kernel really just keeps track of things. Though, writing a UAPI on top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Quoted 4 lines

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Why not just do this in userspace? We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

Alex

Quoted 176 lines
Quoted 175 lines

Regards,
Christian.

Quoted 169 lines

- Danilo

Quoted 165 lines

Regards,
Christian.

Quoted 160 lines

2) Generically connect GPU VA mappings to their backing
buffers, in
particular DRM GEM objects.

3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and
merging
of GPU VA mappings, e.g. for intersecting mapping requests
or partial
unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself
providing the following new interfaces.

1) Initialize a GPU VA space via the new
DRM_IOCTL_NOUVEAU_VM_INIT ioctl
for UMDs to specify the portion of VA space managed by the
kernel and
userspace, respectively.

2) Allocate and free a VA space region as well as bind and
unbind memory
to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND
ioctl.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM
scheduler to queue jobs and support asynchronous processing with DRM syncobjs
as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context
for GEM buffers) by Christian König. Since the patch implementing drm_exec was
not yet merged into drm-next it is part of this series, as well as a small fix
for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test
cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI
and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU
VA manager's logic through Nouveau's new UAPI and should be considered just as
helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test
cases for the DRM GPUVA manager, once and if we agree on it's usefulness and
design.

[1]
https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3]
https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to
this patch series.

Christian König (1):
drm: execution context for GEM buffers

Danilo Krummrich (13):
drm/exec: fix memory leak in drm_exec_prepare_obj()
drm: manager to keep track of GPUs VA mappings
drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
drm/nouveau: debugfs: implement DRM GPU VA debugfs

  Documentation/gpu/driver-uapi.rst             |   11 +
  Documentation/gpu/drm-mm.rst                  |   43 +
  drivers/gpu/drm/Kconfig                       |    6 +
  drivers/gpu/drm/Makefile                      |    3 +
  drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 +
  drivers/gpu/drm/drm_debugfs.c                 |   56 +
  drivers/gpu/drm/drm_exec.c                    |  294 ++++
  drivers/gpu/drm/drm_gem.c                     |    3 +
  drivers/gpu/drm/drm_gpuva_mgr.c               | 1323
+++++++++++++++++
  drivers/gpu/drm/nouveau/Kbuild                |    3 +
  drivers/gpu/drm/nouveau/Kconfig               |    2 +
  drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +-
  drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +-
  .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 +
  drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 +
  drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 +
  drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +-
  drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +-
  drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +-
  drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 +
  drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 +
  drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +-
  drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +-
  drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++
  drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 +
  drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 +
  drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +-
  drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +
  drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
  drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
  drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++
  drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +-
  drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++
  drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 +
  drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +-
  drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 +
  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +-
  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 +
  include/drm/drm_debugfs.h                     |   25 +
  include/drm/drm_drv.h                         |    6 +
  include/drm/drm_exec.h                        |  144 ++
  include/drm/drm_gem.h                         |   75 +
  include/drm/drm_gpuva_mgr.h                   |  527 +++++++
  include/uapi/drm/nouveau_drm.h                |  216 +++
  47 files changed, 5266 insertions(+), 126 deletions(-)

create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

#80 lore raw
Quoted 42 lines · Alex Deucher
Quoted 41 lines · Danilo Krummrich
Quoted 26 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 25 lines

Hi Christian,

Quoted 21 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 14 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

Quoted 3 lines

1) Provide a dedicated range allocator to track GPU VA
allocations and
mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

Quoted 6 lines
Quoted 1 line

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range, the kernel really just keeps track of things. Though, writing a UAPI on top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Quoted 8 lines
Quoted 4 lines

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Why not just do this in userspace? We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Quoted 181 lines

Alex

Quoted 176 lines
Quoted 175 lines

Regards,
Christian.

Quoted 169 lines

- Danilo

Quoted 165 lines

Regards,
Christian.

Quoted 160 lines

2) Generically connect GPU VA mappings to their backing
buffers, in
particular DRM GEM objects.

3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and
merging
of GPU VA mappings, e.g. for intersecting mapping requests
or partial
unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself
providing the following new interfaces.

1) Initialize a GPU VA space via the new
DRM_IOCTL_NOUVEAU_VM_INIT ioctl
for UMDs to specify the portion of VA space managed by the
kernel and
userspace, respectively.

2) Allocate and free a VA space region as well as bind and
unbind memory
to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND
ioctl.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM
scheduler to queue jobs and support asynchronous processing with DRM syncobjs
as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context
for GEM buffers) by Christian König. Since the patch implementing drm_exec was
not yet merged into drm-next it is part of this series, as well as a small fix
for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test
cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI
and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU
VA manager's logic through Nouveau's new UAPI and should be considered just as
helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test
cases for the DRM GPUVA manager, once and if we agree on it's usefulness and
design.

[1]
https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3]
https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to
this patch series.

Christian König (1):
drm: execution context for GEM buffers

Danilo Krummrich (13):
drm/exec: fix memory leak in drm_exec_prepare_obj()
drm: manager to keep track of GPUs VA mappings
drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
drm/nouveau: debugfs: implement DRM GPU VA debugfs

   Documentation/gpu/driver-uapi.rst             |   11 +
   Documentation/gpu/drm-mm.rst                  |   43 +
   drivers/gpu/drm/Kconfig                       |    6 +
   drivers/gpu/drm/Makefile                      |    3 +
   drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 +
   drivers/gpu/drm/drm_debugfs.c                 |   56 +
   drivers/gpu/drm/drm_exec.c                    |  294 ++++
   drivers/gpu/drm/drm_gem.c                     |    3 +
   drivers/gpu/drm/drm_gpuva_mgr.c               | 1323
+++++++++++++++++
   drivers/gpu/drm/nouveau/Kbuild                |    3 +
   drivers/gpu/drm/nouveau/Kconfig               |    2 +
   drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +-
   drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +-
   .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 +
   drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +-
   drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +-
   drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +-
   drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 +
   drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 +
   drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++
   drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 +
   drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 +
   drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +-
   drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +-
   drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +
   drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
   drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++
   drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +-
   drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++
   drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 +
   drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +-
   drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +-
   .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++-
   .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 +
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +-
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 +
   include/drm/drm_debugfs.h                     |   25 +
   include/drm/drm_drv.h                         |    6 +
   include/drm/drm_exec.h                        |  144 ++
   include/drm/drm_gem.h                         |   75 +
   include/drm/drm_gpuva_mgr.h                   |  527 +++++++
   include/uapi/drm/nouveau_drm.h                |  216 +++
   47 files changed, 5266 insertions(+), 126 deletions(-)

create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

#81 lore raw
Quoted 51 lines · Danilo Krummrich
Quoted 47 lines · Alex Deucher
Quoted 45 lines · Danilo Krummrich
Quoted 26 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 25 lines

Hi Christian,

Quoted 21 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 14 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

Quoted 3 lines

1) Provide a dedicated range allocator to track GPU VA
allocations and
mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

Quoted 6 lines
Quoted 1 line

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range, the kernel really just keeps track of things. Though, writing a UAPI on top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Quoted 8 lines
Quoted 3 lines

Why not just do this in userspace? We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Ok, you are just using this for maintaining the GPU VM space in the kernel.

Alex

Quoted 183 lines
Quoted 182 lines

Alex

Quoted 176 lines
Quoted 175 lines

Regards,
Christian.

Quoted 169 lines

- Danilo

Quoted 165 lines

Regards,
Christian.

Quoted 160 lines

2) Generically connect GPU VA mappings to their backing
buffers, in
particular DRM GEM objects.

3) Provide a common implementation to perform more complex mapping operations on the GPU VA space. In particular splitting and
merging
of GPU VA mappings, e.g. for intersecting mapping requests
or partial
unmap requests.

The new VM_BIND Nouveau UAPI build on top of the DRM GPUVA manager, itself
providing the following new interfaces.

1) Initialize a GPU VA space via the new
DRM_IOCTL_NOUVEAU_VM_INIT ioctl
for UMDs to specify the portion of VA space managed by the
kernel and
userspace, respectively.

2) Allocate and free a VA space region as well as bind and
unbind memory
to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND
ioctl.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, make use of the DRM
scheduler to queue jobs and support asynchronous processing with DRM syncobjs
as synchronization mechanism.

By default DRM_IOCTL_NOUVEAU_VM_BIND does synchronous processing, DRM_IOCTL_NOUVEAU_EXEC supports asynchronous processing only.

The new VM_BIND UAPI for Nouveau makes also use of drm_exec (execution context
for GEM buffers) by Christian König. Since the patch implementing drm_exec was
not yet merged into drm-next it is part of this series, as well as a small fix
for this patch, which was found while testing this series.

This patch series is also available at [1].

There is a Mesa NVK merge request by Dave Airlie [2] implementing the corresponding userspace parts for this series.

The Vulkan CTS test suite passes the sparse binding and sparse residency test
cases for the new UAPI together with Dave's Mesa work.

There are also some test cases in the igt-gpu-tools project [3] for the new UAPI
and hence the DRM GPU VA manager. However, most of them are testing the DRM GPU
VA manager's logic through Nouveau's new UAPI and should be considered just as
helper for implementation.

However, I absolutely intend to change those test cases to proper kunit test
cases for the DRM GPUVA manager, once and if we agree on it's usefulness and
design.

[1]
https://gitlab.freedesktop.org/nouvelles/kernel/-/tree/new-uapi-drm-next /
https://gitlab.freedesktop.org/nouvelles/kernel/-/merge_requests/1
[2] https://gitlab.freedesktop.org/nouveau/mesa/-/merge_requests/150/
[3]
https://gitlab.freedesktop.org/dakr/igt-gpu-tools/-/tree/wip_nouveau_vm_bind

I also want to give credit to Dave Airlie, who contributed a lot of ideas to
this patch series.

Christian König (1):
drm: execution context for GEM buffers

Danilo Krummrich (13):
drm/exec: fix memory leak in drm_exec_prepare_obj()
drm: manager to keep track of GPUs VA mappings
drm: debugfs: provide infrastructure to dump a DRM GPU VA space drm/nouveau: new VM_BIND uapi interfaces drm/nouveau: get vmm via nouveau_cli_vmm() drm/nouveau: bo: initialize GEM GPU VA interface drm/nouveau: move usercopy helpers to nouveau_drv.h drm/nouveau: fence: fail to emit when fence context is killed drm/nouveau: chan: provide nouveau_channel_kill() drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm drm/nouveau: implement uvmm for user mode bindings drm/nouveau: implement new VM_BIND UAPI
drm/nouveau: debugfs: implement DRM GPU VA debugfs

   Documentation/gpu/driver-uapi.rst             |   11 +
   Documentation/gpu/drm-mm.rst                  |   43 +
   drivers/gpu/drm/Kconfig                       |    6 +
   drivers/gpu/drm/Makefile                      |    3 +
   drivers/gpu/drm/amd/amdgpu/Kconfig            |    1 +
   drivers/gpu/drm/drm_debugfs.c                 |   56 +
   drivers/gpu/drm/drm_exec.c                    |  294 ++++
   drivers/gpu/drm/drm_gem.c                     |    3 +
   drivers/gpu/drm/drm_gpuva_mgr.c               | 1323
+++++++++++++++++
   drivers/gpu/drm/nouveau/Kbuild                |    3 +
   drivers/gpu/drm/nouveau/Kconfig               |    2 +
   drivers/gpu/drm/nouveau/include/nvif/if000c.h |   23 +-
   drivers/gpu/drm/nouveau/include/nvif/vmm.h    |   17 +-
   .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   10 +
   drivers/gpu/drm/nouveau/nouveau_abi16.c       |   23 +
   drivers/gpu/drm/nouveau/nouveau_abi16.h       |    1 +
   drivers/gpu/drm/nouveau/nouveau_bo.c          |  152 +-
   drivers/gpu/drm/nouveau/nouveau_bo.h          |    2 +-
   drivers/gpu/drm/nouveau/nouveau_chan.c        |   16 +-
   drivers/gpu/drm/nouveau/nouveau_chan.h        |    1 +
   drivers/gpu/drm/nouveau/nouveau_debugfs.c     |   24 +
   drivers/gpu/drm/nouveau/nouveau_drm.c         |   25 +-
   drivers/gpu/drm/nouveau/nouveau_drv.h         |   92 +-
   drivers/gpu/drm/nouveau/nouveau_exec.c        |  310 ++++
   drivers/gpu/drm/nouveau/nouveau_exec.h        |   55 +
   drivers/gpu/drm/nouveau/nouveau_fence.c       |    7 +
   drivers/gpu/drm/nouveau/nouveau_fence.h       |    2 +-
   drivers/gpu/drm/nouveau/nouveau_gem.c         |   83 +-
   drivers/gpu/drm/nouveau/nouveau_mem.h         |    5 +
   drivers/gpu/drm/nouveau/nouveau_prime.c       |    2 +-
   drivers/gpu/drm/nouveau/nouveau_sched.c       |  780 ++++++++++
   drivers/gpu/drm/nouveau/nouveau_sched.h       |   98 ++
   drivers/gpu/drm/nouveau/nouveau_svm.c         |    2 +-
   drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  575 +++++++
   drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   68 +
   drivers/gpu/drm/nouveau/nouveau_vmm.c         |    4 +-
   drivers/gpu/drm/nouveau/nvif/vmm.c            |   73 +-
   .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    |  168 ++-
   .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |    1 +
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c |   32 +-
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |    3 +
   include/drm/drm_debugfs.h                     |   25 +
   include/drm/drm_drv.h                         |    6 +
   include/drm/drm_exec.h                        |  144 ++
   include/drm/drm_gem.h                         |   75 +
   include/drm/drm_gpuva_mgr.h                   |  527 +++++++
   include/uapi/drm/nouveau_drm.h                |  216 +++
   47 files changed, 5266 insertions(+), 126 deletions(-)

create mode 100644 drivers/gpu/drm/drm_exec.c create mode 100644 drivers/gpu/drm/drm_gpuva_mgr.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_exec.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sched.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_uvmm.h create mode 100644 include/drm/drm_exec.h
create mode 100644 include/drm/drm_gpuva_mgr.h

base-commit: 0b45ac1170ea6416bc1d36798414c04870cd356d

maintainer
#82 lore raw
Quoted 57 lines · Alex Deucher
Quoted 55 lines · Danilo Krummrich
Quoted 50 lines · Alex Deucher
Quoted 41 lines · Danilo Krummrich
Quoted 26 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 25 lines

Hi Christian,

Quoted 21 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 14 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

Quoted 3 lines

1) Provide a dedicated range allocator to track GPU VA
allocations and
mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

Quoted 6 lines
Quoted 1 line

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range, the kernel really just keeps track of things. Though, writing a UAPI on top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Quoted 4 lines

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Why not just do this in userspace? We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

Quoted 7 lines
Quoted 4 lines

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Ok, you are just using this for maintaining the GPU VM space in the kernel.

Yes the idea behind having common code wrapping drm_mm for this is to allow us to make the rules consistent across drivers.

Userspace (generally Vulkan, some compute) has interfaces that pretty much dictate a lot of how VMA tracking works, esp around lifetimes, sparse mappings and splitting/merging underlying page tables, I'd really like this to be more consistent across drivers, because already I think we've seen with freedreno some divergence from amdgpu and we also have i915/xe to deal with. I'd like to at least have one place that we can say this is how it should work, since this is something that *should* be consistent across drivers mostly, as it is more about how the uapi is exposed.

Dave.

maintainer
#83 lore raw

Am 18.01.23 um 20:17 schrieb Dave Airlie:

Quoted 58 lines · Alex Deucher
Quoted 45 lines · Danilo Krummrich
Quoted 44 lines · Alex Deucher
Quoted 41 lines · Danilo Krummrich
Quoted 40 lines · Christian König
Quoted 22 lines

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 21 lines

Hi Christian,

Quoted 18 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 17 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

1) Provide a dedicated range allocator to track GPU VA
allocations and
mappings, making use of the drm_mm range allocator.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range, the kernel really just keeps track of things. Though, writing a UAPI on top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Why not just do this in userspace? We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Ok, you are just using this for maintaining the GPU VM space in the kernel.

Yes the idea behind having common code wrapping drm_mm for this is to allow us to make the rules consistent across drivers.

Quoted 9 lines

Userspace (generally Vulkan, some compute) has interfaces that pretty much dictate a lot of how VMA tracking works, esp around lifetimes, sparse mappings and splitting/merging underlying page tables, I'd really like this to be more consistent across drivers, because already I think we've seen with freedreno some divergence from amdgpu and we also have i915/xe to deal with. I'd like to at least have one place that we can say this is how it should work, since this is something that *should* be consistent across drivers mostly, as it is more about how the uapi is exposed.

That's a really good idea, but the implementation with drm_mm won't work like that.

We have Vulkan applications which use the sparse feature to create literally millions of mappings. That's why I have fine tuned the mapping structure in amdgpu down to ~80 bytes IIRC and save every CPU cycle possible in the handling of that.

A drm_mm_node is more in the range of ~200 bytes and certainly not suitable for this kind of job.

I strongly suggest to rather use a good bunch of the amdgpu VM code as blueprint for the common infrastructure.

Regards,
Christian.

Quoted 2 lines

Dave.

#84 lore raw
Quoted 69 lines · Christian König

Am 18.01.23 um 20:17 schrieb Dave Airlie:

Quoted 58 lines · Alex Deucher
Quoted 45 lines · Danilo Krummrich
Quoted 44 lines · Alex Deucher
Quoted 41 lines · Danilo Krummrich
Quoted 40 lines · Christian König
Quoted 22 lines

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 21 lines

Hi Christian,

Quoted 18 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 17 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as sparse bindings and sparse residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

       1) Provide a dedicated range allocator to track GPU VA allocations and
          mappings, making use of the drm_mm range allocator.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

This means that the ranges are allocated by the kernel? If yes that's a really really bad idea.

No, it's just for keeping track of the ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel for a free range? Or what exactly is the drm_mm used for here?

Not even that, userspace provides both the base address and the range, the kernel really just keeps track of things. Though, writing a UAPI on top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Currently, and that's what I think I read out of your question, the main benefit of using drm_mm over simply stuffing the entries into a list or something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Why not just do this in userspace?  We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Ok, you are just using this for maintaining the GPU VM space in the kernel.

Yes the idea behind having common code wrapping drm_mm for this is to allow us to make the rules consistent across drivers.

Quoted 9 lines

Userspace (generally Vulkan, some compute) has interfaces that pretty much dictate a lot of how VMA tracking works, esp around lifetimes, sparse mappings and splitting/merging underlying page tables, I'd really like this to be more consistent across drivers, because already I think we've seen with freedreno some divergence from amdgpu and we also have i915/xe to deal with. I'd like to at least have one place that we can say this is how it should work, since this is something that *should* be consistent across drivers mostly, as it is more about how the uapi is exposed.

Quoted 3 lines

That's a really good idea, but the implementation with drm_mm won't work like that.

We have Vulkan applications which use the sparse feature to create literally millions of mappings. That's why I have fine tuned the mapping structure in amdgpu down to ~80 bytes IIRC and save every CPU cycle possible in the handling of that.

That's a valuable information. Can you recommend such an application for testing / benchmarking?

Your optimization effort sounds great. May it be worth thinking about generalizing your approach by itself and stacking the drm_gpuva_manager on top of it?

Quoted 4 lines

A drm_mm_node is more in the range of ~200 bytes and certainly not suitable for this kind of job.

I strongly suggest to rather use a good bunch of the amdgpu VM code as blueprint for the common infrastructure.

I will definitely have look.

Quoted 7 lines

Regards,
Christian.

Quoted 2 lines

Dave.

#85 lore raw
Quoted 84 lines · Danilo Krummrich
Quoted 83 lines · Christian König

Am 18.01.23 um 20:17 schrieb Dave Airlie:

Quoted 81 lines · Alex Deucher
Quoted 61 lines
Quoted 59 lines · Danilo Krummrich
Quoted 56 lines · Alex Deucher
Quoted 45 lines · Danilo Krummrich
Quoted 29 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 28 lines

Hi Christian,

Quoted 25 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 18 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as
sparse bindings and sparse
residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

Quoted 3 lines

       1) Provide a dedicated range allocator to track GPU VA allocations and
          mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated
by the kernel? If yes that's
a really really bad idea.

Quoted 7 lines
Quoted 2 lines

No, it's just for keeping track of the
ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel
for a free range? Or
what exactly is the drm_mm used for here?

Not even that, userspace provides both the base
address and the range,
the kernel really just keeps track of things.
Though, writing a UAPI on
top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Quoted 6 lines

Currently, and that's what I think I read out of
your question, the main
benefit of using drm_mm over simply stuffing the entries into a list or
something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Why not just do this in userspace?  We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

Quoted 7 lines
Quoted 4 lines

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Ok, you are just using this for maintaining the GPU VM space in the kernel.

Yes the idea behind having common code wrapping drm_mm for this is to allow us to make the rules consistent across drivers.

Userspace (generally Vulkan, some compute) has interfaces that pretty much dictate a lot of how VMA tracking works, esp around lifetimes, sparse mappings and splitting/merging underlying page tables, I'd really like this to be more consistent across drivers, because already I think we've seen with freedreno some divergence from amdgpu and we also have i915/xe to deal with. I'd like to at least have one place that we can say this is how it should work, since this is something that *should* be consistent across drivers mostly, as it is more about how the uapi is exposed.

Quoted 5 lines
Quoted 5 lines

That's a really good idea, but the implementation with drm_mm won't work like that.

We have Vulkan applications which use the sparse feature to create literally millions of mappings. That's why I have fine tuned the mapping

Is this not an application issue? Millions of mappings seems a bit absurd to me.

Quoted 2 lines
Quoted 2 lines

structure in amdgpu down to ~80 bytes IIRC and save every CPU cycle possible in the handling of that.

We might need to bit of work here in Xe as our xe_vma structure is quite big as we currently use it as dumping ground for various features.

Quoted 4 lines

That's a valuable information. Can you recommend such an application for testing / benchmarking?

Also interested.

Quoted 4 lines

Your optimization effort sounds great. May it be worth thinking about generalizing your approach by itself and stacking the drm_gpuva_manager on top of it?

FWIW the Xe is on board with the drm_gpuva_manager effort, we basically open code all of this right now. I'd like to port over to drm_gpuva_manager ASAP so we can contribute and help find a viable solution for all of us.

Matt

Quoted 17 lines
Quoted 6 lines

A drm_mm_node is more in the range of ~200 bytes and certainly not suitable for this kind of job.

I strongly suggest to rather use a good bunch of the amdgpu VM code as blueprint for the common infrastructure.

I will definitely have look.

Quoted 7 lines

Regards,
Christian.

Quoted 2 lines

Dave.

maintainer
#86 lore raw

drm_gpuva_manager requirements (was Re: [PATCH drm-next 00/14] [RFC] DRM GPUVA Manager & Nouveau VM_BIND UAPI)

Am 19.01.23 um 06:23 schrieb Matthew Brost:

Quoted 10 lines

[SNIP]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Userspace (generally Vulkan, some compute) has interfaces that pretty much dictate a lot of how VMA tracking works, esp around lifetimes, sparse mappings and splitting/merging underlying page tables, I'd really like this to be more consistent across drivers, because already I think we've seen with freedreno some divergence from amdgpu and we also have i915/xe to deal with. I'd like to at least have one place that we can say this is how it should work, since this is something that *should* be consistent across drivers mostly, as it is more about how the uapi is exposed.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

That's a really good idea, but the implementation with drm_mm won't work like that.

We have Vulkan applications which use the sparse feature to create literally millions of mappings. That's why I have fine tuned the mapping

Is this not an application issue? Millions of mappings seems a bit absurd to me.

That's unfortunately how some games are designed these days.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

structure in amdgpu down to ~80 bytes IIRC and save every CPU cycle possible in the handling of that.

We might need to bit of work here in Xe as our xe_vma structure is quite big as we currently use it as dumping ground for various features.

We have done that as well and it turned out to be a bad idea. At one point we added some power management information into the mapping structure, but quickly reverted that.

Quoted 4 lines
Quoted 3 lines

That's a valuable information. Can you recommend such an application for testing / benchmarking?

Also interested.

On of the most demanding ones is Forza Horizon 5. The general approach of that game seems to be to allocate 64GiB of address space (equals 16 million 4kiB pages) and then mmap() whatever data it needs into that self managed space, assuming that every 4KiB page is individually mapable to a different location.

Quoted 8 lines
Quoted 4 lines

Your optimization effort sounds great. May it be worth thinking about generalizing your approach by itself and stacking the drm_gpuva_manager on top of it?

FWIW the Xe is on board with the drm_gpuva_manager effort, we basically open code all of this right now. I'd like to port over to drm_gpuva_manager ASAP so we can contribute and help find a viable solution for all of us.

Sounds good. I haven't looked into the drm_gpuva_manager code yet, but a few design notes I've leaned from amdgpu:

Separate address space management (drm_mm) from page table management. In other words when an application asks for 64GiB for free address space you don't look into the page table structures, but rather into a separate drm_mm instance. In amdgpu we even moved the later into userspace, but the general take away is that you have only a handful of address space requests while you have tons of mapping/unmapping requests.

Separate the tracking structure into two, one for each BO+VM combination (we call that amdgpu_bo_va) and one for each mapping (called amdgpu_bo_va_mapping). We unfortunately use that for our hw dependent state machine as well, so it isn't easily generalize-able.

I've gone back on forth on merging VMA and then not again. Not merging them can save quite a bit of overhead, but results in much more mappings for some use cases.

Regards,
Christian.

Quoted 14 lines

Matt

Quoted 11 lines
Quoted 5 lines

A drm_mm_node is more in the range of ~200 bytes and certainly not suitable for this kind of job.

I strongly suggest to rather use a good bunch of the amdgpu VM code as blueprint for the common infrastructure.

I will definitely have look.

Quoted 4 lines

Regards,
Christian.

Quoted 1 line

Dave.

#87 lore raw
In reply to Matthew Brost
Quoted 86 lines · Matthew Brost
Quoted 84 lines · Danilo Krummrich
Quoted 83 lines · Christian König

Am 18.01.23 um 20:17 schrieb Dave Airlie:

Quoted 81 lines · Alex Deucher
Quoted 61 lines
Quoted 59 lines · Danilo Krummrich
Quoted 56 lines · Alex Deucher
Quoted 45 lines · Danilo Krummrich
Quoted 29 lines · Christian König

Am 18.01.23 um 16:34 schrieb Danilo Krummrich:

Quoted 28 lines

Hi Christian,

Quoted 25 lines · Christian König

Am 18.01.23 um 07:12 schrieb Danilo Krummrich:

Quoted 18 lines

This patch series provides a new UAPI for the Nouveau driver in order to
support Vulkan features, such as
sparse bindings and sparse
residency.

Furthermore, with the DRM GPUVA manager it provides a new DRM core feature to
keep track of GPU virtual address (VA) mappings in a more generic way.

The DRM GPUVA manager is indented to help drivers implement userspace-manageable
GPU VA spaces in reference to the Vulkan API. In order to achieve this goal it
serves the following purposes in this context.

Quoted 3 lines

1) Provide a dedicated range allocator to track GPU VA
allocations and
mappings, making use of the drm_mm range allocator.

This means that the ranges are allocated
by the kernel? If yes that's
a really really bad idea.

Quoted 7 lines
Quoted 2 lines

No, it's just for keeping track of the
ranges userspace has allocated.

Ok, that makes more sense.

So basically you have an IOCTL which asks kernel
for a free range? Or
what exactly is the drm_mm used for here?

Not even that, userspace provides both the base
address and the range,
the kernel really just keeps track of things.
Though, writing a UAPI on
top of the GPUVA manager asking for a free range instead would be possible by just adding the corresponding wrapper functions to get a free hole.

Quoted 6 lines

Currently, and that's what I think I read out of
your question, the main
benefit of using drm_mm over simply stuffing the entries into a list or
something boils down to easier collision detection and iterating sub-ranges of the whole VA space.

Why not just do this in userspace? We have a range manager in libdrm_amdgpu that you could lift out into libdrm or some other helper.

Quoted 7 lines
Quoted 4 lines

The kernel still needs to keep track of the mappings within the various VA spaces, e.g. it silently needs to unmap mappings that are backed by BOs that get evicted and remap them once they're validated (or swapped back in).

Ok, you are just using this for maintaining the GPU VM space in the kernel.

Yes the idea behind having common code wrapping drm_mm for this is to allow us to make the rules consistent across drivers.

Userspace (generally Vulkan, some compute) has interfaces that pretty much dictate a lot of how VMA tracking works, esp around lifetimes, sparse mappings and splitting/merging underlying page tables, I'd really like this to be more consistent across drivers, because already I think we've seen with freedreno some divergence from amdgpu and we also have i915/xe to deal with. I'd like to at least have one place that we can say this is how it should work, since this is something that *should* be consistent across drivers mostly, as it is more about how the uapi is exposed.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

That's a really good idea, but the implementation with drm_mm won't work like that.

We have Vulkan applications which use the sparse feature to create literally millions of mappings. That's why I have fine tuned the mapping

Is this not an application issue? Millions of mappings seems a bit absurd to me.

If I look at the most extreme case for AI, assuming 256GB of HBM memory and page mapping of 2MB, we get to 128K of mappings. But that's really the extreme case imo. I assume most mappings will be much larger. In fact, in the most realistic scenario of large-scale training, a single user will probably map the entire HBM memory using 1GB pages.

I have also a question, could this GPUVA code manage VA ranges mappings for userptr mappings, assuming we work without svm/uva/usm (pointer-is-a-pointer) ? Because then we are talking about possible 4KB mappings of 1 - 1.5 TB host server RAM (Implied in my question is the assumption this can be used also for non-VK use-cases. Please tell me if I'm totally wrong here).

Thanks,
Oded

#88 lore raw

Hi Oded,

sorry for the late response, somehow this mail slipped through.

Quoted 10 lines · Oded Gabbay
Quoted 2 lines · Matthew Brost

Is this not an application issue? Millions of mappings seems a bit absurd to me.

If I look at the most extreme case for AI, assuming 256GB of HBM memory and page mapping of 2MB, we get to 128K of mappings. But that's really the extreme case imo. I assume most mappings will be much larger. In fact, in the most realistic scenario of large-scale training, a single user will probably map the entire HBM memory using 1GB pages.

Quoted 6 lines

I have also a question, could this GPUVA code manage VA ranges mappings for userptr mappings, assuming we work without svm/uva/usm (pointer-is-a-pointer) ? Because then we are talking about possible 4KB mappings of 1 - 1.5 TB host server RAM (Implied in my question is the assumption this can be used also for non-VK use-cases. Please tell me if I'm totally wrong here).

In V2 I switched from drm_mm to maple tree, which should improve handling of lots of entries. I also dropped the requirement for GPUVA entries to be backed by a valid GEM object.

I think it can be used for non-VK use-cases. It basically just keeps track of mappings (not allocating them in the sense of finding a hole and providing a base address for a given size). There are basic functions to insert and remove entries. For those basic functions it is ensured that colliding entries can't be inserted and only a specific given entry can be removed, rather than e.g. an arbitrary range.

There are also more advanced functions where users of the GPUVA manager can request to "force map" a new mapping and to unmap a given range. The GPUVA manager will figure out the (sub-)operations to make this happen (.e.g. remove mappings in the way, split up mappings, etc.) and either provide these operations (or steps) through callbacks or though a list of operations to the caller to process them.

Are there any other use-cases or features you could think of that would be beneficial for accelerators?

- Danilo

Quoted 4 lines

Thanks,
Oded