AMD General Hi Christian,
> -----Original Message----- > From: Koenig, Christian <[email protected]> > Sent: Thursday, July 2, 2026 4:23 PM > To: SHANMUGAM, SRINIVASAN <[email protected]>; > Deucher, Alexander <[email protected]> > Cc: [email protected] > Subject: Re: [PATCH v3 1/4] drm/amdgpu: Add PASID fpriv ownership helpers > > On 7/2/26 10:40, Srinivasan Shanmugam wrote: > > AMDGPU already has a global PASID xarray used by the PASID allocator. > > > > Currently allocated PASIDs store a dummy value in that xarray. > > > > Add helper functions so DRM-owned PASIDs can store and retrieve their > > owning DRM file-private object. > > > > This prepares for using: > > > > PASID -> fpriv -> vm > > > > instead of the separate per-device: > > > > PASID -> vm > > > > mapping. > > > > v3: (per Christian) > > - Document that PASID allocation is intentionally kept separate > > from fpriv registration because fpriv is not fully initialized > > when the PASID is allocated. > > > > Cc: Alex Deucher <[email protected]> > > Suggested-by: Christian König <[email protected]> > > Signed-off-by: Srinivasan Shanmugam <[email protected]> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 126 > > ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h | > > 13 +++ > > 2 files changed, 139 insertions(+) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c > > index 684f40fce73f..5333937f0d04 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c > > @@ -78,6 +78,132 @@ int amdgpu_pasid_alloc(unsigned int bits) > > return pasid; > > } > > > > +/** > > + * amdgpu_pasid_set_fpriv - register the DRM owner of a PASID > > + * @pasid: PASID allocated for the DRM client > > + * @fpriv: owning DRM file-private object > > + * > > + * PASID allocation is intentionally kept separate from owner > > + * registration because the DRM file-private object is not fully > > + * initialized when the PASID is allocated. > > + * > > + * This helper replaces the temporary allocation marker with the > > + * initialized DRM owner. > > Taking a closer look at I think we should rather re-structure the fprif init > code to > allocate the pasid later. Thanks! Just to make sure I understand the intended initialization order correctly: when you say "allocate the PASID later", do you mean moving the PASID allocation until after fpriv has been fully initialized in amdgpu_driver_open_kms(), so that amdgpu_pasid_alloc() can directly register the fpriv without a separate amdgpu_pasid_set_fpriv() step? Best regards, Srini
