All of lore.kernel.org
 help / color / mirror / Atom feed
  • * Re: [PATCH v1 1/9] drm/amdgpu: add spm_vmid and exclude it from the MES and KFD pools
           [not found] <20260928185756.2382322-1-sunil.khatri@amd.com>
           [not found] ` <20260928185756.2382322-2-sunil.khatri@amd.com>
    @ 2026-09-29 11:54 ` Christian König
      2026-09-29 17:39   ` Khatri, Sunil
           [not found] ` <20260928185756.2382322-3-sunil.khatri@amd.com>
           [not found] ` <20260928185756.2382322-9-sunil.khatri@amd.com>
      3 siblings, 1 reply; 10+ messages in thread
    From: Christian König @ 2026-09-29 11:54 UTC (permalink / raw)
      To: Sunil Khatri, Alex Deucher, Zhu James, Felix Kuehling, Ma Bing; +Cc: amd-gfx
    
    On 9/28/26 20:57, Sunil Khatri wrote:
    > The SPM (Streaming Performance Monitor) path needs a VMID that is
    > isolated from other GPU contexts. Introduce vm_manager.spm_vmid to let a
    > GFXHUB dedicate a VMID to SPM.
    > 
    > When spm_vmid is set, remove that VMID from the MES user-queue mask and
    > from the KFD compute pool so that neither MES firmware nor KFD ever maps
    > another context onto it. KFD derives its VMID range from the shared
    > compute_vmid_bitmap via ffs()/fls(), so clearing the bit there is
    > sufficient and needs no change inside the KFD subsystem.
    > 
    > The field defaults to 0 (unused), so this is a no-op until a generation
    > opts in by setting spm_vmid.
    > 
    > Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
    > ---
    >  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++++
    >  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c    | 3 +++
    >  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h     | 2 ++
    >  3 files changed, 9 insertions(+)
    > 
    > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
    > index afcfb92fb9f5f..71e47bdf11393 100644
    > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
    > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
    > @@ -207,6 +207,10 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
    >  		for (i = last_valid_bit; i < AMDGPU_MAX_QUEUES; ++i)
    >  			clear_bit(i, gpu_resources.cp_queue_bitmap);
    >  
    > +		if (adev->vm_manager.spm_vmid)
    > +			gpu_resources.compute_vmid_bitmap &=
    > +				~BIT(adev->vm_manager.spm_vmid);
    > +
    
    That is quite a mess.
    
    >  		amdgpu_doorbell_get_kfd_info(adev,
    >  				&gpu_resources.doorbell_physical_address,
    >  				&gpu_resources.doorbell_aperture_size,
    > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
    > index 22ecb70fec2cd..afb56a2f9672b 100644
    > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
    > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
    > @@ -134,6 +134,9 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
    >  	adev->mes.vmid_mask_mmhub = 0xFF00;
    >  	adev->mes.vmid_mask_gfxhub = total_vmid_mask & ~reserved_vmid_mask;
    >  
    > +	if (adev->vm_manager.spm_vmid)
    > +		adev->mes.vmid_mask_gfxhub &= ~BIT(adev->vm_manager.spm_vmid);
    
    Please remove the vmid_mask_gfxhub field from the MES structure if possible and move all of that into adev->vm_manager or adev->vm_manager.id_mgr instead.
    
    Regards,
    Christian.
    
    > +
    >  	num_pipes = adev->gfx.me.num_pipe_per_me * adev->gfx.me.num_me;
    >  	if (num_pipes > AMDGPU_MES_MAX_GFX_PIPES)
    >  		dev_warn(adev->dev, "more gfx pipes than supported by MES! (%d vs %d)\n",
    > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
    > index 0f6634b749746..57070da337750 100644
    > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
    > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
    > @@ -414,6 +414,8 @@ struct amdgpu_vm_manager {
    >  	/* Global registration of recent page fault information */
    >  	struct amdgpu_vm_fault_info	fault_info;
    >  	unsigned int				npa_vmid;
    > +	/* VMID reserved for SPM, 0 if unused */
    > +	unsigned int				spm_vmid;
    >  };
    >  
    >  struct amdgpu_bo_va_mapping;
    
    
    ^ permalink raw reply	[flat|nested] 10+ messages in thread
  • [parent not found: <20260928185756.2382322-3-sunil.khatri@amd.com>]
  • [parent not found: <20260928185756.2382322-9-sunil.khatri@amd.com>]

  • end of thread, other threads:[~2026-09-30  6:40 UTC | newest]
    
    Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <20260928185756.2382322-1-sunil.khatri@amd.com>
         [not found] ` <20260928185756.2382322-2-sunil.khatri@amd.com>
    2026-09-29 11:48   ` [PATCH v1 2/9] drm/amdgpu: hand out the dedicated SPM VMID from the reserved path Christian König
    2026-09-29 17:41     ` Khatri, Sunil
    2026-09-29 11:54 ` [PATCH v1 1/9] drm/amdgpu: add spm_vmid and exclude it from the MES and KFD pools Christian König
    2026-09-29 17:39   ` Khatri, Sunil
         [not found] ` <20260928185756.2382322-3-sunil.khatri@amd.com>
    2026-09-29 11:59   ` [PATCH v1 3/9] drm/amdgpu: reserve SPM VMID on gfx7 Christian König
         [not found] ` <20260928185756.2382322-9-sunil.khatri@amd.com>
    2026-09-29 12:04   ` [PATCH v1 9/9] drm/amdgpu: use spm_vmid for the default RLC SPM VMID Christian König
    2026-09-29 14:56     ` Mukul Joshi
    2026-09-29 17:13       ` Khatri, Sunil
    2026-09-30  6:40         ` Christian König
    2026-09-29 17:40     ` Khatri, Sunil
    

    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.