Skip to contentSkip to conversation

drm/amdgpu: support getting pcie_replay_count on Navi

PATCH In review Quan, Evan 2 participants 2 messages Nov 5, 2019 – Nov 6, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Quan, Evan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: support getting pcie_replay_count on Navi

Enable pcie_replay_count interface support on Navi.

Change-Id Idc770663416ecf45aab8caa19de9cc99b619d2c3
---
 drivers/gpu/drm/amd/amdgpu/nv.c               | 14 ++++++++++
 .../amd/include/asic_reg/nbio/nbio_2_3_smn.h  | 28 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_2_3_smn.h
drivers/gpu/drm/amd/amdgpu/nv.c +14 -0
index 88e3665f7b09..c87e01a736f2 100644
@@ -39,6 +39,7 @@
 #include "gc/gc_10_1_0_sh_mask.h"
 #include "hdp/hdp_5_0_0_offset.h"
 #include "hdp/hdp_5_0_0_sh_mask.h"
+#include "nbio/nbio_2_3_smn.h"
 
 #include "soc15.h"
 #include "soc15_common.h"
@@ -567,6 +568,18 @@ static void nv_init_doorbell_index(struct amdgpu_device *adev)
 	adev->doorbell_index.sdma_doorbell_range = 20;
 }
 
+static uint64_t nv_get_pcie_replay_count(struct amdgpu_device *adev)
+{
+	uint64_t nak_r, nak_g;
+
+	/* Get the number of NAKs received and generated */
+	nak_r = RREG32_PCIE(smnPCIE_RX_NUM_NAK);
+	nak_g = RREG32_PCIE(smnPCIE_RX_NUM_NAK_GENERATED);
+
+	/* Add the total number of NAKs, i.e the number of replays */
+	return (nak_r + nak_g);
+}
+
 static const struct amdgpu_asic_funcs nv_asic_funcs =
 {
 	.read_disabled_bios = &nv_read_disabled_bios,
@@ -585,6 +598,7 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
 	.need_full_reset = &nv_need_full_reset,
 	.get_pcie_usage = &nv_get_pcie_usage,
 	.need_reset_on_init = &nv_need_reset_on_init,
+	.get_pcie_replay_count = &nv_get_pcie_replay_count,
 };
 
 static int nv_common_early_init(void *handle)
drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_2_3_smn.h new file +28 -0
new file mode 100644
index 000000000000..a40ba98cc8bb
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2019  Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _nbio_2_3_SMN_HEADER
+#define _nbio_2_3_SMN_HEADER
+
+#define smnPCIE_RX_NUM_NAK				0x11180038
+#define smnPCIE_RX_NUM_NAK_GENERATED			0x1118003c
+
+#endif	// _nbio_2_3_SMN_HEADER
Signature · 6 lines
2.23.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#2 lore raw
Quoted 5 lines · Evan

Enable pcie_replay_count interface support on Navi.

Change-Id Idc770663416ecf45aab8caa19de9cc99b619d2c3
Quoted 82 lines
---
 drivers/gpu/drm/amd/amdgpu/nv.c               | 14 ++++++++++
 .../amd/include/asic_reg/nbio/nbio_2_3_smn.h  | 28 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_2_3_smn.h
drivers/gpu/drm/amd/amdgpu/nv.c +14 -0
index 88e3665f7b09..c87e01a736f2 100644
@@ -39,6 +39,7 @@
 #include "gc/gc_10_1_0_sh_mask.h"
 #include "hdp/hdp_5_0_0_offset.h"
 #include "hdp/hdp_5_0_0_sh_mask.h"
+#include "nbio/nbio_2_3_smn.h"
 
 #include "soc15.h"
 #include "soc15_common.h"
@@ -567,6 +568,18 @@ static void nv_init_doorbell_index(struct amdgpu_device *adev)
        adev->doorbell_index.sdma_doorbell_range = 20;
 }
 
+static uint64_t nv_get_pcie_replay_count(struct amdgpu_device *adev)
+{
+       uint64_t nak_r, nak_g;
+
+       /* Get the number of NAKs received and generated */
+       nak_r = RREG32_PCIE(smnPCIE_RX_NUM_NAK);
+       nak_g = RREG32_PCIE(smnPCIE_RX_NUM_NAK_GENERATED);
+
+       /* Add the total number of NAKs, i.e the number of replays */
+       return (nak_r + nak_g);
+}
+
 static const struct amdgpu_asic_funcs nv_asic_funcs =
 {
        .read_disabled_bios = &nv_read_disabled_bios,
@@ -585,6 +598,7 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
        .need_full_reset = &nv_need_full_reset,
        .get_pcie_usage = &nv_get_pcie_usage,
        .need_reset_on_init = &nv_need_reset_on_init,
+       .get_pcie_replay_count = &nv_get_pcie_replay_count,
 };
 
 static int nv_common_early_init(void *handle)
drivers/gpu/drm/amd/include/asic_reg/nbio/nbio_2_3_smn.h new file +28 -1
new file mode 100644
index 000000000000..a40ba98cc8bb
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2019  Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _nbio_2_3_SMN_HEADER
+#define _nbio_2_3_SMN_HEADER
+
+#define smnPCIE_RX_NUM_NAK                             0x11180038
+#define smnPCIE_RX_NUM_NAK_GENERATED                   0x1118003c
+
+#endif // _nbio_2_3_SMN_HEADER
--

2.23.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx