Skip to contentSkip to conversation

drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

PATCH In review Stanley.Yang 3 participants 9 messages Jun 26

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22 +++++++++++++++++++
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
 5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +13 -1
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct amdgpu_device *adev)
 	if (!con || amdgpu_sriov_vf(adev))
 		return 0;
 
-	if (amdgpu_uniras_enabled(adev))
+	/*
+	 * For the reset-on-init path (e.g. an NPS memory partition,
+	 * switch) the RAS IP block hw_init has not been enabled and
+	 * the amdgpu_uniras_enabled return false, check amdgpu ras
+	 * context uniras_enabled flag, eepron init will be called
+	 * during RAS IP block hw_init.
+	 */
+	if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
 		return 0;
 
 	control = &con->eeprom_control;
@@ -5859,3 +5866,8 @@ void amdgpu_ras_post_reset(struct amdgpu_device *adev,
 			amdgpu_ras_mgr_post_reset(tmp_adev);
 	}
 }
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev)
+{
+	amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct amdgpu_device *adev,
 					  struct list_head *device_list);
 void amdgpu_ras_post_reset(struct amdgpu_device *adev,
 					  struct list_head *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void amdgpu_xgmi_reset_on_init_work(struct work_struct *work)
 		if (r && r != -EHWPOISON)
 			dev_err(tmp_adev->dev,
 				"error during bad page data initialization");
+
+		/*
+		 * For the reset-on-init path (e.g. an NPS memory partition
+		 * switch) the RAS IP block hw_init was skipped under the
+		 * minimal init level, so uniras was never enabled. Bring it
+		 * up now that the reset domain has been unlocked. This is a
+		 * no-op for any other reset path where RAS is already
+		 * initialized, and for non-uniras devices.
+		 */
+		amdgpu_ras_resume_after_reset(tmp_adev);
 	}
 }
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +22 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)
 	return 0;
 }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev)
+{
+	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+	struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
+	struct amdgpu_ip_block *ip_block;
+
+	if (!con || !con->uniras_enabled)
+		return 0;
+
+	if (!ras_mgr || !ras_mgr->ras_core)
+		return -EINVAL;
+
+	if (ras_mgr->ras_is_ready)
+		return 0;
+
+	ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_RAS);
+	if (!ip_block)
+		return -EINVAL;
+
+	return amdgpu_ras_mgr_hw_init(ip_block);
+}
+
 struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct amdgpu_device *adev)
 {
 	if (!adev || !adev->psp.ras_context.ras)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -0
index 4f44a917d48b..3f80b9f1f0ac 100644
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,
 		void *output, uint32_t out_size);
 int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
 int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
 int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct amdgpu_device *adev,
 		uint64_t addr, uint64_t *nps_page_addr, uint32_t max_page_count);
 #endif
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

Thanks,
Lijo

Quoted 114 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
  .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22 +++++++++++++++++++
  .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
  5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +13 -1
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct amdgpu_device *adev)
  	if (!con || amdgpu_sriov_vf(adev))
  		return 0;
 
-	if (amdgpu_uniras_enabled(adev))
+	/*
+	 * For the reset-on-init path (e.g. an NPS memory partition,
+	 * switch) the RAS IP block hw_init has not been enabled and
+	 * the amdgpu_uniras_enabled return false, check amdgpu ras
+	 * context uniras_enabled flag, eepron init will be called
+	 * during RAS IP block hw_init.
+	 */
+	if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
  		return 0;
 
  	control = &con->eeprom_control;
@@ -5859,3 +5866,8 @@ void amdgpu_ras_post_reset(struct amdgpu_device *adev,
  			amdgpu_ras_mgr_post_reset(tmp_adev);
  	}
  }
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev)
+{
+	amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct amdgpu_device *adev,
  					  struct list_head *device_list);
  void amdgpu_ras_post_reset(struct amdgpu_device *adev,
  					  struct list_head *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
  #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void amdgpu_xgmi_reset_on_init_work(struct work_struct *work)
  		if (r && r != -EHWPOISON)
  			dev_err(tmp_adev->dev,
  				"error during bad page data initialization");
+
+		/*
+		 * For the reset-on-init path (e.g. an NPS memory partition
+		 * switch) the RAS IP block hw_init was skipped under the
+		 * minimal init level, so uniras was never enabled. Bring it
+		 * up now that the reset domain has been unlocked. This is a
+		 * no-op for any other reset path where RAS is already
+		 * initialized, and for non-uniras devices.
+		 */
+		amdgpu_ras_resume_after_reset(tmp_adev);
  	}
  }
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +22 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)
  	return 0;
  }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev)
