Skip to contentSkip to conversation

drm/amdgpu: add amdgpu_mmhub_funcs definition

PATCH In review Tao Zhou 2 participants 5 messages Aug 8, 2019 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/3 drm/amdgpu: add amdgpu_mmhub_funcs definition

add amdgpu_mmhub_funcs definition and initialize it, prepare for mmhub ras enablement

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 31 +++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c     | 12 +++++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c   |  9 +++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h   |  2 ++
 5 files changed, 56 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 41f677613ffa..ed1a217e86e4 100644
@@ -87,6 +87,7 @@
 #include "amdgpu_discovery.h"
 #include "amdgpu_mes.h"
 #include "amdgpu_umc.h"
+#include "amdgpu_mmhub.h"
 
 #define MAX_GPU_INSTANCE		16
 
@@ -979,6 +980,7 @@ struct amdgpu_device {
 
 	const struct amdgpu_nbio_funcs	*nbio_funcs;
 	const struct amdgpu_df_funcs	*df_funcs;
+	const struct amdgpu_mmhub_funcs	*mmhub_funcs;
 
 	/* delayed work_func for deferring clockgating during resume */
 	struct delayed_work     delayed_init_work;
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h new file +31 -0
new file mode 100644
index 000000000000..2d75ecfa199b
@@ -0,0 +1,31 @@
+/*
+ * 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 __AMDGPU_MMHUB_H__
+#define __AMDGPU_MMHUB_H__
+
+struct amdgpu_mmhub_funcs {
+	void (*ras_init)(struct amdgpu_device *adev);
+	void (*query_ras_error_count)(struct amdgpu_device *adev,
+					void *ras_error_status);
+};
+
+#endif
+
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +12 -0
index a2aa35eb512c..ce8ff7172883 100644
@@ -652,6 +652,17 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
 	}
 }
 
+static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev)
+{
+	switch (adev->asic_type) {
+	case CHIP_VEGA20:
+		adev->mmhub_funcs = &mmhub_v1_0_funcs;
+		break;
+	default:
+		break;
+	}
+}
+
 static int gmc_v9_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -659,6 +670,7 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gmc_funcs(adev);
 	gmc_v9_0_set_irq_funcs(adev);
 	gmc_v9_0_set_umc_funcs(adev);
+	gmc_v9_0_set_mmhub_funcs(adev);
 
 	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
 	adev->gmc.shared_aperture_end =
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +9 -0
index 292f3b1cddf2..fa961e0b6f2f 100644
@@ -584,3 +584,12 @@ void mmhub_v1_0_get_clockgating(struct amdgpu_device *adev, u32 *flags)
 	if (data & ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK)
 		*flags |= AMD_CG_SUPPORT_MC_LS;
 }
+
+static void mmhub_v1_0_query_ras_error_count(struct amdgpu_device *adev,
+					   void *ras_error_status)
+{
+}
+
+const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
+	.query_ras_error_count = mmhub_v1_0_query_ras_error_count,
+};
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h +2 -0
index 0de0fdf98c00..c43319e8f945 100644
@@ -23,6 +23,8 @@
 #ifndef __MMHUB_V1_0_H__
 #define __MMHUB_V1_0_H__
 
+extern const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs;
+
 u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev);
 int mmhub_v1_0_gart_enable(struct amdgpu_device *adev);
 void mmhub_v1_0_gart_disable(struct amdgpu_device *adev);
Signature · 6 lines
2.17.1

_______________________________________________
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]

author
#2 lore raw

PATCH 2/3 drm/amdgpu: support mmhub ras in amdgpu ras

call mmhub ras query/inject in amdgpu ras

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -0
index bc766cdbeaae..be59102526a1 100644
@@ -612,6 +612,10 @@ int amdgpu_ras_error_query(struct amdgpu_device *adev,
 		if (adev->gfx.funcs->query_ras_error_count)
 			adev->gfx.funcs->query_ras_error_count(adev, &err_data);
 		break;
+	case AMDGPU_RAS_BLOCK__MMHUB:
+		if (adev->mmhub_funcs->query_ras_error_count)
+			adev->mmhub_funcs->query_ras_error_count(adev, &err_data);
+		break;
 	default:
 		break;
 	}
@@ -657,6 +661,7 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev,
 			ret = -EINVAL;
 		break;
 	case AMDGPU_RAS_BLOCK__UMC:
+	case AMDGPU_RAS_BLOCK__MMHUB:
 		ret = psp_ras_trigger_error(&adev->psp, &block_info);
 		break;
 	default:
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw
In reply to a message not in the archive

For mmhub/gfxhub, currently we didn't organize both in callback functions structure, instead, we declared all the functions in its header file respectively (see mmhub_vxx_x.h/gfxhub_vxx_x.h).

We'd either centralize all the functions into callback function structure, or continue declare the new function in its own header file. Either way seems fine to me.

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: 2019年8月8日 14:54
To: [email protected]; Zhang, Hawking <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Pan, Xinhui <[email protected]>; Clements, John <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: add amdgpu_mmhub_funcs definition

add amdgpu_mmhub_funcs definition and initialize it, prepare for mmhub ras enablement

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 31 +++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c     | 12 +++++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c   |  9 +++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h   |  2 ++
 5 files changed, 56 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 41f677613ffa..ed1a217e86e4 100644
@@ -87,6 +87,7 @@
 #include "amdgpu_discovery.h"
 #include "amdgpu_mes.h"
 #include "amdgpu_umc.h"
+#include "amdgpu_mmhub.h"
 
 #define MAX_GPU_INSTANCE		16
 
@@ -979,6 +980,7 @@ struct amdgpu_device {
 
 	const struct amdgpu_nbio_funcs	*nbio_funcs;
 	const struct amdgpu_df_funcs	*df_funcs;
+	const struct amdgpu_mmhub_funcs	*mmhub_funcs;
 
 	/* delayed work_func for deferring clockgating during resume */
 	struct delayed_work     delayed_init_work;
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h new file +31 -0
new file mode 100644
index 000000000000..2d75ecfa199b
@@ -0,0 +1,31 @@
+/*
+ * 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 __AMDGPU_MMHUB_H__

+#define __AMDGPU_MMHUB_H__
+
+struct amdgpu_mmhub_funcs {
+ void (*ras_init)(struct amdgpu_device *adev);
+ void (*query_ras_error_count)(struct amdgpu_device *adev,
+ void *ras_error_status);
+};
+
+#endif
+

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10 -0
index a2aa35eb512c..ce8ff7172883 100644
@@ -652,6 +652,17 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
 	}
 }
 
+static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	case CHIP_VEGA20:
+		adev->mmhub_funcs = &mmhub_v1_0_funcs;
+		break;
+	default:
+		break;
+	}
+}
+
 static int gmc_v9_0_early_init(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -659,6 +670,7 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gmc_funcs(adev);

gmc_v9_0_set_irq_funcs(adev);
gmc_v9_0_set_umc_funcs(adev);
+ gmc_v9_0_set_mmhub_funcs(adev);

adev->gmc.shared_aperture_start = 0x2000000000000000ULL; adev->gmc.shared_aperture_end =

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +8 -0
index 292f3b1cddf2..fa961e0b6f2f 100644
@@ -584,3 +584,12 @@ void mmhub_v1_0_get_clockgating(struct amdgpu_device *adev, u32 *flags)
 	if (data & ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK)
 		*flags |= AMD_CG_SUPPORT_MC_LS;
 }
+
+static void mmhub_v1_0_query_ras_error_count(struct amdgpu_device *adev,
+					   void *ras_error_status)
+{
+}
+
+const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
+	.query_ras_error_count = mmhub_v1_0_query_ras_error_count, };
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h +2 -1
index 0de0fdf98c00..c43319e8f945 100644
@@ -23,6 +23,8 @@
 #ifndef __MMHUB_V1_0_H__
 #define __MMHUB_V1_0_H__
 
+extern const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs;
+
 u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev);  int mmhub_v1_0_gart_enable(struct amdgpu_device *adev);  void mmhub_v1_0_gart_disable(struct amdgpu_device *adev);
--

2.17.1

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB1418030EB5DA4A863D9686F8FCD70-2J9CzHegvk81aAVlcVN8UQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#5 lore raw

Mmhub ras function will be called in amdgpu_ras.c, amdgpu_ras.c should pay no attention to the version of mmhub functions.

Centralize all the functions into callback function structure is a good idea, but this is a another story and needs a huge effort.

Regards,
Tao

Quoted 185 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: 2019年8月8日 15:16
To: Zhou1, Tao <[email protected]>; [email protected]; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Pan, Xinhui <[email protected]>; Clements, John <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: add amdgpu_mmhub_funcs definition

For mmhub/gfxhub, currently we didn't organize both in callback functions structure, instead, we declared all the functions in its header file respectively (see mmhub_vxx_x.h/gfxhub_vxx_x.h).

We'd either centralize all the functions into callback function structure, or continue declare the new function in its own header file. Either way seems fine to me.

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: 2019年8月8日 14:54
To: [email protected]; Zhang, Hawking <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Pan, Xinhui <[email protected]>; Clements, John <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: add amdgpu_mmhub_funcs definition

add amdgpu_mmhub_funcs definition and initialize it, prepare for mmhub ras enablement

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 31
+++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c     | 12 +++++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c   |  9 +++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h   |  2 ++
 5 files changed, 56 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 41f677613ffa..ed1a217e86e4 100644
@@ -87,6 +87,7 @@
 #include "amdgpu_discovery.h"
 #include "amdgpu_mes.h"
 #include "amdgpu_umc.h"
+#include "amdgpu_mmhub.h"
 
 #define MAX_GPU_INSTANCE		16
 
@@ -979,6 +980,7 @@ struct amdgpu_device {
 
 	const struct amdgpu_nbio_funcs	*nbio_funcs;
 	const struct amdgpu_df_funcs	*df_funcs;
+	const struct amdgpu_mmhub_funcs	*mmhub_funcs;
 
 	/* delayed work_func for deferring clockgating during resume */
 	struct delayed_work     delayed_init_work;
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h new file +24 -0
new file mode 100644
index 000000000000..2d75ecfa199b
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */

drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h new file +11 -0
+#ifndef __AMDGPU_MMHUB_H__
+#define __AMDGPU_MMHUB_H__
+
+struct amdgpu_mmhub_funcs {
+	void (*ras_init)(struct amdgpu_device *adev);
+	void (*query_ras_error_count)(struct amdgpu_device *adev,
+					void *ras_error_status);
+};
+
+#endif
+
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +11 -1
index a2aa35eb512c..ce8ff7172883 100644
@@ -652,6 +652,17 @@ static void gmc_v9_0_set_umc_funcs(struct
 amdgpu_device *adev)
 	}
 }
 
