From cb5d64e9f13e0dd817c3ae2dbe73c3b8c6c13f95 Mon Sep 17 00:00:00 2001 From: Michał Winiarski Date: Mon, 19 Mar 2018 10:53:45 +0100 Subject: drm/i915/guc: Allow user to control default GuC logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While both naming and actual log enable logic in GuC interface are confusing, we can simply expose the default log as yet another log level. GuC logic aside, from i915 point of view we now have the following GuC log levels: 0 Log disabled 1 Non-verbose log 2-5 Verbose log v2: Adjust naming after rebase. v3: Fixed the log_level logic error introduced on rebase. Signed-off-by: Michał Winiarski Cc: Chris Wilson Cc: Daniele Ceraolo Spurio Cc: Sagar Arun Kamble Cc: Michal Wajdeczko Reviewed-by: Sagar Arun Kamble Signed-off-by: Chris Wilson Link: https://patchwork.freedesktop.org/patch/msgid/20180319095348.9716-10-michal.winiarski@intel.com --- drivers/gpu/drm/i915/intel_guc_log.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'drivers/gpu/drm/i915/intel_guc_log.c') diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c index 3180645b9642..4cb422ceb283 100644 --- a/drivers/gpu/drm/i915/intel_guc_log.c +++ b/drivers/gpu/drm/i915/intel_guc_log.c @@ -57,12 +57,14 @@ static int guc_log_flush(struct intel_guc *guc) return intel_guc_send(guc, action, ARRAY_SIZE(action)); } -static int guc_log_control(struct intel_guc *guc, bool enable, u32 verbosity) +static int guc_log_control(struct intel_guc *guc, bool enable, + bool default_logging, u32 verbosity) { union guc_log_control control_val = { { .logging_enabled = enable, .verbosity = verbosity, + .default_logging = default_logging, }, }; u32 action[] = { @@ -499,13 +501,6 @@ int intel_guc_log_level_get(struct intel_guc_log *log) return i915_modparams.guc_log_level; } -#define GUC_LOG_LEVEL_DISABLED 0 -#define LOG_LEVEL_TO_ENABLED(x) ((x) > 0) -#define LOG_LEVEL_TO_VERBOSITY(x) ({ \ - typeof(x) _x = (x); \ - LOG_LEVEL_TO_ENABLED(_x) ? _x - 1 : 0; \ -}) -#define VERBOSITY_TO_LOG_LEVEL(x) ((x) + 1) int intel_guc_log_level_set(struct intel_guc_log *log, u64 val) { struct intel_guc *guc = log_to_guc(log); @@ -521,7 +516,7 @@ int intel_guc_log_level_set(struct intel_guc_log *log, u64 val) * as indication that logging should be disabled. */ if (val < GUC_LOG_LEVEL_DISABLED || - val > VERBOSITY_TO_LOG_LEVEL(GUC_LOG_VERBOSITY_MAX)) + val > GUC_VERBOSITY_TO_LOG_LEVEL(GUC_LOG_VERBOSITY_MAX)) return -EINVAL; mutex_lock(&dev_priv->drm.struct_mutex); @@ -532,8 +527,9 @@ int intel_guc_log_level_set(struct intel_guc_log *log, u64 val) } intel_runtime_pm_get(dev_priv); - ret = guc_log_control(guc, LOG_LEVEL_TO_ENABLED(val), - LOG_LEVEL_TO_VERBOSITY(val)); + ret = guc_log_control(guc, GUC_LOG_LEVEL_TO_VERBOSE(val), + GUC_LOG_LEVEL_TO_ENABLED(val), + GUC_LOG_LEVEL_TO_VERBOSITY(val)); intel_runtime_pm_put(dev_priv); if (ret) { DRM_DEBUG_DRIVER("guc_log_control action failed %d\n", ret); -- cgit