Skip to contentSkip to conversation

drm/amdgpu: drop psp v13 query_boot_status implementation

PATCH New Hawking Zhang 3 participants 8 messages Jan 7, 2024 – Jan 8, 2024

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

PATCH 1/5 drm/amdgpu: drop psp v13 query_boot_status implementation

Will replace it with new implementation to cover
boot fails in ip discovery phase.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c    | 15 -----
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h    |  4 --
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c     | 78 ----------------------
 4 files changed, 99 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -2
index a39c9fea55c4..abad5773714c 100644
@@ -1218,8 +1218,6 @@ static int amdgpu_device_asic_init(struct amdgpu_device *adev)
 	    amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(11, 0, 0)) {
 		amdgpu_psp_wait_for_bootloader(adev);
 		ret = amdgpu_atomfirmware_asic_init(adev, true);
-		/* TODO: check the return val and stop device initialization if boot fails */
-		amdgpu_psp_query_boot_status(adev);
 		return ret;
 	} else {
 		return amdgpu_atom_asic_init(adev->mode_info.atom_context);
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -15
index 2addbdf88394..90451cabb919 100644
@@ -2125,21 +2125,6 @@ int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev)
 	return ret;
 }
 
-int amdgpu_psp_query_boot_status(struct amdgpu_device *adev)
-{
-	struct psp_context *psp = &adev->psp;
-	int ret = 0;
-
-	if (amdgpu_sriov_vf(adev) || (adev->flags & AMD_IS_APU))
-		return 0;
-
-	if (psp->funcs &&
-	    psp->funcs->query_boot_status)
-		ret = psp->funcs->query_boot_status(psp);
-
-	return ret;
-}
-
 static int psp_hw_start(struct psp_context *psp)
 {
 	struct amdgpu_device *adev = psp->adev;
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -4
index c4d9cbde55b9..09d1f8f72a9c 100644
@@ -134,7 +134,6 @@ struct psp_funcs {
 	int (*update_spirom)(struct psp_context *psp, uint64_t fw_pri_mc_addr);
 	int (*vbflash_stat)(struct psp_context *psp);
 	int (*fatal_error_recovery_quirk)(struct psp_context *psp);
-	int (*query_boot_status)(struct psp_context *psp);
 };
 
 struct ta_funcs {
@@ -538,7 +537,4 @@ int psp_spatial_partition(struct psp_context *psp, int mode);
 int is_psp_fw_valid(struct psp_bin_desc bin);
 
 int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev);
-
-int amdgpu_psp_query_boot_status(struct amdgpu_device *adev);
-
 #endif
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +0 -78

90 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

PATCH 4/5 drm/amdgpu: Query boot status if discovery failed

Check and report boot status if discovery failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -1
index b8fde08aec8e..302b71e9f1e2 100644
@@ -27,6 +27,7 @@
 #include "amdgpu_discovery.h"
 #include "soc15_hw_ip.h"
 #include "discovery.h"
+#include "amdgpu_ras.h"
 
 #include "soc15.h"
 #include "gfx_v9_0.h"
@@ -98,6 +99,7 @@
 #define FIRMWARE_IP_DISCOVERY "amdgpu/ip_discovery.bin"
 MODULE_FIRMWARE(FIRMWARE_IP_DISCOVERY);
 
+#define mmIP_DISCOVERY_VERSION  0x16A00
 #define mmRCC_CONFIG_MEMSIZE	0xde3
 #define mmMP0_SMN_C2PMSG_33	0x16061
 #define mmMM_INDEX		0x0
@@ -518,7 +520,9 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
 out:
 	kfree(adev->mman.discovery_bin);
 	adev->mman.discovery_bin = NULL;
-
+	if ((amdgpu_discovery != 2) &&
+	    (RREG32(mmIP_DISCOVERY_VERSION) == 4))
+		amdgpu_ras_query_boot_status(adev, 4);
 	return r;
 }
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 5/5 drm/amdgpu: Query boot status if boot failed

In reply to Hawking Zhang

