From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Subject: [RFC PATCH 2/3] drm/xe: Set the bits in PASID to enable ATS.
Date: Mon, 26 Jan 2026 13:52:06 +0100 [thread overview]
Message-ID: <20260126125207.1119351-3-dev@lankhorst.se> (raw)
In-Reply-To: <20260126125207.1119351-1-dev@lankhorst.se>
If the PCI device claims to support ATS, use it and set the
relevant bits in the context.
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 1 +
drivers/gpu/drm/xe/xe_lrc.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
index b5eff383902c5..959b3f7db91f6 100644
--- a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
+++ b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
@@ -18,6 +18,7 @@
#define CTX_TIMESTAMP_UDW (0x24 + 1)
#define CTX_INDIRECT_RING_STATE (0x26 + 1)
#define CTX_ACC_CTR_THOLD (0x2a + 1)
+#define CTX_SYS_PASID (0x2c + 1)
#define CTX_ASID (0x2e + 1)
#define CTX_PDP0_UDW (0x30 + 1)
#define CTX_PDP0_LDW (0x32 + 1)
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index f4f31bc240d93..fa911ea80c772 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -32,6 +32,8 @@
#include "xe_vm.h"
#include "xe_wa.h"
+#define LRC_SYS_PASID_ENABLE_ATS BIT(31)
+
#define LRC_VALID BIT_ULL(0)
#define LRC_PRIVILEGE BIT_ULL(8)
#define LRC_ADDRESSING_MODE GENMASK_ULL(4, 3)
@@ -1557,6 +1559,10 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
if (xe->info.has_asid && vm)
xe_lrc_write_ctx_reg(lrc, CTX_ASID, vm->usm.asid);
+ /* If possible, enable ATS to offload the IOMMU TLB */
+ if (to_pci_dev(xe->drm.dev)->ats_enabled)
+ xe_lrc_write_ctx_reg(lrc, CTX_SYS_PASID, LRC_SYS_PASID_ENABLE_ATS);
+
lrc->desc = LRC_VALID;
lrc->desc |= FIELD_PREP(LRC_ADDRESSING_MODE, LRC_LEGACY_64B_CONTEXT);
/* TODO: Priority */
--
2.51.0
next prev parent reply other threads:[~2026-01-26 12:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 12:52 [RFC PATCH 0/3] drm/xe: Enable ATS Maarten Lankhorst
2026-01-26 12:52 ` [RFC PATCH 1/3] drm/xe: Force page fault Maarten Lankhorst
2026-01-26 12:52 ` Maarten Lankhorst [this message]
2026-01-26 12:52 ` [RFC PATCH 3/3] drm/xe: Add migration selftest for validating job submission and basic features work Maarten Lankhorst
2026-01-26 19:19 ` Matthew Brost
2026-01-26 12:58 ` ✗ CI.checkpatch: warning for drm/xe: Enable ATS Patchwork
2026-01-26 13:00 ` ✓ CI.KUnit: success " Patchwork
2026-01-26 13:38 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-01-26 14:32 ` ✗ Xe.CI.Full: " Patchwork
2026-01-26 23:23 ` [RFC PATCH 0/3] " Matthew Brost
2026-01-27 8:01 ` ✗ Xe.CI.BAT: failure for " Patchwork
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=20260126125207.1119351-3-dev@lankhorst.se \
--to=dev@lankhorst.se \
--cc=intel-xe@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