+static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	case CHIP_VEGA20:
+		adev->mmhub_funcs = &mmhub_v1_0_funcs;
+		break;
+	default:
+		break;
+	}
+}
+
 static int gmc_v9_0_early_init(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@
-659,6 +670,7 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gmc_funcs(adev);
 	gmc_v9_0_set_irq_funcs(adev);
 	gmc_v9_0_set_umc_funcs(adev);
+	gmc_v9_0_set_mmhub_funcs(adev);
 
 	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
 	adev->gmc.shared_aperture_end =
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2 -0
index 292f3b1cddf2..fa961e0b6f2f 100644
@@ -584,3 +584,12 @@ void mmhub_v1_0_get_clockgating(struct
 amdgpu_device *adev, u32 *flags)
 	if (data & ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK)
 		*flags |= AMD_CG_SUPPORT_MC_LS;
 }
+
+static void mmhub_v1_0_query_ras_error_count(struct amdgpu_device

*adev,

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +6 -0
+					   void *ras_error_status)
+{
+}
+
+const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
+	.query_ras_error_count = mmhub_v1_0_query_ras_error_count, };
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h +2 -0
index 0de0fdf98c00..c43319e8f945 100644
@@ -23,6 +23,8 @@
 #ifndef __MMHUB_V1_0_H__
 #define __MMHUB_V1_0_H__
 
