2022-09-04 09:27:07

by Jingyu Wang

[permalink] [raw]
Subject: [PATCH] drm: amd: This is a patch to the amdgpu_drv.c file that fixes some warnings and errors found by the checkpatch.pl tool

Signed-off-by: Jingyu Wang <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 40 ++++++++++++-------------
1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index de7144b06e93..5c2ac8123450 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -140,8 +140,8 @@ uint amdgpu_pcie_lane_cap;
u64 amdgpu_cg_mask = 0xffffffffffffffff;
uint amdgpu_pg_mask = 0xffffffff;
uint amdgpu_sdma_phase_quantum = 32;
-char *amdgpu_disable_cu = NULL;
-char *amdgpu_virtual_display = NULL;
+char *amdgpu_disable_cu;
+char *amdgpu_virtual_display;

/*
* OverDrive(bit 14) disabled by default
@@ -287,9 +287,9 @@ module_param_named(msi, amdgpu_msi, int, 0444);
* jobs is 10000. The timeout for compute is 60000.
*/
MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
- "for passthrough or sriov, 10000 for all jobs."
- " 0: keep default value. negative: infinity timeout), "
- "format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
+ "for passthrough or sriov, 10000 for all jobs.
+ 0: keep default value. negative: infinity timeout),
+ format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
"for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);

@@ -502,7 +502,7 @@ module_param_named(virtual_display, amdgpu_virtual_display, charp, 0444);
* Set how much time allow a job hang and not drop it. The default is 0.
*/
MODULE_PARM_DESC(job_hang_limit, "how much time allow a job hang and not drop it (default 0)");
-module_param_named(job_hang_limit, amdgpu_job_hang_limit, int ,0444);
+module_param_named(job_hang_limit, amdgpu_job_hang_limit, int, 0444);

/**
* DOC: lbpw (int)
@@ -565,8 +565,8 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);
*/
#ifdef CONFIG_DRM_AMDGPU_SI

-#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
-int amdgpu_si_support = 0;
+#if IS_ENABLED(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
+int amdgpu_si_support;
MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
#else
int amdgpu_si_support = 1;
@@ -584,8 +584,8 @@ module_param_named(si_support, amdgpu_si_support, int, 0444);
*/
#ifdef CONFIG_DRM_AMDGPU_CIK

-#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
-int amdgpu_cik_support = 0;
+#if IS_ENABLED(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
+int amdgpu_cik_support;
MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
#else
int amdgpu_cik_support = 1;
@@ -601,8 +601,8 @@ module_param_named(cik_support, amdgpu_cik_support, int, 0444);
* E.g. 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte. The default is 0 (disabled).
*/
MODULE_PARM_DESC(smu_memory_pool_size,
- "reserve gtt for smu debug usage, 0 = disable,"
- "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
+ "reserve gtt for smu debug usage, 0 = disable,
+ 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);

