Skip to contentSkip to conversation

amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

PATCH In review Yifan Zhang 5 participants 21 messages Sep 29 – Sep 30

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

PATCH 1/1 amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29 ++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
 static int smu_v14_0_2_mode1_reset(struct smu_context *smu)
 {
+	struct amdgpu_device *adev = smu->adev;
+	u16 saved_cmd, cmd;
 	int ret = 0;
 
 	ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-	if (!ret) {
-		if (amdgpu_emu_mode == 1) {
-			msleep(50000);
-		} else {
-			/* disable mmio access while doing mode 1 reset*/
-			smu->adev->no_hw_access = true;
-			/* ensure no_hw_access is globally visible before any MMIO */
-			smp_mb();
-			msleep(1000);
-		}
+	if (ret)
+		return ret;
+
+	pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+	cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+	pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+	if (amdgpu_emu_mode == 1) {
+		msleep(50000);
+	} else {
+		/* disable mmio access while doing mode 1 reset*/
+		smu->adev->no_hw_access = true;
+		/* ensure no_hw_access is globally visible before any MMIO */
+		smp_mb();
+		msleep(1000);
 	}
 
+	pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
 	return ret;
 }
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 51 lines
---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29 ++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
 static int smu_v14_0_2_mode1_reset(struct smu_context *smu)
 {
+	struct amdgpu_device *adev = smu->adev;
+	u16 saved_cmd, cmd;
 	int ret = 0;
 
 	ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-	if (!ret) {
-		if (amdgpu_emu_mode == 1) {
-			msleep(50000);
-		} else {
-			/* disable mmio access while doing mode 1 reset*/
-			smu->adev->no_hw_access = true;
-			/* ensure no_hw_access is globally visible before any MMIO */
-			smp_mb();
-			msleep(1000);
-		}
+	if (ret)
+		return ret;
+
+	pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+	cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+	pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+	if (amdgpu_emu_mode == 1) {
+		msleep(50000);
+	} else {
+		/* disable mmio access while doing mode 1 reset*/
+		smu->adev->no_hw_access = true;
+		/* ensure no_hw_access is globally visible before any MMIO */
+		smp_mb();
+		msleep(1000);
 	}
 
+	pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
 	return ret;
 }
 
#2 lore raw

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs.
I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 53 lines
---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
 static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
      int ret = 0;
 
      ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1 reset*/
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible before any MMIO */
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any MMIO */
+             smp_mb();
+             msleep(1000);
      }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
      return ret;
 }
 
#3 lore raw

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

________________________________
From: Zhang, Yifan <[email protected]>
Sent: Tuesday, September 29, 2026 5:36 AM
To: Koenig, Christian <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Yuan, Perry <[email protected]>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs.
I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 53 lines
---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
 static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
      int ret = 0;
 
      ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1 reset*/
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible before any MMIO */
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any MMIO */
+             smp_mb();
+             msleep(1000);
      }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
      return ret;
 }
 
#4 lore raw

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index b690a07e31ab..075de681ab86 100644
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)
                return false;

}

+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
+ unsigned int delay_ms)
+{
+ u16 saved_cmd, cmd;
+

+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);

+
+ msleep(delay_ms);
+
+ pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+}
+

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
index b250c5e41e45..356e09b7eef9 100644
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
 
        ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);
        if (!ret)
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
+               amdgpu_device_mode1_reset_wait(smu->adev,
+                                              SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
        return ret;

}

Best Regards,
Yifan

From: Deucher, Alexander <[email protected]>
Sent: Wednesday, September 30, 2026 2:59 AM
To: Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

________________________________
From: Zhang, Yifan <[email protected]<mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:36 AM
To: Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs.
I'm not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]<mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 53 lines
---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
 static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
      int ret = 0;
 
      ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1 reset*/
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible before any MMIO */
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any MMIO */
+             smp_mb();
+             msleep(1000);
      }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
      return ret;
 }
 
#5 lore raw

This doesn't work for all (at least on some datacenter GPUs). With AER enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Thanks,
Lijo

