[PATCH V2] drm/amdgpu: Destroy psp ring in hw_fini

Huang Rui ray.huang at amd.com
Thu Apr 20 01:16:17 UTC 2017


On Thu, Apr 20, 2017 at 08:53:54AM +0800, Huang Rui wrote:
> On Tue, Apr 18, 2017 at 03:04:45PM +0800, Trigger Huang wrote:
> > +int psp_v3_1_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_REG_OFFSET(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, 0x8000FFFF, false);
> > +
> 
> > +       if (ring->ring_mem)
> > +               amdgpu_bo_free_kernel(&adev->firmware.rbuf,
> > +                                     &ring->ring_mem_mc_addr,
> > +                                     (void **)&ring->ring_mem);
> 
> adev->firmware.rbuf is entired memory space for storing firmware data which
> inited by amdgpu_ucode_init_bo, and it already teared down via
> amdgpu_ucode_fini_bo. You cannot free it again.
> 

Trigger, I missed read fw_buf(inited by ucode_init) and rbuf, sorry. Yes,
it need free rbuf here. Please ignore above comments.
But you still need check the load_type before destory ring.

Thanks,
Rui


More information about the amd-gfx mailing list