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_uc_fw_types.h" 19 20 /** 21 * struct xe_guc - Graphic micro controller 22 */ 23 struct xe_guc { 24 /** @fw: Generic uC firmware management */ 25 struct xe_uc_fw fw; 26 /** @log: GuC log */ 27 struct xe_guc_log log; 28 /** @ads: GuC ads */ 29 struct xe_guc_ads ads; 30 /** @ct: GuC ct */ 31 struct xe_guc_ct ct; 32 /** @pc: GuC Power Conservation */ 33 struct xe_guc_pc pc; 34 /** @submission_state: GuC submission state */ 35 struct { 36 /** @exec_queue_lookup: Lookup an xe_engine from guc_id */ 37 struct xarray exec_queue_lookup; 38 /** @guc_ids: used to allocate new guc_ids, single-lrc */ 39 struct ida guc_ids; 40 /** @guc_ids_bitmap: used to allocate new guc_ids, multi-lrc */ 41 unsigned long *guc_ids_bitmap; 42 /** @stopped: submissions are stopped */ 43 atomic_t stopped; 44 /** @lock: protects submission state */ 45 struct mutex lock; 46 /** @suspend: suspend fence state */ 47 struct { 48 /** @lock: suspend fences lock */ 49 spinlock_t lock; 50 /** @context: suspend fences context */ 51 u64 context; 52 /** @seqno: suspend fences seqno */ 53 u32 seqno; 54 } suspend; 55 #ifdef CONFIG_PROVE_LOCKING 56 #define NUM_SUBMIT_WQ 256 57 /** @submit_wq_pool: submission ordered workqueues pool */ 58 struct workqueue_struct *submit_wq_pool[NUM_SUBMIT_WQ]; 59 /** @submit_wq_idx: submission ordered workqueue index */ 60 int submit_wq_idx; 61 #endif 62 /** @enabled: submission is enabled */ 63 bool enabled; 64 } submission_state; 65 /** @hwconfig: Hardware config state */ 66 struct { 67 /** @bo: buffer object of the hardware config */ 68 struct xe_bo *bo; 69 /** @size: size of the hardware config */ 70 u32 size; 71 } hwconfig; 72 73 /** 74 * @notify_reg: Register which is written to notify GuC of H2G messages 75 */ 76 struct xe_reg notify_reg; 77 /** @params: Control params for fw initialization */ 78 u32 params[GUC_CTL_MAX_DWORDS]; 79 }; 80 81 #endif 82