Quoted 188 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +14 -0
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct 
 amdgpu_device *adev)
 
                 return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
 
         ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);
 
         if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+                                              

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

        return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic.  Any asic doing mode1 reset should do this?

Alex

------------------------------------------------------------------------

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs.
I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 53 lines
Signed-off-by Yifan Zhang <[email protected] <mailto:[email protected]>>

---
  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------

  1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1 reset*/
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible before any MMIO */
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
 
#6 lore raw

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

This doesn't work for all (at least on some datacenter GPUs). With AER enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Thanks,
Lijo

Quoted 226 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

drivers/gpu/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0

drm/amd/amdgpu/amdgpu_device.c

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

drivers/gpu/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +14 -0
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct
 amdgpu_device *adev)
 
                 return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
drivers/ renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0

gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

drivers/ renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context
 *smu)
 
         ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);
 
         if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

         return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

----------------------------------------------------------------------
--

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs. I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 57 lines

<mailto:[email protected]>>

---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -5
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
 static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
      int ret = 0;
 
      ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any
+MMIO */
+             smp_mb();
+             msleep(1000);
      }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
      return ret;
 }
#7 lore raw

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to Memory Space
accesses. When this bit is Clear, all received Memory Space accesses are caused to be handled as "Unsupported Requests"

On AER enabled systems, depending on how the platform is configured to classify the severity of UR errors, that could result in System error.

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 249 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

This doesn't work for all (at least on some datacenter GPUs). With AER enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Thanks,
Lijo

Quoted 226 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

drivers/gpu/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0

drm/amd/amdgpu/amdgpu_device.c

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

drivers/gpu/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +14 -0
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct
 amdgpu_device *adev)
 
                  return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
drivers/ renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0

gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

drivers/ renamed from drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context
 *smu)
 
          ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);
 
          if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

          return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

----------------------------------------------------------------------
--

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs. I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 57 lines

<mailto:[email protected]>>

---
  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
  1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -5
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
  static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
       int ret = 0;
 
       ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any
+MMIO */
+             smp_mb();
+             msleep(1000);
       }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
       return ret;
  }
#8 lore raw

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

        pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
        pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                   saved_devctl & ~PCI_EXP_DEVCTL_URRE);
        pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                      &saved_uemsk);
        pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       saved_uemsk | PCI_ERR_UNC_UNSUP);

After:

        pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       saved_uemsk);
        pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to Memory Space
accesses. When this bit is Clear, all received Memory Space accesses are caused to be handled as "Unsupported Requests"

On AER enabled systems, depending on how the platform is configured to classify the severity of UR errors, that could result in System error.

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 254 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

This doesn't work for all (at least on some datacenter GPUs). With AER enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Thanks,
Lijo

Quoted 228 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +14 -0
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct
 amdgpu_device *adev)
 
                  return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +2 -1
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context
 *smu)
 
          ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);
 
          if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

          return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

---------------------------------------------------------------------
-
--

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs. I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 57 lines

<mailto:[email protected]>>

---
  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
  1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -5
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
  static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
       int ret = 0;
 
       ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any
+MMIO */
+             smp_mb();
+             msleep(1000);
       }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
       return ret;
  }
#9 lore raw

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 297 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk | PCI_ERR_UNC_UNSUP);

After:

         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to Memory Space
accesses. When this bit is Clear, all received Memory Space accesses are caused to be handled as "Unsupported Requests"

On AER enabled systems, depending on how the platform is configured to classify the severity of UR errors, that could result in System error.

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 254 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

This doesn't work for all (at least on some datacenter GPUs). With AER enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Thanks,
Lijo

Quoted 228 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +14 -0
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +2 -1
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

---------------------------------------------------------------------
-
--

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs. I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 57 lines

<mailto:[email protected]>>

---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -5
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any
+MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#10 lore raw

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 348 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk |

PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 4 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 2 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 1 line
Quoted 1 line

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +14 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

--------------------------------------------------------------------

(quoted diff) +0 -3
-
-
--
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

<mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Best Regards,
Yifan

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>