Check and report firmware boot status if it doesn't reach steady status.

---
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +9 -2
index 6fad451a85be..676bec2cc157 100644
@@ -187,11 +187,18 @@ static int psp_v13_0_wait_for_bootloader(struct psp_context *psp)
 static int psp_v13_0_wait_for_bootloader_steady_state(struct psp_context *psp)
 {
 	struct amdgpu_device *adev = psp->adev;
+	int ret;
 
 	if (amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 6)) {
-		psp_v13_0_wait_for_vmbx_ready(psp);
+		ret = psp_v13_0_wait_for_vmbx_ready(psp);
+		if (ret)
+			amdgpu_ras_query_boot_status(adev, 4);
+
+		ret = psp_v13_0_wait_for_bootloader(psp);
+		if (ret)
+			amdgpu_ras_query_boot_status(adev, 4);
 
-		return psp_v13_0_wait_for_bootloader(psp);
+		return ret;
 	}
 
 	return 0;
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 2/5 drm/amdgpu: Init pcie_index/data address as fallback (v2)

In reply to Hawking Zhang

To allow using this helper for indirect access when nbio funcs is not available. For instance, in ip discovery phase.

v2: define macro for pcie_index/data/index_hi fallback.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18 -5
index abad5773714c..05d7cdcf28b0 100644
@@ -96,6 +96,9 @@ MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin");
 #define AMDGPU_RESUME_MS		2000
 #define AMDGPU_MAX_RETRY_LIMIT		2
 #define AMDGPU_RETRY_SRIOV_RESET(r) ((r) == -EBUSY || (r) == -ETIMEDOUT || (r) == -EINVAL)
+#define AMDGPU_PCIE_INDEX_FALLBACK (0x38 >> 2)
+#define AMDGPU_PCIE_INDEX_HI_FALLBACK (0x44 >> 2)
+#define AMDGPU_PCIE_DATA_FALLBACK (0x3C >> 2)
 
 static const struct drm_driver amdgpu_kms_driver;
 
