drm/amd/amdgpu: add sw_fini interface for df_funcs
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: add sw_fini interface for df_funcs
add sw_fini interface of df_funcs.
This interface will remove sysfs file of df_cntr_avail function.
The old behavior only create sysfs of df_cntr_avail in sw_init, but never remove it for lack of sw_fini interface. With this,driver will report create sysfs fail when it's loaded for the second time.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/df_v1_7.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +++ 4 files changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -655,6 +655,7 @@ struct amdgpu_mmio_remap {struct amdgpu_df_funcs {void (*sw_init)(struct amdgpu_device *adev); +void (*sw_fini)(struct amdgpu_device *adev);void (*enable_broadcast_mode)(struct amdgpu_device *adev,bool enable);u32 (*get_fb_channel_number)(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/df_v1_7.c +5 -0
@@ -33,6 +33,10 @@ static void df_v1_7_sw_init(struct amdgpu_device *adev) { } +static void df_v1_7_sw_fini (struct amdgpu_device *adev) +{ +} +static void df_v1_7_enable_broadcast_mode (struct amdgpu_device *adev,bool enable) {
@@ -111,6 +115,7 @@ static void df_v1_7_enable_ecc_force_par_wr_rmw(struct amdgpu_device *adev,const struct amdgpu_df_funcs df_v1_7_funcs = { .sw_init = df_v1_7_sw_init, + .sw_fini = df_v1_7_sw_fini, .enable_broadcast_mode = df_v1_7_enable_broadcast_mode, .get_fb_channel_number = df_v1_7_get_fb_channel_number, .get_hbm_channel_number = df_v1_7_get_hbm_channel_number,
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +8 -0
@@ -220,6 +220,13 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev) adev->df_perfmon_config_assign_mask[i] =0 ; } +static void df_v3_6_sw_fini (struct amdgpu_device *adev) +{ + +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); + +} +static void df_v3_6_enable_broadcast_mode (struct amdgpu_device *adev,bool enable) {
@@ -537,6 +544,7 @@ static void df_v3_6_pmc_get_count(struct amdgpu_device *adev,const struct amdgpu_df_funcs df_v3_6_funcs = { .sw_init = df_v3_6_sw_init, + .sw_fini = df_v3_6_sw_fini, .enable_broadcast_mode = df_v3_6_enable_broadcast_mode, .get_fb_channel_number = df_v3_6_get_fb_channel_number, .get_hbm_channel_number = df_v3_6_get_hbm_channel_number,
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
@@ -1239,6 +1239,9 @@ static int soc15_common_sw_init(void *handle)static int soc15_common_sw_fini (void *handle) { +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + adev->df_funcs->sw_fini (adev);return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ 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]
Kim, Jonathan
Reviewed-by Jonathan Kim-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jack Zhang
Sent: Tuesday, September 3, 2019 5:54 AM
To: [email protected]
Cc: Zhang, Jack (Jian) <[email protected]>
Subject: [PATCH] drm/amd/amdgpu: add sw_fini interface for df_funcs
[CAUTION: External Email]
add sw_fini interface of df_funcs.
This interface will remove sysfs file of df_cntr_avail function.
The old behavior only create sysfs of df_cntr_avail in sw_init, but never remove it for lack of sw_fini interface. With this,driver will report create sysfs fail when it's loaded for the second time.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/df_v1_7.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +++ 4 files changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -655,6 +655,7 @@ struct amdgpu_mmio_remap {struct amdgpu_df_funcs {void (*sw_init)(struct amdgpu_device *adev); +void (*sw_fini)(struct amdgpu_device *adev);void (*enable_broadcast_mode)(struct amdgpu_device *adev,bool enable); u32 (*get_fb_channel_number)(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
index 844c038..d622129 100644
drivers/gpu/drm/amd/amdgpu/df_v1_7.c +3 -0
@@ -33,6 +33,10 @@ static void df_v1_7_sw_init(struct amdgpu_device *adev) { } +static void df_v1_7_sw_fini (struct amdgpu_device *adev) { } +static void df_v1_7_enable_broadcast_mode (struct amdgpu_device *adev, bool enable) { @@ -111,6 +115,7 @@ static void df_v1_7_enable_ecc_force_par_wr_rmw(struct amdgpu_device *adev, const struct amdgpu_df_funcs df_v1_7_funcs = { .sw_init = df_v1_7_sw_init, + .sw_fini = df_v1_7_sw_fini,
.enable_broadcast_mode = df_v1_7_enable_broadcast_mode,
.get_fb_channel_number = df_v1_7_get_fb_channel_number,
.get_hbm_channel_number = df_v1_7_get_hbm_channel_number, diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c b/drivers/gpu/drm/amd/amdgpu/df_v3_6.cindex deee4f4..16fbd2bc8 100644
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +6 -0
@@ -220,6 +220,13 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev) adev->df_perfmon_config_assign_mask[i] =0 ; } +static void df_v3_6_sw_fini (struct amdgpu_device *adev) { + +device_remove_file (adev->dev, &dev_attr_df_cntr_avail); + +} +static void df_v3_6_enable_broadcast_mode (struct amdgpu_device *adev, bool enable) { @@ -537,6 +544,7 @@ static void df_v3_6_pmc_get_count(struct amdgpu_device *adev, const struct amdgpu_df_funcs df_v3_6_funcs = {
.sw_init = df_v3_6_sw_init,
+ .sw_fini = df_v3_6_sw_fini,
.enable_broadcast_mode = df_v3_6_enable_broadcast_mode,
.get_fb_channel_number = df_v3_6_get_fb_channel_number,
.get_hbm_channel_number = df_v3_6_get_hbm_channel_number, diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.cindex d407e29..cb22970 100644
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -1
@@ -1239,6 +1239,9 @@ static int soc15_common_sw_init(void *handle)static int soc15_common_sw_fini (void *handle) { +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + adev->df_funcs->sw_fini (adev);return 0 ; } --
2.7.4
_______________________________________________
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