/**
@@ -772,9 +772,9 @@ module_param(hws_gws_support, bool, 0444);
MODULE_PARM_DESC(hws_gws_support, "Assume MEC2 FW supports GWS barriers (false = rely on FW version check (Default), true = force supported)");

/**
- * DOC: queue_preemption_timeout_ms (int)
- * queue preemption timeout in ms (1 = Minimum, 9000 = default)
- */
+ * DOC: queue_preemption_timeout_ms (int)
+ * queue preemption timeout in ms (1 = Minimum, 9000 = default)
+ */
int queue_preemption_timeout_ms = 9000;
module_param(queue_preemption_timeout_ms, int, 0644);
MODULE_PARM_DESC(queue_preemption_timeout_ms, "queue preemption timeout in ms (1 = Minimum, 9000 = default)");
@@ -799,7 +799,7 @@ MODULE_PARM_DESC(no_system_mem_limit, "disable system memory limit (false = defa
* DOC: no_queue_eviction_on_vm_fault (int)
* If set, process queues will not be evicted on gpuvm fault. This is to keep the wavefront context for debugging (0 = queue eviction, 1 = no queue eviction). The default is 0 (queue eviction).
*/
-int amdgpu_no_queue_eviction_on_vm_fault = 0;
+int amdgpu_no_queue_eviction_on_vm_fault;
MODULE_PARM_DESC(no_queue_eviction_on_vm_fault, "No queue eviction on VM fault (0 = queue eviction, 1 = no queue eviction)");
module_param_named(no_queue_eviction_on_vm_fault, amdgpu_no_queue_eviction_on_vm_fault, int, 0444);
#endif
@@ -1609,7 +1609,7 @@ static const u16 amdgpu_unsupported_pciidlist[] = {
};

static const struct pci_device_id pciidlist[] = {
-#ifdef CONFIG_DRM_AMDGPU_SI
+#ifdef CONFIG_DRM_AMDGPU_SI
{0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
{0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
{0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
@@ -2289,7 +2289,6 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)
amdgpu_amdkfd_device_init(adev);
amdgpu_ttm_set_buffer_funcs_status(adev, true);
}
- return;
}

static int amdgpu_pmops_prepare(struct device *dev)
@@ -2478,6 +2477,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
/* wait for all rings to drain before suspending */
for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
struct amdgpu_ring *ring = adev->rings[i];
+
if (ring && ring->sched.ready) {
ret = amdgpu_fence_wait_empty(ring);
if (ret)
@@ -2600,6 +2600,7 @@ long amdgpu_drm_ioctl(struct file *filp,
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev;
long ret;
+
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
if (ret < 0)
@@ -2664,9 +2665,8 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
if (!filp)
return -EINVAL;

- if (filp->f_op != &amdgpu_driver_kms_fops) {
+ if (filp->f_op != &amdgpu_driver_kms_fops)
return -EINVAL;
- }

file = filp->private_data;
*fpriv = file->driver_priv;
--
2.34.1


2022-09-04 11:37:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drm: amd: This is a patch to the amdgpu_drv.c file that fixes some warnings and errors found by the checkpatch.pl tool

Hi Jingyu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.0-rc3 next-20220901]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jingyu-Wang/drm-amd-This-is-a-patch-to-the-amdgpu_drv-c-file-that-fixes-some-warnings-and-errors-found-by-the-checkpatch-pl-tool/20220904-165633
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220904/[email protected]/config)
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/639ddf37854dd71c3ee836591db7518b146ae8ae
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jingyu-Wang/drm-amd-This-is-a-patch-to-the-amdgpu_drv-c-file-that-fixes-some-warnings-and-errors-found-by-the-checkpatch-pl-tool/20220904-165633
git checkout 639ddf37854dd71c3ee836591db7518b146ae8ae
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:290:17: warning: missing terminating " character
290 | "for passthrough or sriov, 10000 for all jobs.
| ^
In file included from include/linux/module.h:22,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/drm/drm_print.h:32,
from include/drm/drm_mm.h:51,
from include/drm/drm_vma_manager.h:26,
from include/drm/drm_gem.h:40,
from drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:28:
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:290:17: error: missing terminating " character
290 | "for passthrough or sriov, 10000 for all jobs.
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/moduleparam.h:26:61: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:289:1: note: in expansion of macro 'MODULE_PARM_DESC'
289 | MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
| ^~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:291:17: error: expected ',' or ';' before numeric constant
291 | 0: keep default value. negative: infinity timeout),
| ^
include/linux/moduleparam.h:26:61: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:289:1: note: in expansion of macro 'MODULE_PARM_DESC'
289 | MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
| ^~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:292:83: warning: missing terminating " character
292 | format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:292:83: error: missing terminating " character
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:293:17: error: expected identifier or '(' before string constant
293 | "for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:604:9: warning: missing terminating " character
604 | "reserve gtt for smu debug usage, 0 = disable,
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:605:76: warning: missing terminating " character
605 | 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:2799:45: error: unterminated argument list invoking macro "MODULE_PARM_DESC"
2799 | MODULE_LICENSE("GPL and additional rights");
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:603:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
603 | MODULE_PARM_DESC(smu_memory_pool_size,
| ^~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:186:13: warning: 'amdgpu_drv_delayed_reset_work_handler' used but never defined
186 | static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +290 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

185
> 186 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
187
188 struct amdgpu_mgpu_info mgpu_info = {
189 .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),
190 .delayed_reset_work = __DELAYED_WORK_INITIALIZER(
191 mgpu_info.delayed_reset_work,
192 amdgpu_drv_delayed_reset_work_handler, 0),
193 };
194 int amdgpu_ras_enable = -1;
195 uint amdgpu_ras_mask = 0xffffffff;
196 int amdgpu_bad_page_threshold = -1;
197 struct amdgpu_watchdog_timer amdgpu_watchdog_timer = {
198 .timeout_fatal_disable = false,
199 .period = 0x0, /* default to 0x0 (timeout disable) */
200 };
201
202 /**
203 * DOC: vramlimit (int)
204 * Restrict the total amount of VRAM in MiB for testing. The default is 0 (Use full VRAM).
205 */
206 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
207 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
208
209 /**
210 * DOC: vis_vramlimit (int)
211 * Restrict the amount of CPU visible VRAM in MiB for testing. The default is 0 (Use full CPU visible VRAM).
212 */
213 MODULE_PARM_DESC(vis_vramlimit, "Restrict visible VRAM for testing, in megabytes");
214 module_param_named(vis_vramlimit, amdgpu_vis_vram_limit, int, 0444);
215
216 /**
217 * DOC: gartsize (uint)
218 * Restrict the size of GART in Mib (32, 64, etc.) for testing. The default is -1 (The size depends on asic).
219 */
220 MODULE_PARM_DESC(gartsize, "Size of GART to setup in megabytes (32, 64, etc., -1=auto)");
221 module_param_named(gartsize, amdgpu_gart_size, uint, 0600);
222
223 /**
224 * DOC: gttsize (int)
225 * Restrict the size of GTT domain in MiB for testing. The default is -1 (It's VRAM size if 3GB < VRAM < 3/4 RAM,
226 * otherwise 3/4 RAM size).
227 */
228 MODULE_PARM_DESC(gttsize, "Size of the GTT domain in megabytes (-1 = auto)");
229 module_param_named(gttsize, amdgpu_gtt_size, int, 0600);
230
231 /**
232 * DOC: moverate (int)
233 * Set maximum buffer migration rate in MB/s. The default is -1 (8 MB/s).
234 */
235 MODULE_PARM_DESC(moverate, "Maximum buffer migration rate in MB/s. (32, 64, etc., -1=auto, 0=1=disabled)");
236 module_param_named(moverate, amdgpu_moverate, int, 0600);
237
238 /**
239 * DOC: audio (int)
240 * Set HDMI/DPAudio. Only affects non-DC display handling. The default is -1 (Enabled), set 0 to disabled it.
241 */
242 MODULE_PARM_DESC(audio, "Audio enable (-1 = auto, 0 = disable, 1 = enable)");
243 module_param_named(audio, amdgpu_audio, int, 0444);
244
245 /**
246 * DOC: disp_priority (int)
247 * Set display Priority (1 = normal, 2 = high). Only affects non-DC display handling. The default is 0 (auto).
248 */
249 MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)");
250 module_param_named(disp_priority, amdgpu_disp_priority, int, 0444);
251
252 /**
253 * DOC: hw_i2c (int)
254 * To enable hw i2c engine. Only affects non-DC display handling. The default is 0 (Disabled).
255 */
256 MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
257 module_param_named(hw_i2c, amdgpu_hw_i2c, int, 0444);
258
259 /**
260 * DOC: pcie_gen2 (int)
261 * To disable PCIE Gen2/3 mode (0 = disable, 1 = enable). The default is -1 (auto, enabled).
262 */
263 MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable)");
264 module_param_named(pcie_gen2, amdgpu_pcie_gen2, int, 0444);
265
266 /**
267 * DOC: msi (int)
268 * To disable Message Signaled Interrupts (MSI) functionality (1 = enable, 0 = disable). The default is -1 (auto, enabled).
269 */
270 MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
271 module_param_named(msi, amdgpu_msi, int, 0444);
272
273 /**
274 * DOC: lockup_timeout (string)
275 * Set GPU scheduler timeout value in ms.
276 *
277 * The format can be [Non-Compute] or [GFX,Compute,SDMA,Video]. That is there can be one or
278 * multiple values specified. 0 and negative values are invalidated. They will be adjusted
279 * to the default timeout.
280 *
281 * - With one value specified, the setting will apply to all non-compute jobs.
282 * - With multiple values specified, the first one will be for GFX.
283 * The second one is for Compute. The third and fourth ones are
284 * for SDMA and Video.
285 *
286 * By default(with no lockup_timeout settings), the timeout for all non-compute(GFX, SDMA and Video)
287 * jobs is 10000. The timeout for compute is 60000.
288 */
289 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
> 290 "for passthrough or sriov, 10000 for all jobs.
291 0: keep default value. negative: infinity timeout),
292 format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
293 "for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
294 module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);
295

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-09-04 12:48:07

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drm: amd: This is a patch to the amdgpu_drv.c file that fixes some warnings and errors found by the checkpatch.pl tool