+{
+	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+	struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
+	struct amdgpu_ip_block *ip_block;
+
+	if (!con || !con->uniras_enabled)
+		return 0;
+
+	if (!ras_mgr || !ras_mgr->ras_core)
+		return -EINVAL;
+
+	if (ras_mgr->ras_is_ready)
+		return 0;
+
+	ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_RAS);
+	if (!ip_block)
+		return -EINVAL;
+
+	return amdgpu_ras_mgr_hw_init(ip_block);
+}
+
  struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct amdgpu_device *adev)
  {
  	if (!adev || !adev->psp.ras_context.ras)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -0
index 4f44a917d48b..3f80b9f1f0ac 100644
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,
  		void *output, uint32_t out_size);
  int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
  int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
  int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct amdgpu_device *adev,
  		uint64_t addr, uint64_t *nps_page_addr, uint32_t max_page_count);
  #endif
#2 lore raw

AMD General

Quoted 18 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 4:16 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

Quoted 8 lines

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdg
pu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
.name = "ras_v1_0",
.sw_init = amdgpu_ras_mgr_sw_init,
.sw_fini = amdgpu_ras_mgr_sw_fini,
.hw_init = amdgpu_ras_mgr_hw_init,
.hw_fini = amdgpu_ras_mgr_hw_fini,
};

The RAS IP block does not register suspend and resume callback function, so RAS IP block hw init function missed under this case.

Regards,
Stanley

Quoted 131 lines

Thanks,
Lijo

Quoted 6 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
  .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22

+++++++++++++++++++

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_init_badpage_info(struct

Quoted 9 lines
  .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
  5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c void amdgpu_ras_post_reset(struct

Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -1
    if (!con || amdgpu_sriov_vf(adev))
            return 0;
 
-   if (amdgpu_uniras_enabled(adev))
+   /*
+    * For the reset-on-init path (e.g. an NPS memory partition,
+    * switch) the RAS IP block hw_init has not been enabled and
+    * the amdgpu_uniras_enabled return false, check amdgpu ras
+    * context uniras_enabled flag, eepron init will be called
+    * during RAS IP block hw_init.
+    */
+   if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
            return 0;
 
    control = &con->eeprom_control;
@@ -5859,3 +5866,8 @@ void amdgpu_ras_post_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h void amdgpu_ras_pre_reset(struct

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
                    amdgpu_ras_mgr_post_reset(tmp_adev);
    }
  }
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+   amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static void

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
                                      struct list_head *device_list);
  void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                      struct list_head *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
  #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void

amdgpu_xgmi_reset_on_init_work(struct work_struct *work)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct

Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
            if (r && r != -EHWPOISON)
                    dev_err(tmp_adev->dev,
                            "error during bad page data initialization");
+
+           /*
+            * For the reset-on-init path (e.g. an NPS memory partition
+            * switch) the RAS IP block hw_init was skipped under the
+            * minimal init level, so uniras was never enabled. Bring it
+            * up now that the reset domain has been unlocked. This is a
+            * no-op for any other reset path where RAS is already
+            * initialized, and for non-uniras devices.
+            */
+           amdgpu_ras_resume_after_reset(tmp_adev);
    }
  }
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct

amdgpu_ip_block *ip_block)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
    return 0;
  }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev) {
+   struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+   struct amdgpu_ras_mgr *ras_mgr =

amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 12 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +12 -0
+   struct amdgpu_ip_block *ip_block;
+
+   if (!con || !con->uniras_enabled)
+           return 0;
+
+   if (!ras_mgr || !ras_mgr->ras_core)
+           return -EINVAL;
+
+   if (ras_mgr->ras_is_ready)
+           return 0;
+
+   ip_block = amdgpu_device_ip_get_ip_block(adev,

AMD_IP_BLOCK_TYPE_RAS);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
+   if (!ip_block)
+           return -EINVAL;
+
+   return amdgpu_ras_mgr_hw_init(ip_block); }
+
  struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct

Quoted 8 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
  {
    if (!adev || !adev->psp.ras_context.ras) diff --git

a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -0
            void *output, uint32_t out_size);
  int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
  int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
  int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct amdgpu_device

*adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 87

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
            uint64_t addr, uint64_t *nps_page_addr, uint32_t

max_page_count);

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
  #endif
#3 lore raw
Quoted 37 lines · Stanley

AMD General

Quoted 18 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 4:16 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

Quoted 8 lines

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdg
pu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
.name = "ras_v1_0",
.sw_init = amdgpu_ras_mgr_sw_init,
.sw_fini = amdgpu_ras_mgr_sw_fini,
.hw_init = amdgpu_ras_mgr_hw_init,
.hw_fini = amdgpu_ras_mgr_hw_fini,
};

Quoted 2 lines

The RAS IP block does not register suspend and resume callback function, so RAS IP block hw init function missed under this case.

