Re: [PATCH RFC 06/18] accel/qda: Add memory manager for CB devices

From: Dmitry Baryshkov

Date: Tue Mar 03 2026 - 23:22:27 EST


On Mon, Mar 02, 2026 at 01:45:09PM +0530, Ekansh Gupta wrote:
>
>
> On 2/24/2026 4:20 AM, Dmitry Baryshkov wrote:
> > On Tue, Feb 24, 2026 at 12:39:00AM +0530, Ekansh Gupta wrote:
> >> Introduce a per-device memory manager for the QDA driver that tracks
> >> IOMMU-capable compute context-bank (CB) devices. Each CB device is
> >> represented by a qda_iommu_device and registered with a central
> >> qda_memory_manager instance owned by qda_dev.
> >>
> >> The memory manager maintains an xarray of devices and assigns a
> >> unique ID to each CB. It also provides basic lifetime management
> > Sounds like IDR.
> I was planning to stick with xarray accross QDA as IDR gives checkpatch warnings.

Ack.

> >
> >> and a workqueue for deferred device removal. qda_cb_setup_device()
> > What is deferred device removal? Why do you need it?
> This is not needed, I was trying some experiment in my initial design(CB aggregation),
> but it's not needed now, I'll remove this.

Ack

> >
> >> now allocates a qda_iommu_device for each CB and registers it with
> >> the memory manager after DMA configuration succeeds.
> >>
> >> qda_init_device() is extended to allocate and initialize the memory
> >> manager, while qda_deinit_device() will tear it down in later
> >> patches. This prepares the QDA driver for fine-grained memory and
> >> IOMMU domain management tied to individual CB devices.
> >>
> >> Signed-off-by: Ekansh Gupta <ekansh.gupta@xxxxxxxxxxxxxxxx>
> >> ---
> >> drivers/accel/qda/Makefile | 1 +
> >> drivers/accel/qda/qda_cb.c | 32 +++++++
> >> drivers/accel/qda/qda_drv.c | 46 ++++++++++
> >> drivers/accel/qda/qda_drv.h | 3 +
> >> drivers/accel/qda/qda_memory_manager.c | 152 +++++++++++++++++++++++++++++++++
> >> drivers/accel/qda/qda_memory_manager.h | 101 ++++++++++++++++++++++
> >> 6 files changed, 335 insertions(+)
> >>
>

--
With best wishes
Dmitry