diff mbox

[01/14] drm/i915/guc: Pass intel_guc struct as parameter to intel_guc_wopcm_size

Message ID 1505842071-12787-2-git-send-email-sagar.a.kamble@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

sagar.a.kamble@intel.com Sept. 19, 2017, 5:27 p.m. UTC
Pass intel_guc struct as parameter to intel_guc_wopcm_size instead of
drm_i915_private. intel_guc_suspend/resume parameters are not updated in
this patch as those functions are updated in the upcoming patches.

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
---
 drivers/gpu/drm/i915/intel_guc_loader.c | 3 ++-
 drivers/gpu/drm/i915/intel_uc.c         | 4 ++--
 drivers/gpu/drm/i915/intel_uc.h         | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

Comments

Michal Wajdeczko Sept. 19, 2017, 8:17 p.m. UTC | #1
On Tue, 19 Sep 2017 19:27:38 +0200, Sagar Arun Kamble  
<sagar.a.kamble@intel.com> wrote:

> Pass intel_guc struct as parameter to intel_guc_wopcm_size instead of
> drm_i915_private. intel_guc_suspend/resume parameters are not updated in
> this patch as those functions are updated in the upcoming patches.
>

hmm, missing answer to the "why" question.

> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_guc_loader.c | 3 ++-
>  drivers/gpu/drm/i915/intel_uc.c         | 4 ++--
>  drivers/gpu/drm/i915/intel_uc.h         | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c  
> b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 8b0ae7f..6ee7c16 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -250,8 +250,9 @@ static int guc_ucode_xfer_dma(struct  
> drm_i915_private *dev_priv,
>  	return ret;
>  }
> -u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv)
> +u32 intel_guc_wopcm_size(struct intel_guc *guc)

Maybe better option would be to convert this function into inline
as it is used only in uc.c file.

Michal

>  {
> +	struct drm_i915_private *dev_priv = guc_to_i915(guc);
>  	u32 wopcm_size = GUC_WOPCM_TOP;
> 	/* On BXT, the top of WOPCM is reserved for RC6 context */
> diff --git a/drivers/gpu/drm/i915/intel_uc.c  
> b/drivers/gpu/drm/i915/intel_uc.c
> index 0178ba4..b91f848 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -188,7 +188,7 @@ static void fetch_uc_fw(struct drm_i915_private  
> *dev_priv,
>  		size = uc_fw->header_size + uc_fw->ucode_size;
> 		/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
> -		if (size > intel_guc_wopcm_size(dev_priv)) {
> +		if (size > intel_guc_wopcm_size(&dev_priv->guc)) {
>  			DRM_ERROR("Firmware is too large to fit in WOPCM\n");
>  			goto fail;
>  		}
> @@ -353,7 +353,7 @@ int intel_uc_init_hw(struct drm_i915_private  
> *dev_priv)
>  	}
> 	/* init WOPCM */
> -	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
> +	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(guc));
>  	I915_WRITE(DMA_GUC_WOPCM_OFFSET,
>  		   GUC_WOPCM_OFFSET_VALUE | HUC_LOADING_AGENT_GUC);
> diff --git a/drivers/gpu/drm/i915/intel_uc.h  
> b/drivers/gpu/drm/i915/intel_uc.h
> index 7703c9a..8560a7e 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -227,7 +227,7 @@ static inline void intel_guc_notify(struct intel_guc  
> *guc)
>  int intel_guc_init_hw(struct intel_guc *guc);
>  int intel_guc_suspend(struct drm_i915_private *dev_priv);
>  int intel_guc_resume(struct drm_i915_private *dev_priv);
> -u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
> +u32 intel_guc_wopcm_size(struct intel_guc *guc);
> /* i915_guc_submission.c */
>  int i915_guc_submission_init(struct drm_i915_private *dev_priv);
sagar.a.kamble@intel.com Sept. 20, 2017, 11:13 a.m. UTC | #2
On 9/20/2017 1:47 AM, Michal Wajdeczko wrote:
> On Tue, 19 Sep 2017 19:27:38 +0200, Sagar Arun Kamble 
> <sagar.a.kamble@intel.com> wrote:
>
>> Pass intel_guc struct as parameter to intel_guc_wopcm_size instead of
>> drm_i915_private. intel_guc_suspend/resume parameters are not updated in
>> this patch as those functions are updated in the upcoming patches.
>>
>
> hmm, missing answer to the "why" question.
To maintain the symmetry with other intel_guc* functions defined in 
intel_guc_loader.c I changed this even though this only accesses dev_priv.
Also thought in future some member in intel_guc will have info about 
wopcm size. But currently since it only depends on dev_priv I think
it makes more sense to move this as inline into intel_uc.c as you said 
below.
>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Michał Winiarski <michal.winiarski@intel.com>
>> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_guc_loader.c | 3 ++-
>>  drivers/gpu/drm/i915/intel_uc.c         | 4 ++--
>>  drivers/gpu/drm/i915/intel_uc.h         | 2 +-
>>  3 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c 
>> b/drivers/gpu/drm/i915/intel_guc_loader.c
>> index 8b0ae7f..6ee7c16 100644
>> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
>> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
>> @@ -250,8 +250,9 @@ static int guc_ucode_xfer_dma(struct 
>> drm_i915_private *dev_priv,
>>      return ret;
>>  }
>> -u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv)
>> +u32 intel_guc_wopcm_size(struct intel_guc *guc)
>
> Maybe better option would be to convert this function into inline
> as it is used only in uc.c file.
>
> Michal
>
>>  {
>> +    struct drm_i915_private *dev_priv = guc_to_i915(guc);
>>      u32 wopcm_size = GUC_WOPCM_TOP;
>>     /* On BXT, the top of WOPCM is reserved for RC6 context */
>> diff --git a/drivers/gpu/drm/i915/intel_uc.c 
>> b/drivers/gpu/drm/i915/intel_uc.c
>> index 0178ba4..b91f848 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.c
>> +++ b/drivers/gpu/drm/i915/intel_uc.c
>> @@ -188,7 +188,7 @@ static void fetch_uc_fw(struct drm_i915_private 
>> *dev_priv,
>>          size = uc_fw->header_size + uc_fw->ucode_size;
>>         /* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
>> -        if (size > intel_guc_wopcm_size(dev_priv)) {
>> +        if (size > intel_guc_wopcm_size(&dev_priv->guc)) {
>>              DRM_ERROR("Firmware is too large to fit in WOPCM\n");
>>              goto fail;
>>          }
>> @@ -353,7 +353,7 @@ int intel_uc_init_hw(struct drm_i915_private 
>> *dev_priv)
>>      }
>>     /* init WOPCM */
>> -    I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
>> +    I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(guc));
>>      I915_WRITE(DMA_GUC_WOPCM_OFFSET,
>>             GUC_WOPCM_OFFSET_VALUE | HUC_LOADING_AGENT_GUC);
>> diff --git a/drivers/gpu/drm/i915/intel_uc.h 
>> b/drivers/gpu/drm/i915/intel_uc.h
>> index 7703c9a..8560a7e 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.h
>> +++ b/drivers/gpu/drm/i915/intel_uc.h
>> @@ -227,7 +227,7 @@ static inline void intel_guc_notify(struct 
>> intel_guc *guc)
>>  int intel_guc_init_hw(struct intel_guc *guc);
>>  int intel_guc_suspend(struct drm_i915_private *dev_priv);
>>  int intel_guc_resume(struct drm_i915_private *dev_priv);
>> -u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
>> +u32 intel_guc_wopcm_size(struct intel_guc *guc);
>> /* i915_guc_submission.c */
>>  int i915_guc_submission_init(struct drm_i915_private *dev_priv);
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 8b0ae7f..6ee7c16 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -250,8 +250,9 @@  static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	return ret;
 }
 
-u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv)
+u32 intel_guc_wopcm_size(struct intel_guc *guc)
 {
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
 	u32 wopcm_size = GUC_WOPCM_TOP;
 
 	/* On BXT, the top of WOPCM is reserved for RC6 context */
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 0178ba4..b91f848 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -188,7 +188,7 @@  static void fetch_uc_fw(struct drm_i915_private *dev_priv,
 		size = uc_fw->header_size + uc_fw->ucode_size;
 
 		/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
-		if (size > intel_guc_wopcm_size(dev_priv)) {
+		if (size > intel_guc_wopcm_size(&dev_priv->guc)) {
 			DRM_ERROR("Firmware is too large to fit in WOPCM\n");
 			goto fail;
 		}
@@ -353,7 +353,7 @@  int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	}
 
 	/* init WOPCM */
-	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
+	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(guc));
 	I915_WRITE(DMA_GUC_WOPCM_OFFSET,
 		   GUC_WOPCM_OFFSET_VALUE | HUC_LOADING_AGENT_GUC);
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 7703c9a..8560a7e 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -227,7 +227,7 @@  static inline void intel_guc_notify(struct intel_guc *guc)
 int intel_guc_init_hw(struct intel_guc *guc);
 int intel_guc_suspend(struct drm_i915_private *dev_priv);
 int intel_guc_resume(struct drm_i915_private *dev_priv);
-u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
+u32 intel_guc_wopcm_size(struct intel_guc *guc);
 
 /* i915_guc_submission.c */
 int i915_guc_submission_init(struct drm_i915_private *dev_priv);