[1/7] drm/i915/guc: Kill USES_GUC macro
diff mbox series

Message ID 20200115013143.34961-2-daniele.ceraolospurio@intel.com
State New
Headers show
Series
  • Commit early to GuC
Related show

Commit Message

Daniele Ceraolo Spurio Jan. 15, 2020, 1:31 a.m. UTC
use intel_uc_uses_guc() directly instead, to be consistent in the way we
check what we want to do with the GuC.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ggtt.c |  2 +-
 drivers/gpu/drm/i915/i915_debugfs.c  | 19 ++++++++++---------
 drivers/gpu/drm/i915/i915_drv.h      |  1 -
 3 files changed, 11 insertions(+), 11 deletions(-)

Comments

Michal Wajdeczko Jan. 16, 2020, 7:42 p.m. UTC | #1
On Wed, 15 Jan 2020 02:31:37 +0100, Daniele Ceraolo Spurio  
<daniele.ceraolospurio@intel.com> wrote:

> use intel_uc_uses_guc() directly instead, to be consistent in the way we
> check what we want to do with the GuC.
>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_ggtt.c |  2 +-
>  drivers/gpu/drm/i915/i915_debugfs.c  | 19 ++++++++++---------
>  drivers/gpu/drm/i915/i915_drv.h      |  1 -
>  3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c  
> b/drivers/gpu/drm/i915/gt/intel_ggtt.c
> index 79096722ce16..bb4aa923dbd9 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
> @@ -462,7 +462,7 @@ static int ggtt_reserve_guc_top(struct i915_ggtt  
> *ggtt)
>  	u64 size;
>  	int ret;
> -	if (!USES_GUC(ggtt->vm.i915))
> +	if (!intel_uc_uses_guc(&ggtt->vm.gt->uc))
>  		return 0;
> 	GEM_BUG_ON(ggtt->vm.total <= GUC_GGTT_TOP);
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c  
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index d5a9b8a964c2..c2f480defc71 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1752,10 +1752,8 @@ stringify_guc_log_type(enum guc_log_buffer_type  
> type)
>  	return "";
>  }
> -static void i915_guc_log_info(struct seq_file *m,
> -			      struct drm_i915_private *dev_priv)
> +static void i915_guc_log_info(struct seq_file *m, struct intel_guc_log

hmm, s/dev_priv/guc_log changes look unrelated to main topic
can you move these changes to separate patch ?

> *log)
>  {
> -	struct intel_guc_log *log = &dev_priv->gt.uc.guc.log;
>  	enum guc_log_buffer_type type;
> 	if (!intel_guc_log_relay_created(log)) {
> @@ -1779,11 +1777,12 @@ static void i915_guc_log_info(struct seq_file *m,
>  static int i915_guc_info(struct seq_file *m, void *data)
>  {
>  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
> +	struct intel_uc *uc = &dev_priv->gt.uc;
> -	if (!USES_GUC(dev_priv))
> +	if (!intel_uc_uses_guc(uc))
>  		return -ENODEV;
> -	i915_guc_log_info(m, dev_priv);
> +	i915_guc_log_info(m, &uc->guc.log);
> 	/* Add more as required ... */
> @@ -1884,11 +1883,12 @@ static int i915_guc_log_dump(struct seq_file *m,  
> void *data)
>  static int i915_guc_log_level_get(void *data, u64 *val)
>  {
>  	struct drm_i915_private *dev_priv = data;
> +	struct intel_uc *uc = &dev_priv->gt.uc;
> -	if (!USES_GUC(dev_priv))
> +	if (!intel_uc_uses_guc(uc))
>  		return -ENODEV;
> -	*val = intel_guc_log_get_level(&dev_priv->gt.uc.guc.log);
> +	*val = intel_guc_log_get_level(&uc->guc.log);
> 	return 0;
>  }
> @@ -1896,11 +1896,12 @@ static int i915_guc_log_level_get(void *data,  
> u64 *val)
>  static int i915_guc_log_level_set(void *data, u64 val)
>  {
>  	struct drm_i915_private *dev_priv = data;
> +	struct intel_uc *uc = &dev_priv->gt.uc;
> -	if (!USES_GUC(dev_priv))
> +	if (!intel_uc_uses_guc(uc))
>  		return -ENODEV;
> -	return intel_guc_log_set_level(&dev_priv->gt.uc.guc.log, val);
> +	return intel_guc_log_set_level(&uc->guc.log, val);
>  }
> DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_level_fops,
> diff --git a/drivers/gpu/drm/i915/i915_drv.h  
> b/drivers/gpu/drm/i915/i915_drv.h
> index 077af22b8340..ad0019cd2604 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1719,7 +1719,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
>  #define HAS_GT_UC(dev_priv)	(INTEL_INFO(dev_priv)->has_gt_uc)
> /* Having GuC is not the same as using GuC */
> -#define USES_GUC(dev_priv)		intel_uc_uses_guc(&(dev_priv)->gt.uc)
>  #define  
> USES_GUC_SUBMISSION(dev_priv)	intel_uc_uses_guc_submission(&(dev_priv)->gt.uc)
> #define HAS_POOLED_EU(dev_priv)	(INTEL_INFO(dev_priv)->has_pooled_eu)
Daniele Ceraolo Spurio Jan. 16, 2020, 8:24 p.m. UTC | #2
On 1/16/20 11:42 AM, Michal Wajdeczko wrote:
> On Wed, 15 Jan 2020 02:31:37 +0100, Daniele Ceraolo Spurio 
> <daniele.ceraolospurio@intel.com> wrote:
> 
>> use intel_uc_uses_guc() directly instead, to be consistent in the way we
>> check what we want to do with the GuC.
>>
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: John Harrison <John.C.Harrison@Intel.com>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> ---
>>  drivers/gpu/drm/i915/gt/intel_ggtt.c |  2 +-
>>  drivers/gpu/drm/i915/i915_debugfs.c  | 19 ++++++++++---------
>>  drivers/gpu/drm/i915/i915_drv.h      |  1 -
>>  3 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c 
>> b/drivers/gpu/drm/i915/gt/intel_ggtt.c
>> index 79096722ce16..bb4aa923dbd9 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
>> @@ -462,7 +462,7 @@ static int ggtt_reserve_guc_top(struct i915_ggtt 
>> *ggtt)
>>      u64 size;
>>      int ret;
>> -    if (!USES_GUC(ggtt->vm.i915))
>> +    if (!intel_uc_uses_guc(&ggtt->vm.gt->uc))
>>          return 0;
>>     GEM_BUG_ON(ggtt->vm.total <= GUC_GGTT_TOP);
>> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
>> b/drivers/gpu/drm/i915/i915_debugfs.c
>> index d5a9b8a964c2..c2f480defc71 100644
>> --- a/drivers/gpu/drm/i915/i915_debugfs.c
>> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
>> @@ -1752,10 +1752,8 @@ stringify_guc_log_type(enum guc_log_buffer_type 
>> type)
>>      return "";
>>  }
>> -static void i915_guc_log_info(struct seq_file *m,
>> -                  struct drm_i915_private *dev_priv)
>> +static void i915_guc_log_info(struct seq_file *m, struct intel_guc_log
> 
> hmm, s/dev_priv/guc_log changes look unrelated to main topic
> can you move these changes to separate patch ?

It made sense to me to do the changes since I now had the uc variable at 
hand, but I can easily split them as a prep patch.

Daniele

> 
>> *log)
>>  {
>> -    struct intel_guc_log *log = &dev_priv->gt.uc.guc.log;
>>      enum guc_log_buffer_type type;
>>     if (!intel_guc_log_relay_created(log)) {
>> @@ -1779,11 +1777,12 @@ static void i915_guc_log_info(struct seq_file *m,
>>  static int i915_guc_info(struct seq_file *m, void *data)
>>  {
>>      struct drm_i915_private *dev_priv = node_to_i915(m->private);
>> +    struct intel_uc *uc = &dev_priv->gt.uc;
>> -    if (!USES_GUC(dev_priv))
>> +    if (!intel_uc_uses_guc(uc))
>>          return -ENODEV;
>> -    i915_guc_log_info(m, dev_priv);
>> +    i915_guc_log_info(m, &uc->guc.log);
>>     /* Add more as required ... */
>> @@ -1884,11 +1883,12 @@ static int i915_guc_log_dump(struct seq_file 
>> *m, void *data)
>>  static int i915_guc_log_level_get(void *data, u64 *val)
>>  {
>>      struct drm_i915_private *dev_priv = data;
>> +    struct intel_uc *uc = &dev_priv->gt.uc;
>> -    if (!USES_GUC(dev_priv))
>> +    if (!intel_uc_uses_guc(uc))
>>          return -ENODEV;
>> -    *val = intel_guc_log_get_level(&dev_priv->gt.uc.guc.log);
>> +    *val = intel_guc_log_get_level(&uc->guc.log);
>>     return 0;
>>  }
>> @@ -1896,11 +1896,12 @@ static int i915_guc_log_level_get(void *data, 
>> u64 *val)
>>  static int i915_guc_log_level_set(void *data, u64 val)
>>  {
>>      struct drm_i915_private *dev_priv = data;
>> +    struct intel_uc *uc = &dev_priv->gt.uc;
>> -    if (!USES_GUC(dev_priv))
>> +    if (!intel_uc_uses_guc(uc))
>>          return -ENODEV;
>> -    return intel_guc_log_set_level(&dev_priv->gt.uc.guc.log, val);
>> +    return intel_guc_log_set_level(&uc->guc.log, val);
>>  }
>> DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_level_fops,
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h 
>> b/drivers/gpu/drm/i915/i915_drv.h
>> index 077af22b8340..ad0019cd2604 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -1719,7 +1719,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
>>  #define HAS_GT_UC(dev_priv)    (INTEL_INFO(dev_priv)->has_gt_uc)
>> /* Having GuC is not the same as using GuC */
>> -#define USES_GUC(dev_priv)        intel_uc_uses_guc(&(dev_priv)->gt.uc)
>>  #define USES_GUC_SUBMISSION(dev_priv)    
>> intel_uc_uses_guc_submission(&(dev_priv)->gt.uc)
>> #define HAS_POOLED_EU(dev_priv)    (INTEL_INFO(dev_priv)->has_pooled_eu)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
index 79096722ce16..bb4aa923dbd9 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
@@ -462,7 +462,7 @@  static int ggtt_reserve_guc_top(struct i915_ggtt *ggtt)
 	u64 size;
 	int ret;
 
-	if (!USES_GUC(ggtt->vm.i915))
+	if (!intel_uc_uses_guc(&ggtt->vm.gt->uc))
 		return 0;
 
 	GEM_BUG_ON(ggtt->vm.total <= GUC_GGTT_TOP);
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index d5a9b8a964c2..c2f480defc71 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1752,10 +1752,8 @@  stringify_guc_log_type(enum guc_log_buffer_type type)
 	return "";
 }
 
-static void i915_guc_log_info(struct seq_file *m,
-			      struct drm_i915_private *dev_priv)
+static void i915_guc_log_info(struct seq_file *m, struct intel_guc_log *log)
 {
-	struct intel_guc_log *log = &dev_priv->gt.uc.guc.log;
 	enum guc_log_buffer_type type;
 
 	if (!intel_guc_log_relay_created(log)) {
@@ -1779,11 +1777,12 @@  static void i915_guc_log_info(struct seq_file *m,
 static int i915_guc_info(struct seq_file *m, void *data)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
+	struct intel_uc *uc = &dev_priv->gt.uc;
 
-	if (!USES_GUC(dev_priv))
+	if (!intel_uc_uses_guc(uc))
 		return -ENODEV;
 
-	i915_guc_log_info(m, dev_priv);
+	i915_guc_log_info(m, &uc->guc.log);
 
 	/* Add more as required ... */
 
@@ -1884,11 +1883,12 @@  static int i915_guc_log_dump(struct seq_file *m, void *data)
 static int i915_guc_log_level_get(void *data, u64 *val)
 {
 	struct drm_i915_private *dev_priv = data;
+	struct intel_uc *uc = &dev_priv->gt.uc;
 
-	if (!USES_GUC(dev_priv))
+	if (!intel_uc_uses_guc(uc))
 		return -ENODEV;
 
-	*val = intel_guc_log_get_level(&dev_priv->gt.uc.guc.log);
+	*val = intel_guc_log_get_level(&uc->guc.log);
 
 	return 0;
 }
@@ -1896,11 +1896,12 @@  static int i915_guc_log_level_get(void *data, u64 *val)
 static int i915_guc_log_level_set(void *data, u64 val)
 {
 	struct drm_i915_private *dev_priv = data;
+	struct intel_uc *uc = &dev_priv->gt.uc;
 
-	if (!USES_GUC(dev_priv))
+	if (!intel_uc_uses_guc(uc))
 		return -ENODEV;
 
-	return intel_guc_log_set_level(&dev_priv->gt.uc.guc.log, val);
+	return intel_guc_log_set_level(&uc->guc.log, val);
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_level_fops,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 077af22b8340..ad0019cd2604 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1719,7 +1719,6 @@  IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define HAS_GT_UC(dev_priv)	(INTEL_INFO(dev_priv)->has_gt_uc)
 
 /* Having GuC is not the same as using GuC */
-#define USES_GUC(dev_priv)		intel_uc_uses_guc(&(dev_priv)->gt.uc)
 #define USES_GUC_SUBMISSION(dev_priv)	intel_uc_uses_guc_submission(&(dev_priv)->gt.uc)
 
 #define HAS_POOLED_EU(dev_priv)	(INTEL_INFO(dev_priv)->has_pooled_eu)