Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2017-01-18 Thread Jani Nikula
On Sat, 14 Jan 2017, Anusha Srivatsa  wrote:
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.

Pushed patches 1-2, stopped here because this one doesn't apply to
drm-intel-next-queued. Thanks for the patches.

BR,
Jani.

>
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
>
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased. Changed the year in the copyright message to reflect
> the right year.Correct the comments,remove the unwanted WARN message,
> replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> prototypes in intel_huc.h non-extern.
> v6: rebased. Update the file construction done by HuC. It is similar to
> GuC.Adopted the approach used in-
> https://patchwork.freedesktop.org/patch/104355/ 
> v7: Change dev to dev_priv in macro definition.
> Corrected comments.
> v8: rebased on top of drm-tip. Updated functions 
> intel_huc_load(),intel_huc_init() and
> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> of intel_huc.h to intel_uc.h
> v9: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size().
> Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to
> simply fw to avoid redundency.
> v10: rebased. Correct comments. Make intel_huc_fini() accept dev_priv instead 
> of dev
> like intel_huc_init() and intel_huc_load().Move definition to i915_guc_reg.h 
> from
> intel_uc.h. Clean DMA_CTRL bits after HuC DMA transfer in huc_ucode_xfer()
> instead of guc_ucode_xfer(). Add suitable WARNs to give extra info.
> v11: rebased. Add proper bias for HuC and make sure there are
> asserts on failure by using guc_ggtt_offset_vma(). Introduce
> intel_huc.c and remove intel_huc_loader.c since it has functions that
> do more than just loading.Correct year in copyright.
> v12: remove invalidates that are not required anymore.
>
> Cc: Arkadiusz Hiler 
> Cc: Michal Wajdeczko 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
> Reviewed-by: Michal Wajdeczko 
> ---
>  drivers/gpu/drm/i915/Makefile   |   1 +
>  drivers/gpu/drm/i915/i915_drv.c |   3 +
>  drivers/gpu/drm/i915/i915_drv.h |   2 +
>  drivers/gpu/drm/i915/i915_guc_reg.h |   6 +
>  drivers/gpu/drm/i915/intel_guc_loader.c |   7 +-
>  drivers/gpu/drm/i915/intel_huc.c| 262 
> 
>  drivers/gpu/drm/i915/intel_uc.h |  14 ++
>  7 files changed, 292 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/intel_huc.c
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 5196509..1ea051a 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
>  # general-purpose microcontroller (GuC) support
>  i915-y += intel_uc.o \
> intel_guc_loader.o \
> +   intel_huc.o \
> i915_guc_submission.o
>  
>  # autogenerated null render state
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 4e5ea58..d7a0b49 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -599,6 +599,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   if (ret)
>   goto cleanup_irq;
>  
> + intel_huc_init(dev_priv);
>   intel_guc_init(dev_priv);
>  
>   ret = i915_gem_init(dev_priv);
> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   i915_gem_fini(dev_priv);
>  cleanup_irq:
>   intel_guc_fini(dev_priv);
> + intel_huc_fini(dev_priv);
>   drm_irq_uninstall(dev);
>   intel_teardown_gmbus(dev_priv);
>  cleanup_csr:
> @@ -1314,6 +1316,7 @@ void i915_driver_unload(struct drm_device *dev)
>   drain_workqueue(dev_priv->wq);
>  
>   intel_guc_fini(dev_priv);
> + intel_huc_fini(dev_priv);
>   i915_gem_fini(dev_priv);
>   intel_fbc_cleanup_cfb(dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f861418..ed845a9 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2074,6 +2074,7 @@ struct drm_i915_private {
>  
>   struct intel_gvt *gvt;
>  
> + struct intel_huc huc;
>   struct intel_guc guc;
>  
>   struct intel_csr csr;
> @@ 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2017-01-13 Thread Srivatsa, Anusha


>-Original Message-
>From: Chris Wilson [mailto:ch...@chris-wilson.co.uk]
>Sent: Friday, January 13, 2017 9:16 AM
>To: Srivatsa, Anusha <anusha.sriva...@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter Antoine
><peter.anto...@intel.com>
>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
>
>On Fri, Jan 13, 2017 at 09:06:34AM -0800, Anusha Srivatsa wrote:
>> +/**
>> + * huc_ucode_xfer() - DMA's the firmware
>> + * @dev_priv: the drm_i915_private device
>> + *
>> + * Transfer the firmware image to RAM for execution by the microcontroller.
>> + *
>> + * Return: 0 on success, non-zero on failure  */ static int
>> +huc_ucode_xfer(struct drm_i915_private *dev_priv) {
>> +struct intel_uc_fw *huc_fw = _priv->huc.fw;
>> +struct i915_vma *vma;
>> +unsigned long offset = 0;
>> +u32 size;
>> +int ret;
>> +
>> +ret = i915_gem_object_set_to_gtt_domain(huc_fw->obj, false);
>> +if (ret) {
>> +DRM_DEBUG_DRIVER("set-domain failed %d\n", ret);
>> +return ret;
>> +}
>> +
>> +vma = i915_gem_object_ggtt_pin(huc_fw->obj, NULL, 0, 0,
>> +PIN_OFFSET_BIAS | GUC_WOPCM_TOP);
>> +if (IS_ERR(vma)) {
>> +DRM_DEBUG_DRIVER("pin failed %d\n", (int)PTR_ERR(vma));
>> +return PTR_ERR(vma);
>> +}
>> +
>> +/* Invalidate GuC TLB to let GuC take the latest updates to GTT. */
>> +I915_WRITE(GEN8_GTCR, GEN8_GTCR_INVALIDATE);
>
>This invalidate is not required anymore.
>-Chris

When you previously mentioned, I did not expect it to become invalid so soon :)
Will remove it. Thanks.

Anusha 
>--
>Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2017-01-13 Thread Chris Wilson
On Fri, Jan 13, 2017 at 09:06:34AM -0800, Anusha Srivatsa wrote:
> +/**
> + * huc_ucode_xfer() - DMA's the firmware
> + * @dev_priv: the drm_i915_private device
> + *
> + * Transfer the firmware image to RAM for execution by the microcontroller.
> + *
> + * Return: 0 on success, non-zero on failure
> + */
> +static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
> +{
> + struct intel_uc_fw *huc_fw = _priv->huc.fw;
> + struct i915_vma *vma;
> + unsigned long offset = 0;
> + u32 size;
> + int ret;
> +
> + ret = i915_gem_object_set_to_gtt_domain(huc_fw->obj, false);
> + if (ret) {
> + DRM_DEBUG_DRIVER("set-domain failed %d\n", ret);
> + return ret;
> + }
> +
> + vma = i915_gem_object_ggtt_pin(huc_fw->obj, NULL, 0, 0,
> + PIN_OFFSET_BIAS | GUC_WOPCM_TOP);
> + if (IS_ERR(vma)) {
> + DRM_DEBUG_DRIVER("pin failed %d\n", (int)PTR_ERR(vma));
> + return PTR_ERR(vma);
> + }
> +
> + /* Invalidate GuC TLB to let GuC take the latest updates to GTT. */
> + I915_WRITE(GEN8_GTCR, GEN8_GTCR_INVALIDATE);

This invalidate is not required anymore.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2017-01-04 Thread Arkadiusz Hiler
On Tue, Jan 03, 2017 at 06:59:11PM +, Srivatsa, Anusha wrote:
> 
> 
> >-Original Message-
> >From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> >Srivatsa, Anusha
> >Sent: Monday, January 2, 2017 4:09 PM
> >To: Wajdeczko, Michal <michal.wajdec...@intel.com>
> >Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter 
> >Antoine
> ><peter.anto...@intel.com>
> >Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
> >
> >
> >
> >>-Original Message-
> >>From: Wajdeczko, Michal
> >>Sent: Tuesday, December 27, 2016 9:51 AM
> >>To: Srivatsa, Anusha <anusha.sriva...@intel.com>
> >>Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter
> >>Antoine <peter.anto...@intel.com>
> >>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading
> >>support
> >>
> >>On Thu, Dec 22, 2016 at 03:12:19PM -0800, Anusha Srivatsa wrote:
> >>> The HuC loading process is similar to GuC. The intel_uc_fw_fetch() is
> >>> used for both cases.
> >>>
> >>> HuC loading needs to be before GuC loading. The WOPCM setting must be
> >>> done early before loading any of them.
> >>>
> >>> v2: rebased on-top of drm-intel-nightly.
> >>> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> >>> update huc_version number of format.
> >>> v3: rebased to drm-intel-nightly, changed the file name format to
> >>> match the one in the huc package.
> >>> Changed dev->dev_private to to_i915()
> >>> v4: moved function back to where it was.
> >>> change wait_for_atomic to wait_for.
> >>> v5: rebased + comment changes.
> >>> v7: rebased.
> >>> v8: rebased.
> >>> v9: rebased. Changed the year in the copyright message to reflect the
> >>> right year.Correct the comments,remove the unwanted WARN message,
> >>> replace drm_gem_object_unreference() with i915_gem_object_put().Make
> >>> the prototypes in intel_huc.h non-extern.
> >>> v10: rebased. Update the file construction done by HuC. It is similar
> >>> to GuC.Adopted the approach used in-
> >>> https://patchwork.freedesktop.org/patch/104355/ 
> >>> v11: Fix warnings remove old declaration
> >>> v12: Change dev to dev_priv in macro definition.
> >>> Corrected comments.
> >>> v13: rebased.
> >>> v14: rebased on top of drm-tip
> >>> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> >>> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> >>> of intel_huc.h to intel_uc.h
> >>> v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to
> >>guc_wopcm_size().
> >>> Remove unwanted checks in intel_uc.h. Rename huc_fw in struct
> >>> intel_huc to simply fw to avoid redundency.
> >>> v17: rebased.
> >>>
> >>> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
> >>> Tested-by: Xiang Haihao <haihao.xi...@intel.com>
> >>> Signed-off-by: Anusha Srivatsa <anusha.sriva...@intel.com>
> >>> Signed-off-by: Alex Dai <yu@intel.com>
> >>> Signed-off-by: Peter Antoine <peter.anto...@intel.com>
> >>> ---
> >>>  drivers/gpu/drm/i915/Makefile   |   1 +
> >>>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
> >>>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
> >>>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> >>>  drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
> >>> drivers/gpu/drm/i915/intel_huc_loader.c | 263
> >>
> >>>  drivers/gpu/drm/i915/intel_uc.h |  18 +++
> >>>  7 files changed, 296 insertions(+), 7 deletions(-)  create mode
> >>> 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> >>>
> >>> diff --git a/drivers/gpu/drm/i915/Makefile
> >>> b/drivers/gpu/drm/i915/Makefile index 5196509..45ae124 100644
> >>> --- a/drivers/gpu/drm/i915/Makefile
> >>> +++ b/drivers/gpu/drm/i915/Makefile
> >>> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \  # general-purpose
> >>> microcontroller (GuC) support  i915-y += intel_uc.o \
> >>> intel_guc_loader.o \
> >>> +   intel_huc_loader.o \
> >>> i915_guc_submission.o
> &g

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2017-01-03 Thread Srivatsa, Anusha


>-Original Message-
>From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
>Srivatsa, Anusha
>Sent: Monday, January 2, 2017 4:09 PM
>To: Wajdeczko, Michal <michal.wajdec...@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter Antoine
><peter.anto...@intel.com>
>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
>
>
>
>>-Original Message-
>>From: Wajdeczko, Michal
>>Sent: Tuesday, December 27, 2016 9:51 AM
>>To: Srivatsa, Anusha <anusha.sriva...@intel.com>
>>Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu....@intel.com>; Peter
>>Antoine <peter.anto...@intel.com>
>>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading
>>support
>>
>>On Thu, Dec 22, 2016 at 03:12:19PM -0800, Anusha Srivatsa wrote:
>>> The HuC loading process is similar to GuC. The intel_uc_fw_fetch() is
>>> used for both cases.
>>>
>>> HuC loading needs to be before GuC loading. The WOPCM setting must be
>>> done early before loading any of them.
>>>
>>> v2: rebased on-top of drm-intel-nightly.
>>> removed if(HAS_GUC()) before the guc call. (D.Gordon)
>>> update huc_version number of format.
>>> v3: rebased to drm-intel-nightly, changed the file name format to
>>> match the one in the huc package.
>>> Changed dev->dev_private to to_i915()
>>> v4: moved function back to where it was.
>>> change wait_for_atomic to wait_for.
>>> v5: rebased + comment changes.
>>> v7: rebased.
>>> v8: rebased.
>>> v9: rebased. Changed the year in the copyright message to reflect the
>>> right year.Correct the comments,remove the unwanted WARN message,
>>> replace drm_gem_object_unreference() with i915_gem_object_put().Make
>>> the prototypes in intel_huc.h non-extern.
>>> v10: rebased. Update the file construction done by HuC. It is similar
>>> to GuC.Adopted the approach used in-
>>> https://patchwork.freedesktop.org/patch/104355/ 
>>> v11: Fix warnings remove old declaration
>>> v12: Change dev to dev_priv in macro definition.
>>> Corrected comments.
>>> v13: rebased.
>>> v14: rebased on top of drm-tip
>>> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
>>> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
>>> of intel_huc.h to intel_uc.h
>>> v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to
>>guc_wopcm_size().
>>> Remove unwanted checks in intel_uc.h. Rename huc_fw in struct
>>> intel_huc to simply fw to avoid redundency.
>>> v17: rebased.
>>>
>>> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
>>> Tested-by: Xiang Haihao <haihao.xi...@intel.com>
>>> Signed-off-by: Anusha Srivatsa <anusha.sriva...@intel.com>
>>> Signed-off-by: Alex Dai <yu@intel.com>
>>> Signed-off-by: Peter Antoine <peter.anto...@intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/Makefile   |   1 +
>>>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>>>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
>>>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>>>  drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
>>> drivers/gpu/drm/i915/intel_huc_loader.c | 263
>>
>>>  drivers/gpu/drm/i915/intel_uc.h |  18 +++
>>>  7 files changed, 296 insertions(+), 7 deletions(-)  create mode
>>> 100644 drivers/gpu/drm/i915/intel_huc_loader.c
>>>
>>> diff --git a/drivers/gpu/drm/i915/Makefile
>>> b/drivers/gpu/drm/i915/Makefile index 5196509..45ae124 100644
>>> --- a/drivers/gpu/drm/i915/Makefile
>>> +++ b/drivers/gpu/drm/i915/Makefile
>>> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \  # general-purpose
>>> microcontroller (GuC) support  i915-y += intel_uc.o \
>>>   intel_guc_loader.o \
>>> + intel_huc_loader.o \
>>>   i915_guc_submission.o
>>>
>>>  # autogenerated null render state
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.c
>>> b/drivers/gpu/drm/i915/i915_drv.c index 6428588..85a47c2 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.c
>>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>>> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct
>>> drm_device
>>*dev)
>>> if (ret)
>>> goto cleanup_irq;
>>>
>>> +   intel_huc_

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2017-01-02 Thread Srivatsa, Anusha


>-Original Message-
>From: Wajdeczko, Michal
>Sent: Tuesday, December 27, 2016 9:51 AM
>To: Srivatsa, Anusha <anusha.sriva...@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter Antoine
><peter.anto...@intel.com>
>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
>
>On Thu, Dec 22, 2016 at 03:12:19PM -0800, Anusha Srivatsa wrote:
>> The HuC loading process is similar to GuC. The intel_uc_fw_fetch() is
>> used for both cases.
>>
>> HuC loading needs to be before GuC loading. The WOPCM setting must be
>> done early before loading any of them.
>>
>> v2: rebased on-top of drm-intel-nightly.
>> removed if(HAS_GUC()) before the guc call. (D.Gordon)
>> update huc_version number of format.
>> v3: rebased to drm-intel-nightly, changed the file name format to
>> match the one in the huc package.
>> Changed dev->dev_private to to_i915()
>> v4: moved function back to where it was.
>> change wait_for_atomic to wait_for.
>> v5: rebased + comment changes.
>> v7: rebased.
>> v8: rebased.
>> v9: rebased. Changed the year in the copyright message to reflect the
>> right year.Correct the comments,remove the unwanted WARN message,
>> replace drm_gem_object_unreference() with i915_gem_object_put().Make
>> the prototypes in intel_huc.h non-extern.
>> v10: rebased. Update the file construction done by HuC. It is similar
>> to GuC.Adopted the approach used in-
>> https://patchwork.freedesktop.org/patch/104355/ 
>> v11: Fix warnings remove old declaration
>> v12: Change dev to dev_priv in macro definition.
>> Corrected comments.
>> v13: rebased.
>> v14: rebased on top of drm-tip
>> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
>> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
>> of intel_huc.h to intel_uc.h
>> v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to
>guc_wopcm_size().
>> Remove unwanted checks in intel_uc.h. Rename huc_fw in struct
>> intel_huc to simply fw to avoid redundency.
>> v17: rebased.
>>
>> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
>> Tested-by: Xiang Haihao <haihao.xi...@intel.com>
>> Signed-off-by: Anusha Srivatsa <anusha.sriva...@intel.com>
>> Signed-off-by: Alex Dai <yu@intel.com>
>> Signed-off-by: Peter Antoine <peter.anto...@intel.com>
>> ---
>>  drivers/gpu/drm/i915/Makefile   |   1 +
>>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
>>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>>  drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
>> drivers/gpu/drm/i915/intel_huc_loader.c | 263
>
>>  drivers/gpu/drm/i915/intel_uc.h |  18 +++
>>  7 files changed, 296 insertions(+), 7 deletions(-)  create mode
>> 100644 drivers/gpu/drm/i915/intel_huc_loader.c
>>
>> diff --git a/drivers/gpu/drm/i915/Makefile
>> b/drivers/gpu/drm/i915/Makefile index 5196509..45ae124 100644
>> --- a/drivers/gpu/drm/i915/Makefile
>> +++ b/drivers/gpu/drm/i915/Makefile
>> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \  # general-purpose
>> microcontroller (GuC) support  i915-y += intel_uc.o \
>>intel_guc_loader.o \
>> +  intel_huc_loader.o \
>>i915_guc_submission.o
>>
>>  # autogenerated null render state
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c
>> b/drivers/gpu/drm/i915/i915_drv.c index 6428588..85a47c2 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device
>*dev)
>>  if (ret)
>>  goto cleanup_irq;
>>
>> +intel_huc_init(dev_priv);
>>  intel_guc_init(dev_priv);
>>
>>  ret = i915_gem_init(dev_priv);
>> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device
>*dev)
>>  DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>>  i915_gem_fini(dev_priv);
>>  cleanup_irq:
>> +intel_huc_fini(dev);
>>  intel_guc_fini(dev_priv);
>>  drm_irq_uninstall(dev);
>>  intel_teardown_gmbus(dev_priv);
>> @@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)
>>
>>  /* Flush any outstanding unpin_work. */
>>  drain_workqueue(dev_priv->wq);
>> -
>> +intel_huc_fini(dev);
>>  intel_guc_fini(dev_priv);
>>  

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-27 Thread Michal Wajdeczko
On Thu, Dec 22, 2016 at 03:12:19PM -0800, Anusha Srivatsa wrote:
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.
> 
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
> 
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased + comment changes.
> v7: rebased.
> v8: rebased.
> v9: rebased. Changed the year in the copyright message to reflect
> the right year.Correct the comments,remove the unwanted WARN message,
> replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> prototypes in intel_huc.h non-extern.
> v10: rebased. Update the file construction done by HuC. It is similar to
> GuC.Adopted the approach used in-
> https://patchwork.freedesktop.org/patch/104355/ 
> v11: Fix warnings remove old declaration
> v12: Change dev to dev_priv in macro definition.
> Corrected comments.
> v13: rebased.
> v14: rebased on top of drm-tip
> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> of intel_huc.h to intel_uc.h
> v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size().
> Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to
> simply fw to avoid redundency.
> v17: rebased.
> 
> Cc: Tvrtko Ursulin 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
> ---
>  drivers/gpu/drm/i915/Makefile   |   1 +
>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>  drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
>  drivers/gpu/drm/i915/intel_huc_loader.c | 263 
> 
>  drivers/gpu/drm/i915/intel_uc.h |  18 +++
>  7 files changed, 296 insertions(+), 7 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 5196509..45ae124 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
>  # general-purpose microcontroller (GuC) support
>  i915-y += intel_uc.o \
> intel_guc_loader.o \
> +   intel_huc_loader.o \
> i915_guc_submission.o
>  
>  # autogenerated null render state
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 6428588..85a47c2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   if (ret)
>   goto cleanup_irq;
>  
> + intel_huc_init(dev_priv);
>   intel_guc_init(dev_priv);
>  
>   ret = i915_gem_init(dev_priv);
> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>   i915_gem_fini(dev_priv);
>  cleanup_irq:
> + intel_huc_fini(dev);
>   intel_guc_fini(dev_priv);
>   drm_irq_uninstall(dev);
>   intel_teardown_gmbus(dev_priv);
> @@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)
>  
>   /* Flush any outstanding unpin_work. */
>   drain_workqueue(dev_priv->wq);
> -
> + intel_huc_fini(dev);
>   intel_guc_fini(dev_priv);
>   i915_gem_fini(dev_priv);
>   intel_fbc_cleanup_cfb(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1a91409..7ac7730 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2147,6 +2147,7 @@ struct drm_i915_private {
>  
>   struct intel_gvt *gvt;
>  
> + struct intel_huc huc;
>   struct intel_guc guc;
>  
>   struct intel_csr csr;
> @@ -2921,7 +2922,7 @@ intel_info(const struct drm_i915_private *dev_priv)
>  #define HAS_GUC(dev_priv)((dev_priv)->info.has_guc)
>  #define HAS_GUC_UCODE(dev_priv)  (HAS_GUC(dev_priv))
>  #define HAS_GUC_SCHED(dev_priv)  (HAS_GUC(dev_priv))
> -
> +#define HAS_HUC_UCODE(dev_priv)  (HAS_GUC(dev_priv))
>  #define HAS_RESOURCE_STREAMER(dev_priv) 
> ((dev_priv)->info.has_resource_streamer)
>  
>  #define HAS_POOLED_EU(dev_priv)  ((dev_priv)->info.has_pooled_eu)
> diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> b/drivers/gpu/drm/i915/i915_guc_reg.h
> index 5e638fc..f9829f6 100644
> --- 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-27 Thread Arkadiusz Hiler
On Thu, Dec 22, 2016 at 03:12:19PM -0800, Anusha Srivatsa wrote:
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.
> 
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
> 
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased + comment changes.
> v7: rebased.
> v8: rebased.
> v9: rebased. Changed the year in the copyright message to reflect
> the right year.Correct the comments,remove the unwanted WARN message,
> replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> prototypes in intel_huc.h non-extern.
> v10: rebased. Update the file construction done by HuC. It is similar to
> GuC.Adopted the approach used in-
> https://patchwork.freedesktop.org/patch/104355/ 
> v11: Fix warnings remove old declaration
> v12: Change dev to dev_priv in macro definition.
> Corrected comments.
> v13: rebased.
> v14: rebased on top of drm-tip
> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> of intel_huc.h to intel_uc.h
> v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size().
> Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to
> simply fw to avoid redundency.
> v17: rebased.
> 
> Cc: Tvrtko Ursulin 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
Reviewed-by: Arkadiusz Hiler 

-- 
Cheers,
Arek
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-16 Thread Tvrtko Ursulin


On 16/12/2016 16:29, Arkadiusz Hiler wrote:

On Fri, Dec 16, 2016 at 04:13:14PM +, Tvrtko Ursulin wrote:


On 15/12/2016 22:29, anushasr wrote:

From: Anusha Srivatsa 

The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
is used for both cases.

HuC loading needs to be before GuC loading. The WOPCM setting must
be done early before loading any of them.

v2: rebased on-top of drm-intel-nightly.
removed if(HAS_GUC()) before the guc call. (D.Gordon)
update huc_version number of format.
v3: rebased to drm-intel-nightly, changed the file name format to
match the one in the huc package.
Changed dev->dev_private to to_i915()
v4: moved function back to where it was.
change wait_for_atomic to wait_for.
v5: rebased + comment changes.
v7: rebased.
v8: rebased.
v9: rebased. Changed the year in the copyright message to reflect
the right year.Correct the comments,remove the unwanted WARN message,
replace drm_gem_object_unreference() with i915_gem_object_put().Make the
prototypes in intel_huc.h non-extern.
v10: rebased. Update the file construction done by HuC. It is similar to
GuC.Adopted the approach used in-
https://patchwork.freedesktop.org/patch/104355/ 
v11: Fix warnings remove old declaration
v12: Change dev to dev_priv in macro definition.
Corrected comments.
v13: rebased.
v14: rebased on top of drm-tip
v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
of intel_huc.h to intel_uc.h
v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size().
Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to
simply fw to avoid redundency.

Cc: Tvrtko Ursulin 
Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
---
 drivers/gpu/drm/i915/Makefile   |   1 +
 drivers/gpu/drm/i915/i915_drv.c |   4 +-
 drivers/gpu/drm/i915/i915_drv.h |   3 +-
 drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
 drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
 drivers/gpu/drm/i915/intel_huc_loader.c | 264 
 drivers/gpu/drm/i915/intel_uc.h |  18 +++
 7 files changed, 297 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 5196509..45ae124 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
 # general-purpose microcontroller (GuC) support
 i915-y += intel_uc.o \
  intel_guc_loader.o \
+ intel_huc_loader.o \
  i915_guc_submission.o

 # autogenerated null render state
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6428588..85a47c2 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret)
goto cleanup_irq;

+   intel_huc_init(dev_priv);
intel_guc_init(dev_priv);

ret = i915_gem_init(dev_priv);
@@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
DRM_ERROR("failed to idle hardware; continuing to unload!\n");
i915_gem_fini(dev_priv);
 cleanup_irq:
+   intel_huc_fini(dev);
intel_guc_fini(dev_priv);
drm_irq_uninstall(dev);
intel_teardown_gmbus(dev_priv);
@@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)

