Message ID | 20230914-rockchip-rga-multiplanar-v1-6-abfd77260ae3@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: rockchip: rga: add support for multi-planar formats | expand |
On 2023-09-14 13:40, Michael Tretter wrote: > The RGA DMA descriptor list contains only 32-bit addresses. Set the > dma_mask to only allocate memory that is addressable by the descriptors. > > This prevents errors when preparing vb2 buffers that were allocated by > the RGA. Imported buffers may still fail the preparation, as they may be > allocated above the 4 GB boundary. > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> > --- > drivers/media/platform/rockchip/rga/rga.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c > index f18fccc7b204..149deb1f1e03 100644 > --- a/drivers/media/platform/rockchip/rga/rga.c > +++ b/drivers/media/platform/rockchip/rga/rga.c > @@ -824,6 +824,12 @@ static int rga_probe(struct platform_device *pdev) > goto err_put_clk; > } > > + ret = dma_set_mask(rga->dev, DMA_BIT_MASK(32)); You want dma_set_mask_and_coherent(), given that you are using coherent allocations as well. The driver's getting away with it since the default masks happen to be 32-bit anyway, but it's better to be explicit. Thanks, Robin. > + if (ret) { > + dev_err(rga->dev, "32-bit DMA not supported"); > + goto err_put_clk; > + } > + > ret = v4l2_device_register(&pdev->dev, &rga->v4l2_dev); > if (ret) > goto err_put_clk; >
diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index f18fccc7b204..149deb1f1e03 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -824,6 +824,12 @@ static int rga_probe(struct platform_device *pdev) goto err_put_clk; } + ret = dma_set_mask(rga->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(rga->dev, "32-bit DMA not supported"); + goto err_put_clk; + } + ret = v4l2_device_register(&pdev->dev, &rga->v4l2_dev); if (ret) goto err_put_clk;
The RGA DMA descriptor list contains only 32-bit addresses. Set the dma_mask to only allocate memory that is addressable by the descriptors. This prevents errors when preparing vb2 buffers that were allocated by the RGA. Imported buffers may still fail the preparation, as they may be allocated above the 4 GB boundary. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> --- drivers/media/platform/rockchip/rga/rga.c | 6 ++++++ 1 file changed, 6 insertions(+)