]> asedeno.scripts.mit.edu Git - linux.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)
committerThierry Reding <treding@nvidia.com>
Wed, 5 Jun 2019 13:06:03 +0000 (15:06 +0200)
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>
drivers/gpu/host1x/bus.c
include/linux/host1x.h

index 103fffc1904bbea71d0bf5535a7938bc41b0ec53..c9a637d9417e289412559ed4579a6d4d1a2dc16a 100644 (file)
@@ -425,6 +425,9 @@ static int host1x_device_add(struct host1x *host1x,
 
        of_dma_configure(&device->dev, host1x->dev->of_node, true);
 
+       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 89110d896d72d7573df5140b7613f48d9b9ea5e4..aef6e2f738027a03d81bb08769f9f5951aeba7de 100644 (file)
@@ -310,6 +310,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)