GNU Linux-libre 6.9.2-gnu
[releases.git] / include / drm / i915_pxp_tee_interface.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5
6 #ifndef _I915_PXP_TEE_INTERFACE_H_
7 #define _I915_PXP_TEE_INTERFACE_H_
8
9 #include <linux/mutex.h>
10 #include <linux/device.h>
11 struct scatterlist;
12
13 /**
14  * struct i915_pxp_component_ops - ops for PXP services.
15  * @owner: Module providing the ops
16  * @send: sends data to PXP
17  * @receive: receives data from PXP
18  */
19 struct i915_pxp_component_ops {
20         /**
21          * @owner: owner of the module provding the ops
22          */
23         struct module *owner;
24
25         int (*send)(struct device *dev, const void *message, size_t size,
26                     unsigned long timeout_ms);
27         int (*recv)(struct device *dev, void *buffer, size_t size,
28                     unsigned long timeout_ms);
29         ssize_t (*gsc_command)(struct device *dev, u8 client_id, u32 fence_id,
30                                struct scatterlist *sg_in, size_t total_in_len,
31                                struct scatterlist *sg_out);
32
33 };
34
35 /**
36  * struct i915_pxp_component - Used for communication between i915 and TEE
37  * drivers for the PXP services
38  * @tee_dev: device that provide the PXP service from TEE Bus.
39  * @pxp_ops: Ops implemented by TEE driver, used by i915 driver.
40  */
41 struct i915_pxp_component {
42         struct device *tee_dev;
43         const struct i915_pxp_component_ops *ops;
44
45         /* To protect the above members. */
46         struct mutex mutex;
47 };
48
49 #endif /* _I915_TEE_PXP_INTERFACE_H_ */