---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int smu_v14_0_2_set_df_cstate(struct · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any
+MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#11 lore raw

AMD General

Cc @Feng, Kenneth,

Best Regards,
Kevin

Quoted 384 lines

-----Original Message-----
From: Wang, Kevin
Sent: Wednesday, September 30, 2026 2:09 PM
To: 'Lazar, Lijo' <[email protected]>; Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1

reset message.

Quoted 3 lines

During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 11 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1

reset message.

Quoted 128 lines

During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk |

PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +2 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 7 lines
(quoted diff) +4 -0
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND,

&saved_cmd);

Quoted 71 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
(quoted diff) +8 -0
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

------------------------------------------------------------------
--

(quoted diff) +0 -3
-
-
--
Quoted 21 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

<mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to

fix

Quoted 69 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Best Regards,
Yifan

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>

---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +4 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND,

&saved_cmd);

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 20 lines
Quoted 19 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +14 -0
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#12 lore raw
In reply to Wang, Kevin

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected]>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected]>; Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 354 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk |

PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +14 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

------------------------------------------------------------------
--

(quoted diff) +0 -3
-
-
--
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Best Regards,
Yifan

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>

---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#13 lore raw

AMD General

The actual reset sequence is run by the FW while you are polling for the response. This patch doesn't make any sense in that way.

Thanks,
Lijo
________________________________
From: Zhang, Yifan <[email protected]>
Sent: Wednesday, 30 September 2026 11:47:46
To: Wang, Kevin <[email protected]>; Lazar, Lijo <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected] <[email protected]>
Cc: Yuan, Perry <[email protected]>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected]>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected]>; Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 354 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk |

PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +14 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

------------------------------------------------------------------
--

(quoted diff) +0 -3
-
-
--
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Best Regards,
Yifan

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>

---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#14 lore raw

AMD General

On Navi3x/Navi4x, the driver doesn't poll for a response. It sends the mode1 reset request through the SMU debug mailbox and waits a fixed interval (SMU13_MODE1_RESET_WAIT_TIME_IN_MS) for the reset to proceed. After that, it polls the PSP bootloader status and the memsize register to confirm the ASIC is out of reset. On ASICs where the regular SMU message path is used, the polled response only acknowledges the message; it doesn't indicate that the reset has completed.

From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 2:28 PM
To: Zhang, Yifan <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

The actual reset sequence is run by the FW while you are polling for the response. This patch doesn't make any sense in that way.

Thanks,
Lijo
________________________________
From: Zhang, Yifan <[email protected]<mailto:[email protected]>>
Sent: Wednesday, 30 September 2026 11:47:46
To: Wang, Kevin <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected]<mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; Zhang, Yifan <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 213 lines

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1
reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk |

PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]<mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during
mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]<mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Yuan, Perry <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during
mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +14 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]<mailto:[email protected]>>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> *Cc:* Yuan, Perry <[email protected]<mailto:[email protected]>>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during
mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

------------------------------------------------------------------
--

(quoted diff) +0 -3
-
-
--

*From:*Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>; [email protected]<mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

<mailto:[email protected]>
<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

*Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

Quoted 14 lines

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I'm not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>; [email protected]<mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected]>>

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 2 lines

<mailto:[email protected]%0b>> >>>> <mailto:[email protected]>>

Quoted 59 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
maintainer
#15 lore raw

Well it doesn't matter who gets the request and what do we pool.

The real question is if that goes over the MMIO BAR or the PCIe config space.

If the SMU debug mailbox registers or PSP bootloader status is accessed over the MMIO BAR space then I agree with Lijo that the approach of disabling all MMIO BAR accesses won't work.

Regards,
Christian.

Quoted 419 lines · Yifan

AMD General

On Navi3x/Navi4x, the driver doesn't poll for a response. It sends the mode1 reset request through the SMU debug mailbox and waits a fixed interval (SMU13_MODE1_RESET_WAIT_TIME_IN_MS) for the reset to proceed. After that, it polls the PSP bootloader status and the memsize register to confirm the ASIC is out of reset. On ASICs where the regular SMU message path is used, the polled response only acknowledges the message; it doesn't indicate that the reset has completed.

