All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: Remove repeated calls
@ 2022-01-19  2:55 yipechai
  2022-01-19  2:55 ` [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init yipechai
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: yipechai @ 2022-01-19  2:55 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tao.Zhou1, Hawking.Zhang, John.Clements, yipechai, yipechai

Remove repeated calls.

Signed-off-by: yipechai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 7a1d2bac698e..4992bc554c0c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1704,9 +1704,7 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev)
 static void amdgpu_ras_error_status_query(struct amdgpu_device *adev,
 					  struct ras_query_if *info)
 {
-	struct amdgpu_ras_block_object *block_obj = amdgpu_ras_get_ras_block(adev,
-									info->head.block,
-									info->head.sub_block_index);
+	struct amdgpu_ras_block_object *block_obj;
 	/*
 	 * Only two block need to query read/write
 	 * RspStatus at current state
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init
  2022-01-19  2:55 [PATCH 1/3] drm/amdgpu: Remove repeated calls yipechai
@ 2022-01-19  2:55 ` yipechai
  2022-01-19  6:10   ` Zhou1, Tao
  2022-01-19  6:24   ` Zhang, Hawking
  2022-01-19  2:55 ` [PATCH 3/3] drm/amdgpu: Remove redundant code in gmc v10 yipechai
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: yipechai @ 2022-01-19  2:55 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tao.Zhou1, Hawking.Zhang, John.Clements, yipechai, yipechai

Move xgmi ras initialization from .late_init to .early_init, which let
xgmi ras be initialized only once.

Signed-off-by: yipechai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 -----
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c  | 1 -
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 9 +++++++++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 3483a82f5734..d83eee1984c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -452,11 +452,6 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
 			return r;
 	}
 
-	if (!adev->gmc.xgmi.connected_to_cpu) {
-		adev->gmc.xgmi.ras = &xgmi_ras;
-		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras->ras_block);
-	}
-
 	if (adev->gmc.xgmi.ras && adev->gmc.xgmi.ras->ras_block.ras_late_init) {
 		r = adev->gmc.xgmi.ras->ras_block.ras_late_init(adev, NULL);
 		if (r)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 4f8d356f8432..5f9f82091000 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -716,7 +716,6 @@ static void gmc_v10_0_set_gfxhub_funcs(struct amdgpu_device *adev)
 	}
 }
 
-
 static int gmc_v10_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index c76ffd1a70cd..8d1b11368a7b 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1303,6 +1303,14 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev)
 	amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);
 }
 
+static void gmc_v9_0_set_xgmi_ras_funcs(struct amdgpu_device *adev)
+{
+	if (!adev->gmc.xgmi.connected_to_cpu) {
+		adev->gmc.xgmi.ras = &xgmi_ras;
+		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras->ras_block);
+	}
+}
+
 static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)
 {
 	/* is UMC the right IP to check for MCA?  Maybe DF? */
@@ -1339,6 +1347,7 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gfxhub_funcs(adev);
 	gmc_v9_0_set_hdp_ras_funcs(adev);
 	gmc_v9_0_set_mca_funcs(adev);
+	gmc_v9_0_set_xgmi_ras_funcs(adev);
 
 	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
 	adev->gmc.shared_aperture_end =
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] drm/amdgpu: Remove redundant code in gmc v10
  2022-01-19  2:55 [PATCH 1/3] drm/amdgpu: Remove repeated calls yipechai
  2022-01-19  2:55 ` [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init yipechai
@ 2022-01-19  2:55 ` yipechai
  2022-01-19  6:02 ` [PATCH 1/3] drm/amdgpu: Remove repeated calls Zhang, Hawking
  2022-01-19  6:11 ` Zhou1, Tao
  3 siblings, 0 replies; 8+ messages in thread
From: yipechai @ 2022-01-19  2:55 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tao.Zhou1, Hawking.Zhang, John.Clements, yipechai, yipechai

Gmc v10 doesn't support ras function, remove redundant code in it.

Signed-off-by: yipechai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 5f9f82091000..a833ef130495 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -664,25 +664,10 @@ static void gmc_v10_0_set_umc_funcs(struct amdgpu_device *adev)
 		adev->umc.umc_inst_num = UMC_V8_7_UMC_INSTANCE_NUM;
 		adev->umc.channel_offs = UMC_V8_7_PER_CHANNEL_OFFSET_SIENNA;
 		adev->umc.channel_idx_tbl = &umc_v8_7_channel_idx_tbl[0][0];
-		adev->umc.ras = &umc_v8_7_ras;
 		break;
 	default:
 		break;
 	}
-	if (adev->umc.ras) {
-		amdgpu_ras_register_ras_block(adev, &adev->umc.ras->ras_block);
-
-		strcpy(adev->umc.ras->ras_block.name, "umc");
-		adev->umc.ras->ras_block.block = AMDGPU_RAS_BLOCK__UMC;
-
-		/* If don't define special ras_late_init function, use default ras_late_init */
-		if (!adev->umc.ras->ras_block.ras_late_init)
-				adev->umc.ras->ras_block.ras_late_init = amdgpu_umc_ras_late_init;
-
-		/* If don't define special ras_fini function, use default ras_fini */
-		if (!adev->umc.ras->ras_block.ras_fini)
-				adev->umc.ras->ras_block.ras_fini = amdgpu_umc_ras_fini;
-	}
 }
 
 
@@ -745,10 +730,6 @@ static int gmc_v10_0_late_init(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_gmc_ras_late_init(adev);
-	if (r)
-		return r;
-
 	return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/3] drm/amdgpu: Remove repeated calls
  2022-01-19  2:55 [PATCH 1/3] drm/amdgpu: Remove repeated calls yipechai
  2022-01-19  2:55 ` [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init yipechai
  2022-01-19  2:55 ` [PATCH 3/3] drm/amdgpu: Remove redundant code in gmc v10 yipechai
@ 2022-01-19  6:02 ` Zhang, Hawking
  2022-01-19  6:11 ` Zhou1, Tao
  3 siblings, 0 replies; 8+ messages in thread
From: Zhang, Hawking @ 2022-01-19  6:02 UTC (permalink / raw)
  To: Chai, Thomas, amd-gfx; +Cc: Zhou1, Tao, Clements, John

[AMD Official Use Only]

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>

Regards,
Hawking
-----Original Message-----
From: Chai, Thomas <YiPeng.Chai@amd.com> 
Sent: Wednesday, January 19, 2022 10:56
To: amd-gfx@lists.freedesktop.org
Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Clements, John <John.Clements@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>
Subject: [PATCH 1/3] drm/amdgpu: Remove repeated calls

Remove repeated calls.

Signed-off-by: yipechai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 7a1d2bac698e..4992bc554c0c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1704,9 +1704,7 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev)  static void amdgpu_ras_error_status_query(struct amdgpu_device *adev,
 					  struct ras_query_if *info)
 {
-	struct amdgpu_ras_block_object *block_obj = amdgpu_ras_get_ras_block(adev,
-									info->head.block,
-									info->head.sub_block_index);
+	struct amdgpu_ras_block_object *block_obj;
 	/*
 	 * Only two block need to query read/write
 	 * RspStatus at current state
--
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init
  2022-01-19  2:55 ` [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init yipechai
@ 2022-01-19  6:10   ` Zhou1, Tao
  2022-01-19  7:22     ` Chai, Thomas
  2022-01-19  6:24   ` Zhang, Hawking
  1 sibling, 1 reply; 8+ messages in thread
From: Zhou1, Tao @ 2022-01-19  6:10 UTC (permalink / raw)
  To: Chai, Thomas, amd-gfx; +Cc: Clements, John, Zhang, Hawking

[AMD Official Use Only]



> -----Original Message-----
> From: Chai, Thomas <YiPeng.Chai@amd.com>
> Sent: Wednesday, January 19, 2022 10:56 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking
> <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Clements,
> John <John.Clements@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>
> Subject: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init
> to .early_init
> 
> Move xgmi ras initialization from .late_init to .early_init, which let xgmi ras be
> initialized only once.
> 
> Signed-off-by: yipechai <YiPeng.Chai@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 -----
> drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c  | 1 -
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 9 +++++++++
>  3 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 3483a82f5734..d83eee1984c8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -452,11 +452,6 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device
> *adev)
>  			return r;
>  	}
> 
> -	if (!adev->gmc.xgmi.connected_to_cpu) {
> -		adev->gmc.xgmi.ras = &xgmi_ras;
> -		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras-
> >ras_block);
> -	}
> -
>  	if (adev->gmc.xgmi.ras && adev->gmc.xgmi.ras->ras_block.ras_late_init)
> {
>  		r = adev->gmc.xgmi.ras->ras_block.ras_late_init(adev, NULL);
>  		if (r)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> index 4f8d356f8432..5f9f82091000 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> @@ -716,7 +716,6 @@ static void gmc_v10_0_set_gfxhub_funcs(struct
> amdgpu_device *adev)
>  	}
>  }
> 
> -
[Tao]: Please don't introduce irrelevant change.

>  static int gmc_v10_0_early_init(void *handle)  {
>  	struct amdgpu_device *adev = (struct amdgpu_device *)handle; diff --git
> a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index c76ffd1a70cd..8d1b11368a7b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1303,6 +1303,14 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct
> amdgpu_device *adev)
>  	amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);  }
> 
> +static void gmc_v9_0_set_xgmi_ras_funcs(struct amdgpu_device *adev) {
> +	if (!adev->gmc.xgmi.connected_to_cpu) {
> +		adev->gmc.xgmi.ras = &xgmi_ras;
> +		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras-
> >ras_block);
> +	}
> +}
[Tao]: Since the initialization of xgmi.ras is common for all versions of IP, I recommend to create a generic ras_early_init func for it.
BTW, I think we can remove the check for block_obj's existence in register_ras_block now.

> +
>  static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)  {
>  	/* is UMC the right IP to check for MCA?  Maybe DF? */ @@ -1339,6
> +1347,7 @@ static int gmc_v9_0_early_init(void *handle)
>  	gmc_v9_0_set_gfxhub_funcs(adev);
>  	gmc_v9_0_set_hdp_ras_funcs(adev);
>  	gmc_v9_0_set_mca_funcs(adev);
> +	gmc_v9_0_set_xgmi_ras_funcs(adev);
> 
>  	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
>  	adev->gmc.shared_aperture_end =
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/3] drm/amdgpu: Remove repeated calls
  2022-01-19  2:55 [PATCH 1/3] drm/amdgpu: Remove repeated calls yipechai
                   ` (2 preceding siblings ...)
  2022-01-19  6:02 ` [PATCH 1/3] drm/amdgpu: Remove repeated calls Zhang, Hawking
@ 2022-01-19  6:11 ` Zhou1, Tao
  3 siblings, 0 replies; 8+ messages in thread
From: Zhou1, Tao @ 2022-01-19  6:11 UTC (permalink / raw)
  To: Chai, Thomas, amd-gfx; +Cc: Clements, John, Zhang, Hawking

[AMD Official Use Only]

Reviewed-by: Tao Zhou <tao.zhou1@amd.com>

> -----Original Message-----
> From: Chai, Thomas <YiPeng.Chai@amd.com>
> Sent: Wednesday, January 19, 2022 10:56 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking
> <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Clements,
> John <John.Clements@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>
> Subject: [PATCH 1/3] drm/amdgpu: Remove repeated calls
> 
> Remove repeated calls.
> 
> Signed-off-by: yipechai <YiPeng.Chai@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 7a1d2bac698e..4992bc554c0c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1704,9 +1704,7 @@ static void amdgpu_ras_log_on_err_counter(struct
> amdgpu_device *adev)  static void amdgpu_ras_error_status_query(struct
> amdgpu_device *adev,
>  					  struct ras_query_if *info)
>  {
> -	struct amdgpu_ras_block_object *block_obj =
> amdgpu_ras_get_ras_block(adev,
> -									info-
> >head.block,
> -									info-
> >head.sub_block_index);
> +	struct amdgpu_ras_block_object *block_obj;
>  	/*
>  	 * Only two block need to query read/write
>  	 * RspStatus at current state
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init
  2022-01-19  2:55 ` [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init yipechai
  2022-01-19  6:10   ` Zhou1, Tao
@ 2022-01-19  6:24   ` Zhang, Hawking
  1 sibling, 0 replies; 8+ messages in thread
From: Zhang, Hawking @ 2022-01-19  6:24 UTC (permalink / raw)
  To: Chai, Thomas, amd-gfx; +Cc: Zhou1, Tao, Clements, John

[AMD Official Use Only]

Patch is
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>

Regards,
Hawking
-----Original Message-----
From: Chai, Thomas <YiPeng.Chai@amd.com> 
Sent: Wednesday, January 19, 2022 10:56
To: amd-gfx@lists.freedesktop.org
Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Clements, John <John.Clements@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>
Subject: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init

Move xgmi ras initialization from .late_init to .early_init, which let xgmi ras be initialized only once.

Signed-off-by: yipechai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 -----  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c  | 1 -
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 9 +++++++++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 3483a82f5734..d83eee1984c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -452,11 +452,6 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
 			return r;
 	}
 
-	if (!adev->gmc.xgmi.connected_to_cpu) {
-		adev->gmc.xgmi.ras = &xgmi_ras;
-		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras->ras_block);
-	}
-
 	if (adev->gmc.xgmi.ras && adev->gmc.xgmi.ras->ras_block.ras_late_init) {
 		r = adev->gmc.xgmi.ras->ras_block.ras_late_init(adev, NULL);
 		if (r)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 4f8d356f8432..5f9f82091000 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -716,7 +716,6 @@ static void gmc_v10_0_set_gfxhub_funcs(struct amdgpu_device *adev)
 	}
 }
 
-
 static int gmc_v10_0_early_init(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle; diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index c76ffd1a70cd..8d1b11368a7b 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1303,6 +1303,14 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev)
 	amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);  }
 
+static void gmc_v9_0_set_xgmi_ras_funcs(struct amdgpu_device *adev) {
+	if (!adev->gmc.xgmi.connected_to_cpu) {
+		adev->gmc.xgmi.ras = &xgmi_ras;
+		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras->ras_block);
+	}
+}
+
 static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)  {
 	/* is UMC the right IP to check for MCA?  Maybe DF? */ @@ -1339,6 +1347,7 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gfxhub_funcs(adev);
 	gmc_v9_0_set_hdp_ras_funcs(adev);
 	gmc_v9_0_set_mca_funcs(adev);
+	gmc_v9_0_set_xgmi_ras_funcs(adev);
 
 	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
 	adev->gmc.shared_aperture_end =
--
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init
  2022-01-19  6:10   ` Zhou1, Tao
@ 2022-01-19  7:22     ` Chai, Thomas
  0 siblings, 0 replies; 8+ messages in thread
From: Chai, Thomas @ 2022-01-19  7:22 UTC (permalink / raw)
  To: Zhou1, Tao, amd-gfx; +Cc: Clements, John, Zhang, Hawking



-----Original Message-----
From: Zhou1, Tao <Tao.Zhou1@amd.com> 
Sent: Wednesday, January 19, 2022 2:11 PM
To: Chai, Thomas <YiPeng.Chai@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Zhang, Hawking <Hawking.Zhang@amd.com>; Clements, John <John.Clements@amd.com>
Subject: RE: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init

[AMD Official Use Only]



> -----Original Message-----
> From: Chai, Thomas <YiPeng.Chai@amd.com>
> Sent: Wednesday, January 19, 2022 10:56 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking 
> <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Clements, 
> John <John.Clements@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>
> Subject: [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from 
> .late_init to .early_init
> 
> Move xgmi ras initialization from .late_init to .early_init, which let 
> xgmi ras be initialized only once.
> 
> Signed-off-by: yipechai <YiPeng.Chai@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ----- 
> drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c  | 1 -
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 9 +++++++++
>  3 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 3483a82f5734..d83eee1984c8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -452,11 +452,6 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device
> *adev)
>  			return r;
>  	}
> 
> -	if (!adev->gmc.xgmi.connected_to_cpu) {
> -		adev->gmc.xgmi.ras = &xgmi_ras;
> -		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras-
> >ras_block);
> -	}
> -
>  	if (adev->gmc.xgmi.ras && 
> adev->gmc.xgmi.ras->ras_block.ras_late_init)
> {
>  		r = adev->gmc.xgmi.ras->ras_block.ras_late_init(adev, NULL);
>  		if (r)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> index 4f8d356f8432..5f9f82091000 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> @@ -716,7 +716,6 @@ static void gmc_v10_0_set_gfxhub_funcs(struct 
> amdgpu_device *adev)
>  	}
>  }
> 
> -
>[Tao]: Please don't introduce irrelevant change.

[Thomas] OK

>  static int gmc_v10_0_early_init(void *handle)  {
>  	struct amdgpu_device *adev = (struct amdgpu_device *)handle; diff 
> --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index c76ffd1a70cd..8d1b11368a7b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1303,6 +1303,14 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct 
> amdgpu_device *adev)
>  	amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);  }
> 
> +static void gmc_v9_0_set_xgmi_ras_funcs(struct amdgpu_device *adev) {
> +	if (!adev->gmc.xgmi.connected_to_cpu) {
> +		adev->gmc.xgmi.ras = &xgmi_ras;
> +		amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras-
> >ras_block);
> +	}
> +}
>[Tao]: Since the initialization of xgmi.ras is common for all versions of IP, I recommend to create a generic ras_early_init func for it.
>BTW, I think we can remove the check for block_obj's existence in register_ras_block now.
 
