Skip to contentSkip to conversation

drm/amd: Document device reset methods

PATCH Superseded André Almeida 3 participants 3 messages Nov 10, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: Document device reset methods

Document what each amdgpu driver reset method does.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +20 -0
index a79d53bdbe13..500f86c79eb7 100644
@@ -504,6 +504,26 @@ struct amdgpu_allowed_register_entry {
 	bool grbm_indexed;
 };
 
+/**
+ * enum amd_reset_method - Methods for resetting AMD GPU devices
+ *
+ * @AMD_RESET_METHOD_NONE: The device will not be reset.
+ * @AMD_RESET_LEGACY: Method reserved for SI/CIK asics.
+ * @AMD_RESET_MODE0: High level PCIe reset.
+ * @AMD_RESET_MODE1: Resets each IP block (SDMA, GFX, VCN, etc.) individually.
+ *                   Suitable only for some discrete GPUs.
+ * @AMD_RESET_MODE2: Resets only the GFX block. Useful for APUs, giving that
+ *                   the rest of IP blocks and SMU is shared with the CPU.
+ * @AMD_RESET_BACO: BACO (Bus Alive, Chip Off) method powers off and on the card
+ *                  but without powering off the PCI bus. Suitable only for
+ *                  discrete GPUs.
+ * @AMD_RESET_PCI: Does a full bus reset, including powering on and off the
+ *                 card.
+ *
+ * Methods available for AMD GPU driver for resetting the device. Not all
+ * methods are suitable for every device. User can overwrite the method using
+ * module parameter `reset_method`.
+ */
 enum amd_reset_method {
 	AMD_RESET_METHOD_NONE = -1,
 	AMD_RESET_METHOD_LEGACY = 0,
Signature · 1 line
2.42.1
#1 lore raw
Quoted 13 lines · André Almeida

Document what each amdgpu driver reset method does.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index a79d53bdbe13..500f86c79eb7 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 511

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
@@ -504,6 +504,26 @@ struct amdgpu_allowed_register_entry {
        bool grbm_indexed;
 };
 
+/**
+ * enum amd_reset_method - Methods for resetting AMD GPU devices
+ *
+ * @AMD_RESET_METHOD_NONE: The device will not be reset.
+ * @AMD_RESET_LEGACY: Method reserved for SI/CIK asics.

This also applies to VI asics.

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 512

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
+ * @AMD_RESET_MODE0: High level PCIe reset.

Resets the entire ASIC. Here for completeness, but not actually available to the driver.

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 514

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+ * @AMD_RESET_MODE1: Resets each IP block (SDMA, GFX, VCN, etc.) individually.
+ *                   Suitable only for some discrete GPUs.

Resets all IPs on the asic. Not available on all asics.

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 516

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+ * @AMD_RESET_MODE2: Resets only the GFX block. Useful for APUs, giving that
+ *                   the rest of IP blocks and SMU is shared with the CPU.

Resets a lesser level of IPs compared to MODE1. Which IPs are reset depends on the asic. Notably doesn't reset IPs shared with the CPU on APUs or the memory controllers (so VRAM is not lost). Not available on all asics.

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 521

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
+ * @AMD_RESET_BACO: BACO (Bus Alive, Chip Off) method powers off and on the card
+ *                  but without powering off the PCI bus. Suitable only for
+ *                  discrete GPUs.
+ * @AMD_RESET_PCI: Does a full bus reset, including powering on and off the
+ *                 card.

This calls into the core Linux PCI reset code and does a secondary bus reset or FLR, depending on what the underlying hardware supports.

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -1
+ *
+ * Methods available for AMD GPU driver for resetting the device. Not all
+ * methods are suitable for every device. User can overwrite the method using
+ * module parameter `reset_method`.
+ */
 enum amd_reset_method {
        AMD_RESET_METHOD_NONE = -1,
        AMD_RESET_METHOD_LEGACY = 0,
--

2.42.1

#2 lore raw
In reply to André Almeida

Hi--

Quoted 12 lines · André Almeida

Document what each amdgpu driver reset method does.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index a79d53bdbe13..500f86c79eb7 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 511

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
@@ -504,6 +504,26 @@ struct amdgpu_allowed_register_entry {
 	bool grbm_indexed;
 };
 
+/**
+ * enum amd_reset_method - Methods for resetting AMD GPU devices
+ *
+ * @AMD_RESET_METHOD_NONE: The device will not be reset.
+ * @AMD_RESET_LEGACY: Method reserved for SI/CIK asics.

ASICs.

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_allowed_register_entry { · line 524

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +13 -0
+ * @AMD_RESET_MODE0: High level PCIe reset.
+ * @AMD_RESET_MODE1: Resets each IP block (SDMA, GFX, VCN, etc.) individually.
+ *                   Suitable only for some discrete GPUs.
+ * @AMD_RESET_MODE2: Resets only the GFX block. Useful for APUs, giving that
+ *                   the rest of IP blocks and SMU is shared with the CPU.
+ * @AMD_RESET_BACO: BACO (Bus Alive, Chip Off) method powers off and on the card
+ *                  but without powering off the PCI bus. Suitable only for
+ *                  discrete GPUs.
+ * @AMD_RESET_PCI: Does a full bus reset, including powering on and off the
+ *                 card.
+ *
+ * Methods available for AMD GPU driver for resetting the device. Not all
+ * methods are suitable for every device. User can overwrite the method using

s/overwrite/override/
would make more sense to me.

Otherwise looks good. Thanks.

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+ * module parameter `reset_method`.
+ */
 enum amd_reset_method {
 	AMD_RESET_METHOD_NONE = -1,
 	AMD_RESET_METHOD_LEGACY = 0,
Signature · 1 line
~Randy