From: Icenowy Zheng <uwu@icenowy.me>
To: Christian Koenig <christian.koenig@amd.com>,
Huang Rui <ray.huang@amd.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Icenowy Zheng <uwu@icenowy.me>
Subject: [RFC PATCH 1/2] drm/ttm: save the device's DMA coherency status in ttm_device
Date: Sat, 29 Jun 2024 13:22:46 +0800 [thread overview]
Message-ID: <20240629052247.2653363-2-uwu@icenowy.me> (raw)
In-Reply-To: <20240629052247.2653363-1-uwu@icenowy.me>
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@icenowy.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
next prev parent reply other threads:[~2024-06-29 5:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-29 5:22 [RFC PATCH 0/2] drm/ttm: support device w/o coherency Icenowy Zheng
2024-06-29 5:22 ` Icenowy Zheng [this message]
2024-06-29 5:22 ` [RFC PATCH 2/2] drm/ttm: downgrade cached to write_combined when snooping not available Icenowy Zheng
2024-06-29 19:57 ` Jiaxun Yang
2024-06-29 20:51 ` Icenowy Zheng
2024-07-01 11:40 ` Christian König
2024-07-01 11:52 ` Jiaxun Yang
2024-07-01 12:10 ` Christian König
2024-07-02 1:46 ` Icenowy Zheng
[not found] ` <ff1bf596-83cb-4b3e-a33a-621ac2c8171c@amd.com>
2024-07-02 9:06 ` Icenowy Zheng
[not found] ` <ae7085fd-3bca-4a4a-b465-5e4941011877@amd.com>
2024-07-02 10:01 ` Icenowy Zheng
2024-07-02 10:03 ` Jiaxun Yang
2024-07-03 8:52 ` PCIe coherency in spec (was: [RFC PATCH 2/2] drm/ttm: downgrade cached to write_combined when snooping not available) Jiaxun Yang
2024-07-03 21:08 ` Bjorn Helgaas
2024-07-04 2:00 ` Icenowy Zheng
2024-07-04 6:11 ` Christoph Hellwig
2024-07-04 6:40 ` Icenowy Zheng
2024-07-04 6:44 ` Christoph Hellwig
[not found] ` <4e958aa5-2a56-4754-b3dd-273da95f1d14@amd.com>
2024-07-02 9:36 ` [RFC PATCH 2/2] drm/ttm: downgrade cached to write_combined when snooping not available Icenowy Zheng
2024-06-30 6:52 ` Icenowy Zheng
2024-07-01 11:37 ` [RFC PATCH 0/2] drm/ttm: support device w/o coherency Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240629052247.2653363-2-uwu@icenowy.me \
--to=uwu@icenowy.me \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ray.huang@amd.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®