How does it work for regular reset? For regular reset also, driver calls the resume sequence for the IP block.

I think the proper fix is to add a resume sequence which calls hw_init (if those paths are identical).

Thanks,
Lijo

Quoted 134 lines

Regards,
Stanley

Quoted 131 lines

Thanks,
Lijo

Quoted 6 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
   drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
   .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22

+++++++++++++++++++

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_init_badpage_info(struct

Quoted 9 lines
   .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
   5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c void amdgpu_ras_post_reset(struct

Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -1
     if (!con || amdgpu_sriov_vf(adev))
             return 0;
 
-   if (amdgpu_uniras_enabled(adev))
+   /*
+    * For the reset-on-init path (e.g. an NPS memory partition,
+    * switch) the RAS IP block hw_init has not been enabled and
+    * the amdgpu_uniras_enabled return false, check amdgpu ras
+    * context uniras_enabled flag, eepron init will be called
+    * during RAS IP block hw_init.
+    */
+   if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
             return 0;
 
     control = &con->eeprom_control;
@@ -5859,3 +5866,8 @@ void amdgpu_ras_post_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h void amdgpu_ras_pre_reset(struct

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
                     amdgpu_ras_mgr_post_reset(tmp_adev);
     }
   }
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+   amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static void

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
                                       struct list_head *device_list);
   void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                       struct list_head *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
   #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void

amdgpu_xgmi_reset_on_init_work(struct work_struct *work)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct

Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
             if (r && r != -EHWPOISON)
                     dev_err(tmp_adev->dev,
                             "error during bad page data initialization");
+
+           /*
+            * For the reset-on-init path (e.g. an NPS memory partition
+            * switch) the RAS IP block hw_init was skipped under the
+            * minimal init level, so uniras was never enabled. Bring it
+            * up now that the reset domain has been unlocked. This is a
+            * no-op for any other reset path where RAS is already
+            * initialized, and for non-uniras devices.
+            */
+           amdgpu_ras_resume_after_reset(tmp_adev);
     }
   }
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct

amdgpu_ip_block *ip_block)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
     return 0;
   }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev) {
+   struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+   struct amdgpu_ras_mgr *ras_mgr =

amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 12 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +12 -0
+   struct amdgpu_ip_block *ip_block;
+
+   if (!con || !con->uniras_enabled)
+           return 0;
+
+   if (!ras_mgr || !ras_mgr->ras_core)
+           return -EINVAL;
+
+   if (ras_mgr->ras_is_ready)
+           return 0;
+
+   ip_block = amdgpu_device_ip_get_ip_block(adev,

AMD_IP_BLOCK_TYPE_RAS);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
+   if (!ip_block)
+           return -EINVAL;
+
+   return amdgpu_ras_mgr_hw_init(ip_block); }
+
   struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct

Quoted 8 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
   {
     if (!adev || !adev->psp.ras_context.ras) diff --git

a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -0
             void *output, uint32_t out_size);
   int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
   int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
   int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct amdgpu_device

*adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 87

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
             uint64_t addr, uint64_t *nps_page_addr, uint32_t

max_page_count);

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
   #endif
#4 lore raw

AMD General

Quoted 50 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 5:44 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 22 lines · Stanley

AMD General

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 4:16 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amd

Quoted 9 lines
Quoted 8 lines

g
pu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

Quoted 8 lines

static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
.name = "ras_v1_0",
.sw_init = amdgpu_ras_mgr_sw_init,
.sw_fini = amdgpu_ras_mgr_sw_fini,
.hw_init = amdgpu_ras_mgr_hw_init,
.hw_fini = amdgpu_ras_mgr_hw_fini, };

The RAS IP block does not register suspend and resume callback function, so

Quoted 8 lines

RAS IP block hw init function missed under this case.

Quoted 1 line

How does it work for regular reset? For regular reset also, driver calls the resume sequence for the IP block.

I think the proper fix is to add a resume sequence which calls hw_init (if those paths are identical).

[Stanley]: Normal cold start is at the DEFAULT init level, and RAS hw_init is executing normally, so uniras is enabled; Normal GPU reset, because there is no. suspend, ras_is_read remains true and the state is preserved - so only NPS switching to this XGMI reset on int path will trigger this bug.

Not suggest add .resume sequence because during RAS IP block hw_init process need hold reset domain semaphore but the semaphore has already hold before, the other reason is adding .resume will break regular reset, it doesn't need to be reinitialized due to all RAS error info is cached.

Regards,
Stanley

Quoted 141 lines

Thanks,
Lijo

Quoted 131 lines

Regards,
Stanley

Quoted 129 lines

Thanks,
Lijo

Quoted 6 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
   drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
   .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22

