Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: "Summers, Stuart" <stuart.summers@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Map both mem.kernel_bb_pool and usm.bb_pool
Date: Fri, 2 Feb 2024 17:53:35 +0000	[thread overview]
Message-ID: <Zb0sHwkNiM4aXl9N@DUT025-TGLU> (raw)
In-Reply-To: <d7537d1996d822493036d10a8be4d90a7bb4244f.camel@intel.com>

On Fri, Feb 02, 2024 at 09:58:32AM -0700, Summers, Stuart wrote:
> On Thu, 2024-02-01 at 19:34 -0800, Matthew Brost wrote:
> > For integrated devices we need to map both mem.kernel_bb_pool and
> > usm.bb_pool to be able to run batches from both pools.
> > 
> > Fixes: a682b6a42d4d ("drm/xe: Support device page faults on
> > integrated platforms")
> > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_gt.c      |  5 ++++-
> >  drivers/gpu/drm/xe/xe_migrate.c | 23 ++++++++++++++++++-----
> >  2 files changed, 22 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> > index 675a2927a19e..295cba1c688f 100644
> > --- a/drivers/gpu/drm/xe/xe_gt.c
> > +++ b/drivers/gpu/drm/xe/xe_gt.c
> > @@ -456,7 +456,10 @@ static int all_fw_domain_init(struct xe_gt *gt)
> >                  * USM has its only SA pool to non-block behind user
> > operations
> >                  */
> >                 if (gt_to_xe(gt)->info.has_usm) {
> > -                       gt->usm.bb_pool =
> > xe_sa_bo_manager_init(gt_to_tile(gt), SZ_1M, 16);
> > +                       struct xe_device *xe = gt_to_xe(gt);
> > +
> > +                       gt->usm.bb_pool =
> > xe_sa_bo_manager_init(gt_to_tile(gt),
> > +                                                               IS_DG
> > FX(xe) ? SZ_1M : SZ_512, 16);
> 
> Would it be better to use a modparam for this size/offset? What if we
> decide to change it at some point?
> 

That doesn't seem necessary.

> Also is this supposed to be SZ_512K?
> 

Yep, good catch. Didn't have a LNL to test this.

> >                         if (IS_ERR(gt->usm.bb_pool)) {
> >                                 err = PTR_ERR(gt->usm.bb_pool);
> >                                 goto err_force_wake;
> > diff --git a/drivers/gpu/drm/xe/xe_migrate.c
> > b/drivers/gpu/drm/xe/xe_migrate.c
> > index 9ab004871f9a..7465f8d14028 100644
> > --- a/drivers/gpu/drm/xe/xe_migrate.c
> > +++ b/drivers/gpu/drm/xe/xe_migrate.c
> > @@ -180,11 +180,6 @@ static int xe_migrate_prepare_vm(struct xe_tile
> > *tile, struct xe_migrate *m,
> >         if (!IS_DGFX(xe)) {
> >                 /* Write out batch too */
> >                 m->batch_base_ofs = NUM_PT_SLOTS * XE_PAGE_SIZE;
> > -               if (xe->info.has_usm) {
> > -                       batch = tile->primary_gt->usm.bb_pool->bo;
> > -                       m->usm_batch_base_ofs = m->batch_base_ofs;
> > -               }
> > -
> >                 for (i = 0; i < batch->size;
> >                      i += vm->flags & XE_VM_FLAG_64K ?
> > XE_64K_PAGE_SIZE :
> >                      XE_PAGE_SIZE) {
> > @@ -195,6 +190,24 @@ static int xe_migrate_prepare_vm(struct xe_tile
> > *tile, struct xe_migrate *m,
> >                                   entry);
> >                         level++;
> >                 }
> > +               if (xe->info.has_usm) {
> > +                       xe_tile_assert(tile, batch->size == SZ_1M);
> > +
> > +                       batch = tile->primary_gt->usm.bb_pool->bo;
> > +                       m->usm_batch_base_ofs = m->batch_base_ofs +
> > SZ_1M;
> 
> Same here.
>

Yep.
 
> > +                       xe_tile_assert(tile, batch->size == SZ_512);
> 
> And here.
> 

Yep.

Matt

> Thanks,
> Stuart
> 
> > +
> > +                       for (i = 0; i < batch->size;
> > +                            i += vm->flags & XE_VM_FLAG_64K ?
> > XE_64K_PAGE_SIZE :
> > +                            XE_PAGE_SIZE) {
> > +                               entry = vm->pt_ops-
> > >pte_encode_bo(batch, i,
> > +                                                                
> > pat_index, 0);
> > +
> > +                               xe_map_wr(xe, &bo->vmap, map_ofs +
> > level * 8, u64,
> > +                                         entry);
> > +                               level++;
> > +                       }
> > +               }
> >         } else {
> >                 u64 batch_addr = xe_bo_addr(batch, 0, XE_PAGE_SIZE);
> >  
> 

  reply	other threads:[~2024-02-02 17:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02  3:34 [PATCH] drm/xe: Map both mem.kernel_bb_pool and usm.bb_pool Matthew Brost
2024-02-02  3:37 ` ✓ CI.Patch_applied: success for " Patchwork
2024-02-02  3:37 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-02  3:38 ` ✓ CI.KUnit: success " Patchwork
2024-02-02  3:45 ` ✓ CI.Build: " Patchwork
2024-02-02  3:45 ` ✓ CI.Hooks: " Patchwork
2024-02-02  3:47 ` ✓ CI.checksparse: " Patchwork
2024-02-02  4:09 ` ✓ CI.BAT: " Patchwork
2024-02-02 16:58 ` [PATCH] " Summers, Stuart
2024-02-02 17:53   ` Matthew Brost [this message]
2024-02-02 19:05 ` Welty, Brian

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=Zb0sHwkNiM4aXl9N@DUT025-TGLU \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=stuart.summers@intel.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