All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Yifan" <Yifan1.Zhang@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Zhang, Jesse\(Jie\)" <Jesse.Zhang@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: RE: [PATCH] drm/amdgpu: fix AGP addressing when GART is not at 0
Date: Thu, 16 Nov 2023 09:37:18 +0000	[thread overview]
Message-ID: <CY5PR12MB6369A027501FDC20699E31C7C1B0A@CY5PR12MB6369.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CADnq5_O49zWhVhCopXFTC+9ijepy4iuV6vMbogP6+O8GWrZZOw@mail.gmail.com>

[AMD Official Use Only - General]

Ping... this patch seems still not merged.

Best Regards,
Yifan

-----Original Message-----
From: Alex Deucher <alexdeucher@gmail.com>
Sent: Monday, November 13, 2023 2:13 AM
To: Koenig, Christian <Christian.Koenig@amd.com>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org; Zhang, Yifan <Yifan1.Zhang@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>
Subject: Re: [PATCH] drm/amdgpu: fix AGP addressing when GART is not at 0

On Sat, Nov 11, 2023 at 2:17 AM Christian König <christian.koenig@amd.com> wrote:
>
> Am 10.11.23 um 15:47 schrieb Alex Deucher:
> > This worked by luck if the GART aperture ended up at 0.  When we
> > ended up moving GART on some chips, the GART aperture ended up
> > offsetting the the AGP address since the resource->start is a GART
> > offset, not an MC address.  Fix this by moving the AGP address setup
> > into amdgpu_bo_gpu_offset_no_check().
> >
> > Reported-by: Jesse Zhang <Jesse.Zhang@amd.com>
> > Reported-by: Yifan Zhang <yifan1.zhang@amd.com>
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > Cc: christian.koenig@amd.com
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +++++++---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    |  4 +---
> >   2 files changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > index cef920a93924..1b3e97522838 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > @@ -1527,10 +1527,14 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
> >   u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo)
> >   {
> >       struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> > -     uint64_t offset;
> > +     uint64_t offset, addr;
> >
> > -     offset = (bo->tbo.resource->start << PAGE_SHIFT) +
> > -              amdgpu_ttm_domain_start(adev, bo->tbo.resource->mem_type);
> > +     addr = amdgpu_gmc_agp_addr(&bo->tbo);
>
> IIRC you must check bo->tbo.resource->mem_type before calling
> amdgpu_gmc_agp_addr().

Yes, this was fixed in v2.

Alex

>
> Regards,
> Christian.
>
> > +     if (addr != AMDGPU_BO_INVALID_OFFSET)
> > +             offset = addr;
> > +     else
> > +             offset = (bo->tbo.resource->start << PAGE_SHIFT) +
> > +                     amdgpu_ttm_domain_start(adev,
> > + bo->tbo.resource->mem_type);
> >
> >       return amdgpu_gmc_sign_extend(offset);
> >   }
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > index 05991c5c8ddb..ab4a762aed5b 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > @@ -959,10 +959,8 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo)
> >               return 0;
> >
> >       addr = amdgpu_gmc_agp_addr(bo);
> > -     if (addr != AMDGPU_BO_INVALID_OFFSET) {
> > -             bo->resource->start = addr >> PAGE_SHIFT;
> > +     if (addr != AMDGPU_BO_INVALID_OFFSET)
> >               return 0;
> > -     }
> >
> >       /* allocate GART space */
> >       placement.num_placement = 1;
>

  reply	other threads:[~2023-11-16  9:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 14:47 [PATCH] drm/amdgpu: fix AGP addressing when GART is not at 0 Alex Deucher
2023-11-10 14:50 ` Christian König
2023-11-12 18:13   ` Alex Deucher
2023-11-16  9:37     ` Zhang, Yifan [this message]
2023-11-16 14:25       ` Alex Deucher
2023-11-16 15:05         ` Zhang, Yifan
2023-11-10 15:02 Alex Deucher
2023-11-10 15:03 ` Christian König
2023-11-17 19:24   ` Alex Deucher
2023-11-20 16:16     ` Christian König
2023-11-11  3:18 ` Zhang, Yifan
2023-11-20 18:49 Alex Deucher

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=CY5PR12MB6369A027501FDC20699E31C7C1B0A@CY5PR12MB6369.namprd12.prod.outlook.com \
    --to=yifan1.zhang@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.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.