+++++++++++++++++++

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_init_badpage_info(struct

Quoted 9 lines
   .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
   5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct

amdgpu_device *adev)

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -1
     if (!con || amdgpu_sriov_vf(adev))
             return 0;
 
-   if (amdgpu_uniras_enabled(adev))
+   /*
+    * For the reset-on-init path (e.g. an NPS memory partition,
+    * switch) the RAS IP block hw_init has not been enabled and
+    * the amdgpu_uniras_enabled return false, check amdgpu ras
+    * context uniras_enabled flag, eepron init will be called
+    * during RAS IP block hw_init.
+    */
+   if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
             return 0;
 
     control = &con->eeprom_control; @@ -5859,3 +5866,8 @@ void
Quoted 1 line

amdgpu_ras_post_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h void amdgpu_ras_pre_reset(struct

Quoted 13 lines
                     amdgpu_ras_mgr_post_reset(tmp_adev);
     }

}

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+   amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static void

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
                                       struct list_head *device_list);
   void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                       struct list_head
 *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
   #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void

amdgpu_xgmi_reset_on_init_work(struct work_struct *work)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
             if (r && r != -EHWPOISON)
                     dev_err(tmp_adev->dev,
                             "error during bad page data
 initialization");
+
+           /*
+            * For the reset-on-init path (e.g. an NPS memory partition
+            * switch) the RAS IP block hw_init was skipped under the
+            * minimal init level, so uniras was never enabled. Bring it
+            * up now that the reset domain has been unlocked. This is a
+            * no-op for any other reset path where RAS is already
+            * initialized, and for non-uniras devices.
+            */
+           amdgpu_ras_resume_after_reset(tmp_adev);
     }
   }
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct

amdgpu_ip_block *ip_block)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
     return 0;
   }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev) {
+   struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+   struct amdgpu_ras_mgr *ras_mgr =

amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 12 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +12 -0
+   struct amdgpu_ip_block *ip_block;
+
+   if (!con || !con->uniras_enabled)
+           return 0;
+
+   if (!ras_mgr || !ras_mgr->ras_core)
+           return -EINVAL;
+
+   if (ras_mgr->ras_is_ready)
+           return 0;
+
+   ip_block = amdgpu_device_ip_get_ip_block(adev,

AMD_IP_BLOCK_TYPE_RAS);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
+   if (!ip_block)
+           return -EINVAL;
+
+   return amdgpu_ras_mgr_hw_init(ip_block); }
+
   struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct

Quoted 8 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
   {
     if (!adev || !adev->psp.ras_context.ras) diff --git

a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct

amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -0
             void *output, uint32_t out_size);
   int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
   int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
   int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct

amdgpu_device

Quoted 5 lines
Quoted 4 lines

*adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 87

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
             uint64_t addr, uint64_t *nps_page_addr, uint32_t

max_page_count);

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
   #endif
#5 lore raw
Quoted 58 lines · Stanley

AMD General

Quoted 56 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 5:44 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 22 lines · Stanley

AMD General

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 4:16 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amd

Quoted 9 lines
Quoted 8 lines

g
pu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

Quoted 8 lines

static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
.name = "ras_v1_0",
.sw_init = amdgpu_ras_mgr_sw_init,
.sw_fini = amdgpu_ras_mgr_sw_fini,
.hw_init = amdgpu_ras_mgr_hw_init,
.hw_fini = amdgpu_ras_mgr_hw_fini, };

The RAS IP block does not register suspend and resume callback function, so

RAS IP block hw init function missed under this case.

Quoted 1 line

How does it work for regular reset? For regular reset also, driver calls the resume sequence for the IP block.

Quoted 7 lines
Quoted 2 lines

I think the proper fix is to add a resume sequence which calls hw_init (if those paths are identical).

[Stanley]: Normal cold start is at the DEFAULT init level, and RAS hw_init is executing normally, so uniras is enabled; Normal GPU reset, because there is no. suspend, ras_is_read remains true and the state is preserved - so only NPS switching to this XGMI reset on int path will trigger this bug.

Not suggest add .resume sequence because during RAS IP block hw_init process need hold reset domain semaphore but the semaphore has already hold before, the other reason is adding .resume will break regular reset, it doesn't need to be reinitialized due to all RAS error info is cached.

Then a dedicated resume sequence needs to be added which checks if device is in reset (being resumed from a reset) before taking hold of the semaphore.

As an IP block, it will need suspend/resume for other scenarios like device runtime pm or system suspend/resume. This can be used only as a temporary workaround till that point.

Thanks,
Lijo

Quoted 144 lines

Regards,
Stanley

Quoted 141 lines

Thanks,
Lijo

Quoted 131 lines

Regards,
Stanley

Quoted 129 lines

Thanks,
Lijo

Quoted 6 lines
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
    drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
    drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
    .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22