/* Flush any outstanding unpin_work. */
drain_workqueue(dev_priv->wq);
-
+   intel_huc_fini(dev);
intel_guc_fini(dev_priv);
i915_gem_fini(dev_priv);
intel_fbc_cleanup_cfb(dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4199d26..bd5f235 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2134,6 +2134,7 @@ struct drm_i915_private {

struct intel_gvt *gvt;

+   struct intel_huc huc;
struct intel_guc guc;

struct intel_csr csr;
@@ -2908,7 +2909,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define HAS_GUC(dev_priv)  ((dev_priv)->info.has_guc)
 #define HAS_GUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_GUC_SCHED(dev_priv)(HAS_GUC(dev_priv))
-
+#define HAS_HUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_RESOURCE_STREAMER(dev_priv) 
((dev_priv)->info.has_resource_streamer)

 #define HAS_POOLED_EU(dev_priv)((dev_priv)->info.has_pooled_eu)
diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
b/drivers/gpu/drm/i915/i915_guc_reg.h
index 5e638fc..f9829f6 100644
--- a/drivers/gpu/drm/i915/i915_guc_reg.h
+++ 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-16 Thread Arkadiusz Hiler
On Fri, Dec 16, 2016 at 04:13:14PM +, Tvrtko Ursulin wrote:
> 
> On 15/12/2016 22:29, anushasr wrote:
> > From: Anusha Srivatsa 
> > 
> > The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> > is used for both cases.
> > 
> > HuC loading needs to be before GuC loading. The WOPCM setting must
> > be done early before loading any of them.
> > 
> > v2: rebased on-top of drm-intel-nightly.
> > removed if(HAS_GUC()) before the guc call. (D.Gordon)
> > update huc_version number of format.
> > v3: rebased to drm-intel-nightly, changed the file name format to
> > match the one in the huc package.
> > Changed dev->dev_private to to_i915()
> > v4: moved function back to where it was.
> > change wait_for_atomic to wait_for.
> > v5: rebased + comment changes.
> > v7: rebased.
> > v8: rebased.
> > v9: rebased. Changed the year in the copyright message to reflect
> > the right year.Correct the comments,remove the unwanted WARN message,
> > replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> > prototypes in intel_huc.h non-extern.
> > v10: rebased. Update the file construction done by HuC. It is similar to
> > GuC.Adopted the approach used in-
> > https://patchwork.freedesktop.org/patch/104355/ 
> > v11: Fix warnings remove old declaration
> > v12: Change dev to dev_priv in macro definition.
> > Corrected comments.
> > v13: rebased.
> > v14: rebased on top of drm-tip
> > v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> > intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> > of intel_huc.h to intel_uc.h
> > v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size().
> > Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to
> > simply fw to avoid redundency.
> > 
> > Cc: Tvrtko Ursulin 
> > Tested-by: Xiang Haihao 
> > Signed-off-by: Anusha Srivatsa 
> > Signed-off-by: Alex Dai 
> > Signed-off-by: Peter Antoine 
> > ---
> >  drivers/gpu/drm/i915/Makefile   |   1 +
> >  drivers/gpu/drm/i915/i915_drv.c |   4 +-
> >  drivers/gpu/drm/i915/i915_drv.h |   3 +-
> >  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> >  drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
> >  drivers/gpu/drm/i915/intel_huc_loader.c | 264 
> > 
> >  drivers/gpu/drm/i915/intel_uc.h |  18 +++
> >  7 files changed, 297 insertions(+), 7 deletions(-)
> >  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> > 
> > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> > index 5196509..45ae124 100644
> > --- a/drivers/gpu/drm/i915/Makefile
> > +++ b/drivers/gpu/drm/i915/Makefile
> > @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
> >  # general-purpose microcontroller (GuC) support
> >  i915-y += intel_uc.o \
> >   intel_guc_loader.o \
> > + intel_huc_loader.o \
> >   i915_guc_submission.o
> > 
> >  # autogenerated null render state
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c 
> > b/drivers/gpu/drm/i915/i915_drv.c
> > index 6428588..85a47c2 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device 
> > *dev)
> > if (ret)
> > goto cleanup_irq;
> > 
> > +   intel_huc_init(dev_priv);
> > intel_guc_init(dev_priv);
> > 
> > ret = i915_gem_init(dev_priv);
> > @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device 
> > *dev)
> > DRM_ERROR("failed to idle hardware; continuing to unload!\n");
> > i915_gem_fini(dev_priv);
> >  cleanup_irq:
> > +   intel_huc_fini(dev);
> > intel_guc_fini(dev_priv);
> > drm_irq_uninstall(dev);
> > intel_teardown_gmbus(dev_priv);
> > @@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)
> > 
> > /* Flush any outstanding unpin_work. */
> > drain_workqueue(dev_priv->wq);
> > -
> > +   intel_huc_fini(dev);
> > intel_guc_fini(dev_priv);
> > i915_gem_fini(dev_priv);
> > intel_fbc_cleanup_cfb(dev_priv);
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h 
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index 4199d26..bd5f235 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -2134,6 +2134,7 @@ struct drm_i915_private {
> > 
> > struct intel_gvt *gvt;
> > 
> > +   struct intel_huc huc;
> > struct intel_guc guc;
> > 
> > struct intel_csr csr;
> > @@ -2908,7 +2909,7 @@ intel_info(const struct drm_i915_private *dev_priv)
> >  #define HAS_GUC(dev_priv)  ((dev_priv)->info.has_guc)
> >  #define HAS_GUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
> >  #define HAS_GUC_SCHED(dev_priv)(HAS_GUC(dev_priv))
> > -
> > +#define HAS_HUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
> >  #define 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-16 Thread Tvrtko Ursulin


On 15/12/2016 22:29, anushasr wrote:

From: Anusha Srivatsa 

The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
is used for both cases.

HuC loading needs to be before GuC loading. The WOPCM setting must
be done early before loading any of them.

v2: rebased on-top of drm-intel-nightly.
removed if(HAS_GUC()) before the guc call. (D.Gordon)
update huc_version number of format.
v3: rebased to drm-intel-nightly, changed the file name format to
match the one in the huc package.
Changed dev->dev_private to to_i915()
v4: moved function back to where it was.
change wait_for_atomic to wait_for.
v5: rebased + comment changes.
v7: rebased.
v8: rebased.
v9: rebased. Changed the year in the copyright message to reflect
the right year.Correct the comments,remove the unwanted WARN message,
replace drm_gem_object_unreference() with i915_gem_object_put().Make the
prototypes in intel_huc.h non-extern.
v10: rebased. Update the file construction done by HuC. It is similar to
GuC.Adopted the approach used in-
https://patchwork.freedesktop.org/patch/104355/ 
v11: Fix warnings remove old declaration
v12: Change dev to dev_priv in macro definition.
Corrected comments.
v13: rebased.
v14: rebased on top of drm-tip
v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
of intel_huc.h to intel_uc.h
v16: change SKL_FW_ to SKL_HUC_FW_. Add intel_ prefix to guc_wopcm_size().
Remove unwanted checks in intel_uc.h. Rename huc_fw in struct intel_huc to
simply fw to avoid redundency.

Cc: Tvrtko Ursulin 
Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
---
 drivers/gpu/drm/i915/Makefile   |   1 +
 drivers/gpu/drm/i915/i915_drv.c |   4 +-
 drivers/gpu/drm/i915/i915_drv.h |   3 +-
 drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
 drivers/gpu/drm/i915/intel_guc_loader.c |  11 +-
 drivers/gpu/drm/i915/intel_huc_loader.c | 264 
 drivers/gpu/drm/i915/intel_uc.h |  18 +++
 7 files changed, 297 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 5196509..45ae124 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
 # general-purpose microcontroller (GuC) support
 i915-y += intel_uc.o \
  intel_guc_loader.o \
+ intel_huc_loader.o \
  i915_guc_submission.o

 # autogenerated null render state
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6428588..85a47c2 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret)
goto cleanup_irq;

