RE: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

2019-05-26 Thread Deng, Emily
Ping..

Best wishes
Emily Deng
>-Original Message-
>From: amd-gfx  On Behalf Of Emily
>Deng
>Sent: Friday, May 24, 2019 6:33 PM
>To: amd-gfx@lists.freedesktop.org
>Cc: Deng, Emily 
>Subject: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin
>
>[CAUTION: External Email]
>
>As it will destory clear_state_obj, and also will unpin it in the 
>gfx_v9_0_sw_fini,
>so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin
>warning.
>
>Signed-off-by: Emily Deng 
>---
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 16 
> 1 file changed, 16 deletions(-)
>
>diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>index c763733..231b9e0 100644
>--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>@@ -1154,20 +1154,6 @@ static int gfx_v9_0_csb_vram_pin(struct
>amdgpu_device *adev)
>return r;
> }
>
>-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
>-   int r;
>-
>-   if (!adev->gfx.rlc.clear_state_obj)
>-   return;
>-
>-   r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
>-   if (likely(r == 0)) {
>-   amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
>-   amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
>-   }
>-}
>-
> static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)  {
>amdgpu_bo_free_kernel(>gfx.mec.hpd_eop_obj, NULL, NULL);
>@@ -3385,8 +3371,6 @@ static int gfx_v9_0_hw_fini(void *handle)
>gfx_v9_0_cp_enable(adev, false);
>adev->gfx.rlc.funcs->stop(adev);
>
>-   gfx_v9_0_csb_vram_unpin(adev);
>-
>return 0;
> }
>
>--
>2.7.4
>
>___
>amd-gfx mailing list
>amd-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

RE: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset

2019-05-26 Thread Deng, Emily


>-Original Message-
>From: Alex Deucher 
>Sent: Saturday, May 25, 2019 12:59 AM
>To: Deng, Emily 
>Cc: amd-gfx list 
>Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco
>reset
>
>[CAUTION: External Email]
>
>On Thu, May 23, 2019 at 10:29 PM Deng, Emily  wrote:
>>
>>
>>
>> >-Original Message-
>> >From: Alex Deucher 
>> >Sent: Friday, May 24, 2019 12:09 AM
>> >To: Deng, Emily 
>> >Cc: amd-gfx list 
>> >Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco
>> >reset
>> >
>> >[CAUTION: External Email]
>> >
>> >On Thu, May 23, 2019 at 6:22 AM Emily Deng 
>wrote:
>> >>
>> >> For passthrough, after rebooted the VM, driver will do a baco reset
>> >> before doing other driver initialization during loading  driver.
>> >> For doing the baco reset, it will first check the baco reset capability.
>> >> So first need to set the cap from the vbios information or baco
>> >> reset won't be enabled.
>> >>
>> >> Signed-off-by: Emily Deng 
>> >> ---
>> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  8 
>> >>  drivers/gpu/drm/amd/amdgpu/soc15.c |  3 ++-
>> >>  drivers/gpu/drm/amd/include/kgd_pp_interface.h |  1 +
>> >>  drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 16
>> >+++
>> >>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  1 +
>> >>  .../amd/powerplay/hwmgr/vega10_processpptables.c   | 24
>> >++
>> >>  .../amd/powerplay/hwmgr/vega10_processpptables.h   |  1 +
>> >>  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h  |  1 +
>> >>  8 files changed, 54 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> index bdd1fe73..2dde672 100644
>> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> @@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct
>amdgpu_device
>> >*adev,
>> >>  *  E.g., driver was not cleanly unloaded previously, etc.
>> >>  */
>> >> if (!amdgpu_sriov_vf(adev) &&
>> >> amdgpu_asic_need_reset_on_init(adev)) {
>> >> +   if (amdgpu_passthrough(adev) &&
>> >> + adev->powerplay.pp_funcs &&
>> >adev->powerplay.pp_funcs->set_asic_baco_cap) {
>> >> +   r =
>> >> + adev->powerplay.pp_funcs->set_asic_baco_cap(adev-
>> >>powerplay.pp_handle);
>> >> +   if (r) {
>> >> +   dev_err(adev->dev, "set baco capability 
>> >> failed\n");
>> >> +   goto failed;
>> >> +   }
>> >> +   }
>> >> +
>> >
>> >I think it would be cleaner to add this to hwmgr_early_init() or
>> >something called from early init for powerplay.
>> I  also preferred to put it in the hwmgr_early_init, but as the function
>set_asic_baco_cap  need to get the vbios info,  so need to put the
>amdgpu_get_bios before early init. If so the code changes too big.
>
>I think this change is all you need:
>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>index bdd1fe73f14b..952f61e28d42 100644
>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>@@ -2564,6 +2564,12 @@ int amdgpu_device_init(struct amdgpu_device
>*adev,
>
>amdgpu_device_get_pcie_info(adev);
>
>+   /* Read BIOS */
>+   if (!amdgpu_get_bios(adev)) {
>+   r = -EINVAL;
>+   goto failed;
>+   }
>+
>/* early init functions */
>r = amdgpu_device_ip_early_init(adev);
>if (r)
>@@ -2591,12 +2597,6 @@ int amdgpu_device_init(struct amdgpu_device
>*adev,
>goto fence_driver_init;
>}
>
>-   /* Read BIOS */
>-   if (!amdgpu_get_bios(adev)) {
>-   r = -EINVAL;
>-   goto failed;
>-   }
>-
>r = amdgpu_atombios_init(adev);
>if (r) {
>dev_err(adev->dev, "amdgpu_atombios_init failed\n");
>
>I guess that could be a follow up change if you want.
>
>Alex
Thanks, will modify the change as your suggestion.

Best wishes
Emily Deng


>
>> >
>> >Alex
>> >
>> >> r = amdgpu_asic_reset(adev);
>> >> if (r) {
>> >> dev_err(adev->dev, "asic reset on init
>> >> failed\n"); diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c
>> >> b/drivers/gpu/drm/amd/amdgpu/soc15.c
>> >> index 78bd4fc..d9fdd95 100644
>> >> --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
>> >> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
>> >> @@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct
>> >amdgpu_device *adev)
>> >> /* Just return false for soc15 GPUs.  Reset does not seem to
>> >>  * be necessary.
>> >>  */
>> >> -   return false;
>> >> +   if (!amdgpu_passthrough(adev))
>> >> +   return false;
>> >>
>> >> if (adev->flags & AMD_IS_APU)
>> >>   

[PATCH] drm/amdgpu/powerplay: remove duplicate entry of nbio_6_1_offset.h

2019-05-26 Thread Hariprasad Kelam
asic_reg/nbio/nbio_6_1_offset.h is included twice.

Issue identified by includecheck

Signed-off-by: Hariprasad Kelam 
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_inc.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_inc.h 
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_inc.h
index e6d9e84..0d08c57 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_inc.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_inc.h
@@ -35,7 +35,6 @@
 #include "asic_reg/gc/gc_9_2_1_sh_mask.h"
 
 #include "asic_reg/nbio/nbio_6_1_offset.h"
-#include "asic_reg/nbio/nbio_6_1_offset.h"
 #include "asic_reg/nbio/nbio_6_1_sh_mask.h"
 
 #endif
-- 
2.7.4