From: Oak Zeng <oak.zeng@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [CI 5/8] drm/xe/svm: Get xe memory region from page
Date: Wed, 20 Mar 2024 14:45:39 -0400 [thread overview]
Message-ID: <20240320184542.2239076-5-oak.zeng@intel.com> (raw)
In-Reply-To: <20240320184542.2239076-1-oak.zeng@intel.com>
For gpu vram page, we now have a struct page backing of
it. struct page's pgmap points to xe_memory_region's
pagemap. This allow us to retrieve xe_memory_region
from struct page.
v1: move the function to xe_svm.h
Signed-off-by: Oak Zeng <oak.zeng@intel.com>
---
drivers/gpu/drm/xe/xe_svm.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index 8a34429eb674..624c1581f8ba 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -6,6 +6,7 @@
#ifndef __XE_SVM_H
#define __XE_SVM_H
+#include <linux/mm_types.h>
#include "xe_device_types.h"
#include "xe_device.h"
#include "xe_assert.h"
@@ -35,4 +36,14 @@ static inline u64 xe_mem_region_pfn_to_dpa(struct xe_mem_region *mr, u64 pfn)
int xe_devm_add(struct xe_tile *tile, struct xe_mem_region *mr);
void xe_devm_remove(struct xe_tile *tile, struct xe_mem_region *mr);
+/**
+ * xe_page_to_mem_region() - Get a page's memory region
+ *
+ * @page: a struct page pointer pointing to a page in vram memory region
+ */
+static inline struct xe_mem_region *xe_page_to_mem_region(struct page *page)
+{
+ return container_of(page->pgmap, struct xe_mem_region, pagemap);
+}
+
#endif
--
2.26.3
next prev parent reply other threads:[~2024-03-20 18:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 18:45 [CI 1/8] drm/xe/svm: Remap and provide memmap backing for GPU vram Oak Zeng
2024-03-20 18:45 ` [CI 2/8] drm/xe/svm: Introduce DRM_XE_SVM kernel config Oak Zeng
2024-03-20 18:45 ` [CI 3/8] drm/xe: Introduce helper to get tile from memory region Oak Zeng
2024-03-20 18:45 ` [CI 4/8] drm/xe: Introduce a helper to get dpa from pfn Oak Zeng
2024-03-20 18:45 ` Oak Zeng [this message]
2024-03-20 18:45 ` [CI 6/8] drm/xe: Introduce helper to populate userptr Oak Zeng
2024-03-20 18:45 ` [CI 7/8] drm/xe: Introduce a helper to free sg table Oak Zeng
2024-03-20 18:45 ` [CI 8/8] drm/xe: Use hmm_range_fault to populate user pages Oak Zeng
2024-03-20 18:45 ` ✓ CI.Patch_applied: success for series starting with [CI,1/8] drm/xe/svm: Remap and provide memmap backing for GPU vram Patchwork
2024-03-20 18:46 ` ✗ CI.checkpatch: warning " Patchwork
2024-03-20 18:46 ` ✗ CI.KUnit: failure " 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=20240320184542.2239076-5-oak.zeng@intel.com \
--to=oak.zeng@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