+   intel_huc_init(dev_priv);
intel_guc_init(dev_priv);

ret = i915_gem_init(dev_priv);
@@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
DRM_ERROR("failed to idle hardware; continuing to unload!\n");
i915_gem_fini(dev_priv);
 cleanup_irq:
+   intel_huc_fini(dev);
intel_guc_fini(dev_priv);
drm_irq_uninstall(dev);
intel_teardown_gmbus(dev_priv);
@@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)

/* Flush any outstanding unpin_work. */
drain_workqueue(dev_priv->wq);
-
+   intel_huc_fini(dev);
intel_guc_fini(dev_priv);
i915_gem_fini(dev_priv);
intel_fbc_cleanup_cfb(dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4199d26..bd5f235 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2134,6 +2134,7 @@ struct drm_i915_private {

struct intel_gvt *gvt;

+   struct intel_huc huc;
struct intel_guc guc;

struct intel_csr csr;
@@ -2908,7 +2909,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define HAS_GUC(dev_priv)  ((dev_priv)->info.has_guc)
 #define HAS_GUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_GUC_SCHED(dev_priv)(HAS_GUC(dev_priv))
-
+#define HAS_HUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_RESOURCE_STREAMER(dev_priv) 
((dev_priv)->info.has_resource_streamer)

 #define HAS_POOLED_EU(dev_priv)((dev_priv)->info.has_pooled_eu)
diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
b/drivers/gpu/drm/i915/i915_guc_reg.h
index 5e638fc..f9829f6 100644
--- a/drivers/gpu/drm/i915/i915_guc_reg.h
+++ b/drivers/gpu/drm/i915/i915_guc_reg.h
@@ -61,9 +61,12 @@
 #define   DMA_ADDRESS_SPACE_GTT  (8 << 16)
 #define DMA_COPY_SIZE  

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-14 Thread Parenteau, Paul A
>From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
>Jani Nikula
>Sent: Wednesday, December 14, 2016 7:20 AM
>To: Tvrtko Ursulin <tvrtko.ursu...@linux.intel.com>; Srivatsa, Anusha
><anusha.sriva...@intel.com>; intel-gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
>
>On Mon, 12 Dec 2016, Tvrtko Ursulin <tvrtko.ursu...@linux.intel.com> wrote:
>> Hi all,
>>
>> Executive decision required below:
>>
>> On 08/12/2016 23:02, anushasr wrote:
>>
>> [snip]
>>
>>> +
>>> +/**
>>> + * DOC: HuC Firmware
>>> + *
>>> + * Motivation:
>>> + * GEN9 introduces a new dedicated firmware for usage in media HEVC
>>> +(High
>>> + * Efficiency Video Coding) operations. Userspace can use the
>>> +firmware
>>> + * capabilities by adding HuC specific commands to batch buffers.
>>> + *
>>> + * Implementation:
>>> + * The same firmware loader is used as the GuC. However, the actual
>>> + * loading to HW is deferred until GEM initialization is done.
>>> + *
>>> + * Note that HuC firmware loading must be done before GuC loading.
>>> + */
>>> +
>>> +#define SKL_FW_MAJOR 01
>>> +#define SKL_FW_MINOR 07
>>> +#define SKL_BLD_NUM 1398
>>> +
>>> +#define HUC_FW_PATH(platform, major, minor, bld_num) \
>>> +   "i915/" __stringify(platform) "_huc_ver" __stringify(major) "_" \
>>> +   __stringify(minor) "_" __stringify(bld_num) ".bin"
>>> +
>>> +#define I915_SKL_HUC_UCODE HUC_FW_PATH(skl, SKL_FW_MAJOR, \
>>> +   SKL_FW_MINOR, SKL_BLD_NUM)
>>> +MODULE_FIRMWARE(I915_SKL_HUC_UCODE);
>>
>> Daniel & Jani, I understand in the GuC firmware discussions you were
>> very much in the favour of encoding the full name (major and minor
>> included) as the fw firmware?
>>
>> Argument was that we want to in effect claim support only for one
>> validated firmware binary with one version of i915.
>>
>> In the case of the HuC we have a very similar situation with two key
>> differences.
>>
>> First, there is a build number in the file name as provided by the
>> firmware team. We know that it will happen that only the build number
>> changes with some fixes and the minor stays the same. And we know that
>> the major indicates the interface compatibility.
>>
>> Secondly, from all I can see, there are no interactions between the
>> driver and the HuC firmware apart from driver loading it and thats it.
>>
>> In the light of that I was advocating only using the major in the
>> driver request fw name in order to improve usability both for
>> developers (easier to test with different firmwares), and for users
>> (be it distributions or end users - easier to upgrade the HuC firmware
>> in case of codec issues by not having to patch and recompile the kernel).
>>
>> Since I understand this topic has been beaten to death in the past and
>> there are strong opinions on it, could you just okay (or not) the
>> current proposal (as in posted patches) which encodes major, minor and
>> build number in the fw name?
>
>The question is the same as it ever was, can you absolutely guarantee a new
>firmware version (even if just a build number bump) will not cause regressions?
>Note that we'll probably only have resources to test the latest kernel against 
>the
>latest firmware, but accepting future firmware versions means even stable
>kernels will start using the new firmware versions after linux-firmware 
>updates.
>We also can't easily retroactively prevent this from happening even if we find
>out that there will be breakage.
>
>I still think we should only accept one firmware version. If we (or someone 
>else)
>has the resources to test against older kernels, commits to enable newer
>firmware versions can be backported to stable.
>
I agree with Jani's position here.  We have to keep some controls to the 
combinations of FW and kernels so we know what works.  At least until FW 
matures in the future.
>
>I would love to be able to look at the firmware sources and say, oh, there are 
>no
>interactions with the kernel whatsoever, but you know how that is. I don't know
>if there are interactions. I don't know if future blobs will have 
>interactions, and
>break everything if the kernel doesn't do something the black box expects.
>
>If you want to help developers test various firmware versions, I suggest the 
>same
>thing I suggested the last time: add an _unsafe module parameter to specify the
>firmware filename/version to load.
>
>BR,
>Jani.
>
>
>--
>Jani Nikula, Intel Open Source Technology Center
>___
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-14 Thread Jani Nikula
On Mon, 12 Dec 2016, Tvrtko Ursulin  wrote:
> Hi all,
>
> Executive decision required below:
>
> On 08/12/2016 23:02, anushasr wrote:
>
> [snip]
>
>> +
>> +/**
>> + * DOC: HuC Firmware
>> + *
>> + * Motivation:
>> + * GEN9 introduces a new dedicated firmware for usage in media HEVC (High
>> + * Efficiency Video Coding) operations. Userspace can use the firmware
>> + * capabilities by adding HuC specific commands to batch buffers.
>> + *
>> + * Implementation:
>> + * The same firmware loader is used as the GuC. However, the actual
>> + * loading to HW is deferred until GEM initialization is done.
>> + *
>> + * Note that HuC firmware loading must be done before GuC loading.
>> + */
>> +
>> +#define SKL_FW_MAJOR 01
>> +#define SKL_FW_MINOR 07
>> +#define SKL_BLD_NUM 1398
>> +
>> +#define HUC_FW_PATH(platform, major, minor, bld_num) \
>> +"i915/" __stringify(platform) "_huc_ver" __stringify(major) "_" \
>> +__stringify(minor) "_" __stringify(bld_num) ".bin"
>> +
>> +#define I915_SKL_HUC_UCODE HUC_FW_PATH(skl, SKL_FW_MAJOR, \
>> +SKL_FW_MINOR, SKL_BLD_NUM)
>> +MODULE_FIRMWARE(I915_SKL_HUC_UCODE);
>
> Daniel & Jani, I understand in the GuC firmware discussions you were 
> very much in the favour of encoding the full name (major and minor 
> included) as the fw firmware?
>
> Argument was that we want to in effect claim support only for one 
> validated firmware binary with one version of i915.
>
> In the case of the HuC we have a very similar situation with two key 
> differences.
>
> First, there is a build number in the file name as provided by the 
> firmware team. We know that it will happen that only the build number 
> changes with some fixes and the minor stays the same. And we know that 
> the major indicates the interface compatibility.
>
> Secondly, from all I can see, there are no interactions between the 
> driver and the HuC firmware apart from driver loading it and thats it.
>
> In the light of that I was advocating only using the major in the driver 
> request fw name in order to improve usability both for developers 
> (easier to test with different firmwares), and for users (be it 
> distributions or end users - easier to upgrade the HuC firmware in case 
> of codec issues by not having to patch and recompile the kernel).
>
> Since I understand this topic has been beaten to death in the past and 
> there are strong opinions on it, could you just okay (or not) the 
> current proposal (as in posted patches) which encodes major, minor and 
> build number in the fw name?

