xref: /linux/include/drm/intel/i915_pxp_tee_interface.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
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  */
16 struct i915_pxp_component_ops {
17 	/**
18 	 * @owner: Module providing the ops.
19 	 */
20 	struct module *owner;
21 
22 	/**
23 	 * @send: Send a PXP message.
24 	 */
25 	int (*send)(struct device *dev, const void *message, size_t size,
26 		    unsigned long timeout_ms);
27 	/**
28 	 * @recv: Receive a PXP message.
29 	 */
30 	int (*recv)(struct device *dev, void *buffer, size_t size,
31 		    unsigned long timeout_ms);
32 	/**
33 	 * @gsc_command: Send a GSC command.
34 	 */
35 	ssize_t (*gsc_command)(struct device *dev, u8 client_id, u32 fence_id,
36 			       struct scatterlist *sg_in, size_t total_in_len,
37 			       struct scatterlist *sg_out);
38 
39 };
40 
41 /**
42  * struct i915_pxp_component - Used for communication between i915 and TEE
43  * drivers for the PXP services
44  */
45 struct i915_pxp_component {
46 	/**
47 	 * @tee_dev: device that provide the PXP service from TEE Bus.
48 	 */
49 	struct device *tee_dev;
50 
51 	/**
52 	 * @ops: Ops implemented by TEE driver, used by i915 driver.
53 	 */
54 	const struct i915_pxp_component_ops *ops;
55 
56 	/**
57 	 * @mutex: To protect the above members.
58 	 */
59 	struct mutex mutex;
60 };
61 
62 #endif /* _I915_TEE_PXP_INTERFACE_H_ */
63