+++++++++++++++++++

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_init_badpage_info(struct

Quoted 9 lines
    .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
    5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct

amdgpu_device *adev)

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -1
      if (!con || amdgpu_sriov_vf(adev))
              return 0;
 
-   if (amdgpu_uniras_enabled(adev))
+   /*
+    * For the reset-on-init path (e.g. an NPS memory partition,
+    * switch) the RAS IP block hw_init has not been enabled and
+    * the amdgpu_uniras_enabled return false, check amdgpu ras
+    * context uniras_enabled flag, eepron init will be called
+    * during RAS IP block hw_init.
+    */
+   if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
              return 0;
 
      control = &con->eeprom_control; @@ -5859,3 +5866,8 @@ void
Quoted 1 line

amdgpu_ras_post_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h void amdgpu_ras_pre_reset(struct

Quoted 13 lines
                      amdgpu_ras_mgr_post_reset(tmp_adev);
      }
    }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+   amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static void

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
                                        struct list_head *device_list);
    void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                        struct list_head
 *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
    #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void

amdgpu_xgmi_reset_on_init_work(struct work_struct *work)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
              if (r && r != -EHWPOISON)
                      dev_err(tmp_adev->dev,
                              "error during bad page data
 initialization");
+
+           /*
+            * For the reset-on-init path (e.g. an NPS memory partition
+            * switch) the RAS IP block hw_init was skipped under the
+            * minimal init level, so uniras was never enabled. Bring it
+            * up now that the reset domain has been unlocked. This is a
+            * no-op for any other reset path where RAS is already
+            * initialized, and for non-uniras devices.
+            */
+           amdgpu_ras_resume_after_reset(tmp_adev);
      }
    }
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct

amdgpu_ip_block *ip_block)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
      return 0;
    }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev) {
+   struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+   struct amdgpu_ras_mgr *ras_mgr =

amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 12 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +12 -0
+   struct amdgpu_ip_block *ip_block;
+
+   if (!con || !con->uniras_enabled)
+           return 0;
+
+   if (!ras_mgr || !ras_mgr->ras_core)
+           return -EINVAL;
+
+   if (ras_mgr->ras_is_ready)
+           return 0;
+
+   ip_block = amdgpu_device_ip_get_ip_block(adev,

AMD_IP_BLOCK_TYPE_RAS);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
+   if (!ip_block)
+           return -EINVAL;
+
+   return amdgpu_ras_mgr_hw_init(ip_block); }
+
    struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct

Quoted 8 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
    {
      if (!adev || !adev->psp.ras_context.ras) diff --git

a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct

amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -0
              void *output, uint32_t out_size);
    int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
    int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
    int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct

amdgpu_device

Quoted 5 lines
Quoted 4 lines

*adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 87

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
              uint64_t addr, uint64_t *nps_page_addr, uint32_t

max_page_count);

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
    #endif
#6 lore raw

AMD General

Quoted 79 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 7:37 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 36 lines · Stanley

AMD General

Quoted 34 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 5:44 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 22 lines · Stanley

AMD General

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 4:16 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amd

Quoted 21 lines
Quoted 21 lines
Quoted 16 lines
Quoted 8 lines

g
pu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
.name = "ras_v1_0",
.sw_init = amdgpu_ras_mgr_sw_init,
.sw_fini = amdgpu_ras_mgr_sw_fini,
.hw_init = amdgpu_ras_mgr_hw_init,
.hw_fini = amdgpu_ras_mgr_hw_fini, };

Quoted 2 lines

The RAS IP block does not register suspend and resume callback function, so

RAS IP block hw init function missed under this case.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

How does it work for regular reset? For regular reset also, driver calls the resume sequence for the IP block.

I think the proper fix is to add a resume sequence which calls hw_init (if those paths are identical).

[Stanley]: Normal cold start is at the DEFAULT init level, and RAS hw_init is

executing normally, so uniras is enabled; Normal GPU reset, because there is no. suspend, ras_is_read remains true and the state is preserved - so only NPS switching to this XGMI reset on int path will trigger this bug.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Not suggest add .resume sequence because during RAS IP block hw_init

process need hold reset domain semaphore but the semaphore has already hold before, the other reason is adding .resume will break regular reset, it doesn't need to be reinitialized due to all RAS error info is cached.

Quoted 1 line

Then a dedicated resume sequence needs to be added which checks if device is in reset (being resumed from a reset) before taking hold of the semaphore.

Yes, controlling the semaphore by checking if it is in the reset state can indeed solve the semaphore problem, but as I said there is no need to suspend and then resume the RAS IP block in regular reset.

Regards,
Stanley

Quoted 155 lines

As an IP block, it will need suspend/resume for other scenarios like device runtime pm or system suspend/resume. This can be used only as a temporary workaround till that point.