*From:*Lazar, Lijo <[email protected]>
*Sent:* Wednesday, September 30, 2026 2:28 PM
*To:* Zhang, Yifan <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

The actual reset sequence is run by the FW while you are polling for the response. This patch doesn't make any sense in that way.

Thanks,

Lijo

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, 30 September 2026 11:47:46
*To:* Wang, Kevin <[email protected] <mailto:[email protected]>>; Lazar, Lijo <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected] <mailto:[email protected]>>; Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 213 lines

-----Original Message-----
From: amd-gfx <[email protected] <mailto:[email protected]>> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian
<[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1
reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:
          pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl); pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, saved_devctl & ~PCI_EXP_DEVCTL_URRE); pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK, &saved_uemsk); pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK, saved_uemsk | PCI_ERR_UNC_UNSUP);

After:
          pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK, saved_uemsk); pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian
<[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during
mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

          Memory Space Enable - Controls a Function's response to Memory  Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian
<[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during
mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +14 -0
 amdgpu_device *adev)
 
                     return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +2 -1
 *smu)
 
             ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
             if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

            return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> *Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during
mode1 reset on gfx12

Public

I think this should be asic agnostic.  Any asic doing mode1 reset should do this?

Alex

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

------------------------------------------------------------------
--

(quoted diff) +0 -3
-
-
--

*From:*Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

<mailto:[email protected] <mailto:[email protected]>> <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

*Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

Quoted 14 lines

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

<mailto:[email protected] <mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 2 lines

<mailto:[email protected]%0b>> >>>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 59 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---
    .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------

    1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
     static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
          int ret = 0;
 
          ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/
-                     smu->adev->no_hw_access = true; -                     /* ensure no_hw_access is globally visible before any MMIO */
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +14 -0
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);

         }

+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd); +
         return ret;
    }

#16 lore raw

AMD General

SMU debug mail box registers are accessed prior to disabling PCI_COMMAND_MEMORY, and PSP bootloader status are accessed after enabling PCI_COMMAND_MEMORY. There is no MMIO BAR access in b/w.

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 30, 2026 3:12 PM
To: Zhang, Yifan <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Well it doesn't matter who gets the request and what do we pool.

The real question is if that goes over the MMIO BAR or the PCIe config space.

If the SMU debug mailbox registers or PSP bootloader status is accessed over the MMIO BAR space then I agree with Lijo that the approach of disabling all MMIO BAR accesses won't work.

Regards,
Christian.

Quoted 489 lines · Yifan

AMD General

On Navi3x/Navi4x, the driver doesn't poll for a response. It sends the mode1 reset request through the SMU debug mailbox and waits a fixed interval (SMU13_MODE1_RESET_WAIT_TIME_IN_MS) for the reset to proceed. After that, it polls the PSP bootloader status and the memsize register to confirm the ASIC is out of reset. On ASICs where the regular SMU message path is used, the polled response only acknowledges the message; it doesn't indicate that the reset has completed.

*From:*Lazar, Lijo <[email protected]>
*Sent:* Wednesday, September 30, 2026 2:28 PM
*To:* Zhang, Yifan <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
*Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

The actual reset sequence is run by the FW while you are polling for the response. This patch doesn't make any sense in that way.

Thanks,

Lijo

----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, 30 September 2026 11:47:46
*To:* Wang, Kevin <[email protected] <mailto:[email protected]>>; Lazar, Lijo <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>> *Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected] <mailto:[email protected]>>; Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 232 lines

-----Original Message-----
From: amd-gfx <[email protected] <mailto:[email protected]>> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 37 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL,
&saved_devctl);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl &
~PCI_EXP_DEVCTL_URRE);
pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
&saved_uemsk);
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk |
PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 17 lines
Quoted 17 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
(quoted diff) +16 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND,
+&saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND,
+saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
*Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

-----------------------------------------------------------------

(quoted diff) +0 -5
-
--
-
-
--

