Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: himal.prasad.ghimiray@intel.com,
	Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Subject: [PATCH 3/6] drm/xe/vm: add helper to retrieve VM SVA PASID
Date: Wed, 21 Oct 2026 09:41:14 +0530	[thread overview]
Message-ID: <20261021041117.1774877-4-naresh.kumar.g@intel.com> (raw)
In-Reply-To: <20261021041117.1774877-1-naresh.kumar.g@intel.com>

Add xe_vm_get_sva_pasid() to return the PASID associated with a VM SVA
binding.

The helper checks whether the VM has a valid SVA handle and, if so,
returns the PASID obtained from iommu_sva_get_pasid(). If no SVA handle
is present, return -EINVAL.

Export the helper in xe_vm.h so other XE components can query the VM's
PASID when programming per-context state.

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 16 ++++++++++++++++
 drivers/gpu/drm/xe/xe_vm.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index b1d37e5a673f..dcaeeeb94721 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1649,6 +1649,22 @@ static void xe_vm_init_prove_locking(struct xe_device *xe, struct xe_vm *vm)
 	up_read(&vm->exec_queues.lock);
 }
 
+/**
+ * xe_vm_get_sva_pasid() - get sva pasid for the vm if allocated
+ * @vm: The vm to get valid sva_handle
+ *
+ * Helper to get associated pasid for the vm which uses svm.
+ *
+ * Return: %pasid value on Success. -EINVAL if not pasid available.
+ */
+int xe_vm_get_sva_pasid(struct xe_vm *vm)
+{
+	if (!vm || !vm->sva_handle)
+		return -EINVAL;
+
+	return iommu_sva_get_pasid(vm->sva_handle);
+}
+
 static void xe_vm_sva_handle_init(struct xe_vm *vm)
 {
 	struct device *dev = vm->xe->drm.dev;
diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
index 89c4f95984a2..fe10fd91cdfa 100644
--- a/drivers/gpu/drm/xe/xe_vm.h
+++ b/drivers/gpu/drm/xe/xe_vm.h
@@ -290,6 +290,8 @@ struct dma_fence *xe_vm_bind_kernel_bo(struct xe_vm *vm, struct xe_bo *bo,
 
 void xe_vm_resume_rebind_worker(struct xe_vm *vm);
 
+int xe_vm_get_sva_pasid(struct xe_vm *vm);
+
 /**
  * xe_vm_resv() - Return's the vm's reservation object
  * @vm: The vm
-- 
2.43.0


  parent reply	other threads:[~2026-10-21  4:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  4:11 [PATCH 0/6] ATS/PASID SVA support and PRI-less fault servicing Nareshkumar Gollakoti
2026-10-21  4:11 ` [PATCH 1/6] drm/xe/pci: log ATS/PASID enablement state at probe Nareshkumar Gollakoti
2026-10-21  4:32   ` sashiko-bot
2026-10-21  4:11 ` [PATCH 2/6] drm/xe/vm: Setup SVA infrastructure for PASID support Nareshkumar Gollakoti
2026-10-21  4:30   ` sashiko-bot
2026-10-21  4:11 ` Nareshkumar Gollakoti [this message]
2026-10-21  4:11 ` [PATCH 4/6] drm/xe/lrc: program CTX_SYS_PASID for ATS/PASID-enabled contexts Nareshkumar Gollakoti
2026-10-21  4:11 ` [PATCH 5/6] drm/xe/pci: add helper for ATS/PASID without PRI Nareshkumar Gollakoti
2026-10-21  4:11 ` [PATCH 6/6] drm/xe/pagefault: add CPU mirror VMA for SVA faults " Nareshkumar Gollakoti
2026-10-21  4:35   ` sashiko-bot
2026-10-21  4:21 ` ✗ CI.KUnit: failure for ATS/PASID SVA support and PRI-less fault servicing Patchwork
2026-10-21 15:25 ` [PATCH 0/6] " Thomas Hellström
2026-10-22  6:30   ` Kumar G, Naresh
2026-10-22 11:12     ` Thomas Hellström
2026-10-21 21:24 ` Matthew Brost

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=20261021041117.1774877-4-naresh.kumar.g@intel.com \
    --to=naresh.kumar.g@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --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