Skip to contentSkip to conversation

Add new SoC21 infrastructure

PATCH In review Alex Deucher 2 participants 5 messages Apr 26, 2022 – Apr 27, 2022

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

cover Add new SoC21 infrastructure

This adds GPU SoC infrastructure for asics which use the soc21 design. The first two patches are register headers which are too big for the mailing list so I have omitted them.

Hawking Zhang (3):
drm/amdgpu: add mp v13_0_0 ip headers v7 drm/amdgpu: add gc v11_0_0 ip headers v11 drm/amdgpu: add nbio callback to query rom offset

Likun Gao (1):
drm/amdgpu: add new write field for soc21

Stanley.Yang (1):
drm/amdgpu: add soc21 common ip block v2

 drivers/gpu/drm/amd/amdgpu/Makefile           |     2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c      |    13 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h      |     1 +
 drivers/gpu/drm/amd/amdgpu/soc15_common.h     |     8 +
 drivers/gpu/drm/amd/amdgpu/soc21.c            |   620 +
 drivers/gpu/drm/amd/amdgpu/soc21.h            |    30 +
 .../include/asic_reg/gc/gc_11_0_0_default.h   |  6114 +++
 .../include/asic_reg/gc/gc_11_0_0_offset.h    | 11670 +++++
 .../include/asic_reg/gc/gc_11_0_0_sh_mask.h   | 41635 ++++++++++++++++
 .../include/asic_reg/mp/mp_13_0_0_offset.h    |   461 +
 .../include/asic_reg/mp/mp_13_0_0_sh_mask.h   |   682 +
 11 files changed, 61233 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/soc21.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/soc21.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_default.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_sh_mask.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_0_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_0_sh_mask.h
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 3/5 drm/amdgpu: add nbio callback to query rom offset

From: Hawking Zhang <[email protected]>

Add nbio callback func used to query rom offset. Used to query the rom offset for fetching the vbios.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 13 +++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h |  1 +
 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +11 -2
