Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/amd/powerplay amdgpu: Reduce ...



details:   https://anonhg.NetBSD.org/src/rev/596b23db0eb5
branches:  trunk
changeset: 1028979:596b23db0eb5
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:37:54 2021 +0000

description:
amdgpu: Reduce unhelpful sprintf diffs.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_renoir_ppt.c         |  16 ++-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_smu.c                |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu10_hwmgr.c  |  18 ++-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c   |  40 ++++----
 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu8_hwmgr.c   |  10 +-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_vega10_hwmgr.c |  44 +++++----
 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_vega12_hwmgr.c |  20 ++--
 7 files changed, 84 insertions(+), 72 deletions(-)

diffs (truncated from 579 to 300 lines):

diff -r 3311951bfd19 -r 596b23db0eb5 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_renoir_ppt.c
--- a/sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_renoir_ppt.c  Sun Dec 19 12:37:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_renoir_ppt.c  Sun Dec 19 12:37:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_renoir_ppt.c,v 1.3 2021/12/19 12:21:10 riastradh Exp $  */
+/*     $NetBSD: amdgpu_renoir_ppt.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $  */
 
 /*
  * Copyright 2019 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_renoir_ppt.c,v 1.3 2021/12/19 12:21:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_renoir_ppt.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $");
 
 #include "amdgpu.h"
 #include "amdgpu_smu.h"
@@ -35,6 +35,8 @@
 #include "smu_v12_0.h"
 #include "renoir_ppt.h"
 
+#include <linux/nbsd-namespace.h>
+
 
 #define CLK_MAP(clk, index) \
        [SMU_##clk] = {1, (index)}
@@ -270,12 +272,12 @@
                        else
                                i = 1;
 
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "0: %uMhz %s\n", min,
+                       size += sprintf(buf + size, "0: %uMhz %s\n", min,
                                        i == 0 ? "*" : "");
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "1: %uMhz %s\n",
+                       size += sprintf(buf + size, "1: %uMhz %s\n",
                                        i == 1 ? cur_value : RENOIR_UMD_PSTATE_GFXCLK,
                                        i == 1 ? "*" : "");
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "2: %uMhz %s\n", max,
+                       size += sprintf(buf + size, "2: %uMhz %s\n", max,
                                        i == 2 ? "*" : "");
                }
                return size;
@@ -301,7 +303,7 @@
 
        for (i = 0; i < count; i++) {
                GET_DPM_CUR_FREQ(clk_table, clk_type, i, value);
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %uMhz %s\n", i, value,
+               size += sprintf(buf + size, "%d: %uMhz %s\n", i, value,
                                cur_value == value ? "*" : "");
        }
 
@@ -851,7 +853,7 @@
                if (workload_type < 0)
                        continue;
 
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%2d %14s%s\n",
+               size += sprintf(buf + size, "%2d %14s%s\n",
                        i, profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
        }
 
diff -r 3311951bfd19 -r 596b23db0eb5 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_smu.c
--- a/sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_smu.c Sun Dec 19 12:37:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_smu.c Sun Dec 19 12:37:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_smu.c,v 1.4 2021/12/19 12:31:45 riastradh Exp $ */
+/*     $NetBSD: amdgpu_smu.c,v 1.5 2021/12/19 12:37:54 riastradh Exp $ */
 
 /*
  * Copyright 2019 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_smu.c,v 1.4 2021/12/19 12:31:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_smu.c,v 1.5 2021/12/19 12:37:54 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <linux/pci.h>
@@ -86,7 +86,7 @@
        if (ret)
                goto failed;
 
-       size =  snprintf(buf + size, SIZE_MAX/*XXX*/, "features high: 0x%08x low: 0x%08x\n",
+       size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
                        feature_mask[1], feature_mask[0]);
 
        for (i = 0; i < SMU_FEATURE_COUNT; i++) {
@@ -98,7 +98,7 @@
        }
 
        for (i = 0; i < hw_feature_count; i++) {
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%02d. %-20s (%2d) : %s\n",
+               size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
                               count++,
                               smu_get_feature_name(smu, sort_feature[i]),
                               i,
diff -r 3311951bfd19 -r 596b23db0eb5 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu10_hwmgr.c
--- a/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu10_hwmgr.c   Sun Dec 19 12:37:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu10_hwmgr.c   Sun Dec 19 12:37:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_smu10_hwmgr.c,v 1.3 2021/12/19 12:21:29 riastradh Exp $ */
+/*     $NetBSD: amdgpu_smu10_hwmgr.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $ */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_smu10_hwmgr.c,v 1.3 2021/12/19 12:21:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_smu10_hwmgr.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $");
 
 #include "pp_debug.h"
 #include <linux/types.h>
@@ -42,6 +42,8 @@
 #include "soc15_common.h"
 #include "smu10.h"
 
+#include <linux/nbsd-namespace.h>
+
 #define SMU10_MAX_DEEPSLEEP_DIVIDER_ID     5
 #define SMU10_MINIMUM_ENGINE_CLOCK         800   /* 8Mhz, the low boundary of engine clock allowed on this chip */
 #define SCLK_MIN_DIV_INTV_SHIFT         12
@@ -904,13 +906,13 @@
                else
                        i = 1;
 
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "0: %uMhz %s\n",
+               size += sprintf(buf + size, "0: %uMhz %s\n",
                                        data->gfx_min_freq_limit/100,
                                        i == 0 ? "*" : "");
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "1: %uMhz %s\n",
+               size += sprintf(buf + size, "1: %uMhz %s\n",
                                        i == 1 ? now : SMU10_UMD_PSTATE_GFXCLK,
                                        i == 1 ? "*" : "");
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "2: %uMhz %s\n",
+               size += sprintf(buf + size, "2: %uMhz %s\n",
                                        data->gfx_max_freq_limit/100,
                                        i == 2 ? "*" : "");
                break;
@@ -919,7 +921,7 @@
                now = smum_get_argument(hwmgr);
 
                for (i = 0; i < mclk_table->count; i++)
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %uMhz %s\n",
+                       size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i,
                                        mclk_table->entries[i].clk / 100,
                                        ((mclk_table->entries[i].clk / 100)
@@ -1264,11 +1266,11 @@
        if (!buf)
                return -EINVAL;
 
-       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%s %16s %s %s %s %s\n",title[0],
+       size += sprintf(buf + size, "%s %16s %s %s %s %s\n",title[0],
                        title[1], title[2], title[3], title[4], title[5]);
 
        for (i = 0; i <= PP_SMC_POWER_PROFILE_COMPUTE; i++)
-               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%3d %14s%s: %14d %3d %10d %14d\n",
+               size += sprintf(buf + size, "%3d %14s%s: %14d %3d %10d %14d\n",
                        i, profile_name[i], (i == hwmgr->power_profile_mode) ? "*" : " ",
                        profile_mode_setting[i][0], profile_mode_setting[i][1],
                        profile_mode_setting[i][2], profile_mode_setting[i][3]);
diff -r 3311951bfd19 -r 596b23db0eb5 sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c
--- a/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c    Sun Dec 19 12:37:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c    Sun Dec 19 12:37:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_smu7_hwmgr.c,v 1.3 2021/12/19 12:21:30 riastradh Exp $  */
+/*     $NetBSD: amdgpu_smu7_hwmgr.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $  */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_smu7_hwmgr.c,v 1.3 2021/12/19 12:21:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_smu7_hwmgr.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $");
 
 #include "pp_debug.h"
 #include <linux/delay.h>
@@ -57,6 +57,8 @@
 
 #include "ivsrcid/ivsrcid_vislands30.h"
 
+#include <linux/nbsd-namespace.h>
+
 #define MC_CG_ARB_FREQ_F0           0x0a
 #define MC_CG_ARB_FREQ_F1           0x0b
 #define MC_CG_ARB_FREQ_F2           0x0c
@@ -4470,7 +4472,7 @@
                now = i;
 
                for (i = 0; i < sclk_table->count; i++)
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %uMhz %s\n",
+                       size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, sclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
                break;
@@ -4486,7 +4488,7 @@
                now = i;
 
                for (i = 0; i < mclk_table->count; i++)
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %uMhz %s\n",
+                       size += sprintf(buf + size, "%d: %uMhz %s\n",
                                        i, mclk_table->dpm_levels[i].value / 100,
                                        (i == now) ? "*" : "");
                break;
@@ -4500,7 +4502,7 @@
                now = i;
 
                for (i = 0; i < pcie_table->count; i++)
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %s %s\n", i,
+                       size += sprintf(buf + size, "%d: %s %s\n", i,
                                        (pcie_table->dpm_levels[i].value == 0) ? "2.5GT/s, x8" :
                                        (pcie_table->dpm_levels[i].value == 1) ? "5.0GT/s, x16" :
                                        (pcie_table->dpm_levels[i].value == 2) ? "8.0GT/s, x16" : "",
@@ -4508,32 +4510,32 @@
                break;
        case OD_SCLK:
                if (hwmgr->od_enabled) {
-                       size = snprintf(buf, SIZE_MAX/*XXX*/, "%s:\n", "OD_SCLK");
+                       size = sprintf(buf, "%s:\n", "OD_SCLK");
                        for (i = 0; i < odn_sclk_table->num_of_pl; i++)
-                               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %10uMHz %10umV\n",
+                               size += sprintf(buf + size, "%d: %10uMHz %10umV\n",
                                        i, odn_sclk_table->entries[i].clock/100,
                                        odn_sclk_table->entries[i].vddc);
                }
                break;
        case OD_MCLK:
                if (hwmgr->od_enabled) {
-                       size = snprintf(buf, SIZE_MAX/*XXX*/, "%s:\n", "OD_MCLK");
+                       size = sprintf(buf, "%s:\n", "OD_MCLK");
                        for (i = 0; i < odn_mclk_table->num_of_pl; i++)
-                               size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%d: %10uMHz %10umV\n",
+                               size += sprintf(buf + size, "%d: %10uMHz %10umV\n",
                                        i, odn_mclk_table->entries[i].clock/100,
                                        odn_mclk_table->entries[i].vddc);
                }
                break;
        case OD_RANGE:
                if (hwmgr->od_enabled) {
-                       size = snprintf(buf, SIZE_MAX/*XXX*/, "%s:\n", "OD_RANGE");
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "SCLK: %7uMHz %10uMHz\n",
+                       size = sprintf(buf, "%s:\n", "OD_RANGE");
+                       size += sprintf(buf + size, "SCLK: %7uMHz %10uMHz\n",
                                data->golden_dpm_table.sclk_table.dpm_levels[0].value/100,
                                hwmgr->platform_descriptor.overdriveLimit.engineClock/100);
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "MCLK: %7uMHz %10uMHz\n",
+                       size += sprintf(buf + size, "MCLK: %7uMHz %10uMHz\n",
                                data->golden_dpm_table.mclk_table.dpm_levels[0].value/100,
                                hwmgr->platform_descriptor.overdriveLimit.memoryClock/100);
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "VDDC: %7umV %11umV\n",
+                       size += sprintf(buf + size, "VDDC: %7umV %11umV\n",
                                data->odn_dpm_table.min_vddc,
                                data->odn_dpm_table.max_vddc);
                }
@@ -4944,7 +4946,7 @@
        if (!buf)
                return -EINVAL;
 
-       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%s %16s %16s %16s %16s %16s %16s %16s\n",
+       size += sprintf(buf + size, "%s %16s %16s %16s %16s %16s %16s %16s\n",
                        title[0], title[1], title[2], title[3],
                        title[4], title[5], title[6], title[7]);
 
@@ -4952,7 +4954,7 @@
 
        for (i = 0; i < len; i++) {
                if (i == hwmgr->power_profile_mode) {
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%3d %14s %s: %8d %16d %16d %16d %16d %16d\n",
+                       size += sprintf(buf + size, "%3d %14s %s: %8d %16d %16d %16d %16d %16d\n",
                        i, profile_name[i], "*",
                        data->current_profile_setting.sclk_up_hyst,
                        data->current_profile_setting.sclk_down_hyst,
@@ -4963,21 +4965,21 @@
                        continue;
                }
                if (smu7_profiling[i].bupdate_sclk)
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%3d %16s: %8d %16d %16d ",
+                       size += sprintf(buf + size, "%3d %16s: %8d %16d %16d ",
                        i, profile_name[i], smu7_profiling[i].sclk_up_hyst,
                        smu7_profiling[i].sclk_down_hyst,
                        smu7_profiling[i].sclk_activity);
                else
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%3d %16s: %8s %16s %16s ",
+                       size += sprintf(buf + size, "%3d %16s: %8s %16s %16s ",
                        i, profile_name[i], "-", "-", "-");
 
                if (smu7_profiling[i].bupdate_mclk)
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%16d %16d %16d\n",
+                       size += sprintf(buf + size, "%16d %16d %16d\n",
                        smu7_profiling[i].mclk_up_hyst,
                        smu7_profiling[i].mclk_down_hyst,
                        smu7_profiling[i].mclk_activity);
                else
-                       size += snprintf(buf + size, SIZE_MAX/*XXX*/, "%16s %16s %16s\n",
+                       size += sprintf(buf + size, "%16s %16s %16s\n",



Home | Main Index | Thread Index | Old Index