Skip to contentSkip to conversation

Add NBIF v7.10 Support

PATCH New Alex Deucher 1 participant 3 messages Sep 21

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

cover Add NBIF v7.10 Support

This series adds NBIF (New Bus InterFace) v7.10 support. The first two patches add large new register headers. Skip sending them to avoid spamming the list.

Hawking Zhang (3):
drm/amdgpu: Add nbif v7_10_0 ip headers v4
drm/amdgpu: Add pcie v6_1_3 ip headers v4
drm/amdgpu: Add nbif v7_10 support

ZhenGuo Yin (1):
drm/amdgpu: fall back to RCC_HW_DEBUG for VF frame buffer size

 drivers/gpu/drm/amd/amdgpu/Makefile           |     3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c |    21 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c      |     4 +
 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c       |   350 +
 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.h       |    32 +
 .../asic_reg/nbif/nbif_7_10_0_offset.h        | 15938 ++++
 .../asic_reg/nbif/nbif_7_10_0_sh_mask.h       | 60316 ++++++++++++++++
 .../include/asic_reg/pcie/pcie_6_1_3_offset.h |  1755 +
 .../asic_reg/pcie/pcie_6_1_3_sh_mask.h        | 10821 +++
 9 files changed, 89237 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/nbif/nbif_7_10_0_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/nbif/nbif_7_10_0_sh_mask.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/pcie/pcie_6_1_3_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/pcie/pcie_6_1_3_sh_mask.h
Signature · 1 line
2.55.0
author maintainer
#1 lore raw

PATCH 3/4 drm/amdgpu: Add nbif v7_10 support

From: Hawking Zhang <[email protected]>

Add initial implementation for the new generation of nbif

v2: squash in HDP, VPE, RLC/IH, SDMA fixes

---
 drivers/gpu/drm/amd/amdgpu/Makefile           |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c |   5 +
 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c       | 344 ++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.h       |  32 ++
 4 files changed, 383 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
index ce557cf36c9d4..27ab027271fa1 100644
@@ -91,7 +91,8 @@ amdgpu-y += \
 	nbio_v7_2.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o soc21.o soc24.o \
 	sienna_cichlid.o smu_v13_0_10.o nbio_v4_3.o hdp_v6_0.o nbio_v7_7.o hdp_v5_2.o lsdma_v6_0.o \
 	nbio_v7_9.o aqua_vanjaram.o nbio_v7_11.o lsdma_v7_0.o hdp_v7_0.o nbif_v6_3_1.o \
-	cyan_skillfish_reg_init.o soc_v1_0.o lsdma_v7_1.o nbio_v6_3_2.o nbio_v7_11_5.o
+	cyan_skillfish_reg_init.o soc_v1_0.o lsdma_v7_1.o nbio_v6_3_2.o nbio_v7_11_5.o \
+	nbif_v7_10.o
 
 # add DF block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -0
index 4eb852f2a3824..2034754d6af74 100644
@@ -68,6 +68,7 @@
 #include "nbio_v7_7.h"
 #include "nbif_v6_3_1.h"
 #include "nbio_v6_3_2.h"
+#include "nbif_v7_10.h"
 #include "hdp_v5_0.h"
 #include "hdp_v5_2.h"
 #include "hdp_v6_0.h"
@@ -3814,6 +3815,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
 	case IP_VERSION(6, 3, 2):
 		adev->nbio.funcs = &nbio_v6_3_2_funcs;
 		break;
+	case IP_VERSION(7, 10, 0):
+		adev->nbio.funcs = &nbif_v7_10_funcs;
+		adev->nbio.hdp_flush_reg = &nbif_v7_10_hdp_flush_reg;
+		break;
 	default:
 		break;
 	}
drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c new file +344 -0

