On Fri, Sep 27, 2019 at 6:08 AM Jesse Zhang <zhexi.zhang@xxxxxxx> wrote: > > From: root <root@debian.debian> Please fix your git setup to use your proper email. Alex > > Guest driver can be unloaded while engines still using some > backend resources. That would lead to use after free and then > cause guest driver failed. > > Need to add mutex lock before backend resources free to make > sure nobody is using it. > > Need to check backend data availablility before VCE/UVD enter > powergating mode, if backend resources have been free, then > skip entering powergating. > > Change-Id: If7f93221ddecc578884dc9e99a52f22a43e16b07 > Signed-off-by: Jesse Zhang <zhexi.zhang@xxxxxxx> > --- > drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > index d08493b..a9320a5 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > @@ -810,8 +810,10 @@ static int vega10_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) > kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > > + mutex_lock(&hwmgr->smu_lock); > kfree(hwmgr->backend); > hwmgr->backend = NULL; > + mutex_unlock(&hwmgr->smu_lock); > > return 0; > } > @@ -4619,16 +4621,20 @@ static void vega10_power_gate_vce(struct pp_hwmgr *hwmgr, bool bgate) > { > struct vega10_hwmgr *data = hwmgr->backend; > > - data->vce_power_gated = bgate; > - vega10_enable_disable_vce_dpm(hwmgr, !bgate); > + if(data){ > + data->vce_power_gated = bgate; > + vega10_enable_disable_vce_dpm(hwmgr, !bgate); > + } > } > > static void vega10_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate) > { > struct vega10_hwmgr *data = hwmgr->backend; > > - data->uvd_power_gated = bgate; > - vega10_enable_disable_uvd_dpm(hwmgr, !bgate); > + if(data){ > + data->uvd_power_gated = bgate; > + vega10_enable_disable_uvd_dpm(hwmgr, !bgate); > + } > } > > static inline bool vega10_are_power_levels_equal( > -- > 2.7.4 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx