]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
gpu: host1x: Increase maximum DMA segment size
authorThierry Reding <treding@nvidia.com>
Wed, 5 Jun 2019 08:46:05 +0000 (10:46 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1839213
[ Upstream commit 1e390478cfb527e34c9ab89ba57212cb05c33c51 ]

Recent versions of the DMA API debug code have started to warn about
violations of the maximum DMA segment size. This is because the segment
size defaults to 64 KiB, which can easily be exceeded in large buffer
allocations such as used in DRM/KMS for framebuffers.

Technically the Tegra SMMU and ARM SMMU don't have a maximum segment
size (they map individual pages irrespective of whether they are
contiguous or not), so the choice of 4 MiB is a bit arbitrary here. The
maximum segment size is a 32-bit unsigned integer, though, so we can't
set it to the correct maximum size, which would be the size of the
aperture.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/gpu/host1x/bus.c
include/linux/host1x.h

index 2e57c9cea696e317ae67a5ee9a7eb2b512fb2cf7..50a8ac9a7a988f645869222e34df0a499d3e0124 100644 (file)
@@ -411,6 +411,9 @@ static int host1x_device_add(struct host1x *host1x,
 
        of_dma_configure(&device->dev, host1x->dev->of_node);
 
+       device->dev.dma_parms = &device->dma_parms;
+       dma_set_max_seg_size(&device->dev, SZ_4M);
+
        err = host1x_device_parse_dt(device, driver);
        if (err < 0) {
                kfree(device);
index ddf7f9ca86ccd6fe3702a14b78322bae7161fe83..e0a360d5833c346793ea48c9be70e3013ec3104b 100644 (file)
@@ -322,6 +322,8 @@ struct host1x_device {
        struct list_head clients;
 
        bool registered;
+
+       struct device_dma_parameters dma_parms;
 };
 
 static inline struct host1x_device *to_host1x_device(struct device *dev)