1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright(c) 2020, Intel Corporation. All rights reserved. 4 */ 5 6 #ifndef __INTEL_PXP_H__ 7 #define __INTEL_PXP_H__ 8 9 #include "intel_pxp_types.h" 10 11 struct drm_i915_gem_object; 12 13 static inline bool intel_pxp_is_enabled(const struct intel_pxp *pxp) 14 { 15 return pxp->ce; 16 } 17 18 #ifdef CONFIG_DRM_I915_PXP 19 struct intel_gt *pxp_to_gt(const struct intel_pxp *pxp); 20 bool intel_pxp_is_active(const struct intel_pxp *pxp); 21 22 void intel_pxp_init(struct intel_pxp *pxp); 23 void intel_pxp_fini(struct intel_pxp *pxp); 24 25 void intel_pxp_init_hw(struct intel_pxp *pxp); 26 void intel_pxp_fini_hw(struct intel_pxp *pxp); 27 28 void intel_pxp_mark_termination_in_progress(struct intel_pxp *pxp); 29 30 int intel_pxp_start(struct intel_pxp *pxp); 31 32 int intel_pxp_key_check(struct intel_pxp *pxp, 33 struct drm_i915_gem_object *obj, 34 bool assign); 35 36 void intel_pxp_invalidate(struct intel_pxp *pxp); 37 #else 38 static inline void intel_pxp_init(struct intel_pxp *pxp) 39 { 40 } 41 42 static inline void intel_pxp_fini(struct intel_pxp *pxp) 43 { 44 } 45 46 static inline int intel_pxp_start(struct intel_pxp *pxp) 47 { 48 return -ENODEV; 49 } 50 51 static inline bool intel_pxp_is_active(const struct intel_pxp *pxp) 52 { 53 return false; 54 } 55 56 static inline int intel_pxp_key_check(struct intel_pxp *pxp, 57 struct drm_i915_gem_object *obj, 58 bool assign) 59 { 60 return -ENODEV; 61 } 62 #endif 63 64 #endif /* __INTEL_PXP_H__ */ 65