[PATCH 5/7] drm/amdgpu: add mmhub ras_late_init callback function

Zhou1, Tao Tao.Zhou1 at amd.com
Thu Aug 29 03:53:23 UTC 2019


Can we also add a ras_late_init for umc?

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Zhou1, Tao
> Sent: 2019年8月29日 11:41
> To: Zhang, Hawking <Hawking.Zhang at amd.com>; amd-
> gfx at lists.freedesktop.org; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: Zhang, Hawking <Hawking.Zhang at amd.com>
> Subject: RE: [PATCH 5/7] drm/amdgpu: add mmhub ras_late_init callback
> function
> 
> 
> 
> > -----Original Message-----
> > From: Hawking Zhang <Hawking.Zhang at amd.com>
> > Sent: 2019年8月28日 21:03
> > To: amd-gfx at lists.freedesktop.org; Zhou1, Tao <Tao.Zhou1 at amd.com>;
> > Deucher, Alexander <Alexander.Deucher at amd.com>
> > Cc: Zhang, Hawking <Hawking.Zhang at amd.com>
> > Subject: [PATCH 5/7] drm/amdgpu: add mmhub ras_late_init callback
> > function
> >
> > The function will be called in late init phase to do mmhub ras init
> >
> > Signed-off-by: Hawking Zhang <Hawking.Zhang at amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h |  1 +
> >  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c     | 21 ++-------------------
> >  drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c   | 28
> > ++++++++++++++++++++++++++++
> >  3 files changed, 31 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> > index 2d75ecf..df04c71 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> > @@ -23,6 +23,7 @@
> >
> >  struct amdgpu_mmhub_funcs {
> >  	void (*ras_init)(struct amdgpu_device *adev);
> > +	int (*ras_late_init)(struct amdgpu_device *adev);
> >  	void (*query_ras_error_count)(struct amdgpu_device *adev,
> >  					void *ras_error_status);
> >  };
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> > b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> > index 8dc13d2..26a6956 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> > @@ -762,7 +762,6 @@ static int gmc_v9_0_ecc_late_init(void *handle)  {
> >  	int r;
> >  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> > -	struct ras_ih_if mmhub_ih_info;
> >  	struct ras_fs_if umc_fs_info = {
> >  		.sysfs_name = "umc_err_count",
> >  		.debugfs_name = "umc_err_inject",
> > @@ -770,10 +769,6 @@ static int gmc_v9_0_ecc_late_init(void *handle)
> >  	struct ras_ih_if umc_ih_info = {
> >  		.cb = gmc_v9_0_process_ras_data_cb,
> >  	};
> > -	struct ras_fs_if mmhub_fs_info = {
> > -		.sysfs_name = "mmhub_err_count",
> > -		.debugfs_name = "mmhub_err_inject",
> > -	};
> >
> >  	if (!adev->gmc.umc_ras_if) {
> >  		adev->gmc.umc_ras_if = kmalloc(sizeof(struct
> ras_common_if),
> > GFP_KERNEL); @@ -797,25 +792,13 @@ static int
> > gmc_v9_0_ecc_late_init(void *handle)
> >  			goto free;
> >  	}
> >
> > -	if (!adev->gmc.mmhub_ras_if) {
> > -		adev->gmc.mmhub_ras_if = kmalloc(sizeof(struct
> > ras_common_if), GFP_KERNEL);
> > -		if (!adev->gmc.mmhub_ras_if)
> > -			return -ENOMEM;
> > -		adev->gmc.mmhub_ras_if->block =
> > AMDGPU_RAS_BLOCK__MMHUB;
> > -		adev->gmc.mmhub_ras_if->type =
> > AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
> > -		adev->gmc.mmhub_ras_if->sub_block_index = 0;
> > -		strcpy(adev->gmc.mmhub_ras_if->name, "mmhub");
> > -	}
> > -	mmhub_ih_info.head = mmhub_fs_info.head = *adev-
> > >gmc.mmhub_ras_if;
> > -	r = amdgpu_ras_late_init(adev, adev->gmc.mmhub_ras_if,
> > -				 &mmhub_fs_info, &mmhub_ih_info);
> > +	r = adev->mmhub_funcs->ras_late_init(adev);
> [Tao] It's better to add "if (adev->mmhub_funcs->ras_late_init(adev))"
> 
> >  	if (r)
> > -		goto free;
> > +		return r;
> >
> >  	return 0;
> >  free:
> >  	kfree(adev->gmc.umc_ras_if);
> > -	kfree(adev->gmc.mmhub_ras_if);
> >  	return r;
> >  }
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
> > b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
> > index 04cd4b6..9f7d5d1 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
> > @@ -31,6 +31,7 @@
> >  #include "vega10_enum.h"
> >
> >  #include "soc15_common.h"
> > +#include "amdgpu_ras.h"
> >
> >  #define mmDAGB0_CNTL_MISC2_RV 0x008f
> >  #define mmDAGB0_CNTL_MISC2_RV_BASE_IDX 0 @@ -615,6 +616,33 @@
> static
> > void mmhub_v1_0_query_ras_error_count(struct amdgpu_device *adev,
> >  	}
> >  }
> >
> > +static int mmhub_v1_0_ras_late_init(struct amdgpu_device *adev) {
> > +	int r;
> > +	struct ras_ih_if mmhub_ih_info;
> > +	struct ras_fs_if mmhub_fs_info = {
> > +		.sysfs_name = "mmhub_err_count",
> > +		.debugfs_name = "mmhub_err_inject",
> > +	};
> > +
> > +	if (!adev->gmc.mmhub_ras_if) {
> > +		adev->gmc.mmhub_ras_if = kmalloc(sizeof(struct
> > ras_common_if), GFP_KERNEL);
> > +		if (!adev->gmc.mmhub_ras_if)
> > +			return -ENOMEM;
> > +		adev->gmc.mmhub_ras_if->block =
> > AMDGPU_RAS_BLOCK__MMHUB;
> > +		adev->gmc.mmhub_ras_if->type =
> > AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
> > +		adev->gmc.mmhub_ras_if->sub_block_index = 0;
> > +		strcpy(adev->gmc.mmhub_ras_if->name, "mmhub");
> > +	}
> > +	mmhub_ih_info.head = mmhub_fs_info.head = *adev-
> > >gmc.mmhub_ras_if;
> > +	r = amdgpu_ras_late_init(adev, adev->gmc.mmhub_ras_if,
> > +				 &mmhub_fs_info, &mmhub_ih_info);
> > +	if (r)
> > +		kfree(adev->gmc.mmhub_ras_if);
> > +	return r;
> > +}
> > +
> >  const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
> > +	.ras_late_init = mmhub_v1_0_ras_late_init,
> >  	.query_ras_error_count = mmhub_v1_0_query_ras_error_count,  };
> > --
> > 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list