[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240629052247.2653363-2-uwu@icenowy.me>
Date: Sat, 29 Jun 2024 13:22:46 +0800
From: Icenowy Zheng <uwu@...nowy.me>
To: Christian Koenig <christian.koenig@....com>,
Huang Rui <ray.huang@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Jiaxun Yang <jiaxun.yang@...goat.com>
Cc: dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Icenowy Zheng <uwu@...nowy.me>
Subject: [RFC PATCH 1/2] drm/ttm: save the device's DMA coherency status in ttm_device
Currently TTM utilizes cached memory regardless of whether the device
have full DMA coherency (can snoop CPU cache).
Save the device's DMA coherency status in struct ttm_device, to allow
further support of devices w/o snooping capability (the capability
missing on at least one part of the transmission between the CPU and the
device).
Signed-off-by: Icenowy Zheng <uwu@...nowy.me>
---
drivers/gpu/drm/ttm/ttm_device.c | 2 ++
include/drm/ttm/ttm_device.h | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
index 434cf0258000e..b923c14861c1a 100644
--- a/drivers/gpu/drm/ttm/ttm_device.c
+++ b/drivers/gpu/drm/ttm/ttm_device.c
@@ -237,6 +237,8 @@ int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *func
list_add_tail(&bdev->device_list, &glob->device_list);
mutex_unlock(&ttm_global_mutex);
+ bdev->dma_coherent = dev->dma_coherent;
+
return 0;
}
EXPORT_SYMBOL(ttm_device_init);
diff --git a/include/drm/ttm/ttm_device.h b/include/drm/ttm/ttm_device.h
index c22f30535c848..9daf7f47d6507 100644
--- a/include/drm/ttm/ttm_device.h
+++ b/include/drm/ttm/ttm_device.h
@@ -225,6 +225,11 @@ struct ttm_device {
*/
const struct ttm_device_funcs *funcs;
+ /**
+ * @dma_coherent: if the device backed is dma-coherent.
+ */
+ bool dma_coherent;
+
/**
* @sysman: Resource manager for the system domain.
* Access via ttm_manager_type.
--
2.45.2
Powered by blists - more mailing lists