Skip to contentSkip to conversation

Add MMHUB 3.0.2 support

PATCH New Alex Deucher 1 participant 3 messages May 3, 2022

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

cover Add MMHUB 3.0.2 support

This adds support for MultiMedia HUB (MMHUB) version 3.0.2. The first patch adds register headers and is too large to send out.

Hawking Zhang (3):
drm/amdgpu: add mmhub v3_0_2 ip headers drm/amdgpu: add mmhub v3_0_2 ip callback functions drm/amdgpu: split mmhub v3_0_2 callbacks from mmhub v3_0

 drivers/gpu/drm/amd/amdgpu/Makefile           |    2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c        |   10 +-
 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c     |  571 ++
 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.h     |   28 +
 .../asic_reg/mmhub/mmhub_3_0_2_offset.h       | 1425 ++++
 .../asic_reg/mmhub/mmhub_3_0_2_sh_mask.h      | 7228 +++++++++++++++++
 6 files changed, 9262 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_3_0_2_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_3_0_2_sh_mask.h
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/3 drm/amdgpu: add mmhub v3_0_2 ip callback functions

From: Hawking Zhang <[email protected]>

Unlike mmhub v3_0_0, there is no atc_l2 related registers available in mmhub v3_0_2. Split the mmhub v3_0_2 callback implementations from mmhub v3_0 so we don't need to add ip version check when atc related programming needs to be added to mmhub v3_0_0.

---
 drivers/gpu/drm/amd/amdgpu/Makefile       |   2 +-
 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c | 571 ++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.h |  28 ++
 3 files changed, 600 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index 7c7f946f1e6f..d4e7d297f883 100644
@@ -88,7 +88,7 @@ amdgpu-y += \
 	gmc_v8_0.o \
 	gfxhub_v1_0.o mmhub_v1_0.o gmc_v9_0.o gfxhub_v1_1.o mmhub_v9_4.o \
 	gfxhub_v2_0.o mmhub_v2_0.o gmc_v10_0.o gfxhub_v2_1.o mmhub_v2_3.o \
-	mmhub_v1_7.o gfxhub_v3_0.o mmhub_v3_0.o gmc_v11_0.o
+	mmhub_v1_7.o gfxhub_v3_0.o mmhub_v3_0.o mmhub_v3_0_2.o gmc_v11_0.o
 
 # add UMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c new file +571 -0

571 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.h new file +28 -0
new file mode 100644
index 000000000000..23ad7b156cdb
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2022 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 __MMHUB_V3_0_2_H__
+#define __MMHUB_V3_0_2_H__
+
+extern const struct amdgpu_mmhub_funcs mmhub_v3_0_2_funcs;
+
+#endif
Signature · 1 line
2.35.1
author maintainer
#2 lore raw

PATCH 3/3 drm/amdgpu: split mmhub v3_0_2 callbacks from mmhub v3_0

In reply to Alex Deucher

From: Hawking Zhang <[email protected]>

So we don't need to add ip version check in every callback when there is atc related programming that is only available in mmhub v3_0

---
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +9 -1
index 032414d7429d..ab9f8b7e0aa8 100644
@@ -37,6 +37,7 @@
 #include "nbio_v4_3.h"
 #include "gfxhub_v3_0.h"
 #include "mmhub_v3_0.h"
+#include "mmhub_v3_0_2.h"
 #include "athub_v3_0.h"
 
 
@@ -599,7 +600,14 @@ static void gmc_v11_0_set_umc_funcs(struct amdgpu_device *adev)
 
 static void gmc_v11_0_set_mmhub_funcs(struct amdgpu_device *adev)
 {
-	adev->mmhub.funcs = &mmhub_v3_0_funcs;
+	switch (adev->ip_versions[MMHUB_HWIP][0]) {
+	case IP_VERSION(3, 0, 2):
+		adev->mmhub.funcs = &mmhub_v3_0_2_funcs;
+		break;
+	default:
+		adev->mmhub.funcs = &mmhub_v3_0_funcs;
+		break;
+	}
 }
 
 static void gmc_v11_0_set_gfxhub_funcs(struct amdgpu_device *adev)
Signature · 1 line
2.35.1