diff mbox series

[09/11] accel/ivpu: Add debug Kconfig option

Message ID 20241017145817.121590-10-jacek.lawrynowicz@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series accel/ivpu: Changes for 6.13-rc5 | expand

Commit Message

Jacek Lawrynowicz Oct. 17, 2024, 2:58 p.m. UTC
From: Maciej Falkowski <maciej.falkowski@linux.intel.com>

Add CONFIG_DRM_ACCEL_IVPU_DEBUG option that:
 - Adds -DDEBUG that enables printk regardless of the kernel config
 - Enables unsafe module params (that are now disabled by default)

Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
 drivers/accel/ivpu/Kconfig    | 10 ++++++++++
 drivers/accel/ivpu/Makefile   |  2 ++
 drivers/accel/ivpu/ivpu_drv.c |  2 ++
 drivers/accel/ivpu/ivpu_fw.c  |  2 ++
 drivers/accel/ivpu/ivpu_pm.c  |  2 ++
 5 files changed, 18 insertions(+)

Comments

Jeffrey Hugo Oct. 18, 2024, 10:09 p.m. UTC | #1
On 10/17/2024 8:58 AM, Jacek Lawrynowicz wrote:
> From: Maciej Falkowski <maciej.falkowski@linux.intel.com>
> 
> Add CONFIG_DRM_ACCEL_IVPU_DEBUG option that:
>   - Adds -DDEBUG that enables printk regardless of the kernel config
>   - Enables unsafe module params (that are now disabled by default)
> 
> Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
> ---
>   drivers/accel/ivpu/Kconfig    | 10 ++++++++++
>   drivers/accel/ivpu/Makefile   |  2 ++
>   drivers/accel/ivpu/ivpu_drv.c |  2 ++
>   drivers/accel/ivpu/ivpu_fw.c  |  2 ++
>   drivers/accel/ivpu/ivpu_pm.c  |  2 ++
>   5 files changed, 18 insertions(+)
> 
> diff --git a/drivers/accel/ivpu/Kconfig b/drivers/accel/ivpu/Kconfig
> index e4d418b44626e..8858b32e05640 100644
> --- a/drivers/accel/ivpu/Kconfig
> +++ b/drivers/accel/ivpu/Kconfig
> @@ -16,3 +16,13 @@ config DRM_ACCEL_IVPU
>   	  and Deep Learning applications.
>   
>   	  If "M" is selected, the module will be called intel_vpu.
> +
> +config DRM_ACCEL_IVPU_DEBUG
> +	bool "Intel NPU debug mode"
> +	depends on DRM_ACCEL_IVPU
> +	default n

The default is N, so this is redundant, no?

> +	help
> +	  Choose this option to enable additional
> +	  debug features for the Intel NPU driver:
> +	  - Always print debug messages regardless of dyndbg config,
> +	  - Enable unsafe module params.
> diff --git a/drivers/accel/ivpu/Makefile b/drivers/accel/ivpu/Makefile
> index e73937c86d9ad..1029e0bab0615 100644
Jacek Lawrynowicz Oct. 25, 2024, 11:43 a.m. UTC | #2
Hi,

On 10/19/2024 12:09 AM, Jeffrey Hugo wrote:
> On 10/17/2024 8:58 AM, Jacek Lawrynowicz wrote:
>> From: Maciej Falkowski <maciej.falkowski@linux.intel.com>
>>
>> Add CONFIG_DRM_ACCEL_IVPU_DEBUG option that:
>>   - Adds -DDEBUG that enables printk regardless of the kernel config
>>   - Enables unsafe module params (that are now disabled by default)
>>
>> Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
>> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
>> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
>> ---
>>   drivers/accel/ivpu/Kconfig    | 10 ++++++++++
>>   drivers/accel/ivpu/Makefile   |  2 ++
>>   drivers/accel/ivpu/ivpu_drv.c |  2 ++
>>   drivers/accel/ivpu/ivpu_fw.c  |  2 ++
>>   drivers/accel/ivpu/ivpu_pm.c  |  2 ++
>>   5 files changed, 18 insertions(+)
>>
>> diff --git a/drivers/accel/ivpu/Kconfig b/drivers/accel/ivpu/Kconfig
>> index e4d418b44626e..8858b32e05640 100644
>> --- a/drivers/accel/ivpu/Kconfig
>> +++ b/drivers/accel/ivpu/Kconfig
>> @@ -16,3 +16,13 @@ config DRM_ACCEL_IVPU
>>         and Deep Learning applications.
>>           If "M" is selected, the module will be called intel_vpu.
>> +
>> +config DRM_ACCEL_IVPU_DEBUG
>> +    bool "Intel NPU debug mode"
>> +    depends on DRM_ACCEL_IVPU
>> +    default n
> 
> The default is N, so this is redundant, no?
> 