+extern const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs;
+
 u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev);  int

mmhub_v1_0_gart_enable(struct amdgpu_device *adev); void mmhub_v1_0_gart_disable(struct amdgpu_device *adev); --
2.17.1

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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3054CEB6F60C417D28CAC42DB0D70-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Hawking Zhang
#7 lore raw

Okay, we can have mmhub ras function go first and find another timeslot to refine those two huge blocks. The series is

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: 2019年8月8日 15:58
To: Zhang, Hawking <[email protected]>; [email protected]; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Pan, Xinhui <[email protected]>; Clements, John <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: add amdgpu_mmhub_funcs definition

Mmhub ras function will be called in amdgpu_ras.c, amdgpu_ras.c should pay no attention to the version of mmhub functions.

Centralize all the functions into callback function structure is a good idea, but this is a another story and needs a huge effort.

Regards,
Tao

Quoted 184 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: 2019年8月8日 15:16
To: Zhou1, Tao <[email protected]>; [email protected]; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Pan, Xinhui <[email protected]>; Clements, John <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: add amdgpu_mmhub_funcs definition

For mmhub/gfxhub, currently we didn't organize both in callback functions structure, instead, we declared all the functions in its header file respectively (see mmhub_vxx_x.h/gfxhub_vxx_x.h).

We'd either centralize all the functions into callback function structure, or continue declare the new function in its own header file. Either way seems fine to me.

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: 2019年8月8日 14:54
To: [email protected]; Zhang, Hawking <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Pan, Xinhui <[email protected]>; Clements, John <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: add amdgpu_mmhub_funcs definition

