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