*From:*Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]
<mailto:[email protected]>>
<[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

*Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient. I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

Quoted 14 lines

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I'm not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]
<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 2 lines

<mailto:[email protected]%0b>> >>>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 60 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2086

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)
 {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
maintainer
#17 lore raw

If the SMU debug mail box register is the start of the mode 1 reset procedure and if that procedure requires that we stop VRAM and doorbell accesses then we need to do that *before* we do the SMU debug mail box write.

Everything else is racy and not something we can do upstream.

Regards,
Christian.

Quoted 511 lines · Yifan

AMD General

SMU debug mail box registers are accessed prior to disabling PCI_COMMAND_MEMORY, and PSP bootloader status are accessed after enabling PCI_COMMAND_MEMORY. There is no MMIO BAR access in b/w.

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 30, 2026 3:12 PM
To: Zhang, Yifan <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Well it doesn't matter who gets the request and what do we pool.

The real question is if that goes over the MMIO BAR or the PCIe config space.

If the SMU debug mailbox registers or PSP bootloader status is accessed over the MMIO BAR space then I agree with Lijo that the approach of disabling all MMIO BAR accesses won't work.

Regards,
Christian.

Quoted 489 lines · Yifan

AMD General

On Navi3x/Navi4x, the driver doesn't poll for a response. It sends the mode1 reset request through the SMU debug mailbox and waits a fixed interval (SMU13_MODE1_RESET_WAIT_TIME_IN_MS) for the reset to proceed. After that, it polls the PSP bootloader status and the memsize register to confirm the ASIC is out of reset. On ASICs where the regular SMU message path is used, the polled response only acknowledges the message; it doesn't indicate that the reset has completed.

*From:*Lazar, Lijo <[email protected]>
*Sent:* Wednesday, September 30, 2026 2:28 PM
*To:* Zhang, Yifan <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
*Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

The actual reset sequence is run by the FW while you are polling for the response. This patch doesn't make any sense in that way.

Thanks,

Lijo

----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, 30 September 2026 11:47:46
*To:* Wang, Kevin <[email protected] <mailto:[email protected]>>; Lazar, Lijo <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>> *Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected] <mailto:[email protected]>>; Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 232 lines

-----Original Message-----
From: amd-gfx <[email protected] <mailto:[email protected]>> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 37 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL,
&saved_devctl);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl &
~PCI_EXP_DEVCTL_URRE);
pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
&saved_uemsk);
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk |
PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 17 lines
Quoted 17 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
(quoted diff) +16 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND,
+&saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND,
+saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
*Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

-----------------------------------------------------------------

(quoted diff) +0 -5
-
--
-
-
--