Hi Jingyu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.0-rc3 next-20220901]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jingyu-Wang/drm-amd-This-is-a-patch-to-the-amdgpu_drv-c-file-that-fixes-some-warnings-and-errors-found-by-the-checkpatch-pl-tool/20220904-165633
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
config: mips-randconfig-r006-20220904 (https://download.01.org/0day-ci/archive/20220904/[email protected]/config)
compiler: mips64el-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/639ddf37854dd71c3ee836591db7518b146ae8ae
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jingyu-Wang/drm-amd-This-is-a-patch-to-the-amdgpu_drv-c-file-that-fixes-some-warnings-and-errors-found-by-the-checkpatch-pl-tool/20220904-165633
git checkout 639ddf37854dd71c3ee836591db7518b146ae8ae
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:290:17: warning: missing terminating " character
290 | "for passthrough or sriov, 10000 for all jobs.
| ^
In file included from include/linux/module.h:22,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/drm/drm_print.h:32,
from include/drm/drm_mm.h:51,
from include/drm/drm_vma_manager.h:26,
from include/drm/drm_gem.h:40,
from drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:28:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:290:17: error: missing terminating " character
290 | "for passthrough or sriov, 10000 for all jobs.
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/moduleparam.h:26:61: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:289:1: note: in expansion of macro 'MODULE_PARM_DESC'
289 | MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
| ^~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:291:17: error: expected ',' or ';' before numeric constant
291 | 0: keep default value. negative: infinity timeout),
| ^
include/linux/moduleparam.h:26:61: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:289:1: note: in expansion of macro 'MODULE_PARM_DESC'
289 | MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
| ^~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:292:83: warning: missing terminating " character
292 | format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:292:83: error: missing terminating " character
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:293:17: error: expected identifier or '(' before string constant
293 | "for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:604:9: warning: missing terminating " character
604 | "reserve gtt for smu debug usage, 0 = disable,
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:605:76: warning: missing terminating " character
605 | 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
| ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:2799:45: error: unterminated argument list invoking macro "MODULE_PARM_DESC"
2799 | MODULE_LICENSE("GPL and additional rights");
| ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:603:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
603 | MODULE_PARM_DESC(smu_memory_pool_size,
| ^~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:186:13: warning: 'amdgpu_drv_delayed_reset_work_handler' used but never defined
186 | static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +290 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

185
> 186 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
187
188 struct amdgpu_mgpu_info mgpu_info = {
189 .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),
190 .delayed_reset_work = __DELAYED_WORK_INITIALIZER(
191 mgpu_info.delayed_reset_work,
192 amdgpu_drv_delayed_reset_work_handler, 0),
193 };
194 int amdgpu_ras_enable = -1;
195 uint amdgpu_ras_mask = 0xffffffff;
196 int amdgpu_bad_page_threshold = -1;
197 struct amdgpu_watchdog_timer amdgpu_watchdog_timer = {
198 .timeout_fatal_disable = false,
199 .period = 0x0, /* default to 0x0 (timeout disable) */
200 };
201
202 /**
203 * DOC: vramlimit (int)
204 * Restrict the total amount of VRAM in MiB for testing. The default is 0 (Use full VRAM).
205 */
206 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
207 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
208
209 /**
210 * DOC: vis_vramlimit (int)
211 * Restrict the amount of CPU visible VRAM in MiB for testing. The default is 0 (Use full CPU visible VRAM).
212 */
213 MODULE_PARM_DESC(vis_vramlimit, "Restrict visible VRAM for testing, in megabytes");
214 module_param_named(vis_vramlimit, amdgpu_vis_vram_limit, int, 0444);
215
216 /**
217 * DOC: gartsize (uint)
218 * Restrict the size of GART in Mib (32, 64, etc.) for testing. The default is -1 (The size depends on asic).
219 */
220 MODULE_PARM_DESC(gartsize, "Size of GART to setup in megabytes (32, 64, etc., -1=auto)");
221 module_param_named(gartsize, amdgpu_gart_size, uint, 0600);
222
223 /**
224 * DOC: gttsize (int)
225 * Restrict the size of GTT domain in MiB for testing. The default is -1 (It's VRAM size if 3GB < VRAM < 3/4 RAM,
226 * otherwise 3/4 RAM size).
227 */
228 MODULE_PARM_DESC(gttsize, "Size of the GTT domain in megabytes (-1 = auto)");
229 module_param_named(gttsize, amdgpu_gtt_size, int, 0600);
230
231 /**
232 * DOC: moverate (int)
233 * Set maximum buffer migration rate in MB/s. The default is -1 (8 MB/s).
234 */
235 MODULE_PARM_DESC(moverate, "Maximum buffer migration rate in MB/s. (32, 64, etc., -1=auto, 0=1=disabled)");
236 module_param_named(moverate, amdgpu_moverate, int, 0600);
237
238 /**
239 * DOC: audio (int)
240 * Set HDMI/DPAudio. Only affects non-DC display handling. The default is -1 (Enabled), set 0 to disabled it.
241 */
242 MODULE_PARM_DESC(audio, "Audio enable (-1 = auto, 0 = disable, 1 = enable)");
243 module_param_named(audio, amdgpu_audio, int, 0444);
244
245 /**
246 * DOC: disp_priority (int)
247 * Set display Priority (1 = normal, 2 = high). Only affects non-DC display handling. The default is 0 (auto).
248 */
249 MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)");
250 module_param_named(disp_priority, amdgpu_disp_priority, int, 0444);
251
252 /**
253 * DOC: hw_i2c (int)
254 * To enable hw i2c engine. Only affects non-DC display handling. The default is 0 (Disabled).
255 */
256 MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
257 module_param_named(hw_i2c, amdgpu_hw_i2c, int, 0444);
258
259 /**
260 * DOC: pcie_gen2 (int)
261 * To disable PCIE Gen2/3 mode (0 = disable, 1 = enable). The default is -1 (auto, enabled).
262 */
263 MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable)");
264 module_param_named(pcie_gen2, amdgpu_pcie_gen2, int, 0444);
265
266 /**
267 * DOC: msi (int)
268 * To disable Message Signaled Interrupts (MSI) functionality (1 = enable, 0 = disable). The default is -1 (auto, enabled).
269 */
270 MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
271 module_param_named(msi, amdgpu_msi, int, 0444);
272
273 /**
274 * DOC: lockup_timeout (string)
275 * Set GPU scheduler timeout value in ms.
276 *
277 * The format can be [Non-Compute] or [GFX,Compute,SDMA,Video]. That is there can be one or
278 * multiple values specified. 0 and negative values are invalidated. They will be adjusted
279 * to the default timeout.
280 *
281 * - With one value specified, the setting will apply to all non-compute jobs.
282 * - With multiple values specified, the first one will be for GFX.
283 * The second one is for Compute. The third and fourth ones are
284 * for SDMA and Video.
285 *
286 * By default(with no lockup_timeout settings), the timeout for all non-compute(GFX, SDMA and Video)
287 * jobs is 10000. The timeout for compute is 60000.
288 */
289 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
> 290 "for passthrough or sriov, 10000 for all jobs.
> 291 0: keep default value. negative: infinity timeout),
292 format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
> 293 "for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
294 module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);
295

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-09-04 14:15:12