The question is the same as it ever was, can you absolutely guarantee a
new firmware version (even if just a build number bump) will not cause
regressions? Note that we'll probably only have resources to test the
latest kernel against the latest firmware, but accepting future firmware
versions means even stable kernels will start using the new firmware
versions after linux-firmware updates. We also can't easily
retroactively prevent this from happening even if we find out that there
will be breakage.

I still think we should only accept one firmware version. If we (or
someone else) has the resources to test against older kernels, commits
to enable newer firmware versions can be backported to stable.

I would love to be able to look at the firmware sources and say, oh,
there are no interactions with the kernel whatsoever, but you know how
that is. I don't know if there are interactions. I don't know if future
blobs will have interactions, and break everything if the kernel doesn't
do something the black box expects.

If you want to help developers test various firmware versions, I suggest
the same thing I suggested the last time: add an _unsafe module
parameter to specify the firmware filename/version to load.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-12 Thread Tvrtko Ursulin


Hi all,

Executive decision required below:

On 08/12/2016 23:02, anushasr wrote:

[snip]


+
+/**
+ * DOC: HuC Firmware
+ *
+ * Motivation:
+ * GEN9 introduces a new dedicated firmware for usage in media HEVC (High
+ * Efficiency Video Coding) operations. Userspace can use the firmware
+ * capabilities by adding HuC specific commands to batch buffers.
+ *
+ * Implementation:
+ * The same firmware loader is used as the GuC. However, the actual
+ * loading to HW is deferred until GEM initialization is done.
+ *
+ * Note that HuC firmware loading must be done before GuC loading.
+ */
+
+#define SKL_FW_MAJOR 01
+#define SKL_FW_MINOR 07
+#define SKL_BLD_NUM 1398
+
+#define HUC_FW_PATH(platform, major, minor, bld_num) \
+   "i915/" __stringify(platform) "_huc_ver" __stringify(major) "_" \
+   __stringify(minor) "_" __stringify(bld_num) ".bin"
+
+#define I915_SKL_HUC_UCODE HUC_FW_PATH(skl, SKL_FW_MAJOR, \
+   SKL_FW_MINOR, SKL_BLD_NUM)
+MODULE_FIRMWARE(I915_SKL_HUC_UCODE);


Daniel & Jani, I understand in the GuC firmware discussions you were 
very much in the favour of encoding the full name (major and minor 
included) as the fw firmware?


Argument was that we want to in effect claim support only for one 
validated firmware binary with one version of i915.


In the case of the HuC we have a very similar situation with two key 
differences.


First, there is a build number in the file name as provided by the 
firmware team. We know that it will happen that only the build number 
changes with some fixes and the minor stays the same. And we know that 
the major indicates the interface compatibility.


Secondly, from all I can see, there are no interactions between the 
driver and the HuC firmware apart from driver loading it and thats it.


In the light of that I was advocating only using the major in the driver 
request fw name in order to improve usability both for developers 
(easier to test with different firmwares), and for users (be it 
distributions or end users - easier to upgrade the HuC firmware in case 
of codec issues by not having to patch and recompile the kernel).


Since I understand this topic has been beaten to death in the past and 
there are strong opinions on it, could you just okay (or not) the 
current proposal (as in posted patches) which encodes major, minor and 
build number in the fw name?


Regards,

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


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-12 Thread Arkadiusz Hiler
On Fri, Dec 09, 2016 at 11:56:20PM +, Srivatsa, Anusha wrote:
> 
> 
> >-Original Message-
> >From: Michal Wajdeczko [mailto:michal.wajdec...@linux.intel.com]
> >Sent: Friday, December 9, 2016 4:18 AM
> >To: Srivatsa, Anusha <anusha.sriva...@intel.com>
> >Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter 
> >Antoine
> ><peter.anto...@intel.com>
> >Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
> >
> >On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
> >> From: Anusha Srivatsa <anusha.sriva...@intel.com>
> >>
> >> The HuC loading process is similar to GuC. The intel_uc_fw_fetch() is
> >> used for both cases.
> >>
> >> HuC loading needs to be before GuC loading. The WOPCM setting must be
> >> done early before loading any of them.
> >>
> >> v2: rebased on-top of drm-intel-nightly.
> >> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> >> update huc_version number of format.
> >> v3: rebased to drm-intel-nightly, changed the file name format to
> >> match the one in the huc package.
> >> Changed dev->dev_private to to_i915()
> >> v4: moved function back to where it was.
> >> change wait_for_atomic to wait_for.
> >> v5: rebased + comment changes.
> >> v7: rebased.
> >> v8: rebased.
> >> v9: rebased. Changed the year in the copyright message to reflect the
> >> right year.Correct the comments,remove the unwanted WARN message,
> >> replace drm_gem_object_unreference() with i915_gem_object_put().Make
> >> the prototypes in intel_huc.h non-extern.
> >> v10: rebased. Update the file construction done by HuC. It is similar
> >> to GuC.Adopted the approach used in-
> >> https://patchwork.freedesktop.org/patch/104355/ 
> >> v11: Fix warnings remove old declaration
> >> v12: Change dev to dev_priv in macro definition.
> >> Corrected comments.
> >> v13: rebased.
> >> v14: rebased on top of drm-tip
> >> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> >> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> >> of intel_huc.h to intel_uc.h
> >>
> >> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
> >> Tested-by: Xiang Haihao <haihao.xi...@intel.com>
> >> Signed-off-by: Anusha Srivatsa <anusha.sriva...@intel.com>
> >> Signed-off-by: Alex Dai <yu@intel.com>
> >> Signed-off-by: Peter Antoine <peter.anto...@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/Makefile   |   1 +
> >>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
> >>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
> >>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> >>  drivers/gpu/drm/i915/intel_guc_loader.c |   7 +-
> >>  drivers/gpu/drm/i915/intel_huc_loader.c | 264
> >
> >>  drivers/gpu/drm/i915/intel_uc.h |  22 +++
> >>  7 files changed, 299 insertions(+), 5 deletions(-)  create mode
> >> 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> >>
> >> diff --git a/drivers/gpu/drm/i915/Makefile
> >> b/drivers/gpu/drm/i915/Makefile index 3c30916..01d4f4b 100644
> >> --- a/drivers/gpu/drm/i915/Makefile
> >> +++ b/drivers/gpu/drm/i915/Makefile
> >> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \  # general-purpose
> >> microcontroller (GuC) support  i915-y += intel_uc.o \
> >>  intel_guc_loader.o \
> >> +intel_huc_loader.o \
> >>  i915_guc_submission.o
> >>
> >>  # autogenerated null render state
> >> diff --git a/drivers/gpu/drm/i915/i915_drv.c
> >> b/drivers/gpu/drm/i915/i915_drv.c index 6428588..85a47c2 100644
> >> --- a/drivers/gpu/drm/i915/i915_drv.c
> >> +++ b/drivers/gpu/drm/i915/i915_drv.c
> >> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device
> >*dev)
> >>if (ret)
> >>goto cleanup_irq;
> >>
> >> +  intel_huc_init(dev_priv);
> >>intel_guc_init(dev_priv);
> >>
> >>ret = i915_gem_init(dev_priv);
> >> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device
> >*dev)
> >>DRM_ERROR("failed to idle hardware; continuing to unload!\n");
> >>i915_gem_fini(dev_priv);
> >>  cleanup_irq:
> >> +  intel_huc_fini(dev);
> >>intel_guc

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-09 Thread Srivatsa, Anusha