*From:*Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]
<mailto:[email protected]>>
<[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

*Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient. I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

Quoted 14 lines

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I'm not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]
<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 2 lines

<mailto:[email protected]%0b>> >>>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 60 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2086

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)
 {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#18 lore raw

AMD General

But SMU debug mail box register is itself a part of PCIe MMIO BAR, we can't block PCIE BARs before SMU debug mail box write...

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 30, 2026 3:56 PM
To: Zhang, Yifan <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

If the SMU debug mail box register is the start of the mode 1 reset procedure and if that procedure requires that we stop VRAM and doorbell accesses then we need to do that *before* we do the SMU debug mail box write.

Everything else is racy and not something we can do upstream.

Regards,
Christian.

Quoted 528 lines · Yifan

AMD General

SMU debug mail box registers are accessed prior to disabling PCI_COMMAND_MEMORY, and PSP bootloader status are accessed after enabling PCI_COMMAND_MEMORY. There is no MMIO BAR access in b/w.

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 30, 2026 3:12 PM
To: Zhang, Yifan <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Well it doesn't matter who gets the request and what do we pool.

The real question is if that goes over the MMIO BAR or the PCIe config space.

If the SMU debug mailbox registers or PSP bootloader status is accessed over the MMIO BAR space then I agree with Lijo that the approach of disabling all MMIO BAR accesses won't work.

Regards,
Christian.

Quoted 503 lines · Yifan

AMD General

On Navi3x/Navi4x, the driver doesn't poll for a response. It sends the mode1 reset request through the SMU debug mailbox and waits a fixed interval (SMU13_MODE1_RESET_WAIT_TIME_IN_MS) for the reset to proceed. After that, it polls the PSP bootloader status and the memsize register to confirm the ASIC is out of reset. On ASICs where the regular SMU message path is used, the polled response only acknowledges the message; it doesn't indicate that the reset has completed.

*From:*Lazar, Lijo <[email protected]>
*Sent:* Wednesday, September 30, 2026 2:28 PM
*To:* Zhang, Yifan <[email protected]>; Wang, Kevin <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
*Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

The actual reset sequence is run by the FW while you are polling for the response. This patch doesn't make any sense in that way.

Thanks,

Lijo

---------------------------------------------------------------------

(quoted diff) +0 -28
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
---------------------------------------------------------------------
-
----------

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, 30 September 2026 11:47:46
*To:* Wang, Kevin <[email protected] <mailto:[email protected]>>; Lazar, Lijo <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>> *Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Yes. In addition, the polling happens inside smu_cmn_send_smc_msg(), which runs before PCI_COMMAND_MEMORY is cleared. During the mode1 reset process there should be no traffic to the PCIe BARs; otherwise, the PCI bus may hang.

Also, every PCI config write in the patch targets only the GPU device itself (pci_write_config_dword is per device), so no other PCI devices are affected.

-----Original Message-----
From: Wang, Kevin <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 2:09 PM
To: Lazar, Lijo <[email protected] <mailto:[email protected]>>; Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 232 lines

-----Original Message-----
From: amd-gfx <[email protected] <mailto:[email protected]>> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 37 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL,
&saved_devctl);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl &
~PCI_EXP_DEVCTL_URRE);
pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
&saved_uemsk);
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk |
PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 5 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 3 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 17 lines
Quoted 17 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected] <mailto:[email protected]>>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines
Quoted 2 lines

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
(quoted diff) +16 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND,
+&saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND,
+saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
*Cc:* Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

-----------------------------------------------------------------

(quoted diff) +0 -5
-
--
-
-
--

*From:*Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]
<mailto:[email protected]>>
<[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

*Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient. I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

Quoted 14 lines

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I'm not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>; [email protected] <mailto:[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]
<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]

<mailto:[email protected]%0b>> >>>
<mailto:[email protected]
<mailto:[email protected]>>>; Yuan, Perry

Quoted 1 line

<[email protected]

<mailto:[email protected]%0b>> >>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 2 lines

<mailto:[email protected]%0b>> >>>> <mailto:[email protected] <mailto:[email protected]>>>

Quoted 59 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int
 smu_v14_0_2_set_df_cstate(struct smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu) {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before
+any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
#19 lore raw
In reply to Wang, Kevin

AMD General

That is not part of actual reset, it is reinit after reset and that time access is safe.

Thanks,
Lijo
________________________________
From: Wang, Kevin <[email protected]>
Sent: Wednesday, 30 September 2026 11:39:10
To: Lazar, Lijo <[email protected]>; Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected] <[email protected]>
Cc: Yuan, Perry <[email protected]>
Subject: RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

AMD General

Quoted 5 lines

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

That is not right. When the OS driver polls and sees the response register become "1", it does **NOT** mean the mode1 sequence is completed. The PMFW will continue forward the message to PSP and wait for PMFW ucode reload to finish at a 2nd-half stage.

Best Regards,
Kevin

Quoted 348 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, September 30, 2026 1:41 PM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

On a second look, the patch doesn't seem right. Reset sequence is supposed to be complete by the time FW responds back to the mode-1 reset message. During reset sequence, we need Mem space to be enabled to poll success status of the message and that's most volatile window during the whole sequence.

Disabling the memory space after reset sequence is complete looks to be the wrong diagnosis of the issue. Access during reinit sequence after reset is safe and shouldn't cause any issue in general.

That said, we should try to resolve the issue without touching any PCI config settings. PCI config space is open for others as well.

Thanks,
Lijo

Quoted 32 lines · Yifan

AMD General