by Christian König

[permalink] [raw]
Subject: Re: [PATCH] drm: amd: This is a patch to the amdgpu_drv.c file that fixes some warnings and errors found by the checkpatch.pl tool



Am 04.09.22 um 10:39 schrieb Jingyu Wang:


Looks mostly valid, but a few style nits and the kernel test robot
complained about something as well.

First of all please shorten the subject line, something like
"drm/amdgpu: cleanup coding style in amdgpu_drv.c".

Then provide a commit message, e.g.: "Fix everything checkpatch.pl
complained about in amdgpu_drv.c."

> Signed-off-by: Jingyu Wang <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 40 ++++++++++++-------------
> 1 file changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index de7144b06e93..5c2ac8123450 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -140,8 +140,8 @@ uint amdgpu_pcie_lane_cap;
> u64 amdgpu_cg_mask = 0xffffffffffffffff;
> uint amdgpu_pg_mask = 0xffffffff;
> uint amdgpu_sdma_phase_quantum = 32;
> -char *amdgpu_disable_cu = NULL;
> -char *amdgpu_virtual_display = NULL;
> +char *amdgpu_disable_cu;
> +char *amdgpu_virtual_display;
>
> /*
> * OverDrive(bit 14) disabled by default
> @@ -287,9 +287,9 @@ module_param_named(msi, amdgpu_msi, int, 0444);
> * jobs is 10000. The timeout for compute is 60000.
> */
> MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
> - "for passthrough or sriov, 10000 for all jobs."
> - " 0: keep default value. negative: infinity timeout), "
> - "format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
> + "for passthrough or sriov, 10000 for all jobs.
> + 0: keep default value. negative: infinity timeout),
> + format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
> "for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");

