From: Matthew Brost <matthew.brost@intel.com>
To: Honglei Huang <honglei1.huang@amd.com>
Cc: <sima@ffwll.ch>, <rodrigo.vivi@intel.com>,
<thomas.hellstrom@linux.intel.com>, <dakr@kernel.org>,
<aliceryhl@google.com>, <Alexander.Deucher@amd.com>,
<Felix.Kuehling@amd.com>, <Christian.Koenig@amd.com>,
<Oak.Zeng@amd.com>, <Jenny-Jing.Liu@amd.com>,
<Philip.Yang@amd.com>, <Xiaogang.Chen@amd.com>,
<Ray.Huang@amd.com>, <Lingshan.Zhu@amd.com>,
<Junhua.Shen@amd.com>, <Yiru.Ma@amd.com>,
<amd-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <honghuan@amd.com>
Subject: Re: [RFC 5/5] drm/gpusvm: let the drm_gpusvm core context purely MM level
Date: Tue, 9 Jun 2026 21:19:11 -0700 [thread overview]
Message-ID: <aijlvyqblELUBAJi@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260603065620.2555316-6-honglei1.huang@amd.com>
On Wed, Jun 03, 2026 at 02:56:20PM +0800, Honglei Huang wrote:
> From: Honglei Huang <honghuan@amd.com>
>
> The core mechanism of drm_gpusvm is HMM, which is fundamentally an
> MM side subsystem. A drm_device, enters the picture on the device side at
> DMA mapping / GPU bind.
>
> So drop struct drm_device from struct drm_gpusvm. Let drm_gpusvm keep
> its core neutral and leave device side decisions to the driver.
> Make drm_gpusvm a pure MM level object.
>
> - Drop the drm from struct drm_gpusvm
> - Drop the drm parameter from drm_gpusvm_init()
> - Update the xe call sites in xe_svm_init() and other callers.
>
I'd mention somewhere that drm_device is now stored in the pages.
Otherwise LGTM.
Matt
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> ---
> drivers/gpu/drm/drm_gpusvm.c | 7 +++----
> drivers/gpu/drm/xe/xe_svm.c | 4 ++--
> drivers/gpu/drm/xe/xe_svm.h | 2 +-
> include/drm/drm_gpusvm.h | 4 +---
> 4 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
> index 55515390c53..5cade46234c 100644
> --- a/drivers/gpu/drm/drm_gpusvm.c
> +++ b/drivers/gpu/drm/drm_gpusvm.c
> @@ -359,7 +359,6 @@ static const struct mmu_interval_notifier_ops drm_gpusvm_notifier_ops = {
> * drm_gpusvm_init() - Initialize the GPU SVM.
> * @gpusvm: Pointer to the GPU SVM structure.
> * @name: Name of the GPU SVM.
> - * @drm: Pointer to the DRM device structure.
> * @mm: Pointer to the mm_struct for the address space.
> * @mm_start: Start address of GPU SVM.
> * @mm_range: Range of the GPU SVM.
> @@ -373,7 +372,8 @@ static const struct mmu_interval_notifier_ops drm_gpusvm_notifier_ops = {
> * This function initializes the GPU SVM.
> *
> * Note: If only using the simple drm_gpusvm_pages API (get/unmap/free),
> - * then only @gpusvm, @name, and @drm are expected. However, the same base
> + * then only @gpusvm and @name are expected. The struct @drm for dma
> + * mappings is now required in drm_gpusvm_get_pages(). However, the same base
> * @gpusvm can also be used with both modes together in which case the full
> * setup is needed, where the core drm_gpusvm_pages API will simply never use
> * the other fields.
> @@ -381,7 +381,7 @@ static const struct mmu_interval_notifier_ops drm_gpusvm_notifier_ops = {
> * Return: 0 on success, a negative error code on failure.
> */
> int drm_gpusvm_init(struct drm_gpusvm *gpusvm,
> - const char *name, struct drm_device *drm,
> + const char *name,
> struct mm_struct *mm,
> unsigned long mm_start, unsigned long mm_range,
> unsigned long notifier_size,
> @@ -399,7 +399,6 @@ int drm_gpusvm_init(struct drm_gpusvm *gpusvm,
> }
>
> gpusvm->name = name;
> - gpusvm->drm = drm;
> gpusvm->mm = mm;
> gpusvm->mm_start = mm_start;
> gpusvm->mm_range = mm_range;
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index 33c26df5111..b0b737234ee 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -905,7 +905,7 @@ int xe_svm_init(struct xe_vm *vm)
> return err;
> }
>
> - err = drm_gpusvm_init(&vm->svm.gpusvm, "Xe SVM", &vm->xe->drm,
> + err = drm_gpusvm_init(&vm->svm.gpusvm, "Xe SVM",
> current->mm, 0, vm->size,
> xe_modparam.svm_notifier_size * SZ_1M,
> &gpusvm_ops, fault_chunk_sizes,
> @@ -919,7 +919,7 @@ int xe_svm_init(struct xe_vm *vm)
> }
> } else {
> err = drm_gpusvm_init(&vm->svm.gpusvm, "Xe SVM (simple)",
> - &vm->xe->drm, NULL, 0, 0, 0, NULL,
> + NULL, 0, 0, 0, NULL,
> NULL, 0);
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
> index ea73241d3d9..1c5195f5495 100644
> --- a/drivers/gpu/drm/xe/xe_svm.h
> +++ b/drivers/gpu/drm/xe/xe_svm.h
> @@ -238,7 +238,7 @@ static inline
> int xe_svm_init(struct xe_vm *vm)
> {
> #if IS_ENABLED(CONFIG_DRM_GPUSVM)
> - return drm_gpusvm_init(&vm->svm.gpusvm, "Xe SVM (simple)", &vm->xe->drm,
> + return drm_gpusvm_init(&vm->svm.gpusvm, "Xe SVM (simple)",
> NULL, 0, 0, 0, NULL, NULL, 0);
> #else
> return 0;
> diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
> index 250c59f0930..2bea47ee171 100644
> --- a/include/drm/drm_gpusvm.h
> +++ b/include/drm/drm_gpusvm.h
> @@ -191,7 +191,6 @@ struct drm_gpusvm_range {
> * struct drm_gpusvm - GPU SVM structure
> *
> * @name: Name of the GPU SVM
> - * @drm: Pointer to the DRM device structure
> * @mm: Pointer to the mm_struct for the address space
> * @mm_start: Start address of GPU SVM
> * @mm_range: Range of the GPU SVM
> @@ -215,7 +214,6 @@ struct drm_gpusvm_range {
> */
> struct drm_gpusvm {
> const char *name;
> - struct drm_device *drm;
> struct mm_struct *mm;
> unsigned long mm_start;
> unsigned long mm_range;
> @@ -267,7 +265,7 @@ struct drm_gpusvm_ctx {
> };
>
> int drm_gpusvm_init(struct drm_gpusvm *gpusvm,
> - const char *name, struct drm_device *drm,
> + const char *name,
> struct mm_struct *mm,
> unsigned long mm_start, unsigned long mm_range,
> unsigned long notifier_size,
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-06-10 4:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 6:56 [RFC 0/5] drm/gpusvm: split MM and device state across Honglei Huang
2026-06-03 6:56 ` [RFC 1/5] drm/gpusvm: split MM state flags out of drm_gpusvm_pages_flags Honglei Huang
2026-06-10 3:55 ` Matthew Brost
2026-06-10 8:59 ` Huang, Honglei
2026-06-03 6:56 ` [RFC 2/5] drm/gpusvm: embed struct drm_device into drm_gpusvm_pages Honglei Huang
2026-06-10 4:07 ` Matthew Brost
2026-06-10 9:01 ` Huang, Honglei
2026-06-03 6:56 ` [RFC 3/5] drm/xe: have xe_svm_range embed one drm_gpusvm_pages Honglei Huang
2026-06-10 4:14 ` Matthew Brost
2026-06-10 9:03 ` Huang, Honglei
2026-06-03 6:56 ` [RFC 4/5] drm/gpusvm: move struct drm_gpusvm_pages out of struct drm_gpusvm_range Honglei Huang
2026-06-10 4:17 ` Matthew Brost
2026-06-10 9:04 ` Huang, Honglei
2026-06-03 6:56 ` [RFC 5/5] drm/gpusvm: let the drm_gpusvm core context purely MM level Honglei Huang
2026-06-10 4:19 ` Matthew Brost [this message]
2026-06-10 9:10 ` Huang, Honglei
2026-06-10 3:44 ` [RFC 0/5] drm/gpusvm: split MM and device state across Matthew Brost
2026-06-10 8:49 ` Huang, Honglei
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=aijlvyqblELUBAJi@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Jenny-Jing.Liu@amd.com \
--cc=Junhua.Shen@amd.com \
--cc=Lingshan.Zhu@amd.com \
--cc=Oak.Zeng@amd.com \
--cc=Philip.Yang@amd.com \
--cc=Ray.Huang@amd.com \
--cc=Xiaogang.Chen@amd.com \
--cc=Yiru.Ma@amd.com \
--cc=aliceryhl@google.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=honghuan@amd.com \
--cc=honglei1.huang@amd.com \
--cc=rodrigo.vivi@intel.com \
--cc=sima@ffwll.ch \
--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