From eca775e22215bf1391c6327e2d89a25a41743fc3 Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Mon, 16 Sep 2024 15:33:20 +0200 Subject: [PATCH] gpu: host1x: Set up device DMA parameters In order to store device DMA parameters, the DMA framework depends on the device's dma_parms field to point at a valid memory location. Add backing storage for this in struct host1x_memory_context and point to it. Reported-by: Jonathan Hunter Reviewed-by: Christoph Hellwig Tested-by: Jon Hunter Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20240916133320.368620-1-thierry.reding@gmail.com (cherry picked from commit b4ad4ef374d66cc8df3188bb1ddb65bce5fc9e50) Bug 4876974 Signed-off-by: Jon Hunter Change-Id: I0a7f9c9f49a5e4580193d5814ff4a6a15f8014c8 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3268196 (cherry picked from commit 027ee6a9a0b3848fbaae21c788064f59072c0978) Signed-off-by: Paritosh Dixit Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3326864 GVS: buildbot_gerritrpt --- drivers/gpu/host1x/context.c | 3 ++- drivers/gpu/host1x/context.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c index aaef0bd6..dacaa026 100644 --- a/drivers/gpu/host1x/context.c +++ b/drivers/gpu/host1x/context.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2021-2024, NVIDIA Corporation. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #include @@ -57,6 +57,7 @@ int host1x_memory_context_list_init(struct host1x *host1x) ctx->dev.bus = &host1x_context_device_bus_type; ctx->dev.parent = host1x->dev; + ctx->dev.dma_parms = &ctx->dma_parms; dma_set_max_seg_size(&ctx->dev, UINT_MAX); err = device_add(&ctx->dev); diff --git a/drivers/gpu/host1x/context.h b/drivers/gpu/host1x/context.h index e2114cb4..1f734f0a 100644 --- a/drivers/gpu/host1x/context.h +++ b/drivers/gpu/host1x/context.h @@ -2,7 +2,7 @@ /* * Host1x context devices * - * Copyright (c) 2020, NVIDIA Corporation. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #ifndef __HOST1X_CONTEXT_H @@ -28,6 +28,7 @@ struct host1x_hw_memory_context { refcount_t ref; struct pid *owner; + struct device_dma_parameters dma_parms; struct device dev; u64 dma_mask; u32 stream_id;