Skip to contentSkip to conversation

drm/amdgpu: save the setting of VM_CONTEXT_CNTL

PATCH In review Alex Deucher 2 participants 4 messages Apr 28, 2022 – Apr 29, 2022

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/3 drm/amdgpu: save the setting of VM_CONTEXT_CNTL

From: Jack Xiao <[email protected]>

MES firmware needs the setting of VM_CONTEXT_CNTL to perform vmid switch. Save the initial setting when hub initializing.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h  | 1 +
 drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c  | 2 ++
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c  | 2 ++
 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c  | 2 ++
 7 files changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
index 4be6b657944a..008eaca27151 100644
@@ -100,6 +100,7 @@ struct amdgpu_vmhub {
 	uint32_t	eng_distance;
 	uint32_t	eng_addr_distance; /* include LO32/HI32 */
 
+	uint32_t        vm_cntx_cntl;
 	uint32_t	vm_cntx_cntl_vm_fault;
 	uint32_t	vm_l2_bank_select_reserved_cid2;
 
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c +2 -0
index 6e0ace2fbfab..34513e8e1519 100644
@@ -325,6 +325,8 @@ static void gfxhub_v2_0_setup_vmid_config(struct amdgpu_device *adev)
 				    i * hub->ctx_addr_distance,
 				    upper_32_bits(adev->vm_manager.max_pfn - 1));
 	}
+
+	hub->vm_cntx_cntl = tmp;
 }
 
 static void gfxhub_v2_0_program_invalidation(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c +2 -0
index ff738e9725ee..d8c531581116 100644
@@ -334,6 +334,8 @@ static void gfxhub_v2_1_setup_vmid_config(struct amdgpu_device *adev)
 				    i * hub->ctx_addr_distance,
 				    upper_32_bits(adev->vm_manager.max_pfn - 1));
 	}
+
+	hub->vm_cntx_cntl = tmp;
 }
 
 static void gfxhub_v2_1_program_invalidation(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c +2 -0
index 47f0e4daa466..5eccaa2c7ca0 100644
@@ -335,6 +335,8 @@ static void gfxhub_v3_0_setup_vmid_config(struct amdgpu_device *adev)
 				    i * hub->ctx_addr_distance,
 				    upper_32_bits(adev->vm_manager.max_pfn - 1));
 	}
+
+	hub->vm_cntx_cntl = tmp;
 }
 
 static void gfxhub_v3_0_program_invalidation(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +2 -0
index 636abd855686..4d304f22889e 100644
@@ -408,6 +408,8 @@ static void mmhub_v2_0_setup_vmid_config(struct amdgpu_device *adev)
 				    i * hub->ctx_addr_distance,
 				    upper_32_bits(adev->vm_manager.max_pfn - 1));
 	}
+
+	hub->vm_cntx_cntl = tmp;
 }
 
 static void mmhub_v2_0_program_invalidation(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c +2 -0
index ff44c5364a8c..1b027d069ab4 100644
@@ -324,6 +324,8 @@ static void mmhub_v2_3_setup_vmid_config(struct amdgpu_device *adev)
 				    i * hub->ctx_addr_distance,
 				    upper_32_bits(adev->vm_manager.max_pfn - 1));
 	}
+
+	hub->vm_cntx_cntl = tmp;
 }
 
 static void mmhub_v2_3_program_invalidation(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +2 -0
index 74b5b2f2dfd3..08a85a0cd334 100644
@@ -361,6 +361,8 @@ static void mmhub_v3_0_setup_vmid_config(struct amdgpu_device *adev)
 				    i * hub->ctx_addr_distance,
 				    upper_32_bits(adev->vm_manager.max_pfn - 1));
 	}
+
+	hub->vm_cntx_cntl = tmp;
 }
 
 static void mmhub_v3_0_program_invalidation(struct amdgpu_device *adev)
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/3 drm/amdgpu: add gmc v11_0 ip block (v3)

From: "Tianci.Yin" <[email protected]>

Add support for GPU memory controller v11.