How about disable UE during mode1 reset ? E.g.

Before:

         pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &saved_devctl);
         pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
                                    saved_devctl & ~PCI_EXP_DEVCTL_URRE);
         pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                       &saved_uemsk);
         pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
                                        saved_uemsk |

PCI_ERR_UNC_UNSUP);

After:
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_MASK,
saved_uemsk);
pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
saved_devctl);

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:37 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 4 lines

This is the behaviour of this bit -

Memory Space Enable - Controls a Function's response to
Memory Space accesses. When this bit is Clear, all received Memory Space

accesses are caused to be handled as "Unsupported Requests"

Quoted 2 lines

On AER enabled systems, depending on how the platform is configured to

classify the severity of UR errors, that could result in System error.

Quoted 14 lines

On other hand, if you are sure that there is no such access during mode-1 reset, we don't need this patch in the first place.

Thanks,
Lijo

Quoted 5 lines · Yifan

AMD General

Hi Lijo,

Why does clearing PCI_COMMAND_MEMORY cause AER errors on data

center GPUs? Are their PCIe BARs still being accessed during a mode1 reset?

Quoted 14 lines
Quoted 14 lines

Best Regards,
Yifan

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 30, 2026 11:06 AM
To: Zhang, Yifan <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Yuan, Perry <[email protected]>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 1 line
Quoted 1 line

This doesn't work for all (at least on some datacenter GPUs). With AER

enabled, this will result in AER errors. Depending on the platform config, some may classify this access as fatal.

Quoted 20 lines
Quoted 20 lines

Thanks,
Lijo

Quoted 15 lines · Yifan

Public

Hi Alex,

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

(quoted diff) +0 -0

b/drivers/gpu/ drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
Quoted 7 lines

Review bool

Quoted 7 lines

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

(quoted diff) +0 -0
@@ -4931,6 +4931,28 @@ bool

amdgpu_device_should_recover_gpu(struct

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
(quoted diff) +14 -0
 amdgpu_device *adev)
 
                   return false;
 
 }
 
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
(quoted diff) +0 -0

b/drivers/ gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 7 lines
Quoted 7 lines

Review int smu_v13_0_mode1_reset(struct

Quoted 7 lines

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

(quoted diff) +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct

smu_context

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
(quoted diff) +2 -1
 *smu)
 
           ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset,
 NULL);
 
           if (!ret)
 
-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);
 
+               amdgpu_device_mode1_reset_wait(smu->adev,
 
+

SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

           return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]> *Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic. Any asic doing mode1 reset should do this?

Alex

--------------------------------------------------------------------

(quoted diff) +0 -3
-
-
--
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

<mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to
SMU13/14 ASICs, without affecting the Mode 1 reset process on other

ASICs.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently,

so

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate

patch?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Best Regards,
Yifan

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry

<[email protected]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

<mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that

no_hw_access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

flag in any way. Who added that there?

Regards,
Christian.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

<mailto:[email protected]>>

---
   .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------
   1 file changed, 19 insertions(+), 10 deletions(-)

diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c index 072d9c4e202d..25b9085ead71 100644

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -0
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int smu_v14_0_2_set_df_cstate(struct · line 2085

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu,

DEBUGSMC_MSG_Mode1Reset);

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -5
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1

reset*/

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +0 -2
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible

before any MMIO */

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +18 -3
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any
+MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }
maintainer
#20 lore raw
In reply to Zhang, Yifan

Branching the discussion of here since what Lijo wrote is more on the HW side while I want to comment on the SW side of this.

Quoted 5 lines · Yifan

Public

Hi Alex,

Quoted 7 lines

I think it is reasonable to apply the patch to all ASICs. I will sync with the hardware team about this change; so far we have only tested it on Navi31.

How about adding a common helper and calling it from ASIC-specific code, starting with Navi31? For example:

We already have that, see amdgpu_device_mode1_reset(). That's why I was so suprised to see no_hw_access beeing touched from the SMU code.

What could be is that the smu v14 code re-implemented this function, but that would be a really questionable approach and should be avoided.

