Re: [PATCH v2 09/15] accel/qda: Add DMA-backed GEM objects and memory manager integration
Dmitry Baryshkov <[email protected]>
| Newsgroups | gmane.linux.documentation,gmane.linux.kernel,gmane.comp.video.dri.devel,gmane.linux.ports.arm.msm,gmane.linux.drivers.video-input-infrastructure |
|---|---|
| Message-ID | <pm5yr7fovkav4cuat5zqn3ngf2fxzrqutsgyaobwp5djv4xkuv@in7n4o3x3x6y> |
On Mon, Aug 17, 2026 at 10:17:44AM +0530, Ekansh Gupta wrote:
> Introduce DMA-coherent buffer management for the QDA driver, wiring
> together the GEM subsystem, the IOMMU memory manager, and a DMA
> allocation backend.
>
> +
> +/*
> + * The DSP identifies the IOMMU context bank from the upper bits of the address,
> + * so the stream ID is folded into every address handed to it. The DMA API only
> + * ever sees the plain 32-bit address, which is why the context bank devices are
> + * created with a 32-bit DMA mask.
> + */
> +static dma_addr_t get_actual_dma_addr(struct qda_gem_obj *gem_obj)
Let me propose a very simple rule for you. Unless you know what you are
doing, all function, struct and macro names should start with qda_. The
to_qda_foo(), I think, is the only example up to now where you don't need
to have the prefix.
> +{
> + return gem_obj->dma_addr - ((u64)gem_obj->iommu_dev->sid << 32);
> +}
> +
> +static void setup_gem_object(struct qda_gem_obj *gem_obj, void *virt,
> + dma_addr_t dma_addr, struct qda_iommu_device *iommu_dev)
> +{
> + gem_obj->virt = virt;
> + gem_obj->dma_addr = dma_addr;
> + gem_obj->iommu_dev = iommu_dev;
> +}
> +
> +static void cleanup_gem_object_fields(struct qda_gem_obj *gem_obj)
> +{
> + gem_obj->virt = NULL;
> + gem_obj->dma_addr = 0;
> + gem_obj->iommu_dev = NULL;
> +}
These functions are called only once. Inline them.
> +
--
With best wishes
Dmitry