Yes, I will remove it.
diff mbox series

Patch

diff --git a/drivers/accel/ivpu/Kconfig b/drivers/accel/ivpu/Kconfig
index e4d418b44626e..8858b32e05640 100644
--- a/drivers/accel/ivpu/Kconfig
+++ b/drivers/accel/ivpu/Kconfig
@@ -16,3 +16,13 @@  config DRM_ACCEL_IVPU
 	  and Deep Learning applications.
 
 	  If "M" is selected, the module will be called intel_vpu.
+
+config DRM_ACCEL_IVPU_DEBUG
+	bool "Intel NPU debug mode"
+	depends on DRM_ACCEL_IVPU
+	default n
+	help
+	  Choose this option to enable additional
+	  debug features for the Intel NPU driver:
+	  - Always print debug messages regardless of dyndbg config,
+	  - Enable unsafe module params.
diff --git a/drivers/accel/ivpu/Makefile b/drivers/accel/ivpu/Makefile
index e73937c86d9ad..1029e0bab0615 100644
--- a/drivers/accel/ivpu/Makefile
+++ b/drivers/accel/ivpu/Makefile
@@ -24,4 +24,6 @@  intel_vpu-$(CONFIG_DEV_COREDUMP) += ivpu_coredump.o
 
 obj-$(CONFIG_DRM_ACCEL_IVPU) += intel_vpu.o
 
+subdir-ccflags-$(CONFIG_DRM_ACCEL_IVPU_DEBUG) += -DDEBUG
+
 CFLAGS_ivpu_trace_points.o = -I$(src)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index f5a8d93fe2a57..ca2bf47ce2484 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -43,8 +43,10 @@  module_param_named(dbg_mask, ivpu_dbg_mask, int, 0644);
 MODULE_PARM_DESC(dbg_mask, "Driver debug mask. See IVPU_DBG_* macros.");
 
 int ivpu_test_mode;
+#if IS_ENABLED(CONFIG_DRM_ACCEL_IVPU_DEBUG)
 module_param_named_unsafe(test_mode, ivpu_test_mode, int, 0644);
 MODULE_PARM_DESC(test_mode, "Test mode mask. See IVPU_TEST_MODE_* macros.");
+#endif
 
 u8 ivpu_pll_min_ratio;
 module_param_named(pll_min_ratio, ivpu_pll_min_ratio, byte, 0644);
diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
index be367465e7df4..d358cf0b0f972 100644
--- a/drivers/accel/ivpu/ivpu_fw.c
+++ b/drivers/accel/ivpu/ivpu_fw.c
@@ -46,8 +46,10 @@ 
 #define IVPU_FOCUS_PRESENT_TIMER_MS 1000
 
 static char *ivpu_firmware;
+#if IS_ENABLED(CONFIG_DRM_ACCEL_IVPU_DEBUG)
 module_param_named_unsafe(firmware, ivpu_firmware, charp, 0644);
 MODULE_PARM_DESC(firmware, "NPU firmware binary in /lib/firmware/..");
+#endif
 
 static struct {
 	int gen;
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index e567df79a6129..dbc0711e28d13 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -24,8 +24,10 @@ 
 #include "vpu_boot_api.h"
 
 static bool ivpu_disable_recovery;
+#if IS_ENABLED(CONFIG_DRM_ACCEL_IVPU_DEBUG)
 module_param_named_unsafe(disable_recovery, ivpu_disable_recovery, bool, 0644);
 MODULE_PARM_DESC(disable_recovery, "Disables recovery when NPU hang is detected");
+#endif
 
 static unsigned long ivpu_tdr_timeout_ms;
 module_param_named(tdr_timeout_ms, ivpu_tdr_timeout_ms, ulong, 0644);