AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <Lang.Yu@amd.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Yifan Zhang <yifan1.zhang@amd.com>,
	amd-gfx@lists.freedesktop.org,
	Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Subject: Re: [PATCH 2/2] drm/amdgpu: use amdgpu_bo_create_kernel_at() to create large TMR for APU
Date: Thu, 27 Jul 2023 16:24:28 +0800	[thread overview]
Message-ID: <ZMIpvO4RynD1J1VW@lang-desktop> (raw)
In-Reply-To: <f786e262-4d64-2274-c740-8a69cc7b8ea7@amd.com>

On 07/27/ , Christian König wrote:
> Am 27.07.23 um 09:56 schrieb Lang Yu:
> > TMR requires physical contiguous memory, amdgpu_bo_create_kernel()
> > can't satisfy large(>128MB) physical contiguous memory allocation
> > request with default 512MB VRAM on APU.
> > 
> > When requested TMR size > 128MB, use amdgpu_bo_create_kernel_at()
> > to create the TMR BO at offset 64MB.
> 
> Well complete NAK, you have misunderstood what amdgpu_bo_create_kernel_at()
> is doing.

  OK. Either taking over or creating memory area, amdgpu_bo_create series
  functions should satisfy the client's memory request.
  Anyway, amdgpu_bo_create_kernel_at() just works.
  
  Regards,
  Lang

> Regards,
> Christian.
> 
> > 
> > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++++++++++++---------
> >   1 file changed, 28 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > index 15217e33b51d..2eac82113d34 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > @@ -783,13 +783,38 @@ static bool psp_boottime_tmr(struct psp_context *psp)
> >   	}
> >   }
> > +static inline int psp_create_tmr_bo(struct psp_context *psp, int tmr_size)
> > +{
> > +	void *tmr_buf;
> > +	void **pptr;
> > +	int ret;
> > +
> > +	if (psp->tmr_bo)
> > +		return 0;
> > +
> > +	pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
> > +
> > +	if (psp->adev->flags & AMD_IS_APU && tmr_size > 0x8000000)
> > +		ret = amdgpu_bo_create_kernel_at(psp->adev, 0x4000000, tmr_size,
> > +						 &psp->tmr_bo, &psp->tmr_mc_addr,
> > +						 pptr);
> > +	else
> > +		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size,
> > +					      PSP_TMR_ALIGNMENT,
> > +					      AMDGPU_HAS_VRAM(psp->adev) ?
> > +					      AMDGPU_GEM_DOMAIN_VRAM :
> > +					      AMDGPU_GEM_DOMAIN_GTT,
> > +					      &psp->tmr_bo, &psp->tmr_mc_addr,
> > +					      pptr);
> > +
> > +	return ret;
> > +}
> > +
> >   /* Set up Trusted Memory Region */
> >   static int psp_tmr_init(struct psp_context *psp)
> >   {
> >   	int ret = 0;
> >   	int tmr_size;
> > -	void *tmr_buf;
> > -	void **pptr;
> >   	/*
> >   	 * According to HW engineer, they prefer the TMR address be "naturally
> > @@ -813,18 +838,7 @@ static int psp_tmr_init(struct psp_context *psp)
> >   		}
> >   	}
> > -	if (!psp->tmr_bo) {
> > -		pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
> > -		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size,
> > -					      PSP_TMR_ALIGNMENT,
> > -					      AMDGPU_HAS_VRAM(psp->adev) ?
> > -					      AMDGPU_GEM_DOMAIN_VRAM :
> > -					      AMDGPU_GEM_DOMAIN_GTT,
> > -					      &psp->tmr_bo, &psp->tmr_mc_addr,
> > -					      pptr);
> > -	}
> > -
> > -	return ret;
> > +	return psp_create_tmr_bo(psp, tmr_size);
> >   }
> >   static bool psp_skip_tmr(struct psp_context *psp)
> 

  reply	other threads:[~2023-07-27  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  7:56 [PATCH 1/2] drm/amdgpu: refine amdgpu_bo_create_kernel_at() Lang Yu
2023-07-27  7:56 ` [PATCH 2/2] drm/amdgpu: use amdgpu_bo_create_kernel_at() to create large TMR for APU Lang Yu
2023-07-27  8:01   ` Christian König
2023-07-27  8:24     ` Lang Yu [this message]
2023-07-27  8:00 ` [PATCH 1/2] drm/amdgpu: refine amdgpu_bo_create_kernel_at() Christian König
2023-07-27  8:15   ` Lang Yu
2023-07-27 11:23     ` Christian König
2023-07-27 12:04       ` Lang Yu

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=ZMIpvO4RynD1J1VW@lang-desktop \
    --to=lang.yu@amd.com \
    --cc=Arunpravin.PaneerSelvam@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=yifan1.zhang@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox