1*3f2dd94aSFrançois Tigeot /* 2*3f2dd94aSFrançois Tigeot * Copyright © 2014-2017 Intel Corporation 3*3f2dd94aSFrançois Tigeot * 4*3f2dd94aSFrançois Tigeot * Permission is hereby granted, free of charge, to any person obtaining a 5*3f2dd94aSFrançois Tigeot * copy of this software and associated documentation files (the "Software"), 6*3f2dd94aSFrançois Tigeot * to deal in the Software without restriction, including without limitation 7*3f2dd94aSFrançois Tigeot * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*3f2dd94aSFrançois Tigeot * and/or sell copies of the Software, and to permit persons to whom the 9*3f2dd94aSFrançois Tigeot * Software is furnished to do so, subject to the following conditions: 10*3f2dd94aSFrançois Tigeot * 11*3f2dd94aSFrançois Tigeot * The above copyright notice and this permission notice (including the next 12*3f2dd94aSFrançois Tigeot * paragraph) shall be included in all copies or substantial portions of the 13*3f2dd94aSFrançois Tigeot * Software. 14*3f2dd94aSFrançois Tigeot * 15*3f2dd94aSFrançois Tigeot * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*3f2dd94aSFrançois Tigeot * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*3f2dd94aSFrançois Tigeot * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*3f2dd94aSFrançois Tigeot * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19*3f2dd94aSFrançois Tigeot * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20*3f2dd94aSFrançois Tigeot * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21*3f2dd94aSFrançois Tigeot * IN THE SOFTWARE. 22*3f2dd94aSFrançois Tigeot * 23*3f2dd94aSFrançois Tigeot */ 24*3f2dd94aSFrançois Tigeot 25*3f2dd94aSFrançois Tigeot #ifndef _INTEL_GUC_LOG_H_ 26*3f2dd94aSFrançois Tigeot #define _INTEL_GUC_LOG_H_ 27*3f2dd94aSFrançois Tigeot 28*3f2dd94aSFrançois Tigeot #include <linux/workqueue.h> 29*3f2dd94aSFrançois Tigeot 30*3f2dd94aSFrançois Tigeot #include "intel_guc_fwif.h" 31*3f2dd94aSFrançois Tigeot 32*3f2dd94aSFrançois Tigeot struct drm_i915_private; 33*3f2dd94aSFrançois Tigeot struct intel_guc; 34*3f2dd94aSFrançois Tigeot 35*3f2dd94aSFrançois Tigeot struct intel_guc_log { 36*3f2dd94aSFrançois Tigeot u32 flags; 37*3f2dd94aSFrançois Tigeot struct i915_vma *vma; 38*3f2dd94aSFrançois Tigeot /* The runtime stuff gets created only when GuC logging gets enabled */ 39*3f2dd94aSFrançois Tigeot struct { 40*3f2dd94aSFrançois Tigeot void *buf_addr; 41*3f2dd94aSFrançois Tigeot struct workqueue_struct *flush_wq; 42*3f2dd94aSFrançois Tigeot struct work_struct flush_work; 43*3f2dd94aSFrançois Tigeot struct rchan *relay_chan; 44*3f2dd94aSFrançois Tigeot } runtime; 45*3f2dd94aSFrançois Tigeot /* logging related stats */ 46*3f2dd94aSFrançois Tigeot u32 capture_miss_count; 47*3f2dd94aSFrançois Tigeot u32 flush_interrupt_count; 48*3f2dd94aSFrançois Tigeot u32 prev_overflow_count[GUC_MAX_LOG_BUFFER]; 49*3f2dd94aSFrançois Tigeot u32 total_overflow_count[GUC_MAX_LOG_BUFFER]; 50*3f2dd94aSFrançois Tigeot u32 flush_count[GUC_MAX_LOG_BUFFER]; 51*3f2dd94aSFrançois Tigeot }; 52*3f2dd94aSFrançois Tigeot 53*3f2dd94aSFrançois Tigeot int intel_guc_log_create(struct intel_guc *guc); 54*3f2dd94aSFrançois Tigeot void intel_guc_log_destroy(struct intel_guc *guc); 55*3f2dd94aSFrançois Tigeot int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val); 56*3f2dd94aSFrançois Tigeot void i915_guc_log_register(struct drm_i915_private *dev_priv); 57*3f2dd94aSFrançois Tigeot void i915_guc_log_unregister(struct drm_i915_private *dev_priv); 58*3f2dd94aSFrançois Tigeot 59*3f2dd94aSFrançois Tigeot #endif 60