[Thomas] I will update the patch.

> +
>  static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)  {
>  	/* is UMC the right IP to check for MCA?  Maybe DF? */ @@ -1339,6
> +1347,7 @@ static int gmc_v9_0_early_init(void *handle)
>  	gmc_v9_0_set_gfxhub_funcs(adev);
>  	gmc_v9_0_set_hdp_ras_funcs(adev);
>  	gmc_v9_0_set_mca_funcs(adev);
> +	gmc_v9_0_set_xgmi_ras_funcs(adev);
> 
>  	adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
>  	adev->gmc.shared_aperture_end =
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-19  7:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  2:55 [PATCH 1/3] drm/amdgpu: Remove repeated calls yipechai
2022-01-19  2:55 ` [PATCH 2/3] drm/amdgpu: Move xgmi ras initialization from .late_init to .early_init yipechai
2022-01-19  6:10   ` Zhou1, Tao
2022-01-19  7:22     ` Chai, Thomas
2022-01-19  6:24   ` Zhang, Hawking
2022-01-19  2:55 ` [PATCH 3/3] drm/amdgpu: Remove redundant code in gmc v10 yipechai
2022-01-19  6:02 ` [PATCH 1/3] drm/amdgpu: Remove repeated calls Zhang, Hawking
2022-01-19  6:11 ` Zhou1, Tao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.