344 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/nbif_v7_10.h new file +32 -0
new file mode 100644
index 0000000000000..4759d6fb16a77
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2025 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) OR AUTHOR(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_V7_10_H__
+#define __NBIO_V7_10_H__
+
+#include "soc15_common.h"
+
+extern const struct nbio_hdp_flush_reg nbif_v7_10_hdp_flush_reg;
+extern const struct amdgpu_nbio_funcs nbif_v7_10_funcs;
+
+#endif
Signature · 1 line
2.55.0
author maintainer
#2 lore raw

PATCH 4/4 drm/amdgpu: fall back to RCC_HW_DEBUG for VF frame buffer size

In reply to Alex Deucher

From: ZhenGuo Yin <[email protected]>

On some SR-IOV VFs RCC_CONFIG_MEMSIZE reads back 0. Fall back to RCC_HW_DEBUG for the frame buffer size in the nbif get_memsize() callback and in the early-init paths that read the register directly. Only VFs that read back 0 are affected.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 16 ++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c      |  4 ++++
 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c       |  8 +++++++-
 3 files changed, 25 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +14 -2
index 2034754d6af74..59294028f0690 100644
@@ -144,6 +144,7 @@ MODULE_FIRMWARE("amdgpu/aldebaran_ip_discovery.bin");
 /* Note: These registers are consistent across all the SOCs */
 #define mmIP_DISCOVERY_VERSION  0x16A00
 #define mmRCC_CONFIG_MEMSIZE	0xde3
+#define mmRCC_HW_DEBUG		0x10c01
 #define mmMP0_SMN_C2PMSG_33	0x16061
 #define mmMM_INDEX		0x0
 #define mmMM_INDEX_HI		0x6
@@ -289,6 +290,17 @@ static int hw_id_map[MAX_HWIP] = {
 	[ATU_HWIP]	= ATU_HWID,
 };
 
+static u32 amdgpu_discovery_get_config_memsize(struct amdgpu_device *adev)
+{
+	u32 memsize = RREG32(mmRCC_CONFIG_MEMSIZE);
+
+	/* Fall back to RCC_HW_DEBUG when RCC_CONFIG_MEMSIZE reads 0 on a VF. */
+	if (!memsize && amdgpu_sriov_vf(adev))
+		memsize = RREG32(mmRCC_HW_DEBUG);
+
+	return memsize;
+}
+
 static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
 					 bool *is_tmr_in_sysmem)
 {
@@ -313,7 +325,7 @@ static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
 		}
 	}
 
-	vram_size = RREG32(mmRCC_CONFIG_MEMSIZE);
+	vram_size = amdgpu_discovery_get_config_memsize(adev);
 	if (vram_size == U32_MAX)
 		return -ENXIO;
 	else if (!vram_size)
@@ -2323,7 +2335,7 @@ static int amdgpu_discovery_refresh_nps_info(struct amdgpu_device *adev,
 	struct binary_header_v2 bhdrv2;
 	uint16_t checksum;
 
-	vram_size = (uint64_t)RREG32(mmRCC_CONFIG_MEMSIZE) << 20;
+	vram_size = (uint64_t)amdgpu_discovery_get_config_memsize(adev) << 20;
 	pos = vram_size - DISCOVERY_TMR_OFFSET;
 	amdgpu_device_vram_access(adev, pos, &bhdr, sizeof(bhdr), false);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +4 -0
index a454c6f12d38d..681a9904a79e5 100644
@@ -47,6 +47,7 @@
 	} while (0)
 
 #define mmRCC_CONFIG_MEMSIZE    0xde3
+#define mmRCC_HW_DEBUG          0x10c01
 
 const char *amdgpu_virt_dynamic_crit_table_name[] = {
 	"IP DISCOVERY",
@@ -1068,6 +1069,9 @@ int amdgpu_virt_init_critical_region(struct amdgpu_device *adev)
 		return 0;
 
 	vram_size = RREG32(mmRCC_CONFIG_MEMSIZE);
+	/* Fall back to RCC_HW_DEBUG when RCC_CONFIG_MEMSIZE reads 0 on a VF. */
+	if (!vram_size)
+		vram_size = RREG32(mmRCC_HW_DEBUG);
 	if (!vram_size || vram_size == U32_MAX)
 		return -EINVAL;
 	vram_size <<= 20;
drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c +7 -1
index 9022454aa74ec..3cdbb79906470 100644
@@ -60,7 +60,13 @@ static void nbif_v7_10_mc_access_enable(struct amdgpu_device *adev, bool enable)
 
 static u32 nbif_v7_10_get_memsize(struct amdgpu_device *adev)
 {
-	return RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE);
+	u32 vram_size = RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE);
+
+	/* Fall back to RCC_HW_DEBUG when RCC_CONFIG_MEMSIZE reads 0 on a VF. */
+	if (!vram_size && amdgpu_sriov_vf(adev))
+		vram_size = RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF0_RCC_HW_DEBUG);
+
+	return vram_size;
 }
 
 static void nbif_v7_10_sdma_doorbell_range(struct amdgpu_device *adev,
Signature · 1 line
2.55.0