Thanks,
Lijo

Quoted 14 lines

Regards,
Stanley

Quoted 12 lines

Thanks,
Lijo

Quoted 8 lines

Regards,
Stanley

Quoted 6 lines

Thanks,
Lijo

Quoted 3 lines
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14

+++++++++++-

Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 3 lines
    drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
    drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
    .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22

+++++++++++++++++++

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_init_badpage_info(struct

Quoted 9 lines
    .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
    5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct

amdgpu_device *adev)

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -1
      if (!con || amdgpu_sriov_vf(adev))
              return 0;
 
-   if (amdgpu_uniras_enabled(adev))
+   /*
+    * For the reset-on-init path (e.g. an NPS memory partition,
+    * switch) the RAS IP block hw_init has not been enabled and
+    * the amdgpu_uniras_enabled return false, check amdgpu ras
+    * context uniras_enabled flag, eepron init will be called
+    * during RAS IP block hw_init.
+    */
+   if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
              return 0;
 
      control = &con->eeprom_control; @@ -5859,3 +5866,8 @@ void
Quoted 1 line

amdgpu_ras_post_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h void amdgpu_ras_pre_reset(struct

Quoted 13 lines
                      amdgpu_ras_mgr_post_reset(tmp_adev);
      }
    }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+   amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static void

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
                                        struct list_head *device_list);
    void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                        struct list_head
 *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
    #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void

amdgpu_xgmi_reset_on_init_work(struct work_struct *work)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
              if (r && r != -EHWPOISON)
                      dev_err(tmp_adev->dev,
                              "error during bad page data
 initialization");
+
+           /*
+            * For the reset-on-init path (e.g. an NPS memory partition
+            * switch) the RAS IP block hw_init was skipped under the
+            * minimal init level, so uniras was never enabled. Bring it
+            * up now that the reset domain has been unlocked. This is a
+            * no-op for any other reset path where RAS is already
+            * initialized, and for non-uniras devices.
+            */
+           amdgpu_ras_resume_after_reset(tmp_adev);
      }
    }
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct

amdgpu_ip_block *ip_block)

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 4 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +1 -0
      return 0;
    }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device

*adev) {

Quoted 45 lines
Quoted 44 lines
Quoted 32 lines
Quoted 32 lines

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct · line 470

Quoted 2 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +2 -0
+   struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+   struct amdgpu_ras_mgr *ras_mgr =

amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 12 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +12 -0
+   struct amdgpu_ip_block *ip_block;
+
+   if (!con || !con->uniras_enabled)
+           return 0;
+
+   if (!ras_mgr || !ras_mgr->ras_core)
+           return -EINVAL;
+
+   if (ras_mgr->ras_is_ready)
+           return 0;
+
+   ip_block = amdgpu_device_ip_get_ip_block(adev,

AMD_IP_BLOCK_TYPE_RAS);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
+   if (!ip_block)
+           return -EINVAL;
+
+   return amdgpu_ras_mgr_hw_init(ip_block); }
+
    struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct

Quoted 8 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
    {
      if (!adev || !adev->psp.ras_context.ras) diff --git

a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct

amdgpu_device *adev,

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +2 -0
              void *output, uint32_t out_size);
    int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
    int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device
+*adev);
    int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct

amdgpu_device

Quoted 5 lines
Quoted 4 lines

*adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 88

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
              uint64_t addr, uint64_t *nps_page_addr, uint32_t

max_page_count);

Quoted 1 line
    #endif
Reviewed-by
#7 lore raw
Quoted 87 lines · Stanley

AMD General

Quoted 85 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 7:37 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 36 lines · Stanley

AMD General

Quoted 34 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 5:44 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 22 lines · Stanley

AMD General

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, June 26, 2026 4:16 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

Quoted 5 lines · Stanley.Yang

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

After reset, we set it to default level.

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amd

Quoted 21 lines
Quoted 21 lines
Quoted 16 lines
Quoted 8 lines

g
pu/amdgpu_device.c#L5211

The default level includes all IP blocks, hence it's supposed to resume all blocks.

With RAS as a separate ip block, ideally it should have resumed. Could you check why/how RAS IP block is missed?

static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
.name = "ras_v1_0",
.sw_init = amdgpu_ras_mgr_sw_init,
.sw_fini = amdgpu_ras_mgr_sw_fini,
.hw_init = amdgpu_ras_mgr_hw_init,
.hw_fini = amdgpu_ras_mgr_hw_fini, };

Quoted 2 lines

The RAS IP block does not register suspend and resume callback function, so

RAS IP block hw init function missed under this case.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

How does it work for regular reset? For regular reset also, driver calls the resume sequence for the IP block.

I think the proper fix is to add a resume sequence which calls hw_init (if those paths are identical).

