diff options
Diffstat (limited to 'meta-r1000/recipes-kernel/linux/linux-yocto-4.14.71/4749-drm-amd-amdgpu-Add-a-GPU_LOAD-entry-to-sysfs-v3.patch')
-rw-r--r-- | meta-r1000/recipes-kernel/linux/linux-yocto-4.14.71/4749-drm-amd-amdgpu-Add-a-GPU_LOAD-entry-to-sysfs-v3.patch | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/meta-r1000/recipes-kernel/linux/linux-yocto-4.14.71/4749-drm-amd-amdgpu-Add-a-GPU_LOAD-entry-to-sysfs-v3.patch b/meta-r1000/recipes-kernel/linux/linux-yocto-4.14.71/4749-drm-amd-amdgpu-Add-a-GPU_LOAD-entry-to-sysfs-v3.patch deleted file mode 100644 index 3c3d9f82..00000000 --- a/meta-r1000/recipes-kernel/linux/linux-yocto-4.14.71/4749-drm-amd-amdgpu-Add-a-GPU_LOAD-entry-to-sysfs-v3.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 59766c824785eb6236991fc9396ca44236d44e75 Mon Sep 17 00:00:00 2001 -From: Tom St Denis <tom.stdenis@amd.com> -Date: Wed, 20 Jun 2018 07:55:39 -0400 -Subject: [PATCH 4749/5725] drm/amd/amdgpu: Add a GPU_LOAD entry to sysfs (v3) - -This adds what should be a stable interface to read GPU -load from userspace. - -(v2): Fix comments and name of file per recommendations. -(v3): Add chapter to amdgpu.rst as well. - -Signed-off-by: Tom St Denis <tom.stdenis@amd.com> -Acked-by: Slava Abramov <slava.abramov@amd.com> -Reviewed-by: Alex Deucher <alexander.deucher@amd.com> -Signed-off-by: Alex Deucher <alexander.deucher@amd.com> ---- - drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 40 ++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c -index bc2dd4f9..dbc8300 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c -@@ -918,6 +918,36 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, - return -EINVAL; - } - -+/** -+ * DOC: busy_percent -+ * -+ * The amdgpu driver provides a sysfs API for reading how busy the GPU -+ * is as a percentage. The file gpu_busy_percent is used for this. -+ * The SMU firmware computes a percentage of load based on the -+ * aggregate activity level in the IP cores. -+ */ -+static ssize_t amdgpu_get_busy_percent(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct drm_device *ddev = dev_get_drvdata(dev); -+ struct amdgpu_device *adev = ddev->dev_private; -+ int r, value, size = sizeof(value); -+ -+ /* sanity check PP is enabled */ -+ if (!(adev->powerplay.pp_funcs && -+ adev->powerplay.pp_funcs->read_sensor)) -+ return -EINVAL; -+ -+ /* read the IP busy sensor */ -+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_LOAD, -+ (void *)&value, &size); -+ if (r) -+ return r; -+ -+ return snprintf(buf, PAGE_SIZE, "%d\n", value); -+} -+ - static DEVICE_ATTR(power_dpm_state, S_IRUGO | S_IWUSR, amdgpu_get_dpm_state, amdgpu_set_dpm_state); - static DEVICE_ATTR(power_dpm_force_performance_level, S_IRUGO | S_IWUSR, - amdgpu_get_dpm_forced_performance_level, -@@ -951,6 +981,8 @@ static DEVICE_ATTR(pp_power_profile_mode, S_IRUGO | S_IWUSR, - static DEVICE_ATTR(pp_od_clk_voltage, S_IRUGO | S_IWUSR, - amdgpu_get_pp_od_clk_voltage, - amdgpu_set_pp_od_clk_voltage); -+static DEVICE_ATTR(gpu_busy_percent, S_IRUGO, -+ amdgpu_get_busy_percent, NULL); - - static ssize_t amdgpu_hwmon_show_temp(struct device *dev, - struct device_attribute *attr, -@@ -1853,6 +1885,13 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) - "pp_od_clk_voltage\n"); - return ret; - } -+ ret = device_create_file(adev->dev, -+ &dev_attr_gpu_busy_percent); -+ if (ret) { -+ DRM_ERROR("failed to create device file " -+ "gpu_busy_level\n"); -+ return ret; -+ } - ret = amdgpu_debugfs_pm_init(adev); - if (ret) { - DRM_ERROR("Failed to register debugfs file for dpm!\n"); -@@ -1888,6 +1927,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) - &dev_attr_pp_power_profile_mode); - device_remove_file(adev->dev, - &dev_attr_pp_od_clk_voltage); -+ device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); - } - - void amdgpu_pm_compute_clocks(struct amdgpu_device *adev) --- -2.7.4 - |