index 0eddca795e96..e363f56c72af 100644
@@ -471,6 +471,7 @@ bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
 {
 	u32 *dw_ptr;
 	u32 i, length_dw;
+	u32 rom_offset;
 	u32 rom_index_offset;
 	u32 rom_data_offset;
 
@@ -494,8 +495,16 @@ bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
 	rom_data_offset =
 		adev->smuio.funcs->get_rom_data_offset(adev);
 
-	/* set rom index to 0 */
-	WREG32(rom_index_offset, 0);
+	if (adev->nbio.funcs &&
+	    adev->nbio.funcs->get_rom_offset) {
+		rom_offset = adev->nbio.funcs->get_rom_offset(adev);
+		rom_offset = rom_offset << 17;
+	} else {
+		rom_offset = 0;
+	}
+
+	/* set rom index to rom_offset */
+	WREG32(rom_index_offset, rom_offset);
 	/* read out the rom data */
 	for (i = 0; i < length_dw; i++)
 		dw_ptr[i] = RREG32(rom_data_offset);
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +1 -0
index 03439083182a..ccd9fe96fab7 100644
@@ -93,6 +93,7 @@ struct amdgpu_nbio_funcs {
 	void (*apply_lc_spc_mode_wa)(struct amdgpu_device *adev);
 	void (*apply_l1_link_width_reconfig_wa)(struct amdgpu_device *adev);
 	void (*clear_doorbell_interrupt)(struct amdgpu_device *adev);
+	u32 (*get_rom_offset)(struct amdgpu_device *adev);
 };
 
 struct amdgpu_nbio {
Signature · 1 line
2.35.1
author maintainer
#2 lore raw

PATCH 4/5 drm/amdgpu: add new write field for soc21

In reply to Alex Deucher

From: Likun Gao <[email protected]>

add new write field macro to handle soc21
registers with reg prefix

---
 drivers/gpu/drm/amd/amdgpu/soc15_common.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15_common.h +8 -0
index acce8c2e0328..9fefd403e14f 100644
@@ -45,6 +45,14 @@
 				~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field), \
 			      0, ip##_HWIP)
 
+#define WREG32_FIELD15_PREREG(ip, idx, reg_name, field, val)        \
+	__WREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][idx][reg##reg_name##_BASE_IDX] + reg##reg_name,   \
+			(__RREG32_SOC15_RLC__( \
+					adev->reg_offset[ip##_HWIP][idx][reg##reg_name##_BASE_IDX] + reg##reg_name, \
+					0, ip##_HWIP) & \
+					~REG_FIELD_MASK(reg_name, field)) | (val) << REG_FIELD_SHIFT(reg_name, field), \
+			0, ip##_HWIP)
+
 #define RREG32_SOC15(ip, inst, reg) \
 	__RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
 			 0, ip##_HWIP)
Signature · 1 line
2.35.1
author maintainer
#3 lore raw

PATCH 5/5 drm/amdgpu: add soc21 common ip block v2

In reply to Alex Deucher

From: "Stanley.Yang" <[email protected]>

This adds soc21 common ip block support

Changed from v1:
Switch WREG32/RREG32_PCIE to use indirect reg access helper for sco15 and onwards

---
 drivers/gpu/drm/amd/amdgpu/Makefile |   2 +-
 drivers/gpu/drm/amd/amdgpu/soc21.c  | 620 ++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc21.h  |  30 ++
 3 files changed, 651 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/soc21.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/soc21.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index b525f9be9326..2b454e7d7a76 100644
@@ -74,7 +74,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce
 amdgpu-y += \
 	vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \
 	vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o arct_reg_init.o mxgpu_nv.o \
-	nbio_v7_2.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o
+	nbio_v7_2.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o soc21.o
 
 # add DF block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/soc21.c new file +620 -0

620 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/soc21.h new file +30 -0
new file mode 100644
index 000000000000..4c8067af1b65
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2021 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 __SOC21_H__
+#define __SOC21_H__
+
+extern const struct amdgpu_ip_block_version soc21_common_ip_block;
+
+void soc21_grbm_select(struct amdgpu_device *adev,
+		    u32 me, u32 pipe, u32 queue, u32 vmid);
+#endif
Signature · 1 line
2.35.1
#4 lore raw
In reply to Alex Deucher

Am 26.04.22 um 20:52 schrieb Alex Deucher:

Quoted 4 lines

This adds GPU SoC infrastructure for asics which use the soc21 design. The first two patches are register headers which are too big for the mailing list so I have omitted them.

We really have to find a way to better compress those.

Anyway series is Acked-by: Christian König <[email protected]>

Quoted 32 lines

Hawking Zhang (3):
drm/amdgpu: add mp v13_0_0 ip headers v7 drm/amdgpu: add gc v11_0_0 ip headers v11 drm/amdgpu: add nbio callback to query rom offset

Likun Gao (1):
drm/amdgpu: add new write field for soc21

Stanley.Yang (1):
drm/amdgpu: add soc21 common ip block v2

  drivers/gpu/drm/amd/amdgpu/Makefile           |     2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c      |    13 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h      |     1 +
  drivers/gpu/drm/amd/amdgpu/soc15_common.h     |     8 +
  drivers/gpu/drm/amd/amdgpu/soc21.c            |   620 +
  drivers/gpu/drm/amd/amdgpu/soc21.h            |    30 +
  .../include/asic_reg/gc/gc_11_0_0_default.h   |  6114 +++
  .../include/asic_reg/gc/gc_11_0_0_offset.h    | 11670 +++++
  .../include/asic_reg/gc/gc_11_0_0_sh_mask.h   | 41635 ++++++++++++++++
  .../include/asic_reg/mp/mp_13_0_0_offset.h    |   461 +
  .../include/asic_reg/mp/mp_13_0_0_sh_mask.h   |   682 +
  11 files changed, 61233 insertions(+), 3 deletions(-)

create mode 100644 drivers/gpu/drm/amd/amdgpu/soc21.c
create mode 100644 drivers/gpu/drm/amd/amdgpu/soc21.h
create mode 100644 drivers/gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_default.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_sh_mask.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_0_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_0_sh_mask.h