Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Michal Wajdeczko" <michal.wajdeczko@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Matt Roper" <matthew.d.roper@intel.com>
Subject: [PATCH v2] drm/xe: Use ttm_uncached for BO with NEEDS_UC flag
Date: Tue, 18 Jun 2024 12:49:47 +0200	[thread overview]
Message-ID: <20240618104947.729-1-michal.wajdeczko@intel.com> (raw)

We should honor requested uncached mode also at the TTM layer.
Otherwise, we risk losing updates to the memory based interrupts
source or status vectors, as those require uncached memory.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
---
v2: assert that cpu_caching is unset (Matt)
---
 drivers/gpu/drm/xe/xe_bo.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 74294f1b05bc..65c696966e96 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -378,6 +378,15 @@ static struct ttm_tt *xe_ttm_tt_create(struct ttm_buffer_object *ttm_bo,
 	    (xe->info.graphics_verx100 >= 1270 && bo->flags & XE_BO_FLAG_PAGETABLE))
 		caching = ttm_write_combined;
 
+	if (bo->flags & XE_BO_FLAG_NEEDS_UC) {
+		/*
+		 * Valid only for internally-created buffers only, for
+		 * which cpu_caching is never initialized.
+		 */
+		xe_assert(xe, bo->cpu_caching == 0);
+		caching = ttm_uncached;
+	}
+
 	err = ttm_tt_init(&tt->ttm, &bo->ttm, page_flags, caching, extra_pages);
 	if (err) {
 		kfree(tt);
-- 
2.43.0


             reply	other threads:[~2024-06-18 10:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 10:49 Michal Wajdeczko [this message]
2024-06-18 10:55 ` ✓ CI.Patch_applied: success for drm/xe: Use ttm_uncached for BO with NEEDS_UC flag (rev2) Patchwork
2024-06-18 10:55 ` ✓ CI.checkpatch: " Patchwork
2024-06-18 10:56 ` ✓ CI.KUnit: " Patchwork
2024-06-18 11:08 ` ✓ CI.Build: " Patchwork
2024-06-18 11:10 ` ✗ CI.Hooks: failure " Patchwork
2024-06-18 11:11 ` ✓ CI.checksparse: success " Patchwork
2024-06-18 11:35 ` ✗ CI.BAT: failure " Patchwork
2024-06-18 11:42   ` Michal Wajdeczko
2024-06-18 19:16 ` [PATCH v2] drm/xe: Use ttm_uncached for BO with NEEDS_UC flag Matt Roper
2024-06-18 22:46 ` ✗ CI.FULL: failure for drm/xe: Use ttm_uncached for BO with NEEDS_UC flag (rev2) Patchwork
2024-06-19 11:22   ` Michal Wajdeczko

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=20240618104947.729-1-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /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