public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Christian König <christian.koenig@amd.com>
To: Junhua Shen <Junhua.Shen@amd.com>,
	Alexander.Deucher@amd.com, Felix.Kuehling@amd.com,
	Oak.Zeng@amd.com, Jenny-Jing.Liu@amd.com, Philip.Yang@amd.com,
	Xiaogang.Chen@amd.com, Ray.Huang@amd.com, honglei1.huang@amd.com,
	Lingshan.Zhu@amd.com, simona@ffwll.ch
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 5/6] drm/amdgpu: hook up ZONE_DEVICE registration in device init and reset
Date: Wed, 13 May 2026 15:47:33 +0200	[thread overview]
Message-ID: <901369e4-9763-4477-a908-86ac8d77cb4e@amd.com> (raw)
In-Reply-To: <20260513095734.69598-6-Junhua.Shen@amd.com>



On 5/13/26 11:57, Junhua Shen wrote:
> Call amdgpu_svm_migration_init() in the device initialization and
> XGMI reset-restore paths to register the GPU's VRAM as a ZONE_DEVICE
> region before KFD initialization.
> 
> This activates the drm_pagemap migration infrastructure.
> 
> Signed-off-by: Junhua Shen <Junhua.Shen@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c  | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index fbe553c38583..3be51a2c0106 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -78,6 +78,7 @@
>  #include "amdgpu_reset.h"
>  #include "amdgpu_virt.h"
>  #include "amdgpu_dev_coredump.h"
> +#include "amdgpu_migrate.h"
>  
>  #include <linux/suspend.h>
>  #include <drm/task_barrier.h>
> @@ -4076,6 +4077,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>  
>  	/* Don't init kfd if whole hive need to be reset during init */
>  	if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) {
> +#if IS_ENABLED(CONFIG_DRM_AMDGPU_SVM)
> +		amdgpu_svm_migration_init(adev);
> +#endif

Looks good in general, but just a style advise:

Instead of spread those #if IS_ENABLED() It's good practice to do something like this in the header:

#if IS_ENABLED(CONFIG_DRM_AMDGPU_SVM)

void amdgpu_svm_migration_init(struct amdgpu_device *adev);

#else

void amdgpu_svm_migration_init(struct amdgpu_device *adev) {}

#endif

Especially when the function is used multiple times.

Regards,
Christian.

>  		kgd2kfd_init_zone_device(adev);
>  		kfd_update_svm_support_properties(adev);
>  	}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
> index 28c4ad62f50e..c94d43f3ab42 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
> @@ -25,6 +25,7 @@
>  #include "aldebaran.h"
>  #include "sienna_cichlid.h"
>  #include "smu_v13_0_10.h"
> +#include "amdgpu_migrate.h"
>  
>  static int amdgpu_reset_xgmi_reset_on_init_suspend(struct amdgpu_device *adev)
>  {
> @@ -87,6 +88,9 @@ static int amdgpu_reset_xgmi_reset_on_init_restore_hwctxt(
>  		return r;
>  	list_for_each_entry(tmp_adev, reset_device_list, reset_list) {
>  		if (!tmp_adev->kfd.init_complete) {
> +#if IS_ENABLED(CONFIG_DRM_AMDGPU_SVM)
> +			amdgpu_svm_migration_init(tmp_adev);
> +#endif
>  			kgd2kfd_init_zone_device(tmp_adev);
>  			amdgpu_amdkfd_device_init(tmp_adev);
>  			amdgpu_amdkfd_drm_client_create(tmp_adev);


  reply	other threads:[~2026-05-13 13:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  9:57 [PATCH v4 0/6] drm/amdgpu: SVM VRAM migration via drm_pagemap (XNACK-on) Junhua Shen
2026-05-13  9:57 ` [PATCH v4 1/6] drm/amdgpu: add VRAM migration infrastructure for drm_pagemap Junhua Shen
2026-05-16  2:15   ` Claude review: " Claude Code Review Bot
2026-05-13  9:57 ` [PATCH v4 2/6] drm/amdgpu: implement drm_pagemap SDMA migration callbacks Junhua Shen
2026-05-16  2:15   ` Claude review: " Claude Code Review Bot
2026-05-13  9:57 ` [PATCH v4 3/6] drm/amdgpu: implement synchronous TTM eviction for SVM BOs Junhua Shen
2026-05-16  2:15   ` Claude review: " Claude Code Review Bot
2026-05-13  9:57 ` [PATCH v4 4/6] drm/amdgpu: add SVM range migration helpers for drm_pagemap Junhua Shen
2026-05-16  2:15   ` Claude review: " Claude Code Review Bot
2026-05-13  9:57 ` [PATCH v4 5/6] drm/amdgpu: hook up ZONE_DEVICE registration in device init and reset Junhua Shen
2026-05-13 13:47   ` Christian König [this message]
2026-05-14  7:33     ` Junhua Shen
2026-05-16  2:15   ` Claude review: " Claude Code Review Bot
2026-05-13  9:57 ` [PATCH v4 6/6] drm/amdgpu: integrate VRAM migration into SVM range map and fault paths Junhua Shen
2026-05-16  2:15   ` Claude review: " Claude Code Review Bot
2026-05-16  2:15 ` Claude review: drm/amdgpu: SVM VRAM migration via drm_pagemap (XNACK-on) Claude Code Review Bot

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=901369e4-9763-4477-a908-86ac8d77cb4e@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@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=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=honglei1.huang@amd.com \
    --cc=simona@ffwll.ch \
    /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