v1: Add support for gmc v11.0
Add gmc 11 block (Tianci)
v2: drop unused amdgpu_bo_late_init (Hawking)
v3: squash in various fix

---
 drivers/gpu/drm/amd/amdgpu/Makefile     |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |   6 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c  | 966 ++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.h  |  30 +
 4 files changed, 1001 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index 156de606f275..7a1b13fabebb 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
+	mmhub_v1_7.o gfxhub_v3_0.o mmhub_v3_0.o gmc_v11_0.o
 
 # add UMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +4 -2
index ad8e7d486a7d..8e18d3fc4fab 100644
@@ -335,8 +335,10 @@ struct amdgpu_gfx {
 	DECLARE_BITMAP			(pipe_reserve_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
 
 	/*ras */
-	struct ras_common_if			*ras_if;
-	struct amdgpu_gfx_ras	*ras;
+	struct ras_common_if		*ras_if;
+	struct amdgpu_gfx_ras		*ras;
+
+	bool				is_poweron;
 };
 
 #define amdgpu_gfx_get_gpu_clock_counter(adev) (adev)->gfx.funcs->get_gpu_clock_counter((adev))
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c new file +966 -0

966 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gmc_v11_0.h new file +30 -0
new file mode 100644
index 000000000000..def4d5516f82
@@ -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 __GMC_V11_0_H__
+#define __GMC_V11_0_H__
+
+extern const struct amd_ip_funcs gmc_v11_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gmc_v11_0_ip_block;
+
+#endif
Signature · 1 line
2.35.1
author maintainer
#2 lore raw

PATCH 3/3 drm/amdgpu/discovery: add GMC 11.0 Support

In reply to Alex Deucher

From: Likun Gao <[email protected]>

Enable GMC 11.0 on asics where it is present.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +4 -0
index fceaef64485d..35598193dc7b 100644
@@ -47,6 +47,7 @@
 #include "jpeg_v2_5.h"
 #include "smuio_v9_0.h"
 #include "gmc_v10_0.h"
+#include "gmc_v11_0.h"
 #include "gfxhub_v2_0.h"
 #include "mmhub_v2_0.h"
 #include "nbio_v2_3.h"
@@ -1513,6 +1514,9 @@ static int amdgpu_discovery_set_gmc_ip_blocks(struct amdgpu_device *adev)
 	case IP_VERSION(10, 3, 7):
 		amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block);
 		break;
+	case IP_VERSION(11, 0, 0):
+		amdgpu_device_ip_block_add(adev, &gmc_v11_0_ip_block);
+		break;
 	default:
 		dev_err(adev->dev,
 			"Failed to add gmc ip block(GC_HWIP:0x%x)\n",
Signature · 1 line
2.35.1
Reviewed-by on v1 3/3
#3 lore raw

RE: [PATCH 3/3] drm/amdgpu/discovery: add GMC 11.0 Support

[AMD Official Use Only - General]

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, April 29, 2022 02:54
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Gao, Likun <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu/discovery: add GMC 11.0 Support

From: Likun Gao <[email protected]>

Enable GMC 11.0 on asics where it is present.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +4 -0
index fceaef64485d..35598193dc7b 100644
@@ -47,6 +47,7 @@
 #include "jpeg_v2_5.h"
 #include "smuio_v9_0.h"
 #include "gmc_v10_0.h"
+#include "gmc_v11_0.h"
 #include "gfxhub_v2_0.h"
 #include "mmhub_v2_0.h"
 #include "nbio_v2_3.h"
@@ -1513,6 +1514,9 @@ static int amdgpu_discovery_set_gmc_ip_blocks(struct amdgpu_device *adev)
        case IP_VERSION(10, 3, 7):
                amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block);
                break;
+       case IP_VERSION(11, 0, 0):
+               amdgpu_device_ip_block_add(adev, &gmc_v11_0_ip_block);
+               break;
        default:
                dev_err(adev->dev,
                        "Failed to add gmc ip block(GC_HWIP:0x%x)\n",

--
2.35.1