[Stanley]: Normal cold start is at the DEFAULT init level, and RAS hw_init is

executing normally, so uniras is enabled; Normal GPU reset, because there is no. suspend, ras_is_read remains true and the state is preserved - so only NPS switching to this XGMI reset on int path will trigger this bug.

Quoted 2 lines

Not suggest add .resume sequence because during RAS IP block hw_init

process need hold reset domain semaphore but the semaphore has already hold before, the other reason is adding .resume will break regular reset, it doesn't need to be reinitialized due to all RAS error info is cached.

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

Then a dedicated resume sequence needs to be added which checks if device is in reset (being resumed from a reset) before taking hold of the semaphore.

Yes, controlling the semaphore by checking if it is in the reset state can indeed solve the semaphore problem, but as I said there is no need to suspend and then resume the RAS IP block in regular reset.

Right. Eventually ras block also will need suspend/resume sequence like others for other cases like S3 suspend/resume (or during VF migration sequence). It's better to add a TODO comment (remove this once suspend/resume sequence is added or similar) in the existing code.

With that change

Thanks,
Lijo

Quoted 158 lines

Regards,
Stanley

Quoted 155 lines

As an IP block, it will need suspend/resume for other scenarios like device runtime pm or system suspend/resume. This can be used only as a temporary workaround till that point.

Thanks,
Lijo

Quoted 14 lines

Regards,
Stanley

Quoted 12 lines

Thanks,
Lijo

Quoted 8 lines

Regards,
Stanley

Quoted 6 lines

Thanks,
Lijo

Quoted 3 lines
---
     drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14

+++++++++++-

Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 3 lines
     drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
     drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
     .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22

+++++++++++++++++++

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_init_badpage_info(struct

Quoted 9 lines
     .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
     5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct

amdgpu_device *adev)

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -1
       if (!con || amdgpu_sriov_vf(adev))
               return 0;
 
-   if (amdgpu_uniras_enabled(adev))
+   /*
+    * For the reset-on-init path (e.g. an NPS memory partition,
+    * switch) the RAS IP block hw_init has not been enabled and
+    * the amdgpu_uniras_enabled return false, check amdgpu ras
+    * context uniras_enabled flag, eepron init will be called
+    * during RAS IP block hw_init.
+    */
+   if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
               return 0;
 
       control = &con->eeprom_control; @@ -5859,3 +5866,8 @@ void
Quoted 1 line

amdgpu_ras_post_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h void amdgpu_ras_pre_reset(struct

Quoted 13 lines
                       amdgpu_ras_mgr_post_reset(tmp_adev);
       }
     }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+   amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static void

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
                                         struct list_head *device_list);
     void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                         struct list_head
 *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
     #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void

amdgpu_xgmi_reset_on_init_work(struct work_struct *work)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
               if (r && r != -EHWPOISON)
                       dev_err(tmp_adev->dev,
                               "error during bad page data
 initialization");
+
+           /*
+            * For the reset-on-init path (e.g. an NPS memory partition
+            * switch) the RAS IP block hw_init was skipped under the
+            * minimal init level, so uniras was never enabled. Bring it
+            * up now that the reset domain has been unlocked. This is a
+            * no-op for any other reset path where RAS is already
+            * initialized, and for non-uniras devices.
+            */
+           amdgpu_ras_resume_after_reset(tmp_adev);
       }
     }
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct

amdgpu_ip_block *ip_block)

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct · line 468

Quoted 4 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +1 -0
       return 0;
     }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device

*adev) {

Quoted 45 lines
Quoted 44 lines
Quoted 32 lines
Quoted 32 lines

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct · line 470

Quoted 2 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +2 -0
+   struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+   struct amdgpu_ras_mgr *ras_mgr =

amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct · line 482

Quoted 12 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +12 -0
+   struct amdgpu_ip_block *ip_block;
+
+   if (!con || !con->uniras_enabled)
+           return 0;
+
+   if (!ras_mgr || !ras_mgr->ras_core)
+           return -EINVAL;
+
+   if (ras_mgr->ras_is_ready)
+           return 0;
+
+   ip_block = amdgpu_device_ip_get_ip_block(adev,

AMD_IP_BLOCK_TYPE_RAS);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c static int amdgpu_ras_mgr_hw_fini(struct · line 488

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +5 -0
+   if (!ip_block)
+           return -EINVAL;
+
+   return amdgpu_ras_mgr_hw_init(ip_block); }
+
     struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct

Quoted 8 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +0 -0
     {
       if (!adev || !adev->psp.ras_context.ras) diff --git

a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct

amdgpu_device *adev,

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 87

Quoted 6 lines
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +2 -0
               void *output, uint32_t out_size);
     int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);
     int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device
+*adev);
     int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct

amdgpu_device

Quoted 5 lines
Quoted 4 lines

*adev,

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h int amdgpu_ras_mgr_handle_ras_cmd(struct · line 88

Quoted 1 line
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +0 -0
               uint64_t addr, uint64_t *nps_page_addr, uint32_t

max_page_count);

Quoted 1 line
     #endif
Reviewed-by on v1 1/1
#8 lore raw
In reply to Stanley.Yang

AMD General

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Stanley.Yang
Sent: Friday, June 26, 2026 3:18 PM
To: [email protected]
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH 1/1] drm/amdgpu/ras: Resum RAS IP hw init during nps dynamic switch

On an XGMI reset-on-init (NPS memory patition mode swith), RAS IP hw fini, sw fini is called but hw init is skipped due to RAS IP block is not included in hwinit mask, so need call RAS IP hw init during XGMI reset-on-init.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       | 14 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h       |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c      | 10 +++++++++
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c  | 22 +++++++++++++++++++  .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h  |  1 +
 5 files changed, 47 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12 -1
index 7ef7c54ab982..e11c542a01b6 100644
@@ -3857,7 +3857,14 @@ int amdgpu_ras_init_badpage_info(struct amdgpu_device *adev)
        if (!con || amdgpu_sriov_vf(adev))
                return 0;
 
-       if (amdgpu_uniras_enabled(adev))
+       /*
+        * For the reset-on-init path (e.g. an NPS memory partition,
+        * switch) the RAS IP block hw_init has not been enabled and
+        * the amdgpu_uniras_enabled return false, check amdgpu ras
+        * context uniras_enabled flag, eepron init will be called
+        * during RAS IP block hw_init.
+        */
+       if (amdgpu_uniras_enabled(adev) || con->uniras_enabled)
                return 0;
 
        control = &con->eeprom_control;
@@ -5859,3 +5866,8 @@ void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                        amdgpu_ras_mgr_post_reset(tmp_adev);
        }
 }
+
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev) {
+       amdgpu_ras_mgr_resume_after_reset(adev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
index a86ab65aa2f0..ad24c7cf8936 100644
@@ -1045,4 +1045,5 @@ void amdgpu_ras_pre_reset(struct amdgpu_device *adev,
                                          struct list_head *device_list);
 void amdgpu_ras_post_reset(struct amdgpu_device *adev,
                                          struct list_head *device_list);
+void amdgpu_ras_resume_after_reset(struct amdgpu_device *adev);
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10 -0
index 9a4e8715742a..f175c8987aeb 100644
@@ -1669,6 +1669,16 @@ static void amdgpu_xgmi_reset_on_init_work(struct work_struct *work)
                if (r && r != -EHWPOISON)
                        dev_err(tmp_adev->dev,
                                "error during bad page data initialization");
+
+               /*
+                * For the reset-on-init path (e.g. an NPS memory partition
+                * switch) the RAS IP block hw_init was skipped under the
+                * minimal init level, so uniras was never enabled. Bring it
+                * up now that the reset domain has been unlocked. This is a
+                * no-op for any other reset path where RAS is already
+                * initialized, and for non-uniras devices.
+                */
+               amdgpu_ras_resume_after_reset(tmp_adev);
        }
 }
 
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +20 -0
index f627a97797ed..a70e532b3d00 100644
@@ -465,6 +465,28 @@ static int amdgpu_ras_mgr_hw_fini(struct amdgpu_ip_block *ip_block)
        return 0;
 }
 
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev) {
+       struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+       struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
+       struct amdgpu_ip_block *ip_block;
+
+       if (!con || !con->uniras_enabled)
+               return 0;
+
+       if (!ras_mgr || !ras_mgr->ras_core)
+               return -EINVAL;
+
+       if (ras_mgr->ras_is_ready)
+               return 0;
+
+       ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_RAS);
+       if (!ip_block)
+               return -EINVAL;
+
+       return amdgpu_ras_mgr_hw_init(ip_block); }
+
 struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct amdgpu_device *adev)  {
        if (!adev || !adev->psp.ras_context.ras) diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h

index 4f44a917d48b..3f80b9f1f0ac 100644

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +1 -1
@@ -82,6 +82,7 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,
                void *output, uint32_t out_size);
 int amdgpu_ras_mgr_pre_reset(struct amdgpu_device *adev);  int amdgpu_ras_mgr_post_reset(struct amdgpu_device *adev);
+int amdgpu_ras_mgr_resume_after_reset(struct amdgpu_device *adev);
 int amdgpu_ras_mgr_lookup_bad_pages_in_a_row(struct amdgpu_device *adev,
                uint64_t addr, uint64_t *nps_page_addr, uint32_t max_page_count);  #endif
--

2.43.0