From: Lyude Paul <lyude@redhat.com>
To: nouveau@lists.freedesktop.org
Cc: Christoph Hellwig <hch@lst.de>, Ben Skeggs <bskeggs@redhat.com>,
Karol Herbst <kherbst@redhat.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org (open list:DRM DRIVER FOR NVIDIA
GEFORCE/QUADRO GPUS), linux-kernel@vger.kernel.org (open list)
Subject: [RFC] drm/nouveau/ttm: Stop calling into swiotlb
Date: Thu, 28 Jul 2022 18:05:44 -0400 [thread overview]
Message-ID: <20220728220545.163763-1-lyude@redhat.com> (raw)
Per the request of some of the DMA folks, some of the swiotlb helpers are
being sunset in favor of better alternatives that don't involve layer
mixing. Since it seems like we can actually replace the one thing we use
swiotlb for pretty easily, e.g. checking whether or not we are capable of
coherent allocations using is_swiotlb_active().
So, let's do this by replacing is_swiotlb_active() with our own
nouveau_drm_use_coherent_gpu_mapping() helper.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
---
Hey! This is the patch that I came up with, but as the folks involved
with this thread can probably tell I'm not entirely sure this is
correct?
Also, someone more knowledgeable about mm with nouveau should probably
verify this as well
drivers/gpu/drm/nouveau/nouveau_ttm.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 85f1f5a0fe5d..ab7ccba1d601 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -24,7 +24,6 @@
*/
#include <linux/limits.h>
-#include <linux/swiotlb.h>
#include <drm/ttm/ttm_range_manager.h>
@@ -241,7 +240,6 @@ nouveau_ttm_init(struct nouveau_drm *drm)
struct nvkm_pci *pci = device->pci;
struct nvif_mmu *mmu = &drm->client.mmu;
struct drm_device *dev = drm->dev;
- bool need_swiotlb = false;
int typei, ret;
ret = nouveau_ttm_init_host(drm, 0);
@@ -276,14 +274,11 @@ nouveau_ttm_init(struct nouveau_drm *drm)
drm->agp.cma = pci->agp.cma;
}
-#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
- need_swiotlb = is_swiotlb_active(dev->dev);
-#endif
-
ret = ttm_device_init(&drm->ttm.bdev, &nouveau_bo_driver, drm->dev->dev,
- dev->anon_inode->i_mapping,
- dev->vma_offset_manager, need_swiotlb,
- drm->client.mmu.dmabits <= 32);
+ dev->anon_inode->i_mapping,
+ dev->vma_offset_manager,
+ nouveau_drm_use_coherent_gpu_mapping(drm),
+ drm->client.mmu.dmabits <= 32);
if (ret) {
NV_ERROR(drm, "error initialising bo driver, %d\n", ret);
return ret;
--
2.35.3
next reply other threads:[~2022-07-28 22:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 22:05 Lyude Paul [this message]
2022-07-29 13:12 ` [RFC] drm/nouveau/ttm: Stop calling into swiotlb Christoph Hellwig
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=20220728220545.163763-1-lyude@redhat.com \
--to=lyude@redhat.com \
--cc=airlied@linux.ie \
--cc=bskeggs@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
/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