>-Original Message-
>From: Michal Wajdeczko [mailto:michal.wajdec...@linux.intel.com]
>Sent: Friday, December 9, 2016 4:18 AM
>To: Srivatsa, Anusha <anusha.sriva...@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; Alex Dai <yu@intel.com>; Peter Antoine
><peter.anto...@intel.com>
>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
>
>On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
>> From: Anusha Srivatsa <anusha.sriva...@intel.com>
>>
>> The HuC loading process is similar to GuC. The intel_uc_fw_fetch() is
>> used for both cases.
>>
>> HuC loading needs to be before GuC loading. The WOPCM setting must be
>> done early before loading any of them.
>>
>> v2: rebased on-top of drm-intel-nightly.
>> removed if(HAS_GUC()) before the guc call. (D.Gordon)
>> update huc_version number of format.
>> v3: rebased to drm-intel-nightly, changed the file name format to
>> match the one in the huc package.
>> Changed dev->dev_private to to_i915()
>> v4: moved function back to where it was.
>> change wait_for_atomic to wait_for.
>> v5: rebased + comment changes.
>> v7: rebased.
>> v8: rebased.
>> v9: rebased. Changed the year in the copyright message to reflect the
>> right year.Correct the comments,remove the unwanted WARN message,
>> replace drm_gem_object_unreference() with i915_gem_object_put().Make
>> the prototypes in intel_huc.h non-extern.
>> v10: rebased. Update the file construction done by HuC. It is similar
>> to GuC.Adopted the approach used in-
>> https://patchwork.freedesktop.org/patch/104355/ 
>> v11: Fix warnings remove old declaration
>> v12: Change dev to dev_priv in macro definition.
>> Corrected comments.
>> v13: rebased.
>> v14: rebased on top of drm-tip
>> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
>> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
>> of intel_huc.h to intel_uc.h
>>
>> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
>> Tested-by: Xiang Haihao <haihao.xi...@intel.com>
>> Signed-off-by: Anusha Srivatsa <anusha.sriva...@intel.com>
>> Signed-off-by: Alex Dai <yu@intel.com>
>> Signed-off-by: Peter Antoine <peter.anto...@intel.com>
>> ---
>>  drivers/gpu/drm/i915/Makefile   |   1 +
>>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
>>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>>  drivers/gpu/drm/i915/intel_guc_loader.c |   7 +-
>>  drivers/gpu/drm/i915/intel_huc_loader.c | 264
>
>>  drivers/gpu/drm/i915/intel_uc.h |  22 +++
>>  7 files changed, 299 insertions(+), 5 deletions(-)  create mode
>> 100644 drivers/gpu/drm/i915/intel_huc_loader.c
>>
>> diff --git a/drivers/gpu/drm/i915/Makefile
>> b/drivers/gpu/drm/i915/Makefile index 3c30916..01d4f4b 100644
>> --- a/drivers/gpu/drm/i915/Makefile
>> +++ b/drivers/gpu/drm/i915/Makefile
>> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \  # general-purpose
>> microcontroller (GuC) support  i915-y += intel_uc.o \
>>intel_guc_loader.o \
>> +  intel_huc_loader.o \
>>i915_guc_submission.o
>>
>>  # autogenerated null render state
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c
>> b/drivers/gpu/drm/i915/i915_drv.c index 6428588..85a47c2 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device
>*dev)
>>  if (ret)
>>  goto cleanup_irq;
>>
>> +intel_huc_init(dev_priv);
>>  intel_guc_init(dev_priv);
>>
>>  ret = i915_gem_init(dev_priv);
>> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device
>*dev)
>>  DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>>  i915_gem_fini(dev_priv);
>>  cleanup_irq:
>> +intel_huc_fini(dev);
>>  intel_guc_fini(dev_priv);
>>  drm_irq_uninstall(dev);
>>  intel_teardown_gmbus(dev_priv);
>> @@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)
>>
>>  /* Flush any outstanding unpin_work. */
>>  drain_workqueue(dev_priv->wq);
>> -
>> +intel_huc_fini(dev);
>>  intel_guc_fini(dev_priv);
>>  i915_gem_fini(dev_priv);
>>  intel_fbc_cleanup_cfb(dev_priv);
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h
>

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-09 Thread Arkadiusz Hiler
On Fri, Dec 09, 2016 at 12:34:55PM +0100, Arkadiusz Hiler wrote:
> On Fri, Dec 09, 2016 at 11:10:03AM +, Chris Wilson wrote:
> > On Fri, Dec 09, 2016 at 11:56:10AM +0100, Arkadiusz Hiler wrote:
> > > On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
> > > > -static u32 guc_wopcm_size(struct drm_i915_private *dev_priv)
> > > > +u32 guc_wopcm_size(struct drm_i915_private *dev_priv)
> > > >  {
> > > > u32 wopcm_size = GUC_WOPCM_TOP;
> > > >  
> > > > @@ -511,6 +511,7 @@ int intel_guc_setup(struct drm_i915_private 
> > > > *dev_priv)
> > > > if (err)
> > > > goto fail;
> > > >  
> > > > +   intel_huc_load(dev_priv);
> > 
> > We don't need error handling? That would simplify a lot of our code!
> > -Chris
> 
> With this patch series on this specific piece of code - not really.
> HuC support it intorduce is _best-eforrty_.
> 
> If the function would report error we would not act on it in anyway
> other than logging the fail (which the function already does for us).
> 
> As Anusha discussed here, there will be some code reorganization due to
> introduction of i915.enable_huc and deprecation of enable_guc_loading.
> Once we want to have enable_huc=2, there is a reason to change the
> signature and report errors.

Ergh, I've got signatures of auth and load mixed up. But most of the
statement above still semi-holds.

-- 
Cheers,
Arek
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-09 Thread Michal Wajdeczko
On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
> From: Anusha Srivatsa 
> 
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.
> 
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
> 
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased + comment changes.
> v7: rebased.
> v8: rebased.
> v9: rebased. Changed the year in the copyright message to reflect
> the right year.Correct the comments,remove the unwanted WARN message,
> replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> prototypes in intel_huc.h non-extern.
> v10: rebased. Update the file construction done by HuC. It is similar to
> GuC.Adopted the approach used in-
> https://patchwork.freedesktop.org/patch/104355/ 
> v11: Fix warnings remove old declaration
> v12: Change dev to dev_priv in macro definition.
> Corrected comments.
> v13: rebased.
> v14: rebased on top of drm-tip
> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> of intel_huc.h to intel_uc.h
> 
> Cc: Tvrtko Ursulin 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
> ---
>  drivers/gpu/drm/i915/Makefile   |   1 +
>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>  drivers/gpu/drm/i915/intel_guc_loader.c |   7 +-
>  drivers/gpu/drm/i915/intel_huc_loader.c | 264 
> 
>  drivers/gpu/drm/i915/intel_uc.h |  22 +++
>  7 files changed, 299 insertions(+), 5 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 3c30916..01d4f4b 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
>  # general-purpose microcontroller (GuC) support
>  i915-y += intel_uc.o \
> intel_guc_loader.o \
> +   intel_huc_loader.o \
> i915_guc_submission.o
>  
>  # autogenerated null render state
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 6428588..85a47c2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   if (ret)
>   goto cleanup_irq;
>  
> + intel_huc_init(dev_priv);
>   intel_guc_init(dev_priv);
>  
>   ret = i915_gem_init(dev_priv);
> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>   i915_gem_fini(dev_priv);
>  cleanup_irq:
> + intel_huc_fini(dev);
>   intel_guc_fini(dev_priv);
>   drm_irq_uninstall(dev);
>   intel_teardown_gmbus(dev_priv);
> @@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)
>  
>   /* Flush any outstanding unpin_work. */
>   drain_workqueue(dev_priv->wq);
> -
> + intel_huc_fini(dev);
>   intel_guc_fini(dev_priv);
>   i915_gem_fini(dev_priv);
>   intel_fbc_cleanup_cfb(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1480e73..0371ca4 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2036,6 +2036,7 @@ struct drm_i915_private {
>  
>   struct intel_gvt *gvt;
>  
> + struct intel_huc huc;
>   struct intel_guc guc;
>  
>   struct intel_csr csr;
> @@ -2810,7 +2811,7 @@ intel_info(const struct drm_i915_private *dev_priv)
>  #define HAS_GUC(dev_priv)((dev_priv)->info.has_guc)
>  #define HAS_GUC_UCODE(dev_priv)  (HAS_GUC(dev_priv))
>  #define HAS_GUC_SCHED(dev_priv)  (HAS_GUC(dev_priv))
> -
> +#define HAS_HUC_UCODE(dev_priv)  (HAS_GUC(dev_priv))
>  #define HAS_RESOURCE_STREAMER(dev_priv) 
> ((dev_priv)->info.has_resource_streamer)
>  
>  #define HAS_POOLED_EU(dev_priv)  ((dev_priv)->info.has_pooled_eu)
> diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> b/drivers/gpu/drm/i915/i915_guc_reg.h
> index 5e638fc..f9829f6 100644
> --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> @@ -61,9 +61,12 @@
>  #define   DMA_ADDRESS_SPACE_GTT(8 << 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-09 Thread Arkadiusz Hiler
On Fri, Dec 09, 2016 at 11:10:03AM +, Chris Wilson wrote:
> On Fri, Dec 09, 2016 at 11:56:10AM +0100, Arkadiusz Hiler wrote:
> > On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
> > > -static u32 guc_wopcm_size(struct drm_i915_private *dev_priv)
> > > +u32 guc_wopcm_size(struct drm_i915_private *dev_priv)
> > >  {
> > >   u32 wopcm_size = GUC_WOPCM_TOP;
> > >  
> > > @@ -511,6 +511,7 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)
> > >   if (err)
> > >   goto fail;
> > >  
> > > + intel_huc_load(dev_priv);
> 
> We don't need error handling? That would simplify a lot of our code!
> -Chris

With this patch series on this specific piece of code - not really.
HuC support it intorduce is _best-eforrty_.

If the function would report error we would not act on it in anyway
other than logging the fail (which the function already does for us).

As Anusha discussed here, there will be some code reorganization due to
introduction of i915.enable_huc and deprecation of enable_guc_loading.
Once we want to have enable_huc=2, there is a reason to change the
signature and report errors.

-- 
Cheers,
Arek
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-09 Thread Chris Wilson
On Fri, Dec 09, 2016 at 11:56:10AM +0100, Arkadiusz Hiler wrote:
> On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
> > -static u32 guc_wopcm_size(struct drm_i915_private *dev_priv)
> > +u32 guc_wopcm_size(struct drm_i915_private *dev_priv)
> >  {
> > u32 wopcm_size = GUC_WOPCM_TOP;
> >  
> > @@ -511,6 +511,7 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)
> > if (err)
> > goto fail;
> >  
> > +   intel_huc_load(dev_priv);

We don't need error handling? That would simplify a lot of our code!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-09 Thread Arkadiusz Hiler
On Thu, Dec 08, 2016 at 03:02:14PM -0800, anushasr wrote:
> From: Anusha Srivatsa 
> 
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.
> 
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
> 
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased + comment changes.
> v7: rebased.
> v8: rebased.
> v9: rebased. Changed the year in the copyright message to reflect
> the right year.Correct the comments,remove the unwanted WARN message,
> replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> prototypes in intel_huc.h non-extern.
> v10: rebased. Update the file construction done by HuC. It is similar to
> GuC.Adopted the approach used in-
> https://patchwork.freedesktop.org/patch/104355/ 
> v11: Fix warnings remove old declaration
> v12: Change dev to dev_priv in macro definition.
> Corrected comments.
> v13: rebased.
> v14: rebased on top of drm-tip
> v15: rebased. Updated functions intel_huc_load(),intel_huc_init() and
> intel_uc_fw_fetch() to accept dev_priv instead of dev. Moved contents
> of intel_huc.h to intel_uc.h
> 
> Cc: Tvrtko Ursulin 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
> ---
>  drivers/gpu/drm/i915/Makefile   |   1 +
>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>  drivers/gpu/drm/i915/i915_drv.h |   3 +-
>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>  drivers/gpu/drm/i915/intel_guc_loader.c |   7 +-
>  drivers/gpu/drm/i915/intel_huc_loader.c | 264 
> 
>  drivers/gpu/drm/i915/intel_uc.h |  22 +++
>  7 files changed, 299 insertions(+), 5 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 3c30916..01d4f4b 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
>  # general-purpose microcontroller (GuC) support
>  i915-y += intel_uc.o \
> intel_guc_loader.o \
> +   intel_huc_loader.o \
> i915_guc_submission.o
>  
>  # autogenerated null render state
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 6428588..85a47c2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -600,6 +600,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   if (ret)
>   goto cleanup_irq;
>  
> + intel_huc_init(dev_priv);
>   intel_guc_init(dev_priv);
>  
>   ret = i915_gem_init(dev_priv);
> @@ -627,6 +628,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>   DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>   i915_gem_fini(dev_priv);
>  cleanup_irq:
> + intel_huc_fini(dev);
>   intel_guc_fini(dev_priv);
>   drm_irq_uninstall(dev);
>   intel_teardown_gmbus(dev_priv);
> @@ -1313,7 +1315,7 @@ void i915_driver_unload(struct drm_device *dev)
>  
>   /* Flush any outstanding unpin_work. */
>   drain_workqueue(dev_priv->wq);
> -
> + intel_huc_fini(dev);
>   intel_guc_fini(dev_priv);
>   i915_gem_fini(dev_priv);
>   intel_fbc_cleanup_cfb(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1480e73..0371ca4 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2036,6 +2036,7 @@ struct drm_i915_private {
>  
>   struct intel_gvt *gvt;
>  
> + struct intel_huc huc;
>   struct intel_guc guc;
>  
>   struct intel_csr csr;
> @@ -2810,7 +2811,7 @@ intel_info(const struct drm_i915_private *dev_priv)
>  #define HAS_GUC(dev_priv)((dev_priv)->info.has_guc)
>  #define HAS_GUC_UCODE(dev_priv)  (HAS_GUC(dev_priv))
>  #define HAS_GUC_SCHED(dev_priv)  (HAS_GUC(dev_priv))
> -
> +#define HAS_HUC_UCODE(dev_priv)  (HAS_GUC(dev_priv))
>  #define HAS_RESOURCE_STREAMER(dev_priv) 
> ((dev_priv)->info.has_resource_streamer)
>  
>  #define HAS_POOLED_EU(dev_priv)  ((dev_priv)->info.has_pooled_eu)
> diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> b/drivers/gpu/drm/i915/i915_guc_reg.h
> index 5e638fc..f9829f6 100644
> --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> @@ -61,9 +61,12 @@
>  #define   DMA_ADDRESS_SPACE_GTT(8 << 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-01 Thread Srivatsa, Anusha


>-Original Message-
>From: Tvrtko Ursulin [mailto:tvrtko.ursu...@linux.intel.com]
>Sent: Thursday, December 1, 2016 5:24 AM
>To: Srivatsa, Anusha <anusha.sriva...@intel.com>; intel-
>g...@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support
>
>Hi,
>
>On 30/11/2016 23:31, Anusha Srivatsa wrote:
>> The HuC loading process is similar to GuC. The intel_uc_fw_fetch() is
>> used for both cases.
>>
>> HuC loading needs to be before GuC loading. The WOPCM setting must be
>> done early before loading any of them.
>>
>> v2: rebased on-top of drm-intel-nightly.
>> removed if(HAS_GUC()) before the guc call. (D.Gordon)
>> update huc_version number of format.
>> v3: rebased to drm-intel-nightly, changed the file name format to
>> match the one in the huc package.
>> Changed dev->dev_private to to_i915()
>> v4: moved function back to where it was.
>> change wait_for_atomic to wait_for.
>> v5: rebased + comment changes.
>> v7: rebased.
>> v8: rebased.
>> v9: rebased. Changed the year in the copyright message to reflect the
>> right year.Correct the comments,remove the unwanted WARN message,
>> replace drm_gem_object_unreference() with i915_gem_object_put().Make
>> the prototypes in intel_huc.h non-extern.
>> v10: rebased. Update the file construction done by HuC. It is similar
>> to GuC.Adopted the approach used in-
>> https://patchwork.freedesktop.org/patch/104355/ 
>> v11: Fix warnings remove old declaration
>> v12: Change dev to dev_priv in macro definition.
>> Corrected comments.
>> v13: rebased.
>> v14: rebased on top of drm-tip
>
>I thought we basically agreed to add i915.enable_huc (default=yes) and hide
>i915.enable_guc_loading, making it automatically turn on if either huc or guc
>submission are enabled?
Yes, I will be sending the patch for the same soon.

>Regards,
>
>Tvrtko
>
>>
>> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
>> Tested-by: Xiang Haihao <haihao.xi...@intel.com>
>> Signed-off-by: Anusha Srivatsa <anusha.sriva...@intel.com>
>> Signed-off-by: Alex Dai <yu@intel.com>
>> Signed-off-by: Peter Antoine <peter.anto...@intel.com>
>> Reviewed-by: Dave Gordon <david.s.gor...@intel.com>
>> ---
>>  drivers/gpu/drm/i915/Makefile   |   1 +
>>  drivers/gpu/drm/i915/i915_drv.c |   4 +-
>>  drivers/gpu/drm/i915/i915_drv.h |   4 +-
>>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>>  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
>>  drivers/gpu/drm/i915/intel_huc.h|  42 +
>>  drivers/gpu/drm/i915/intel_huc_loader.c | 267
>
>>  drivers/gpu/drm/i915/intel_uc.h |   2 +
>>  8 files changed, 324 insertions(+), 5 deletions(-)  create mode
>> 100644 drivers/gpu/drm/i915/intel_huc.h  create mode 100644
>> drivers/gpu/drm/i915/intel_huc_loader.c
>>
>> diff --git a/drivers/gpu/drm/i915/Makefile
>> b/drivers/gpu/drm/i915/Makefile index 3c30916..01d4f4b 100644
>> --- a/drivers/gpu/drm/i915/Makefile
>> +++ b/drivers/gpu/drm/i915/Makefile
>> @@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \  # general-purpose
>> microcontroller (GuC) support  i915-y += intel_uc.o \
>>intel_guc_loader.o \
>> +  intel_huc_loader.o \
>>i915_guc_submission.o
>>
>>  # autogenerated null render state
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c
>> b/drivers/gpu/drm/i915/i915_drv.c index 8dac298..075d9ce 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -603,6 +603,7 @@ static int i915_load_modeset_init(struct drm_device
>*dev)
>>  if (ret)
>>  goto cleanup_irq;
>>
>> +intel_huc_init(dev);
>>  intel_guc_init(dev);
>>
>>  ret = i915_gem_init(dev);
>> @@ -630,6 +631,7 @@ static int i915_load_modeset_init(struct drm_device
>*dev)
>>  DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>>  i915_gem_fini(dev_priv);
>>  cleanup_irq:
>> +intel_huc_fini(dev);
>>  intel_guc_fini(dev);
>>  drm_irq_uninstall(dev);
>>  intel_teardown_gmbus(dev);
>> @@ -1326,7 +1328,7 @@ void i915_driver_unload(struct drm_device *dev)
>>
>>  /* Flush any outstanding unpin_work. */
>>  drain_workqueue(dev_priv->wq);
>> -
>> +intel_huc_fini(dev);
>>  intel_guc_fini(dev);
>>  i915_gem_fini(dev_priv);
>>  in

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-12-01 Thread Tvrtko Ursulin

Hi,

On 30/11/2016 23:31, Anusha Srivatsa wrote:

The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
is used for both cases.

HuC loading needs to be before GuC loading. The WOPCM setting must
be done early before loading any of them.

v2: rebased on-top of drm-intel-nightly.
removed if(HAS_GUC()) before the guc call. (D.Gordon)
update huc_version number of format.
v3: rebased to drm-intel-nightly, changed the file name format to
match the one in the huc package.
Changed dev->dev_private to to_i915()
v4: moved function back to where it was.
change wait_for_atomic to wait_for.
v5: rebased + comment changes.
v7: rebased.
v8: rebased.
v9: rebased. Changed the year in the copyright message to reflect
the right year.Correct the comments,remove the unwanted WARN message,
replace drm_gem_object_unreference() with i915_gem_object_put().Make the
prototypes in intel_huc.h non-extern.
v10: rebased. Update the file construction done by HuC. It is similar to
GuC.Adopted the approach used in-
https://patchwork.freedesktop.org/patch/104355/ 
v11: Fix warnings remove old declaration
v12: Change dev to dev_priv in macro definition.
Corrected comments.
v13: rebased.
v14: rebased on top of drm-tip


I thought we basically agreed to add i915.enable_huc (default=yes) and 
hide i915.enable_guc_loading, making it automatically turn on if either 
huc or guc submission are enabled?


Regards,

Tvrtko



Cc: Tvrtko Ursulin 
Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
Reviewed-by: Dave Gordon 
---
 drivers/gpu/drm/i915/Makefile   |   1 +
 drivers/gpu/drm/i915/i915_drv.c |   4 +-
 drivers/gpu/drm/i915/i915_drv.h |   4 +-
 drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
 drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
 drivers/gpu/drm/i915/intel_huc.h|  42 +
 drivers/gpu/drm/i915/intel_huc_loader.c | 267 
 drivers/gpu/drm/i915/intel_uc.h |   2 +
 8 files changed, 324 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_huc.h
 create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3c30916..01d4f4b 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
 # general-purpose microcontroller (GuC) support
 i915-y += intel_uc.o \
  intel_guc_loader.o \
+ intel_huc_loader.o \
  i915_guc_submission.o

 # autogenerated null render state
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8dac298..075d9ce 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -603,6 +603,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret)
goto cleanup_irq;

+   intel_huc_init(dev);
intel_guc_init(dev);

ret = i915_gem_init(dev);
@@ -630,6 +631,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
DRM_ERROR("failed to idle hardware; continuing to unload!\n");
i915_gem_fini(dev_priv);
 cleanup_irq:
+   intel_huc_fini(dev);
intel_guc_fini(dev);
drm_irq_uninstall(dev);
intel_teardown_gmbus(dev);
@@ -1326,7 +1328,7 @@ void i915_driver_unload(struct drm_device *dev)

/* Flush any outstanding unpin_work. */
drain_workqueue(dev_priv->wq);
-
+   intel_huc_fini(dev);
intel_guc_fini(dev);
i915_gem_fini(dev_priv);
intel_fbc_cleanup_cfb(dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 297ad03..8edfae6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -56,6 +56,7 @@
 #include "intel_bios.h"
 #include "intel_dpll_mgr.h"
 #include "intel_uc.h"
+#include "intel_huc.h"
 #include "intel_lrc.h"
 #include "intel_ringbuffer.h"

@@ -1933,6 +1934,7 @@ struct drm_i915_private {

struct intel_gvt *gvt;

+   struct intel_huc huc;
struct intel_guc guc;

struct intel_csr csr;
@@ -2698,7 +2700,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define HAS_GUC(dev_priv)  ((dev_priv)->info.has_guc)
 #define HAS_GUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_GUC_SCHED(dev_priv)(HAS_GUC(dev_priv))
-
+#define HAS_HUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_RESOURCE_STREAMER(dev_priv) 
((dev_priv)->info.has_resource_streamer)

 #define HAS_POOLED_EU(dev_priv)((dev_priv)->info.has_pooled_eu)
diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
b/drivers/gpu/drm/i915/i915_guc_reg.h
index 5e638fc..f9829f6 100644
--- a/drivers/gpu/drm/i915/i915_guc_reg.h
+++ 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-11-11 Thread Jeff McGee
On Fri, Nov 11, 2016 at 06:05:34PM -0800, Jeff McGee wrote:
> On Thu, Nov 10, 2016 at 04:15:16PM -0800, Anusha Srivatsa wrote:
> > From: Peter Antoine 
> > 
> > The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> > is used for both cases.
> > 
> > HuC loading needs to be before GuC loading. The WOPCM setting must
> > be done early before loading any of them.
> > 
> > v2: rebased on-top of drm-intel-nightly.
> > removed if(HAS_GUC()) before the guc call. (D.Gordon)
> > update huc_version number of format.
> > v3: rebased to drm-intel-nightly, changed the file name format to
> > match the one in the huc package.
> > Changed dev->dev_private to to_i915()
> > v4: moved function back to where it was.
> > change wait_for_atomic to wait_for.
> > v5: rebased + comment changes.
> > v7: rebased.
> > v8: rebased.
> > v9: rebased. Changed the year in the copyright message to reflect
> > the right year.Correct the comments,remove the unwanted WARN message,
> > replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> > prototypes in intel_huc.h non-extern.
> > v10: rebased. Update the file construction done by HuC. It is similar to
> > GuC.Adopted the approach used in-
> > https://patchwork.freedesktop.org/patch/104355/ 
> > 
> > Cc: Tvrtko Ursulin 
> > Tested-by: Xiang Haihao 
> > Signed-off-by: Anusha Srivatsa 
> > Signed-off-by: Alex Dai 
> > Signed-off-by: Peter Antoine 
> > Reviewed-by: Dave Gordon 
> > ---
> >  drivers/gpu/drm/i915/Makefile   |   1 +
> >  drivers/gpu/drm/i915/i915_drv.h |   3 +
> >  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> >  drivers/gpu/drm/i915/intel_guc.h|   1 +
> >  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
> >  drivers/gpu/drm/i915/intel_huc.h|  42 +
> >  drivers/gpu/drm/i915/intel_huc_loader.c | 270 
> > 
> >  7 files changed, 324 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/i915/intel_huc.h
> >  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> > 
> > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> > index 0857e50..c99b0ee 100644
> > --- a/drivers/gpu/drm/i915/Makefile
> > +++ b/drivers/gpu/drm/i915/Makefile
> > @@ -55,6 +55,7 @@ i915-y += i915_cmd_parser.o \
> >  
> >  # general-purpose microcontroller (GuC) support
> >  i915-y += intel_guc_loader.o \
> > + intel_huc_loader.o \
> >   i915_guc_submission.o
> >  
> >  # autogenerated null render state
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h 
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index 30777de..ebef982 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -56,6 +56,7 @@
> >  #include "intel_bios.h"
> >  #include "intel_dpll_mgr.h"
> >  #include "intel_guc.h"
> > +#include "intel_huc.h"
> >  #include "intel_lrc.h"
> >  #include "intel_ringbuffer.h"
> >  
> > @@ -1804,6 +1805,7 @@ struct drm_i915_private {
> >  
> > struct intel_gvt *gvt;
> >  
> > +   struct intel_huc huc;
> > struct intel_guc guc;
> >  
> > struct intel_csr csr;
> > @@ -2928,6 +2930,7 @@ struct drm_i915_cmd_table {
> >  #define HAS_GUC(dev)   (INTEL_INFO(dev)->has_guc)
> >  #define HAS_GUC_UCODE(dev) (HAS_GUC(dev))
> >  #define HAS_GUC_SCHED(dev) (HAS_GUC(dev))
> > +#define HAS_HUC_UCODE(dev) (HAS_GUC(dev))
> >  
> >  #define HAS_RESOURCE_STREAMER(dev) (INTEL_INFO(dev)->has_resource_streamer)
> >  
> > diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> > b/drivers/gpu/drm/i915/i915_guc_reg.h
> > index a47e1e4..64e942a 100644
> > --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> > @@ -61,9 +61,12 @@
> >  #define   DMA_ADDRESS_SPACE_GTT  (8 << 16)
> >  #define DMA_COPY_SIZE  _MMIO(0xc310)
> >  #define DMA_CTRL   _MMIO(0xc314)
> > +#define   HUC_UKERNEL(1<<9)
> >  #define   UOS_MOVE   (1<<4)
> >  #define   START_DMA  (1<<0)
> >  #define DMA_GUC_WOPCM_OFFSET   _MMIO(0xc340)
> > +#define   HUC_LOADING_AGENT_VCR  (0<<1)
> > +#define   HUC_LOADING_AGENT_GUC  (1<<1)
> >  #define   GUC_WOPCM_OFFSET_VALUE 0x8   /* 512KB */
> >  #define GUC_MAX_IDLE_COUNT _MMIO(0xC3E4)
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_guc.h 
> > b/drivers/gpu/drm/i915/intel_guc.h
> > index 45dfa40..ff6aba6 100644
> > --- a/drivers/gpu/drm/i915/intel_guc.h
> > +++ b/drivers/gpu/drm/i915/intel_guc.h
> > @@ -183,6 +183,7 @@ extern const char *intel_uc_fw_status_repr(enum 
> > intel_uc_fw_status status);
> >  extern int intel_guc_suspend(struct drm_device *dev);
> >  extern int intel_guc_resume(struct drm_device *dev);
> >  void 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-11-11 Thread Jeff McGee
On Thu, Nov 10, 2016 at 04:15:16PM -0800, Anusha Srivatsa wrote:
> From: Peter Antoine 
> 
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.
> 
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
> 
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased + comment changes.
> v7: rebased.
> v8: rebased.
> v9: rebased. Changed the year in the copyright message to reflect
> the right year.Correct the comments,remove the unwanted WARN message,
> replace drm_gem_object_unreference() with i915_gem_object_put().Make the
> prototypes in intel_huc.h non-extern.
> v10: rebased. Update the file construction done by HuC. It is similar to
> GuC.Adopted the approach used in-
> https://patchwork.freedesktop.org/patch/104355/ 
> 
> Cc: Tvrtko Ursulin 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
> Reviewed-by: Dave Gordon 
> ---
>  drivers/gpu/drm/i915/Makefile   |   1 +
>  drivers/gpu/drm/i915/i915_drv.h |   3 +
>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>  drivers/gpu/drm/i915/intel_guc.h|   1 +
>  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
>  drivers/gpu/drm/i915/intel_huc.h|  42 +
>  drivers/gpu/drm/i915/intel_huc_loader.c | 270 
> 
>  7 files changed, 324 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/intel_huc.h
>  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 0857e50..c99b0ee 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -55,6 +55,7 @@ i915-y += i915_cmd_parser.o \
>  
>  # general-purpose microcontroller (GuC) support
>  i915-y += intel_guc_loader.o \
> +   intel_huc_loader.o \
> i915_guc_submission.o
>  
>  # autogenerated null render state
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 30777de..ebef982 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -56,6 +56,7 @@
>  #include "intel_bios.h"
>  #include "intel_dpll_mgr.h"
>  #include "intel_guc.h"
> +#include "intel_huc.h"
>  #include "intel_lrc.h"
>  #include "intel_ringbuffer.h"
>  
> @@ -1804,6 +1805,7 @@ struct drm_i915_private {
>  
>   struct intel_gvt *gvt;
>  
> + struct intel_huc huc;
>   struct intel_guc guc;
>  
>   struct intel_csr csr;
> @@ -2928,6 +2930,7 @@ struct drm_i915_cmd_table {
>  #define HAS_GUC(dev) (INTEL_INFO(dev)->has_guc)
>  #define HAS_GUC_UCODE(dev)   (HAS_GUC(dev))
>  #define HAS_GUC_SCHED(dev)   (HAS_GUC(dev))
> +#define HAS_HUC_UCODE(dev)   (HAS_GUC(dev))
>  
>  #define HAS_RESOURCE_STREAMER(dev) (INTEL_INFO(dev)->has_resource_streamer)
>  
> diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> b/drivers/gpu/drm/i915/i915_guc_reg.h
> index a47e1e4..64e942a 100644
> --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> @@ -61,9 +61,12 @@
>  #define   DMA_ADDRESS_SPACE_GTT(8 << 16)
>  #define DMA_COPY_SIZE_MMIO(0xc310)
>  #define DMA_CTRL _MMIO(0xc314)
> +#define   HUC_UKERNEL  (1<<9)
>  #define   UOS_MOVE (1<<4)
>  #define   START_DMA(1<<0)
>  #define DMA_GUC_WOPCM_OFFSET _MMIO(0xc340)
> +#define   HUC_LOADING_AGENT_VCR(0<<1)
> +#define   HUC_LOADING_AGENT_GUC(1<<1)
>  #define   GUC_WOPCM_OFFSET_VALUE   0x8   /* 512KB */
>  #define GUC_MAX_IDLE_COUNT   _MMIO(0xC3E4)
>  
> diff --git a/drivers/gpu/drm/i915/intel_guc.h 
> b/drivers/gpu/drm/i915/intel_guc.h
> index 45dfa40..ff6aba6 100644
> --- a/drivers/gpu/drm/i915/intel_guc.h
> +++ b/drivers/gpu/drm/i915/intel_guc.h
> @@ -183,6 +183,7 @@ extern const char *intel_uc_fw_status_repr(enum 
> intel_uc_fw_status status);
>  extern int intel_guc_suspend(struct drm_device *dev);
>  extern int intel_guc_resume(struct drm_device *dev);
>  void intel_uc_fw_fetch(struct drm_device *dev, struct intel_uc_fw *uc_fw);
> +u32 guc_wopcm_size(struct drm_i915_private *dev_priv);
>  
>  /* i915_guc_submission.c */
>  int i915_guc_submission_init(struct drm_i915_private *dev_priv);
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c 
> 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-10-27 Thread Jeff McGee
On Mon, Oct 24, 2016 at 02:24:01PM -0700, Carlos Santa wrote:
> On Thu, 2016-10-13 at 13:54 -0700, Jeff McGee wrote:
> > On Thu, Oct 13, 2016 at 10:42:42AM -0700, Jeff McGee wrote:
> > > 
> > > On Mon, Oct 03, 2016 at 11:42:57AM -0700, Anusha Srivatsa wrote:
> > > > 
> > > > From: Peter Antoine 
> > > > 
> > > > The HuC loading process is similar to GuC. The
> > > > intel_uc_fw_fetch()
> > > > is used for both cases.
> > > > 
> > > > HuC loading needs to be before GuC loading. The WOPCM setting
> > > > must
> > > > be done early before loading any of them.
> > > > 
> > > > v2: rebased on-top of drm-intel-nightly.
> > > > removed if(HAS_GUC()) before the guc call. (D.Gordon)
> > > > update huc_version number of format.
> > > > v3: rebased to drm-intel-nightly, changed the file name format to
> > > > match the one in the huc package.
> > > > Changed dev->dev_private to to_i915()
> > > > v4: moved function back to where it was.
> > > > change wait_for_atomic to wait_for.
> > > > v5: rebased + comment changes.
> > > > v7: rebased.
> > > > v8: rebased.
> > > > 
> > > > Tested-by: Xiang Haihao 
> > > > Signed-off-by: Anusha Srivatsa 
> > > > Signed-off-by: Alex Dai 
> > > > Signed-off-by: Peter Antoine 
> > > > Reviewed-by: Dave Gordon 
> > > > ---
> > > >  drivers/gpu/drm/i915/Makefile   |   1 +
> > > >  drivers/gpu/drm/i915/i915_drv.c |   3 +
> > > >  drivers/gpu/drm/i915/i915_drv.h |   3 +
> > > >  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> > > >  drivers/gpu/drm/i915/intel_guc.h|   1 +
> > > >  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
> > > >  drivers/gpu/drm/i915/intel_huc.h|  44 ++
> > > >  drivers/gpu/drm/i915/intel_huc_loader.c | 268
> > > > 
> > > >  8 files changed, 327 insertions(+), 2 deletions(-)
> > > >  create mode 100644 drivers/gpu/drm/i915/intel_huc.h
> > > >  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/Makefile
> > > > b/drivers/gpu/drm/i915/Makefile
> > > > index e6fe004..6e99c51 100644
> > > > --- a/drivers/gpu/drm/i915/Makefile
> > > > +++ b/drivers/gpu/drm/i915/Makefile
> > > > @@ -53,6 +53,7 @@ i915-y += i915_cmd_parser.o \
> > > >  
> > > >  # general-purpose microcontroller (GuC) support
> > > >  i915-y += intel_guc_loader.o \
> > > > +     intel_huc_loader.o \
> > > >       i915_guc_submission.o
> > > >  
> > > >  # autogenerated null render state
> > > > diff --git a/drivers/gpu/drm/i915/i915_drv.c
> > > > b/drivers/gpu/drm/i915/i915_drv.c
> > > > index 31b2b63..7af7bd6 100644
> > > > --- a/drivers/gpu/drm/i915/i915_drv.c
> > > > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > > > @@ -613,6 +613,7 @@ static int i915_load_modeset_init(struct
> > > > drm_device *dev)
> > > >      * working irqs for e.g. gmbus and dp aux transfers. */
> > > >     intel_modeset_init(dev);
> > > >  
> > > > +   intel_huc_init(dev);
> > > >     intel_guc_init(dev);
> > > >  
> > > >     ret = i915_gem_init(dev);
> > > > @@ -638,6 +639,7 @@ static int i915_load_modeset_init(struct
> > > > drm_device *dev)
> > > >  cleanup_gem:
> > > >     i915_gem_fini(dev);
> > > >  cleanup_irq:
> > > > +   intel_huc_fini(dev);
> > > >     intel_guc_fini(dev);
> > > >     drm_irq_uninstall(dev);
> > > >     intel_teardown_gmbus(dev);
> > > > @@ -1315,6 +1317,7 @@ void i915_driver_unload(struct drm_device
> > > > *dev)
> > > >     /* Flush any outstanding unpin_work. */
> > > >     drain_workqueue(dev_priv->wq);
> > > >  
> > > > +   intel_huc_fini(dev);
> > > >     intel_guc_fini(dev);
> > > >     i915_gem_fini(dev);
> > > >     intel_fbc_cleanup_cfb(dev_priv);
> > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > > b/drivers/gpu/drm/i915/i915_drv.h
> > > > index e0cb71c..625aa92 100644
> > > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > > @@ -55,6 +55,7 @@
> > > >  #include "intel_bios.h"
> > > >  #include "intel_dpll_mgr.h"
> > > >  #include "intel_guc.h"
> > > > +#include "intel_huc.h"
> > > >  #include "intel_lrc.h"
> > > >  #include "intel_ringbuffer.h"
> > > >  
> > > > @@ -1766,6 +1767,7 @@ struct drm_i915_private {
> > > >  
> > > >     struct intel_gvt gvt;
> > > >  
> > > > +   struct intel_huc huc;
> > > >     struct intel_guc guc;
> > > >  
> > > >     struct intel_csr csr;
> > > > @@ -2822,6 +2824,7 @@ struct drm_i915_cmd_table {
> > > >  #define HAS_GUC(dev)   (INTEL_INFO(dev)->has_guc)
> > > >  #define HAS_GUC_UCODE(dev) (HAS_GUC(dev))
> > > >  #define HAS_GUC_SCHED(dev) (HAS_GUC(dev))
> > > > +#define HAS_HUC_UCODE(dev) (HAS_GUC(dev))
> > > >  
> > > >  #define HAS_RESOURCE_STREAMER(dev) (INTEL_INFO(dev)-
> > > > >has_resource_streamer)
> > 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-10-24 Thread Carlos Santa
On Thu, 2016-10-13 at 13:54 -0700, Jeff McGee wrote:
> On Thu, Oct 13, 2016 at 10:42:42AM -0700, Jeff McGee wrote:
> > 
> > On Mon, Oct 03, 2016 at 11:42:57AM -0700, Anusha Srivatsa wrote:
> > > 
> > > From: Peter Antoine 
> > > 
> > > The HuC loading process is similar to GuC. The
> > > intel_uc_fw_fetch()
> > > is used for both cases.
> > > 
> > > HuC loading needs to be before GuC loading. The WOPCM setting
> > > must
> > > be done early before loading any of them.
> > > 
> > > v2: rebased on-top of drm-intel-nightly.
> > > removed if(HAS_GUC()) before the guc call. (D.Gordon)
> > > update huc_version number of format.
> > > v3: rebased to drm-intel-nightly, changed the file name format to
> > > match the one in the huc package.
> > > Changed dev->dev_private to to_i915()
> > > v4: moved function back to where it was.
> > > change wait_for_atomic to wait_for.
> > > v5: rebased + comment changes.
> > > v7: rebased.
> > > v8: rebased.
> > > 
> > > Tested-by: Xiang Haihao 
> > > Signed-off-by: Anusha Srivatsa 
> > > Signed-off-by: Alex Dai 
> > > Signed-off-by: Peter Antoine 
> > > Reviewed-by: Dave Gordon 
> > > ---
> > >  drivers/gpu/drm/i915/Makefile   |   1 +
> > >  drivers/gpu/drm/i915/i915_drv.c |   3 +
> > >  drivers/gpu/drm/i915/i915_drv.h |   3 +
> > >  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> > >  drivers/gpu/drm/i915/intel_guc.h|   1 +
> > >  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
> > >  drivers/gpu/drm/i915/intel_huc.h|  44 ++
> > >  drivers/gpu/drm/i915/intel_huc_loader.c | 268
> > > 
> > >  8 files changed, 327 insertions(+), 2 deletions(-)
> > >  create mode 100644 drivers/gpu/drm/i915/intel_huc.h
> > >  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> > > 
> > > diff --git a/drivers/gpu/drm/i915/Makefile
> > > b/drivers/gpu/drm/i915/Makefile
> > > index e6fe004..6e99c51 100644
> > > --- a/drivers/gpu/drm/i915/Makefile
> > > +++ b/drivers/gpu/drm/i915/Makefile
> > > @@ -53,6 +53,7 @@ i915-y += i915_cmd_parser.o \
> > >  
> > >  # general-purpose microcontroller (GuC) support
> > >  i915-y += intel_guc_loader.o \
> > > +   intel_huc_loader.o \
> > >     i915_guc_submission.o
> > >  
> > >  # autogenerated null render state
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.c
> > > b/drivers/gpu/drm/i915/i915_drv.c
> > > index 31b2b63..7af7bd6 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.c
> > > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > > @@ -613,6 +613,7 @@ static int i915_load_modeset_init(struct
> > > drm_device *dev)
> > >    * working irqs for e.g. gmbus and dp aux transfers. */
> > >   intel_modeset_init(dev);
> > >  
> > > + intel_huc_init(dev);
> > >   intel_guc_init(dev);
> > >  
> > >   ret = i915_gem_init(dev);
> > > @@ -638,6 +639,7 @@ static int i915_load_modeset_init(struct
> > > drm_device *dev)
> > >  cleanup_gem:
> > >   i915_gem_fini(dev);
> > >  cleanup_irq:
> > > + intel_huc_fini(dev);
> > >   intel_guc_fini(dev);
> > >   drm_irq_uninstall(dev);
> > >   intel_teardown_gmbus(dev);
> > > @@ -1315,6 +1317,7 @@ void i915_driver_unload(struct drm_device
> > > *dev)
> > >   /* Flush any outstanding unpin_work. */
> > >   drain_workqueue(dev_priv->wq);
> > >  
> > > + intel_huc_fini(dev);
> > >   intel_guc_fini(dev);
> > >   i915_gem_fini(dev);
> > >   intel_fbc_cleanup_cfb(dev_priv);
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > b/drivers/gpu/drm/i915/i915_drv.h
> > > index e0cb71c..625aa92 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -55,6 +55,7 @@
> > >  #include "intel_bios.h"
> > >  #include "intel_dpll_mgr.h"
> > >  #include "intel_guc.h"
> > > +#include "intel_huc.h"
> > >  #include "intel_lrc.h"
> > >  #include "intel_ringbuffer.h"
> > >  
> > > @@ -1766,6 +1767,7 @@ struct drm_i915_private {
> > >  
> > >   struct intel_gvt gvt;
> > >  
> > > + struct intel_huc huc;
> > >   struct intel_guc guc;
> > >  
> > >   struct intel_csr csr;
> > > @@ -2822,6 +2824,7 @@ struct drm_i915_cmd_table {
> > >  #define HAS_GUC(dev) (INTEL_INFO(dev)->has_guc)
> > >  #define HAS_GUC_UCODE(dev)   (HAS_GUC(dev))
> > >  #define HAS_GUC_SCHED(dev)   (HAS_GUC(dev))
> > > +#define HAS_HUC_UCODE(dev)   (HAS_GUC(dev))
> > >  
> > >  #define HAS_RESOURCE_STREAMER(dev) (INTEL_INFO(dev)-
> > > >has_resource_streamer)
> > >  
> > > diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h
> > > b/drivers/gpu/drm/i915/i915_guc_reg.h
> > > index a47e1e4..64e942a 100644
> > > --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> > > @@ -61,9 +61,12 @@
> > >  #define   DMA_ADDRESS_SPACE_GTT    (8 << 16)
> > >  #define DMA_COPY_SIZE_MMIO(0xc310)
> > >  #define DMA_CTRL 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-10-13 Thread Jeff McGee
On Thu, Oct 13, 2016 at 10:42:42AM -0700, Jeff McGee wrote:
> On Mon, Oct 03, 2016 at 11:42:57AM -0700, Anusha Srivatsa wrote:
> > From: Peter Antoine 
> > 
> > The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> > is used for both cases.
> > 
> > HuC loading needs to be before GuC loading. The WOPCM setting must
> > be done early before loading any of them.
> > 
> > v2: rebased on-top of drm-intel-nightly.
> > removed if(HAS_GUC()) before the guc call. (D.Gordon)
> > update huc_version number of format.
> > v3: rebased to drm-intel-nightly, changed the file name format to
> > match the one in the huc package.
> > Changed dev->dev_private to to_i915()
> > v4: moved function back to where it was.
> > change wait_for_atomic to wait_for.
> > v5: rebased + comment changes.
> > v7: rebased.
> > v8: rebased.
> > 
> > Tested-by: Xiang Haihao 
> > Signed-off-by: Anusha Srivatsa 
> > Signed-off-by: Alex Dai 
> > Signed-off-by: Peter Antoine 
> > Reviewed-by: Dave Gordon 
> > ---
> >  drivers/gpu/drm/i915/Makefile   |   1 +
> >  drivers/gpu/drm/i915/i915_drv.c |   3 +
> >  drivers/gpu/drm/i915/i915_drv.h |   3 +
> >  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
> >  drivers/gpu/drm/i915/intel_guc.h|   1 +
> >  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
> >  drivers/gpu/drm/i915/intel_huc.h|  44 ++
> >  drivers/gpu/drm/i915/intel_huc_loader.c | 268 
> > 
> >  8 files changed, 327 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/i915/intel_huc.h
> >  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> > 
> > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> > index e6fe004..6e99c51 100644
> > --- a/drivers/gpu/drm/i915/Makefile
> > +++ b/drivers/gpu/drm/i915/Makefile
> > @@ -53,6 +53,7 @@ i915-y += i915_cmd_parser.o \
> >  
> >  # general-purpose microcontroller (GuC) support
> >  i915-y += intel_guc_loader.o \
> > + intel_huc_loader.o \
> >   i915_guc_submission.o
> >  
> >  # autogenerated null render state
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c 
> > b/drivers/gpu/drm/i915/i915_drv.c
> > index 31b2b63..7af7bd6 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -613,6 +613,7 @@ static int i915_load_modeset_init(struct drm_device 
> > *dev)
> >  * working irqs for e.g. gmbus and dp aux transfers. */
> > intel_modeset_init(dev);
> >  
> > +   intel_huc_init(dev);
> > intel_guc_init(dev);
> >  
> > ret = i915_gem_init(dev);
> > @@ -638,6 +639,7 @@ static int i915_load_modeset_init(struct drm_device 
> > *dev)
> >  cleanup_gem:
> > i915_gem_fini(dev);
> >  cleanup_irq:
> > +   intel_huc_fini(dev);
> > intel_guc_fini(dev);
> > drm_irq_uninstall(dev);
> > intel_teardown_gmbus(dev);
> > @@ -1315,6 +1317,7 @@ void i915_driver_unload(struct drm_device *dev)
> > /* Flush any outstanding unpin_work. */
> > drain_workqueue(dev_priv->wq);
> >  
> > +   intel_huc_fini(dev);
> > intel_guc_fini(dev);
> > i915_gem_fini(dev);
> > intel_fbc_cleanup_cfb(dev_priv);
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h 
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index e0cb71c..625aa92 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -55,6 +55,7 @@
> >  #include "intel_bios.h"
> >  #include "intel_dpll_mgr.h"
> >  #include "intel_guc.h"
> > +#include "intel_huc.h"
> >  #include "intel_lrc.h"
> >  #include "intel_ringbuffer.h"
> >  
> > @@ -1766,6 +1767,7 @@ struct drm_i915_private {
> >  
> > struct intel_gvt gvt;
> >  
> > +   struct intel_huc huc;
> > struct intel_guc guc;
> >  
> > struct intel_csr csr;
> > @@ -2822,6 +2824,7 @@ struct drm_i915_cmd_table {
> >  #define HAS_GUC(dev)   (INTEL_INFO(dev)->has_guc)
> >  #define HAS_GUC_UCODE(dev) (HAS_GUC(dev))
> >  #define HAS_GUC_SCHED(dev) (HAS_GUC(dev))
> > +#define HAS_HUC_UCODE(dev) (HAS_GUC(dev))
> >  
> >  #define HAS_RESOURCE_STREAMER(dev) (INTEL_INFO(dev)->has_resource_streamer)
> >  
> > diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> > b/drivers/gpu/drm/i915/i915_guc_reg.h
> > index a47e1e4..64e942a 100644
> > --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> > @@ -61,9 +61,12 @@
> >  #define   DMA_ADDRESS_SPACE_GTT  (8 << 16)
> >  #define DMA_COPY_SIZE  _MMIO(0xc310)
> >  #define DMA_CTRL   _MMIO(0xc314)
> > +#define   HUC_UKERNEL(1<<9)
> >  #define   UOS_MOVE   (1<<4)
> >  #define   START_DMA  (1<<0)
> >  #define DMA_GUC_WOPCM_OFFSET   _MMIO(0xc340)
> > +#define   HUC_LOADING_AGENT_VCR  (0<<1)
> > 

Re: [Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-10-13 Thread Jeff McGee
On Mon, Oct 03, 2016 at 11:42:57AM -0700, Anusha Srivatsa wrote:
> From: Peter Antoine 
> 
> The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
> is used for both cases.
> 
> HuC loading needs to be before GuC loading. The WOPCM setting must
> be done early before loading any of them.
> 
> v2: rebased on-top of drm-intel-nightly.
> removed if(HAS_GUC()) before the guc call. (D.Gordon)
> update huc_version number of format.
> v3: rebased to drm-intel-nightly, changed the file name format to
> match the one in the huc package.
> Changed dev->dev_private to to_i915()
> v4: moved function back to where it was.
> change wait_for_atomic to wait_for.
> v5: rebased + comment changes.
> v7: rebased.
> v8: rebased.
> 
> Tested-by: Xiang Haihao 
> Signed-off-by: Anusha Srivatsa 
> Signed-off-by: Alex Dai 
> Signed-off-by: Peter Antoine 
> Reviewed-by: Dave Gordon 
> ---
>  drivers/gpu/drm/i915/Makefile   |   1 +
>  drivers/gpu/drm/i915/i915_drv.c |   3 +
>  drivers/gpu/drm/i915/i915_drv.h |   3 +
>  drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
>  drivers/gpu/drm/i915/intel_guc.h|   1 +
>  drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
>  drivers/gpu/drm/i915/intel_huc.h|  44 ++
>  drivers/gpu/drm/i915/intel_huc_loader.c | 268 
> 
>  8 files changed, 327 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/intel_huc.h
>  create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index e6fe004..6e99c51 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -53,6 +53,7 @@ i915-y += i915_cmd_parser.o \
>  
>  # general-purpose microcontroller (GuC) support
>  i915-y += intel_guc_loader.o \
> +   intel_huc_loader.o \
> i915_guc_submission.o
>  
>  # autogenerated null render state
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 31b2b63..7af7bd6 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -613,6 +613,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>* working irqs for e.g. gmbus and dp aux transfers. */
>   intel_modeset_init(dev);
>  
> + intel_huc_init(dev);
>   intel_guc_init(dev);
>  
>   ret = i915_gem_init(dev);
> @@ -638,6 +639,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  cleanup_gem:
>   i915_gem_fini(dev);
>  cleanup_irq:
> + intel_huc_fini(dev);
>   intel_guc_fini(dev);
>   drm_irq_uninstall(dev);
>   intel_teardown_gmbus(dev);
> @@ -1315,6 +1317,7 @@ void i915_driver_unload(struct drm_device *dev)
>   /* Flush any outstanding unpin_work. */
>   drain_workqueue(dev_priv->wq);
>  
> + intel_huc_fini(dev);
>   intel_guc_fini(dev);
>   i915_gem_fini(dev);
>   intel_fbc_cleanup_cfb(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e0cb71c..625aa92 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -55,6 +55,7 @@
>  #include "intel_bios.h"
>  #include "intel_dpll_mgr.h"
>  #include "intel_guc.h"
> +#include "intel_huc.h"
>  #include "intel_lrc.h"
>  #include "intel_ringbuffer.h"
>  
> @@ -1766,6 +1767,7 @@ struct drm_i915_private {
>  
>   struct intel_gvt gvt;
>  
> + struct intel_huc huc;
>   struct intel_guc guc;
>  
>   struct intel_csr csr;
> @@ -2822,6 +2824,7 @@ struct drm_i915_cmd_table {
>  #define HAS_GUC(dev) (INTEL_INFO(dev)->has_guc)
>  #define HAS_GUC_UCODE(dev)   (HAS_GUC(dev))
>  #define HAS_GUC_SCHED(dev)   (HAS_GUC(dev))
> +#define HAS_HUC_UCODE(dev)   (HAS_GUC(dev))
>  
>  #define HAS_RESOURCE_STREAMER(dev) (INTEL_INFO(dev)->has_resource_streamer)
>  
> diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
> b/drivers/gpu/drm/i915/i915_guc_reg.h
> index a47e1e4..64e942a 100644
> --- a/drivers/gpu/drm/i915/i915_guc_reg.h
> +++ b/drivers/gpu/drm/i915/i915_guc_reg.h
> @@ -61,9 +61,12 @@
>  #define   DMA_ADDRESS_SPACE_GTT(8 << 16)
>  #define DMA_COPY_SIZE_MMIO(0xc310)
>  #define DMA_CTRL _MMIO(0xc314)
> +#define   HUC_UKERNEL  (1<<9)
>  #define   UOS_MOVE (1<<4)
>  #define   START_DMA(1<<0)
>  #define DMA_GUC_WOPCM_OFFSET _MMIO(0xc340)
> +#define   HUC_LOADING_AGENT_VCR(0<<1)
> +#define   HUC_LOADING_AGENT_GUC(1<<1)
>  #define   GUC_WOPCM_OFFSET_VALUE   0x8   /* 512KB */
>  #define GUC_MAX_IDLE_COUNT   _MMIO(0xC3E4)
>  
> diff --git a/drivers/gpu/drm/i915/intel_guc.h 
> b/drivers/gpu/drm/i915/intel_guc.h
> index