Skip to content

Commit 86044e7

Browse files
committed
drm/tegra: dc: Inherit DMA mask
Inherit the DMA mask from host1x (on Tegra210 and earlier) or the display hub (on Tegra186 and later). This is necessary in order to properly map buffers without SMMU support and use the maximum IOVA space available with SMMU support. Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 933deb8 commit 86044e7

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/gpu/drm/tegra/dc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,9 +2538,16 @@ static int tegra_dc_couple(struct tegra_dc *dc)
25382538

25392539
static int tegra_dc_probe(struct platform_device *pdev)
25402540
{
2541+
u64 dma_mask = dma_get_mask(pdev->dev.parent);
25412542
struct tegra_dc *dc;
25422543
int err;
25432544

2545+
err = dma_coerce_mask_and_coherent(&pdev->dev, dma_mask);
2546+
if (err < 0) {
2547+
dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
2548+
return err;
2549+
}
2550+
25442551
dc = devm_kzalloc(&pdev->dev, sizeof(*dc), GFP_KERNEL);
25452552
if (!dc)
25462553
return -ENOMEM;

drivers/gpu/drm/tegra/hub.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,19 @@ static const struct host1x_client_ops tegra_display_hub_ops = {
848848

849849
static int tegra_display_hub_probe(struct platform_device *pdev)
850850
{
851+
u64 dma_mask = dma_get_mask(pdev->dev.parent);
851852
struct device_node *child = NULL;
852853
struct tegra_display_hub *hub;
853854
struct clk *clk;
854855
unsigned int i;
855856
int err;
856857

858+
err = dma_coerce_mask_and_coherent(&pdev->dev, dma_mask);
859+
if (err < 0) {
860+
dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
861+
return err;
862+
}
863+
857864
hub = devm_kzalloc(&pdev->dev, sizeof(*hub), GFP_KERNEL);
858865
if (!hub)
859866
return -ENOMEM;

0 commit comments

Comments
 (0)