Re: [PATCH 3/4] drm/amdgpu: Remove wrapper layer of amdgpu_powerplay
On Mon, Mar 12, 2018 at 8:34 AM, Rex Zhuwrote: > delete struct pp_instance, > make struct hwmgr as the smu hw context. > > Change-Id: I444aabe20477fc2fc1288542d45bf887d45bf0cd > Signed-off-by: Rex Zhu > --- > drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 - > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 285 --- > drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h | 33 -- > drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 16 +- > drivers/gpu/drm/amd/amdgpu/cik.c| 15 +- > drivers/gpu/drm/amd/amdgpu/cik_dpm.h| 7 +- > drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 16 +- > drivers/gpu/drm/amd/amdgpu/si.c | 8 +- > drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 +- > drivers/gpu/drm/amd/amdgpu/si_dpm.h | 3 +- > drivers/gpu/drm/amd/amdgpu/soc15.c | 5 +- > drivers/gpu/drm/amd/amdgpu/vi.c | 13 +- > drivers/gpu/drm/amd/include/kgd_pp_interface.h | 3 +- > drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 611 > ++-- > drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 50 +- > drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 16 +- > drivers/gpu/drm/amd/powerplay/inc/pp_instance.h | 36 -- > 19 files changed, 336 insertions(+), 804 deletions(-) > delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c > delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h > delete mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index 353c937..94db35a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -87,8 +87,7 @@ amdgpu-y += \ > > # add SMC block > amdgpu-y += \ > - amdgpu_dpm.o \ > - amdgpu_powerplay.o > + amdgpu_dpm.o > > # add DCE block > amdgpu-y += \ > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index 96bcdb9..62773b6 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -1398,9 +1398,7 @@ enum amd_hw_ip_block_type { > #define HWIP_MAX_INSTANCE 6 > > struct amd_powerplay { > - struct cgs_device *cgs_device; > void *pp_handle; > - const struct amd_ip_funcs *ip_funcs; > const struct amd_pm_funcs *pp_funcs; > }; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > index 632b186..361975c 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > @@ -1154,7 +1154,7 @@ static umode_t hwmon_attributes_visible(struct kobject > *kobj, > umode_t effective_mode = attr->mode; > > /* handle non-powerplay limitations */ > - if (!adev->powerplay.cgs_device) { > + if (!adev->powerplay.pp_handle) { > /* Skip fan attributes if fan is not present */ > if (adev->pm.no_fan && > (attr == _dev_attr_pwm1.dev_attr.attr || > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c > deleted file mode 100644 > index 825c9b9..000 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c > +++ /dev/null > @@ -1,285 +0,0 @@ > -/* > - * Copyright 2015 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. > - * > - * Authors: AMD > - * > - */ > -#include "atom.h" > -#include "amdgpu.h" > -#include "amd_shared.h" > -#include > -#include > -#include "amdgpu_pm.h" > -#include > -#include "amdgpu_powerplay.h" > -#include "si_dpm.h" > -#include "cik_dpm.h" > -#include "vi_dpm.h" > - > -static int
[PATCH 3/4] drm/amdgpu: Remove wrapper layer of amdgpu_powerplay
delete struct pp_instance, make struct hwmgr as the smu hw context. Change-Id: I444aabe20477fc2fc1288542d45bf887d45bf0cd Signed-off-by: Rex Zhu--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 - drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 285 --- drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h | 33 -- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 16 +- drivers/gpu/drm/amd/amdgpu/cik.c| 15 +- drivers/gpu/drm/amd/amdgpu/cik_dpm.h| 7 +- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 16 +- drivers/gpu/drm/amd/amdgpu/si.c | 8 +- drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 +- drivers/gpu/drm/amd/amdgpu/si_dpm.h | 3 +- drivers/gpu/drm/amd/amdgpu/soc15.c | 5 +- drivers/gpu/drm/amd/amdgpu/vi.c | 13 +- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 3 +- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 611 ++-- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 50 +- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 16 +- drivers/gpu/drm/amd/powerplay/inc/pp_instance.h | 36 -- 19 files changed, 336 insertions(+), 804 deletions(-) delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h delete mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index 353c937..94db35a 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -87,8 +87,7 @@ amdgpu-y += \ # add SMC block amdgpu-y += \ - amdgpu_dpm.o \ - amdgpu_powerplay.o + amdgpu_dpm.o # add DCE block amdgpu-y += \ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 96bcdb9..62773b6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1398,9 +1398,7 @@ enum amd_hw_ip_block_type { #define HWIP_MAX_INSTANCE 6 struct amd_powerplay { - struct cgs_device *cgs_device; void *pp_handle; - const struct amd_ip_funcs *ip_funcs; const struct amd_pm_funcs *pp_funcs; }; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 632b186..361975c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c @@ -1154,7 +1154,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, umode_t effective_mode = attr->mode; /* handle non-powerplay limitations */ - if (!adev->powerplay.cgs_device) { + if (!adev->powerplay.pp_handle) { /* Skip fan attributes if fan is not present */ if (adev->pm.no_fan && (attr == _dev_attr_pwm1.dev_attr.attr || diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c deleted file mode 100644 index 825c9b9..000 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2015 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. - * - * Authors: AMD - * - */ -#include "atom.h" -#include "amdgpu.h" -#include "amd_shared.h" -#include -#include -#include "amdgpu_pm.h" -#include -#include "amdgpu_powerplay.h" -#include "si_dpm.h" -#include "cik_dpm.h" -#include "vi_dpm.h" - -static int amdgpu_pp_early_init(void *handle) -{ - struct amdgpu_device *adev = (struct amdgpu_device *)handle; - struct amd_powerplay *amd_pp; - int ret = 0; - - amd_pp = &(adev->powerplay); - amd_pp->pp_handle = (void *)adev; - - switch (adev->asic_type) { - case