From: Leon Romanovsky <leonro@xxxxxxxxxxxx> Hi, This series is from Yishai reuses the new kABI interface to create new interface named DEVX which provides general access to mlx5 device. The main patches are pretended by two my small patches which generalize u64-to-ptr code used in DRM subsystem. >From Yishai: ---------------------------------------------------------------------- This DEVX series enables direct access from the user space area to the mlx5 device driver by using the KABI mechanism. The main purpose here is to make the user space driver as independent as possible from the kernel so that future device functionality and commands can be activated with minimal to none kernel changes. The series keeps the same level of user process security/isolation as provided today by the kernel IB verbs by using a user id returned from the firmware upon context creation. This user id is put by the kernel code in all firmware command from the DEVX interface so that the isolation/security will be enforced by the firmware based on that id. Below kernel services are exposed to let the above work: 1) Expose a DEVX object that represent some underlay firmware object, the input command to create it is some raw data given by the user application which should match the device specification. 2) Expose a UMEM DEVX object for user memory registration for DMA: The driver provides an API to register user memory, getting as input the user address, length and access flags, and provides to the user as output an ID (UMEM ID) returned by the firmware to this registered memory. The user will use that UMEM ID in device direct commands that use this memory instead of the physical addresses list. 3) Expose device general command API: The driver provides an API to issue some general command except than create and destroy. 4) UAR mapping: Returns a device UAR ID for a given user index by using the kernel context information. This is safe from security point of view as described in details in the relevant patch in the series. 5) EQ mapping: Returns the matching device EQN for a given user vector number via the DEVX interface. 6) Process resources cleanup: This is achieved by the existing kernel KABI logic, upon DEVX object creation the kernel builds the FW destroy command inbox in the KABI object and uses it upon cleanup. 7) Future device commands: This will be supported by some general command type (create, destroy) that the DEVX code embeds as part of its code and is going to be used from now on by the firmware. At the beginning of this series there are some KABI infra-structures improvements and fixes to enable the above DEVX functionality in a cleaner way. More details appear as part of the commit logs of the series and as part of the comments in the code itself. Thanks Leon Romanovsky (2): drm/i915: Move u64-to-ptr helpers to general header kernel.h: Reuse u64_to_ptr macro to cast __user pointers Matan Barak (9): IB/uverbs: Declare uverbs idr and fd types as static when no user access IB/uverbs: Get a specification from a method by specifying the index IB/uverbs: Add validations in attr_get and copy_{to,from} functions IB/uverbs: Add a ib_uobject getter to ioctl() infastructure IB/uverbs: Refactor uverbs_finalize_objects IB/uverbs: Add PTR_IN attributes that are allocated/copied automatically IB/uverbs: Add alloc and copy_from attribute to ioctl() infrastructure IB/uverbs: Add a macro to define a type with no kernel known size IB/uverbs: Allow an empty namepsace in ioctl() framrwork Yishai Hadas (10): IB/mlx5: Expose DEVX ifc structures IB/mlx5: Introduce DEVX IB/core: Introduce DECLARE_UVERBS_GLOBAL_METHODS IB: Expose ib_ucontext from a given ib_uverbs_file IB/mlx5: Add support for DEVX general command IB/mlx5: Add obj create and destroy functionality IB/mlx5: Add support for DEVX query UAR IB/mlx5: Add DEVX support for memory registration IB/mlx5: Add DEVX query EQN support IB/mlx5: Expose DEVX tree drivers/gpu/drm/i915/i915_utils.h | 12 +- drivers/infiniband/core/rdma_core.c | 53 +- drivers/infiniband/core/rdma_core.h | 11 +- drivers/infiniband/core/uverbs_ioctl.c | 106 ++- drivers/infiniband/core/uverbs_main.c | 6 + drivers/infiniband/core/uverbs_std_types.c | 4 +- drivers/infiniband/core/uverbs_std_types_cq.c | 23 +- .../infiniband/core/uverbs_std_types_flow_action.c | 4 +- drivers/infiniband/hw/mlx5/Makefile | 1 + drivers/infiniband/hw/mlx5/devx.c | 793 +++++++++++++++++++++ drivers/infiniband/hw/mlx5/main.c | 25 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 19 + drivers/infiniband/hw/mlx5/qp.c | 9 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 + include/linux/kernel.h | 11 +- include/linux/mlx5/device.h | 3 + include/linux/mlx5/mlx5_ifc.h | 68 +- include/rdma/ib_verbs.h | 2 + include/rdma/uverbs_ioctl.h | 186 +++++ include/rdma/uverbs_named_ioctl.h | 4 + include/rdma/uverbs_std_types.h | 2 - include/rdma/uverbs_types.h | 5 + include/uapi/rdma/mlx5-abi.h | 3 + include/uapi/rdma/mlx5_user_ioctl_cmds.h | 59 ++ 24 files changed, 1302 insertions(+), 111 deletions(-) create mode 100644 drivers/infiniband/hw/mlx5/devx.c -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html