Regards,
Christian.

Quoted 200 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0

index b690a07e31ab..075de681ab86 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -4931,6 +4931,28 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)
 
                 return false;
 
 }
 

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +14 -0
+void amdgpu_device_mode1_reset_wait(struct amdgpu_device *adev,
 
+                                   unsigned int delay_ms)
 
+{
 
+       u16 saved_cmd, cmd;
 
+
 
+       pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
 
+       cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
 
+
 
+       msleep(delay_ms);
 
+
 
+       pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
 
+}
 
+
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0

index b250c5e41e45..356e09b7eef9 100644

--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
@@ -2242,7 +2242,8 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
 

        ret = smu_cmn_send_smc_msg(smu, SMU_MSG_Mode1Reset, NULL);

        if (!ret)

-               msleep(SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

+               amdgpu_device_mode1_reset_wait(smu->adev,

+                                              SMU13_MODE1_RESET_WAIT_TIME_IN_MS);

        return ret;

}

Best Regards,

Yifan

*From:*Deucher, Alexander <[email protected]>
*Sent:* Wednesday, September 30, 2026 2:59 AM
*To:* Zhang, Yifan <[email protected]>; Koenig, Christian <[email protected]>; [email protected] *Cc:* Yuan, Perry <[email protected]>
*Subject:* Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

I think this should be asic agnostic.  Any asic doing mode1 reset should do this?

Alex

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

*From:*Zhang, Yifan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, September 29, 2026 5:36 AM
*To:* Koenig, Christian <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Public

Hi Christian,

The no_hw_access flag was first set in commit 0de604d0357d0d22cbf03af1077d174b641707b6. This was intended to fix the Mode 1 reset hang, but it proved insufficient.
I think the flag was set in the SMU code so that it would apply only to SMU13/14 ASICs, without affecting the Mode 1 reset process on other ASICs.
I’m not sure whether we can drop the no_hw_access flag after disabling PCI_COMMAND_MEMORY. The PCI hang occurs intermittently, so we may need another round of stress testing to confirm that the flag is no longer needed. Should we remove no_hw_access in a separate patch?

Best Regards,
Yifan

-----Original Message-----
From: Koenig, Christian <[email protected] <mailto:[email protected]>>
Sent: Tuesday, September 29, 2026 5:06 PM
To: Zhang, Yifan <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]>
Cc: Deucher, Alexander <[email protected] <mailto:[email protected]>>; Yuan, Perry <[email protected] <mailto:[email protected]>>
Subject: Re: [PATCH] amdgpu/pm: block GPU PCI bar access during mode1 reset on gfx12

Quoted 2 lines · Yifan Zhang

block GPU PCI bar access during mode1 reset on gfx12, to resolve the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in any way. Who added that there?

Regards,
Christian.

Quoted 53 lines
Signed-off-by Yifan Zhang <[email protected] <mailto:[email protected]>>

---
  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29
++++++++++++-------

  1 file changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +19 -10
index 072d9c4e202d..25b9085ead71 100644
@@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct
 smu_context *smu,
 
   static int smu_v14_0_2_mode1_reset(struct smu_context *smu)  {
+     struct amdgpu_device *adev = smu->adev;
+     u16 saved_cmd, cmd;
        int ret = 0;
 
        ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
-     if (!ret) {
-             if (amdgpu_emu_mode == 1) {
-                     msleep(50000);
-             } else {
-                     /* disable mmio access while doing mode 1 reset*/
-                     smu->adev->no_hw_access = true;
-                     /* ensure no_hw_access is globally visible before any MMIO */
-                     smp_mb();
-                     msleep(1000);
-             }
+     if (ret)
+             return ret;
+
+     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
+     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
+     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+
+     if (amdgpu_emu_mode == 1) {
+             msleep(50000);
+     } else {
+             /* disable mmio access while doing mode 1 reset*/
+             smu->adev->no_hw_access = true;
+             /* ensure no_hw_access is globally visible before any MMIO */
+             smp_mb();
+             msleep(1000);
        }
 
+     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
+
        return ret;
   }