add amdgpu_mmhub_funcs definition and initialize it, prepare for mmhub ras enablement

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 31
+++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c     | 12 +++++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c   |  9 +++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h   |  2 ++
 5 files changed, 56 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 41f677613ffa..ed1a217e86e4 100644
@@ -87,6 +87,7 @@
 #include "amdgpu_discovery.h"
 #include "amdgpu_mes.h"
 #include "amdgpu_umc.h"
+#include "amdgpu_mmhub.h"
 
 #define MAX_GPU_INSTANCE		16
 
@@ -979,6 +980,7 @@ struct amdgpu_device {
 
 	const struct amdgpu_nbio_funcs	*nbio_funcs;
 	const struct amdgpu_df_funcs	*df_funcs;
+	const struct amdgpu_mmhub_funcs	*mmhub_funcs;
 
 	/* delayed work_func for deferring clockgating during resume */
 	struct delayed_work     delayed_init_work;
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h new file +24 -0
new file mode 100644
index 000000000000..2d75ecfa199b
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */

drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h new file +11 -0
+#ifndef __AMDGPU_MMHUB_H__
+#define __AMDGPU_MMHUB_H__
+
+struct amdgpu_mmhub_funcs {
+	void (*ras_init)(struct amdgpu_device *adev);
+	void (*query_ras_error_count)(struct amdgpu_device *adev,
+					void *ras_error_status);
+};
+
+#endif
+
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +11 -1
index a2aa35eb512c..ce8ff7172883 100644
@@ -652,6 +652,17 @@ static void gmc_v9_0_set_umc_funcs(struct 
 amdgpu_device *adev)
 	}
 }
 
+static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	case CHIP_VEGA20:
+		adev->mmhub_funcs = &mmhub_v1_0_funcs;
+		break;
+	default:
+		break;
+	}
+}
+
 static int gmc_v9_0_early_init(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@
-659,6 +670,7 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gmc_funcs(adev);
 	gmc_v9_0_set_irq_funcs(adev);
 	gmc_v9_0_set_umc_funcs(adev);
+	gmc_v9_0_set_mmhub_funcs(adev);
 
 	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
 	adev->gmc.shared_aperture_end =
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2 -0
index 292f3b1cddf2..fa961e0b6f2f 100644
@@ -584,3 +584,12 @@ void mmhub_v1_0_get_clockgating(struct 
 amdgpu_device *adev, u32 *flags)
 	if (data & ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK)
 		*flags |= AMD_CG_SUPPORT_MC_LS;
 }
+
+static void mmhub_v1_0_query_ras_error_count(struct amdgpu_device

*adev,

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +6 -0
+					   void *ras_error_status)
+{
+}
+
+const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
+	.query_ras_error_count = mmhub_v1_0_query_ras_error_count, };
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h +2 -0
index 0de0fdf98c00..c43319e8f945 100644
@@ -23,6 +23,8 @@
 #ifndef __MMHUB_V1_0_H__
 #define __MMHUB_V1_0_H__
 
+extern const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs;
+
 u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev);  int 

mmhub_v1_0_gart_enable(struct amdgpu_device *adev); void mmhub_v1_0_gart_disable(struct amdgpu_device *adev); --
2.17.1

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