[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZWi3WzM6kYRotWrd@google.com>
Date: Thu, 30 Nov 2023 16:24:59 +0000
From: Paz Zcharya <pazz@...omium.org>
To: Andrzej Hajda <andrzej.hajda@...el.com>
Cc: Subrata Banik <subratabanik@...gle.com>,
Tvrtko Ursulin <tvrtko.ursulin@...el.com>,
intel-gfx@...ts.freedesktop.org,
Marcin Wojtas <mwojtas@...omium.org>,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
Sean Paul <seanpaul@...omium.org>, matthew.auld@...el.com,
Daniel Vetter <daniel@...ll.ch>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Drew Davenport <ddavenport@...omium.org>,
David Airlie <airlied@...il.com>,
Nirmoy Das <nirmoy.das@...el.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be
relative not absolute
On Tue, Nov 28, 2023 at 12:12:08PM +0100, Andrzej Hajda wrote:
> On 28.11.2023 04:47, Paz Zcharya wrote:
> >
> > On Mon, Nov 27, 2023 at 8:20 PM Paz Zcharya <pazz@...omium.org> wrote:
> > >
> > > On 21.11.2023 13:06, Andrzej Hajda wrote:
> > >
> > > > The simplest approach would be then do the same as in case of DGFX:
> > > > gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm;
> > > > gen8_pte_t pte;
> > > >
> > > > gte += base / I915_GTT_PAGE_SIZE;
> > > >
> > > > pte = ioread64(gte);
> > > > phys_base = pte & I915_GTT_PAGE_MASK;
> > > >
> > > > Regards
> > > > Andrzej
> >
> > Hey Andrzej,
> >
> > On a second thought, what do you think about something like
> >
> > + gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm;
> > + gen8_pte_t pte;
> > + gte += base / I915_GTT_PAGE_SIZE;
> > + pte = ioread64(gte);
> > + pte = pte & I915_GTT_PAGE_MASK;
> > + phys_base = pte - i915->mm.stolen_region->region.start;
> >
> > The only difference is the last line.
>
> Bingo :) It seems to be generic algorithm to get phys_base for all
> platforms:
> - on older platforms stolen_region points to system memory which starts at
> 0,
> - on DG2 it uses lmem region which starts at 0 as well,
> - on MTL stolen_region points to stolen-local which starts at 0x800000.
>
> So this whole "if (IS_DGFX(i915)) {...} else {...}" could be replaced
> with sth generic.
> 1. Find pte.
> 2. if(IS_DGFX(i915) && pte & GEN12_GGTT_PTE_LM) mem =
> i915->mm.regions[INTEL_REGION_LMEM_0] else mem = i915->mm.stolen_region
> 3. phys_base = (pte & I915_GTT_PAGE_MASK) - mem->region.start;
>
> Regards
> Andrzej
>
>
Hey Andrzej,
I uploaded https://patchwork.freedesktop.org/series/127130/ based on
algorithm. Please take a look and let me know if you'd like me to change
anything.
Really appreciate all of your help!
Best,
Paz
Powered by blists - more mailing lists