checkpatch.pl might now not complain about it, but that doesn't look
correct on first glance.

You now include all the newlines and empty spaces in the string which is
not intentionally.

Christian.

> module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);
>
> @@ -502,7 +502,7 @@ module_param_named(virtual_display, amdgpu_virtual_display, charp, 0444);
> * Set how much time allow a job hang and not drop it. The default is 0.
> */
> MODULE_PARM_DESC(job_hang_limit, "how much time allow a job hang and not drop it (default 0)");
> -module_param_named(job_hang_limit, amdgpu_job_hang_limit, int ,0444);
> +module_param_named(job_hang_limit, amdgpu_job_hang_limit, int, 0444);
>
> /**
> * DOC: lbpw (int)
> @@ -565,8 +565,8 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);
> */
> #ifdef CONFIG_DRM_AMDGPU_SI
>
> -#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
> -int amdgpu_si_support = 0;
> +#if IS_ENABLED(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
> +int amdgpu_si_support;
> MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
> #else
> int amdgpu_si_support = 1;
> @@ -584,8 +584,8 @@ module_param_named(si_support, amdgpu_si_support, int, 0444);
> */
> #ifdef CONFIG_DRM_AMDGPU_CIK
>
> -#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
> -int amdgpu_cik_support = 0;
> +#if IS_ENABLED(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
> +int amdgpu_cik_support;
> MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
> #else
> int amdgpu_cik_support = 1;
> @@ -601,8 +601,8 @@ module_param_named(cik_support, amdgpu_cik_support, int, 0444);
> * E.g. 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte. The default is 0 (disabled).
> */
> MODULE_PARM_DESC(smu_memory_pool_size,
> - "reserve gtt for smu debug usage, 0 = disable,"
> - "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
> + "reserve gtt for smu debug usage, 0 = disable,
> + 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
> module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
>
> /**
> @@ -772,9 +772,9 @@ module_param(hws_gws_support, bool, 0444);
> MODULE_PARM_DESC(hws_gws_support, "Assume MEC2 FW supports GWS barriers (false = rely on FW version check (Default), true = force supported)");
>
> /**
> - * DOC: queue_preemption_timeout_ms (int)
> - * queue preemption timeout in ms (1 = Minimum, 9000 = default)
> - */
> + * DOC: queue_preemption_timeout_ms (int)
> + * queue preemption timeout in ms (1 = Minimum, 9000 = default)
> + */
> int queue_preemption_timeout_ms = 9000;
> module_param(queue_preemption_timeout_ms, int, 0644);
> MODULE_PARM_DESC(queue_preemption_timeout_ms, "queue preemption timeout in ms (1 = Minimum, 9000 = default)");
> @@ -799,7 +799,7 @@ MODULE_PARM_DESC(no_system_mem_limit, "disable system memory limit (false = defa
> * DOC: no_queue_eviction_on_vm_fault (int)
> * If set, process queues will not be evicted on gpuvm fault. This is to keep the wavefront context for debugging (0 = queue eviction, 1 = no queue eviction). The default is 0 (queue eviction).
> */
> -int amdgpu_no_queue_eviction_on_vm_fault = 0;
> +int amdgpu_no_queue_eviction_on_vm_fault;
> MODULE_PARM_DESC(no_queue_eviction_on_vm_fault, "No queue eviction on VM fault (0 = queue eviction, 1 = no queue eviction)");
> module_param_named(no_queue_eviction_on_vm_fault, amdgpu_no_queue_eviction_on_vm_fault, int, 0444);
> #endif
> @@ -1609,7 +1609,7 @@ static const u16 amdgpu_unsupported_pciidlist[] = {
> };
>
> static const struct pci_device_id pciidlist[] = {
> -#ifdef CONFIG_DRM_AMDGPU_SI
> +#ifdef CONFIG_DRM_AMDGPU_SI
> {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
> {0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
> {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
> @@ -2289,7 +2289,6 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)
> amdgpu_amdkfd_device_init(adev);
> amdgpu_ttm_set_buffer_funcs_status(adev, true);
> }
> - return;
> }
>
> static int amdgpu_pmops_prepare(struct device *dev)
> @@ -2478,6 +2477,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
> /* wait for all rings to drain before suspending */
> for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
> struct amdgpu_ring *ring = adev->rings[i];
> +
> if (ring && ring->sched.ready) {
> ret = amdgpu_fence_wait_empty(ring);
> if (ret)
> @@ -2600,6 +2600,7 @@ long amdgpu_drm_ioctl(struct file *filp,
> struct drm_file *file_priv = filp->private_data;
> struct drm_device *dev;
> long ret;
> +
> dev = file_priv->minor->dev;
> ret = pm_runtime_get_sync(dev->dev);
> if (ret < 0)
> @@ -2664,9 +2665,8 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
> if (!filp)
> return -EINVAL;
>
> - if (filp->f_op != &amdgpu_driver_kms_fops) {
> + if (filp->f_op != &amdgpu_driver_kms_fops)
> return -EINVAL;
> - }
>
> file = filp->private_data;
> *fpriv = file->driver_priv;