@@ -781,12 +784,22 @@ u32 amdgpu_device_indirect_rreg_ext(struct amdgpu_device *adev,
 	void __iomem *pcie_index_hi_offset;
 	void __iomem *pcie_data_offset;
 
-	pcie_index = adev->nbio.funcs->get_pcie_index_offset(adev);
-	pcie_data = adev->nbio.funcs->get_pcie_data_offset(adev);
-	if ((reg_addr >> 32) && (adev->nbio.funcs->get_pcie_index_hi_offset))
-		pcie_index_hi = adev->nbio.funcs->get_pcie_index_hi_offset(adev);
-	else
+	if (unlikely(!adev->nbio.funcs)) {
+		pcie_index = AMDGPU_PCIE_INDEX_FALLBACK;
+		pcie_data = AMDGPU_PCIE_DATA_FALLBACK;
+	} else {
+		pcie_index = adev->nbio.funcs->get_pcie_index_offset(adev);
+		pcie_data = adev->nbio.funcs->get_pcie_data_offset(adev);
+	}
+
+	if (reg_addr >> 32) {
+		if (unlikely(!adev->nbio.funcs))
+			pcie_index_hi = AMDGPU_PCIE_INDEX_HI_FALLBACK;
+		else
+			pcie_index_hi = adev->nbio.funcs->get_pcie_index_hi_offset(adev);
+	} else {
 		pcie_index_hi = 0;
+	}
 
 	spin_lock_irqsave(&adev->pcie_idx_lock, flags);
 	pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index * 4;
Signature · 1 line
2.17.1
Reviewed-by on v2 2/5
#4 lore raw

RE: [PATCH v2 v2 2/5] drm/amdgpu: Init pcie_index/data address as fallback (v2)

[AMD Official Use Only - General]

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Sunday, January 7, 2024 11:40 PM
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Chai, Thomas <[email protected]>; Li, Candice <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Ma, Le <[email protected]>
Subject: [PATCH v2 v2 2/5] drm/amdgpu: Init pcie_index/data address as fallback (v2)

To allow using this helper for indirect access when nbio funcs is not available. For instance, in ip discovery phase.

v2: define macro for pcie_index/data/index_hi fallback.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -5
index abad5773714c..05d7cdcf28b0 100644
@@ -96,6 +96,9 @@ MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin");
 #define AMDGPU_RESUME_MS               2000
 #define AMDGPU_MAX_RETRY_LIMIT         2
 #define AMDGPU_RETRY_SRIOV_RESET(r) ((r) == -EBUSY || (r) == -ETIMEDOUT || (r) == -EINVAL)
+#define AMDGPU_PCIE_INDEX_FALLBACK (0x38 >> 2) #define
+AMDGPU_PCIE_INDEX_HI_FALLBACK (0x44 >> 2) #define
+AMDGPU_PCIE_DATA_FALLBACK (0x3C >> 2)
 
 static const struct drm_driver amdgpu_kms_driver;
 
@@ -781,12 +784,22 @@ u32 amdgpu_device_indirect_rreg_ext(struct amdgpu_device *adev,
        void __iomem *pcie_index_hi_offset;
        void __iomem *pcie_data_offset;
 
-       pcie_index = adev->nbio.funcs->get_pcie_index_offset(adev);
-       pcie_data = adev->nbio.funcs->get_pcie_data_offset(adev);
-       if ((reg_addr >> 32) && (adev->nbio.funcs->get_pcie_index_hi_offset))
-               pcie_index_hi = adev->nbio.funcs->get_pcie_index_hi_offset(adev);
-       else
+       if (unlikely(!adev->nbio.funcs)) {
+               pcie_index = AMDGPU_PCIE_INDEX_FALLBACK;
+               pcie_data = AMDGPU_PCIE_DATA_FALLBACK;
+       } else {
+               pcie_index = adev->nbio.funcs->get_pcie_index_offset(adev);
+               pcie_data = adev->nbio.funcs->get_pcie_data_offset(adev);
+       }
+
+       if (reg_addr >> 32) {

[kevin]:
Gentle reminder that the macro 'upper_32_bits()' can help on it .

Series is.

Best Regards,
Kevin
+ if (unlikely(!adev->nbio.funcs))
+ pcie_index_hi = AMDGPU_PCIE_INDEX_HI_FALLBACK;
+ else
+ pcie_index_hi = adev->nbio.funcs->get_pcie_index_hi_offset(adev);

+       } else {
                pcie_index_hi = 0;

+ }

        spin_lock_irqsave(&adev->pcie_idx_lock, flags);
        pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index * 4;

--
2.17.1

#5 lore raw

PATCH v2 3/5 drm/amdgpu: Add ras helper to query boot errors v2

In reply to Hawking Zhang

Add ras helper function to query boot time gpu
errors.
v2: use aqua_vanjaram smn addressing pattern

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 95 +++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 15 +++-
 3 files changed, 110 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 9da14436a373..df3aa69be425 100644
@@ -1330,6 +1330,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
 #define WREG32_FIELD_OFFSET(reg, offset, field, val)	\
 	WREG32(mm##reg + offset, (RREG32(mm##reg + offset) & ~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field))
 
+#define AMDGPU_GET_REG_FIELD(x, h, l) (((x) & GENMASK_ULL(h, l)) >> (l))
 /*
  * BIOS helpers.
  */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +95 -0

98 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +14 -1
index 76fb85628716..5785b705c692 100644
@@ -32,6 +32,19 @@
 
 struct amdgpu_iv_entry;
 
+#define AMDGPU_RAS_GPU_ERR_MEM_TRAINING(x)		AMDGPU_GET_REG_FIELD(x, 0, 0)
+#define AMDGPU_RAS_GPU_ERR_FW_LOAD(x)			AMDGPU_GET_REG_FIELD(x, 1, 1)
+#define AMDGPU_RAS_GPU_ERR_WAFL_LINK_TRAINING(x)	AMDGPU_GET_REG_FIELD(x, 2, 2)
+#define AMDGPU_RAS_GPU_ERR_XGMI_LINK_TRAINING(x)	AMDGPU_GET_REG_FIELD(x, 3, 3)
+#define AMDGPU_RAS_GPU_ERR_USR_CP_LINK_TRAINING(x)	AMDGPU_GET_REG_FIELD(x, 4, 4)
+#define AMDGPU_RAS_GPU_ERR_USR_DP_LINK_TRAINING(x)	AMDGPU_GET_REG_FIELD(x, 5, 5)
+#define AMDGPU_RAS_GPU_ERR_HBM_MEM_TEST(x)		AMDGPU_GET_REG_FIELD(x, 6, 6)
+#define AMDGPU_RAS_GPU_ERR_HBM_BIST_TEST(x)		AMDGPU_GET_REG_FIELD(x, 7, 7)
+#define AMDGPU_RAS_GPU_ERR_SOCKET_ID(x)			AMDGPU_GET_REG_FIELD(x, 10, 8)
+#define AMDGPU_RAS_GPU_ERR_AID_ID(x)			AMDGPU_GET_REG_FIELD(x, 12, 11)
+#define AMDGPU_RAS_GPU_ERR_HBM_ID(x)			AMDGPU_GET_REG_FIELD(x, 13, 13)
+#define AMDGPU_RAS_GPU_ERR_BOOT_STATUS(x)		AMDGPU_GET_REG_FIELD(x, 31, 31)
+
 #define AMDGPU_RAS_FLAG_INIT_BY_VBIOS		(0x1 << 0)
 /* position of instance value in sub_block_index of
  * ta_ras_trigger_error_input, the sub block uses lower 12 bits
@@ -818,5 +831,5 @@ int amdgpu_ras_error_statistic_ce_count(struct ras_err_data *err_data,
 int amdgpu_ras_error_statistic_ue_count(struct ras_err_data *err_data,
 		struct amdgpu_smuio_mcm_config_info *mcm_info,
 		struct ras_err_addr *err_addr, u64 count);
-
+void amdgpu_ras_query_boot_status(struct amdgpu_device *adev, u32 num_instances);
 #endif
Signature · 1 line
2.17.1
#6 lore raw

RE: [PATCH v2 v2 3/5] drm/amdgpu: Add ras helper to query boot errors v2

[AMD Official Use Only - General]

The patch series is Reviewed-by: Le Ma <[email protected]> .

If pattern is changed on future asic, we may consider using macro of asic function callback as well.

Quoted 201 lines

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Sunday, January 7, 2024 11:40 PM
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Chai, Thomas <[email protected]>; Li, Candice <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Ma, Le <[email protected]>
Subject: [PATCH v2 v2 3/5] drm/amdgpu: Add ras helper to query boot errors v2

Add ras helper function to query boot time gpu errors.
v2: use aqua_vanjaram smn addressing pattern

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 95
+++++++++++++++++++++++++  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |
15 +++-
 3 files changed, 110 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 9da14436a373..df3aa69be425 100644
@@ -1330,6 +1330,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
 #define WREG32_FIELD_OFFSET(reg, offset, field, val) \
      WREG32(mm##reg + offset, (RREG32(mm##reg + offset) &
 ~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field))
 
+#define AMDGPU_GET_REG_FIELD(x, h, l) (((x) & GENMASK_ULL(h, l)) >>
+(l))
 /*
  * BIOS helpers.
  */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
index fc42fb6ee191..a901b00d4949 100644
@@ -3763,3 +3763,98 @@ int amdgpu_ras_error_statistic_ce_count(struct
 ras_err_data *err_data,
 
      return 0;
 }
+
+#define mmMP0_SMN_C2PMSG_92  0x1609C
+#define mmMP0_SMN_C2PMSG_126 0x160BE
+static void amdgpu_ras_boot_time_error_reporting(struct amdgpu_device

*adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +19 -0
+                                              u32 instance, u32 boot_error)
+{
+     u32 socket_id, aid_id, hbm_id;
+     u32 reg_data;
+     u64 reg_addr;
+
+     socket_id = AMDGPU_RAS_GPU_ERR_SOCKET_ID(boot_error);
+     aid_id = AMDGPU_RAS_GPU_ERR_AID_ID(boot_error);
+     hbm_id = AMDGPU_RAS_GPU_ERR_HBM_ID(boot_error);
+
+     /* The pattern for smn addressing in other SOC could be different from
+      * the one for aqua_vanjaram. We should revisit the code if the pattern
+      * is changed. In such case, replace the aqua_vanjaram implementation
+      * with more common helper */
+     reg_addr = (mmMP0_SMN_C2PMSG_92 << 2) +
+                aqua_vanjaram_encode_ext_smn_addressing(instance);
+
+     reg_data = amdgpu_device_indirect_rreg_ext(adev, reg_addr);
+     dev_err(adev->dev, "socket: %d, aid: %d, firmware boot failed, fw

status is 0x%x\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+             socket_id, aid_id, reg_data);
+
+     if (AMDGPU_RAS_GPU_ERR_MEM_TRAINING(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, hbm: %d, memory

training failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id, hbm_id);
+
+     if (AMDGPU_RAS_GPU_ERR_FW_LOAD(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, firmware load failed

at boot time\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id);
+
+     if (AMDGPU_RAS_GPU_ERR_WAFL_LINK_TRAINING(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, wafl link training

failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id);
+
+     if (AMDGPU_RAS_GPU_ERR_XGMI_LINK_TRAINING(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, xgmi link training

failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id);
+
+     if (AMDGPU_RAS_GPU_ERR_USR_CP_LINK_TRAINING(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, usr cp link training

failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id);
+
+     if (AMDGPU_RAS_GPU_ERR_USR_DP_LINK_TRAINING(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, usr dp link training

failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id);
+
+     if (AMDGPU_RAS_GPU_ERR_HBM_MEM_TEST(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, hbm: %d, hbm

memory test failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
+                      socket_id, aid_id, hbm_id);
+
+     if (AMDGPU_RAS_GPU_ERR_HBM_BIST_TEST(boot_error))
+             dev_info(adev->dev, "socket: %d, aid: %d, hbm: %d, hbm bist

test failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +37 -0
+                      socket_id, aid_id, hbm_id);
+}
+
+static int amdgpu_ras_wait_for_boot_complete(struct amdgpu_device *adev,
+                                          u32 instance, u32 *boot_error) {
+     u32 reg_addr;
+     u32 reg_data;
+     int retry_loop;
+
+     /* The pattern for smn addressing in other SOC could be different from
+      * the one for aqua_vanjaram. We should revisit the code if the pattern
+      * is changed. In such case, replace the aqua_vanjaram implementation
+      * with more common helper */
+     reg_addr = (mmMP0_SMN_C2PMSG_126 << 2) +
+                aqua_vanjaram_encode_ext_smn_addressing(instance);
+
+     for (retry_loop = 0; retry_loop < 1000; retry_loop++) {
+             reg_data = amdgpu_device_indirect_rreg_ext(adev, reg_addr);
+             if (AMDGPU_RAS_GPU_ERR_BOOT_STATUS(reg_data)) {
+                     *boot_error = reg_data;
+                     return 0;
+             }
+             msleep(1);
+     }
+
+     *boot_error = reg_data;
+     return -ETIME;
+}
+
+void amdgpu_ras_query_boot_status(struct amdgpu_device *adev, u32
+num_instances) {
+     u32 boot_error = 0;
+     u32 i;
+
+     for (i = 0; i < num_instances; i++) {
+             if (amdgpu_ras_wait_for_boot_complete(adev, i, &boot_error))
+                     amdgpu_ras_boot_time_error_reporting(adev, i,

boot_error);

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -0
+     }
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +14 -0
index 76fb85628716..5785b705c692 100644
@@ -32,6 +32,19 @@
 
 struct amdgpu_iv_entry;
 
+#define AMDGPU_RAS_GPU_ERR_MEM_TRAINING(x)
      AMDGPU_GET_REG_FIELD(x, 0, 0)
+#define AMDGPU_RAS_GPU_ERR_FW_LOAD(x)
      AMDGPU_GET_REG_FIELD(x, 1, 1)
+#define AMDGPU_RAS_GPU_ERR_WAFL_LINK_TRAINING(x)
      AMDGPU_GET_REG_FIELD(x, 2, 2)
+#define AMDGPU_RAS_GPU_ERR_XGMI_LINK_TRAINING(x)
      AMDGPU_GET_REG_FIELD(x, 3, 3)
+#define AMDGPU_RAS_GPU_ERR_USR_CP_LINK_TRAINING(x)
      AMDGPU_GET_REG_FIELD(x, 4, 4)
+#define AMDGPU_RAS_GPU_ERR_USR_DP_LINK_TRAINING(x)
      AMDGPU_GET_REG_FIELD(x, 5, 5)
+#define AMDGPU_RAS_GPU_ERR_HBM_MEM_TEST(x)
      AMDGPU_GET_REG_FIELD(x, 6, 6)
+#define AMDGPU_RAS_GPU_ERR_HBM_BIST_TEST(x)
      AMDGPU_GET_REG_FIELD(x, 7, 7)
+#define AMDGPU_RAS_GPU_ERR_SOCKET_ID(x)
      AMDGPU_GET_REG_FIELD(x, 10, 8)
+#define AMDGPU_RAS_GPU_ERR_AID_ID(x)
      AMDGPU_GET_REG_FIELD(x, 12, 11)
+#define AMDGPU_RAS_GPU_ERR_HBM_ID(x)
      AMDGPU_GET_REG_FIELD(x, 13, 13)
+#define AMDGPU_RAS_GPU_ERR_BOOT_STATUS(x)
      AMDGPU_GET_REG_FIELD(x, 31, 31)
+
 #define AMDGPU_RAS_FLAG_INIT_BY_VBIOS                (0x1 << 0)
 /* position of instance value in sub_block_index of
  * ta_ras_trigger_error_input, the sub block uses lower 12 bits @@ -818,5
+831,5 @@ int amdgpu_ras_error_statistic_ce_count(struct ras_err_data

*err_data, int amdgpu_ras_error_statistic_ue_count(struct ras_err_data *err_data,
struct amdgpu_smuio_mcm_config_info *mcm_info, struct ras_err_addr *err_addr, u64 count);

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2 -2
-
+void amdgpu_ras_query_boot_status(struct amdgpu_device *adev, u32
+num_instances);
 #endif
--

2.17.1

#7 lore raw

PATCH v2 4/5 drm/amdgpu: Query boot status if discovery failed

In reply to Hawking Zhang

Check and report boot status if discovery failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -1
index b8fde08aec8e..302b71e9f1e2 100644
@@ -27,6 +27,7 @@
 #include "amdgpu_discovery.h"
 #include "soc15_hw_ip.h"
 #include "discovery.h"
+#include "amdgpu_ras.h"
 
 #include "soc15.h"
 #include "gfx_v9_0.h"
@@ -98,6 +99,7 @@
 #define FIRMWARE_IP_DISCOVERY "amdgpu/ip_discovery.bin"
 MODULE_FIRMWARE(FIRMWARE_IP_DISCOVERY);
 
+#define mmIP_DISCOVERY_VERSION  0x16A00
 #define mmRCC_CONFIG_MEMSIZE	0xde3
 #define mmMP0_SMN_C2PMSG_33	0x16061
 #define mmMM_INDEX		0x0
@@ -518,7 +520,9 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
 out:
 	kfree(adev->mman.discovery_bin);
 	adev->mman.discovery_bin = NULL;
-
+	if ((amdgpu_discovery != 2) &&
+	    (RREG32(mmIP_DISCOVERY_VERSION) == 4))
+		amdgpu_ras_query_boot_status(adev, 4);
 	return r;
 }
 
Signature · 1 line
2.17.1