1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2022 Intel Corporation 4 */ 5 6 #ifndef _XE_GUC_TYPES_H_ 7 #define _XE_GUC_TYPES_H_ 8 9 #include <linux/idr.h> 10 #include <linux/xarray.h> 11 12 #include "regs/xe_reg_defs.h" 13 #include "xe_guc_ads_types.h" 14 #include "xe_guc_buf_types.h" 15 #include "xe_guc_ct_types.h" 16 #include "xe_guc_engine_activity_types.h" 17 #include "xe_guc_fwif.h" 18 #include "xe_guc_log_types.h" 19 #include "xe_guc_pc_types.h" 20 #include "xe_guc_relay_types.h" 21 #include "xe_uc_fw_types.h" 22 23 /** 24 * struct xe_guc_db_mgr - GuC Doorbells Manager. 25 * 26 * Note: GuC Doorbells Manager is relying on &xe_guc::submission_state.lock 27 * to protect its members. 28 */ 29 struct xe_guc_db_mgr { 30 /** @count: number of doorbells to manage */ 31 unsigned int count; 32 /** @bitmap: bitmap to track allocated doorbells */ 33 unsigned long *bitmap; 34 }; 35 36 /** 37 * struct xe_guc_id_mgr - GuC context ID Manager. 38 * 39 * Note: GuC context ID Manager is relying on &xe_guc::submission_state.lock 40 * to protect its members. 41 */ 42 struct xe_guc_id_mgr { 43 /** @bitmap: bitmap to track allocated IDs */ 44 unsigned long *bitmap; 45 /** @total: total number of IDs being managed */ 46 unsigned int total; 47 /** @used: number of IDs currently in use */ 48 unsigned int used; 49 }; 50 51 /** 52 * struct xe_guc - Graphic micro controller 53 */ 54 struct xe_guc { 55 /** @fw: Generic uC firmware management */ 56 struct xe_uc_fw fw; 57 /** @log: GuC log */ 58 struct xe_guc_log log; 59 /** @ads: GuC ads */ 60 struct xe_guc_ads ads; 61 /** @ct: GuC ct */ 62 struct xe_guc_ct ct; 63 /** @buf: GuC Buffer Cache manager */ 64 struct xe_guc_buf_cache buf; 65 /** @capture: the error-state-capture module's data and objects */ 66 struct xe_guc_state_capture *capture; 67 /** @pc: GuC Power Conservation */ 68 struct xe_guc_pc pc; 69 /** @dbm: GuC Doorbell Manager */ 70 struct xe_guc_db_mgr dbm; 71 72 /** @g2g: GuC to GuC communication state */ 73 struct { 74 /** @g2g.bo: Storage for GuC to GuC communication channels */ 75 struct xe_bo *bo; 76 /** @g2g.owned: Is the BO owned by this GT or just mapped in */ 77 bool owned; 78 } g2g; 79 80 /** @submission_state: GuC submission state */ 81 struct { 82 /** @submission_state.idm: GuC context ID Manager */ 83 struct xe_guc_id_mgr idm; 84 /** @submission_state.exec_queue_lookup: Lookup an xe_engine from guc_id */ 85 struct xarray exec_queue_lookup; 86 /** @submission_state.stopped: submissions are stopped */ 87 atomic_t stopped; 88 /** @submission_state.lock: protects submission state */ 89 struct mutex lock; 90 /** @submission_state.enabled: submission is enabled */ 91 bool enabled; 92 /** @submission_state.fini_wq: submit fini wait queue */ 93 wait_queue_head_t fini_wq; 94 } submission_state; 95 96 /** @hwconfig: Hardware config state */ 97 struct { 98 /** @hwconfig.bo: buffer object of the hardware config */ 99 struct xe_bo *bo; 100 /** @hwconfig.size: size of the hardware config */ 101 u32 size; 102 } hwconfig; 103 104 /** @relay: GuC Relay Communication used in SR-IOV */ 105 struct xe_guc_relay relay; 106 107 /** @engine_activity: Device specific engine activity */ 108 struct xe_guc_engine_activity engine_activity; 109 110 /** 111 * @notify_reg: Register which is written to notify GuC of H2G messages 112 */ 113 struct xe_reg notify_reg; 114 /** @params: Control params for fw initialization */ 115 u32 params[GUC_CTL_MAX_DWORDS]; 116 }; 117 118 #endif 119