walnux/drivers/misc/CMakeLists.txt
Theodore Karatapanis 707cdaf42e drivers/misc/optee: Expanded RPC support.
This commit expands RPC support for the OP-TEE driver using 2 files:
1) drivers/misc/optee_rpc.c
   * Add support for RPCs that can be handled directly by the kernel.
   * Can delegate RPC handling to optee_supplicant.c for RPCs that
     need userspace interaction.
2) drivers/misc/optee_supplicant.c
   * Enable communication between the userspace TEE supplicant and the
     kernel driver.

Additional changes were needed to the following files:
1) drivers/misc/optee.c
   * Add ioctls used SOLELY by the userspace TEE supplicant.
   * Register /dev/teepriv0 if the supplicant is enabled in Kconfig
   * Add OPTEE_ROLE_CA and OPTEE_ROLE_SUPPLICANT conditionals to
     differentiate paths, between a normal Client Application (CA)
     and the TEE supplicant.
   * Change some functions from static to "public" to reuse them
     in other C files.
   * Adjust optee_to/from_msg_param() to work with RPCs.

2) drivers/misc/optee_smc.c
   * Call the RPC handler from optee_rpc.c

3) drivers/misc/optee_msg.h
   * Add definition needed for RPCs

4) drivers/misc/tee.h
   * Add ioctl definitions
   * Add TEE_SHM_SUPP flag, checked when unregistering supplicant
     memory.

5) Documentation/guides/optee.rs
   * Add documentation for RPCs and the supplicant.

6) drivers/misc/{CMakeLists.txt, Make.defs}
   * Account for the new files.

7) drivers/misc/Kconfig
   * Add DEV_OPTEE_SUPPLICANT option to enable/disable the supplicant
     driver.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-08-06 02:29:33 +08:00

98 lines
2.5 KiB
CMake

# ##############################################################################
# drivers/misc/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
set(SRCS)
if(CONFIG_DEV_SIMPLE_ADDRENV)
list(APPEND SRCS addrenv.c)
endif()
if(CONFIG_DEV_NULL)
list(APPEND SRCS dev_null.c)
endif()
if(CONFIG_DEV_ZERO)
list(APPEND SRCS dev_zero.c)
endif()
if(CONFIG_DEV_MEM)
list(APPEND SRCS dev_mem.c)
endif()
if(CONFIG_DEV_ASCII)
list(APPEND SRCS dev_ascii.c)
endif()
if(CONFIG_LWL_CONSOLE)
list(APPEND SRCS lwl_console.c)
endif()
if(NOT CONFIG_DISABLE_MOUNTPOINT)
list(APPEND SRCS ramdisk.c)
if(CONFIG_DRVR_MKRD)
list(APPEND SRCS mkrd.c)
endif()
endif()
if(CONFIG_DRVR_WRITEBUFFER)
list(APPEND SRCS rwbuffer.c)
elseif(CONFIG_DRVR_READAHEAD)
list(APPEND SRCS rwbuffer.c)
endif()
if(CONFIG_DEV_RPMSG)
list(APPEND SRCS rpmsgdev.c)
endif()
if(CONFIG_DEV_RPMSG_SERVER)
list(APPEND SRCS rpmsgdev_server.c)
endif()
if(CONFIG_BLK_RPMSG)
list(APPEND SRCS rpmsgblk.c)
endif()
if(CONFIG_BLK_RPMSG_SERVER)
target_include_directories(drivers PRIVATE ${NUTTX_DIR}/fs/inode
${NUTTX_DIR}/fs)
set_source_files_properties(rpmsgblk_server.c DIRECTORY
${CMAKE_CURRENT_LIST_DIR}/..)
list(APPEND SRCS rpmsgblk_server.c)
endif()
if(NOT CONFIG_DEV_OPTEE_NONE)
list(APPEND SRCS optee.c)
if(CONFIG_DEV_OPTEE_SMC)
list(APPEND SRCS optee_smc.c)
list(APPEND SRCS optee_rpc.c)
if(CONFIG_DEV_OPTEE_SUPPLICANT)
list(APPEND SRCS optee_supplicant.c)
endif()
else()
list(APPEND SRCS optee_socket.c)
endif()
endif()
if(CONFIG_GOLDFISH_PIPE)
list(APPEND SRCS goldfish_pipe.c)
endif()
target_sources(drivers PRIVATE ${SRCS})