From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Deucher,
Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 4/4] drm/amdgpu: add ring_destroy for psp v10
Date: Mon, 17 Jul 2017 10:40:05 +0800 [thread overview]
Message-ID: <596C2385.6030001@amd.com> (raw)
In-Reply-To: <BN6PR12MB1652D7270B7952D80428DCC5F7AD0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
On 07/14/2017 10:43 PM, Deucher, Alexander wrote:
>> -----Original Message-----
>> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
>> Of Junwei Zhang
>> Sent: Friday, July 14, 2017 6:42 AM
>> To: amd-gfx@lists.freedesktop.org
>> Cc: Zhang, Jerry
>> Subject: [PATCH 4/4] drm/amdgpu: add ring_destroy for psp v10
>>
>> Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 1 +
>> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 27
>> +++++++++++++++++++++++++++
>> drivers/gpu/drm/amd/amdgpu/psp_v10_0.h | 2 ++
>> 3 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> index 8f4eafc..644941d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> @@ -67,6 +67,7 @@ static int psp_sw_init(void *handle)
>> psp->prep_cmd_buf = psp_v10_0_prep_cmd_buf;
>> psp->ring_init = psp_v10_0_ring_init;
>> psp->ring_create = psp_v10_0_ring_create;
>> + psp->ring_destroy = psp_v10_0_ring_destroy;
>> psp->cmd_submit = psp_v10_0_cmd_submit;
>> psp->compare_sram_data =
>> psp_v10_0_compare_sram_data;
>> break;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> index fb29cd4..b4af32a3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> @@ -210,6 +210,33 @@ int psp_v10_0_ring_create(struct psp_context *psp,
>> enum psp_ring_type ring_type)
>> return ret;
>> }
>>
>> +int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type
>> ring_type)
>> +{
>> + int ret = 0;
>> + struct psp_ring *ring;
>> + unsigned int psp_ring_reg = 0;
>> + struct amdgpu_device *adev = psp->adev;
>> +
>> + ring = &psp->km_ring;
>> +
>> + /* Write the ring destroy command to C2PMSG_64 */
>> + psp_ring_reg = 3 << 16;
>> + WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
>> psp_ring_reg);
>> +
>> + /* There might be handshake issue with hardware which needs delay
>> */
>> + mdelay(20);
>> +
>> + /* Wait for response flag (bit 31) in C2PMSG_64 */
>> + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,
>> mmMP0_SMN_C2PMSG_64),
>> + 0x80000000, 0x80000000, false);
>> +
>> + if (ring->ring_mem)
>
> You don't have to check if the ring exists. amdgpu_bo_free_kernel handles NULL bos.
> With that fixed:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Yeah, thanks to reminder that.
I will fix it.
Jerry
>
>> + amdgpu_bo_free_kernel(&adev->firmware.rbuf,
>> + &ring->ring_mem_mc_addr,
>> + (void **)&ring->ring_mem);
>> + return ret;
>> +}
>> +
>> int psp_v10_0_cmd_submit(struct psp_context *psp,
>> struct amdgpu_firmware_info *ucode,
>> uint64_t cmd_buf_mc_addr, uint64_t fence_mc_addr,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.h
>> b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.h
>> index 7e9a8cd..e76cde2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.h
>> @@ -34,6 +34,8 @@ extern int psp_v10_0_ring_init(struct psp_context
>> *psp,
>> enum psp_ring_type ring_type);
>> extern int psp_v10_0_ring_create(struct psp_context *psp,
>> enum psp_ring_type ring_type);
>> +extern int psp_v10_0_ring_destroy(struct psp_context *psp,
>> + enum psp_ring_type ring_type);
>> extern int psp_v10_0_cmd_submit(struct psp_context *psp,
>> struct amdgpu_firmware_info *ucode,
>> uint64_t cmd_buf_mc_addr, uint64_t
>> fence_mc_addr,
>> --
>> 1.9.1
>>
>> _______________________________________________
>> 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
prev parent reply other threads:[~2017-07-17 2:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 10:41 [PATCH 0/4] *** Prepare to support PSP v10 for Raven *** Junwei Zhang
[not found] ` <1500028922-20171-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2017-07-14 10:41 ` [PATCH 1/4] drm/amdgpu: remove unncessary code in psp v10 ring init func Junwei Zhang
[not found] ` <1500028922-20171-2-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2017-07-14 14:40 ` Deucher, Alexander
2017-07-14 10:42 ` [PATCH 2/4] drm/amdgpu: add init microcode function for psp v10 Junwei Zhang
[not found] ` <1500028922-20171-3-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2017-07-14 14:41 ` Deucher, Alexander
2017-07-14 10:42 ` [PATCH 3/4] drm/amdgpu: add ring_create " Junwei Zhang
[not found] ` <1500028922-20171-4-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2017-07-14 14:42 ` Deucher, Alexander
2017-07-14 10:42 ` [PATCH 4/4] drm/amdgpu: add ring_destroy " Junwei Zhang
[not found] ` <1500028922-20171-5-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2017-07-14 14:43 ` Deucher, Alexander
[not found] ` <BN6PR12MB1652D7270B7952D80428DCC5F7AD0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-07-17 2:40 ` Zhang, Jerry (Junwei) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=596C2385.6030001@amd.com \
--to=jerry.zhang-5c7gfcevmho@public.gmane.org \
--cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.