intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 3/3] drm/i915/guc: Move enable/disable msg functions to GuC header
Date: Mon, 19 Mar 2018 16:20:03 +0000	[thread overview]
Message-ID: <20180319162003.30668-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20180319162003.30668-1-michal.wajdeczko@intel.com>

While today we are modifying GuC enabled msg mask only in GuC
log, this code should be defined as generic GuC to allow future
code reuse.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/intel_guc.h     | 14 ++++++++++++++
 drivers/gpu/drm/i915/intel_guc_log.c | 26 ++++++++++++--------------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
index 9a95d15..13f3d1d 100644
--- a/drivers/gpu/drm/i915/intel_guc.h
+++ b/drivers/gpu/drm/i915/intel_guc.h
@@ -155,4 +155,18 @@ static inline int intel_guc_sanitize(struct intel_guc *guc)
 	return 0;
 }
 
+static inline void intel_guc_enable_msg(struct intel_guc *guc, u32 mask)
+{
+	spin_lock_irq(&guc->irq_lock);
+	guc->msg_enabled_mask |= mask;
+	spin_unlock_irq(&guc->irq_lock);
+}
+
+static inline void intel_guc_disable_msg(struct intel_guc *guc, u32 mask)
+{
+	spin_lock_irq(&guc->irq_lock);
+	guc->msg_enabled_mask &= ~mask;
+	spin_unlock_irq(&guc->irq_lock);
+}
+
 #endif
diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c
index 5262bba..f5450bc 100644
--- a/drivers/gpu/drm/i915/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/intel_guc_log.c
@@ -72,25 +72,23 @@ static int guc_action_control_log(struct intel_guc *guc, bool enable,
 	return intel_guc_send(guc, action, ARRAY_SIZE(action));
 }
 
-static void guc_flush_log_msg_enable(struct intel_guc *guc)
+static inline struct intel_guc *log_to_guc(struct intel_guc_log *log)
 {
-	spin_lock_irq(&guc->irq_lock);
-	guc->msg_enabled_mask |= INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER |
-				 INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED;
-	spin_unlock_irq(&guc->irq_lock);
+	return container_of(log, struct intel_guc, log);
 }
 
-static void guc_flush_log_msg_disable(struct intel_guc *guc)
+static void guc_log_enable_flush_events(struct intel_guc_log *log)
 {
-	spin_lock_irq(&guc->irq_lock);
-	guc->msg_enabled_mask &= ~(INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER |
-				   INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED);
-	spin_unlock_irq(&guc->irq_lock);
+	intel_guc_enable_msg(log_to_guc(log),
+			     INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER |
+			     INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED);
 }
 
-static inline struct intel_guc *log_to_guc(struct intel_guc_log *log)
+static void guc_log_disable_flush_events(struct intel_guc_log *log)
 {
-	return container_of(log, struct intel_guc, log);
+	intel_guc_disable_msg(log_to_guc(log),
+			      INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER |
+			      INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED);
 }
 
 /*
@@ -577,7 +575,7 @@ int intel_guc_log_relay_open(struct intel_guc_log *log)
 
 	mutex_unlock(&log->relay.lock);
 
-	guc_flush_log_msg_enable(log_to_guc(log));
+	guc_log_enable_flush_events(log);
 
 	/*
 	 * When GuC is logging without us relaying to userspace, we're ignoring
@@ -617,7 +615,7 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log)
 
 void intel_guc_log_relay_close(struct intel_guc_log *log)
 {
-	guc_flush_log_msg_disable(log_to_guc(log));
+	guc_log_disable_flush_events(log);
 	flush_work(&log->relay.flush_work);
 
 	mutex_lock(&log->relay.lock);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-03-19 16:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 16:20 [PATCH v3 1/3] drm/i915/guc: Unify naming of private GuC action functions Michal Wajdeczko
2018-03-19 16:20 ` [PATCH v3 2/3] drm/i915/guc: Drop union guc_log_control Michal Wajdeczko
2018-03-19 17:18   ` Michał Winiarski
2018-03-19 16:20 ` Michal Wajdeczko [this message]
2018-03-19 18:11 ` ✓ Fi.CI.BAT: success for series starting with [v3,1/3] drm/i915/guc: Unify naming of private GuC action functions Patchwork
2018-03-19 20:42 ` ✗ Fi.CI.IGT: warning " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180319162003.30668-3-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).