diff mbox series

drm/i915/display: move dmc_firmware_path to display params

Message ID 20240321161856.3517856-1-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: move dmc_firmware_path to display params | expand

Commit Message

Jani Nikula March 21, 2024, 4:18 p.m. UTC
The dmc_firmware_path parameter is clearly a display parameter. Move it
there. This also cleans up the ugly member in struct xe_device.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_params.c | 3 +++
 drivers/gpu/drm/i915/display/intel_display_params.h | 1 +
 drivers/gpu/drm/i915/display/intel_dmc.c            | 8 ++++----
 drivers/gpu/drm/i915/i915_params.c                  | 3 ---
 drivers/gpu/drm/i915/i915_params.h                  | 1 -
 drivers/gpu/drm/xe/xe_device_types.h                | 3 ---
 6 files changed, 8 insertions(+), 11 deletions(-)

Comments

Jani Nikula March 21, 2024, 4:20 p.m. UTC | #1
On Thu, 21 Mar 2024, Jani Nikula <jani.nikula@intel.com> wrote:
> The dmc_firmware_path parameter is clearly a display parameter. Move it
> there. This also cleans up the ugly member in struct xe_device.

Hmm, does this actually fix the parameter on xe?!

>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_params.c | 3 +++
>  drivers/gpu/drm/i915/display/intel_display_params.h | 1 +
>  drivers/gpu/drm/i915/display/intel_dmc.c            | 8 ++++----
>  drivers/gpu/drm/i915/i915_params.c                  | 3 ---
>  drivers/gpu/drm/i915/i915_params.h                  | 1 -
>  drivers/gpu/drm/xe/xe_device_types.h                | 3 ---
>  6 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
> index 11e03cfb774d..c8e3d6892e23 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_params.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_params.c
> @@ -27,6 +27,9 @@ static struct intel_display_params intel_display_modparams __read_mostly = {
>   * debugfs mode to 0.
>   */
>  
> +intel_display_param_named_unsafe(dmc_firmware_path, charp, 0400,
> +	"DMC firmware path to use instead of the default one");
> +
>  intel_display_param_named_unsafe(vbt_firmware, charp, 0400,
>  	"Load VBT from specified file under /lib/firmware");
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.h b/drivers/gpu/drm/i915/display/intel_display_params.h
> index 6206cc51df04..f95a6f79904f 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_params.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_params.h
> @@ -24,6 +24,7 @@ struct drm_i915_private;
>   *       debugfs file
>   */
>  #define INTEL_DISPLAY_PARAMS_FOR_EACH(param) \
> +	param(char *, dmc_firmware_path, NULL, 0400) \
>  	param(char *, vbt_firmware, NULL, 0400) \
>  	param(int, lvds_channel_mode, 0, 0400) \
>  	param(int, panel_use_ssc, -1, 0600) \
> diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
> index 3fa851b5c7a6..b4e730882ce2 100644
> --- a/drivers/gpu/drm/i915/display/intel_dmc.c
> +++ b/drivers/gpu/drm/i915/display/intel_dmc.c
> @@ -927,7 +927,7 @@ static void dmc_load_work_fn(struct work_struct *work)
>  
>  	err = request_firmware(&fw, dmc->fw_path, i915->drm.dev);
>  
> -	if (err == -ENOENT && !i915->params.dmc_firmware_path) {
> +	if (err == -ENOENT && !i915->display.params.dmc_firmware_path) {
>  		fallback_path = dmc_fallback_path(i915);
>  		if (fallback_path) {
>  			drm_dbg_kms(&i915->drm, "%s not found, falling back to %s\n",
> @@ -1034,14 +1034,14 @@ void intel_dmc_init(struct drm_i915_private *i915)
>  		dmc->max_fw_size = BXT_DMC_MAX_FW_SIZE;
>  	}
>  
> -	if (i915->params.dmc_firmware_path) {
> -		if (strlen(i915->params.dmc_firmware_path) == 0) {
> +	if (i915->display.params.dmc_firmware_path) {
> +		if (strlen(i915->display.params.dmc_firmware_path) == 0) {
>  			drm_info(&i915->drm,
>  				 "Disabling DMC firmware and runtime PM\n");
>  			goto out;
>  		}
>  
> -		dmc->fw_path = i915->params.dmc_firmware_path;
> +		dmc->fw_path = i915->display.params.dmc_firmware_path;
>  	}
>  
>  	if (!dmc->fw_path) {
> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> index de43048543e8..8c00169e3ab7 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -108,9 +108,6 @@ i915_param_named_unsafe(guc_firmware_path, charp, 0400,
>  i915_param_named_unsafe(huc_firmware_path, charp, 0400,
>  	"HuC firmware path to use instead of the default one");
>  
> -i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
> -	"DMC firmware path to use instead of the default one");
> -
>  i915_param_named_unsafe(gsc_firmware_path, charp, 0400,
>  	"GSC firmware path to use instead of the default one");
>  
> diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
> index 1315d7fac850..2eb3f2115ff2 100644
> --- a/drivers/gpu/drm/i915/i915_params.h
> +++ b/drivers/gpu/drm/i915/i915_params.h
> @@ -51,7 +51,6 @@ struct drm_printer;
>  	param(int, guc_log_level, -1, 0400) \
>  	param(char *, guc_firmware_path, NULL, 0400) \
>  	param(char *, huc_firmware_path, NULL, 0400) \
> -	param(char *, dmc_firmware_path, NULL, 0400) \
>  	param(char *, gsc_firmware_path, NULL, 0400) \
>  	param(bool, memtest, false, 0400) \
>  	param(int, mmio_debug, -IS_ENABLED(CONFIG_DRM_I915_DEBUG_MMIO), 0600) \
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index 9785eef2e5a4..eeab2002d6db 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -524,9 +524,6 @@ struct xe_device {
>  		unsigned int fsb_freq, mem_freq, is_ddr3;
>  		u8 vblank_enabled;
>  	};
> -	struct {
> -		const char *dmc_firmware_path;
> -	} params;
>  
>  	void *pxp;
>  #endif
Lucas De Marchi March 22, 2024, 4:34 a.m. UTC | #2
On Thu, Mar 21, 2024 at 06:20:57PM +0200, Jani Nikula wrote:
>On Thu, 21 Mar 2024, Jani Nikula <jani.nikula@intel.com> wrote:
>> The dmc_firmware_path parameter is clearly a display parameter. Move it
>> there. This also cleans up the ugly member in struct xe_device.
>
>Hmm, does this actually fix the parameter on xe?!

not sure what you meant here. Patches makes sense to me.

Lucas De Marchi

>
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display_params.c | 3 +++
>>  drivers/gpu/drm/i915/display/intel_display_params.h | 1 +
>>  drivers/gpu/drm/i915/display/intel_dmc.c            | 8 ++++----
>>  drivers/gpu/drm/i915/i915_params.c                  | 3 ---
>>  drivers/gpu/drm/i915/i915_params.h                  | 1 -
>>  drivers/gpu/drm/xe/xe_device_types.h                | 3 ---
>>  6 files changed, 8 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
>> index 11e03cfb774d..c8e3d6892e23 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_params.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display_params.c
>> @@ -27,6 +27,9 @@ static struct intel_display_params intel_display_modparams __read_mostly = {
>>   * debugfs mode to 0.
>>   */
>>
>> +intel_display_param_named_unsafe(dmc_firmware_path, charp, 0400,
>> +	"DMC firmware path to use instead of the default one");
>> +
>>  intel_display_param_named_unsafe(vbt_firmware, charp, 0400,
>>  	"Load VBT from specified file under /lib/firmware");
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.h b/drivers/gpu/drm/i915/display/intel_display_params.h
>> index 6206cc51df04..f95a6f79904f 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_params.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_params.h
>> @@ -24,6 +24,7 @@ struct drm_i915_private;
>>   *       debugfs file
>>   */
>>  #define INTEL_DISPLAY_PARAMS_FOR_EACH(param) \
>> +	param(char *, dmc_firmware_path, NULL, 0400) \
>>  	param(char *, vbt_firmware, NULL, 0400) \
>>  	param(int, lvds_channel_mode, 0, 0400) \
>>  	param(int, panel_use_ssc, -1, 0600) \
>> diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>> index 3fa851b5c7a6..b4e730882ce2 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dmc.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>> @@ -927,7 +927,7 @@ static void dmc_load_work_fn(struct work_struct *work)
>>
>>  	err = request_firmware(&fw, dmc->fw_path, i915->drm.dev);
>>
>> -	if (err == -ENOENT && !i915->params.dmc_firmware_path) {
>> +	if (err == -ENOENT && !i915->display.params.dmc_firmware_path) {
>>  		fallback_path = dmc_fallback_path(i915);
>>  		if (fallback_path) {
>>  			drm_dbg_kms(&i915->drm, "%s not found, falling back to %s\n",
>> @@ -1034,14 +1034,14 @@ void intel_dmc_init(struct drm_i915_private *i915)
>>  		dmc->max_fw_size = BXT_DMC_MAX_FW_SIZE;
>>  	}
>>
>> -	if (i915->params.dmc_firmware_path) {
>> -		if (strlen(i915->params.dmc_firmware_path) == 0) {
>> +	if (i915->display.params.dmc_firmware_path) {
>> +		if (strlen(i915->display.params.dmc_firmware_path) == 0) {
>>  			drm_info(&i915->drm,
>>  				 "Disabling DMC firmware and runtime PM\n");
>>  			goto out;
>>  		}
>>
>> -		dmc->fw_path = i915->params.dmc_firmware_path;
>> +		dmc->fw_path = i915->display.params.dmc_firmware_path;
>>  	}
>>
>>  	if (!dmc->fw_path) {
>> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
>> index de43048543e8..8c00169e3ab7 100644
>> --- a/drivers/gpu/drm/i915/i915_params.c
>> +++ b/drivers/gpu/drm/i915/i915_params.c
>> @@ -108,9 +108,6 @@ i915_param_named_unsafe(guc_firmware_path, charp, 0400,
>>  i915_param_named_unsafe(huc_firmware_path, charp, 0400,
>>  	"HuC firmware path to use instead of the default one");
>>
>> -i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
>> -	"DMC firmware path to use instead of the default one");
>> -
>>  i915_param_named_unsafe(gsc_firmware_path, charp, 0400,
>>  	"GSC firmware path to use instead of the default one");
>>
>> diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
>> index 1315d7fac850..2eb3f2115ff2 100644
>> --- a/drivers/gpu/drm/i915/i915_params.h
>> +++ b/drivers/gpu/drm/i915/i915_params.h
>> @@ -51,7 +51,6 @@ struct drm_printer;
>>  	param(int, guc_log_level, -1, 0400) \
>>  	param(char *, guc_firmware_path, NULL, 0400) \
>>  	param(char *, huc_firmware_path, NULL, 0400) \
>> -	param(char *, dmc_firmware_path, NULL, 0400) \
>>  	param(char *, gsc_firmware_path, NULL, 0400) \
>>  	param(bool, memtest, false, 0400) \
>>  	param(int, mmio_debug, -IS_ENABLED(CONFIG_DRM_I915_DEBUG_MMIO), 0600) \
>> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
>> index 9785eef2e5a4..eeab2002d6db 100644
>> --- a/drivers/gpu/drm/xe/xe_device_types.h
>> +++ b/drivers/gpu/drm/xe/xe_device_types.h
>> @@ -524,9 +524,6 @@ struct xe_device {
>>  		unsigned int fsb_freq, mem_freq, is_ddr3;
>>  		u8 vblank_enabled;
>>  	};
>> -	struct {
>> -		const char *dmc_firmware_path;
>> -	} params;
>>
>>  	void *pxp;
>>  #endif
>
>-- 
>Jani Nikula, Intel
Jani Nikula March 22, 2024, 8:48 a.m. UTC | #3
On Thu, 21 Mar 2024, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> On Thu, Mar 21, 2024 at 06:20:57PM +0200, Jani Nikula wrote:
>>On Thu, 21 Mar 2024, Jani Nikula <jani.nikula@intel.com> wrote:
>>> The dmc_firmware_path parameter is clearly a display parameter. Move it
>>> there. This also cleans up the ugly member in struct xe_device.
>>
>>Hmm, does this actually fix the parameter on xe?!
>
> not sure what you meant here. Patches makes sense to me.

Unless I'm mistaken, the parameter currently does not work on xe at
all. I only realized after posting the patch that this probably fixes
that issue too.

BR,
Jani.


>
> Lucas De Marchi
>
>>
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/display/intel_display_params.c | 3 +++
>>>  drivers/gpu/drm/i915/display/intel_display_params.h | 1 +
>>>  drivers/gpu/drm/i915/display/intel_dmc.c            | 8 ++++----
>>>  drivers/gpu/drm/i915/i915_params.c                  | 3 ---
>>>  drivers/gpu/drm/i915/i915_params.h                  | 1 -
>>>  drivers/gpu/drm/xe/xe_device_types.h                | 3 ---
>>>  6 files changed, 8 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
>>> index 11e03cfb774d..c8e3d6892e23 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_display_params.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_display_params.c
>>> @@ -27,6 +27,9 @@ static struct intel_display_params intel_display_modparams __read_mostly = {
>>>   * debugfs mode to 0.
>>>   */
>>>
>>> +intel_display_param_named_unsafe(dmc_firmware_path, charp, 0400,
>>> +	"DMC firmware path to use instead of the default one");
>>> +
>>>  intel_display_param_named_unsafe(vbt_firmware, charp, 0400,
>>>  	"Load VBT from specified file under /lib/firmware");
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.h b/drivers/gpu/drm/i915/display/intel_display_params.h
>>> index 6206cc51df04..f95a6f79904f 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_display_params.h
>>> +++ b/drivers/gpu/drm/i915/display/intel_display_params.h
>>> @@ -24,6 +24,7 @@ struct drm_i915_private;
>>>   *       debugfs file
>>>   */
>>>  #define INTEL_DISPLAY_PARAMS_FOR_EACH(param) \
>>> +	param(char *, dmc_firmware_path, NULL, 0400) \
>>>  	param(char *, vbt_firmware, NULL, 0400) \
>>>  	param(int, lvds_channel_mode, 0, 0400) \
>>>  	param(int, panel_use_ssc, -1, 0600) \
>>> diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>>> index 3fa851b5c7a6..b4e730882ce2 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_dmc.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>>> @@ -927,7 +927,7 @@ static void dmc_load_work_fn(struct work_struct *work)
>>>
>>>  	err = request_firmware(&fw, dmc->fw_path, i915->drm.dev);
>>>
>>> -	if (err == -ENOENT && !i915->params.dmc_firmware_path) {
>>> +	if (err == -ENOENT && !i915->display.params.dmc_firmware_path) {
>>>  		fallback_path = dmc_fallback_path(i915);
>>>  		if (fallback_path) {
>>>  			drm_dbg_kms(&i915->drm, "%s not found, falling back to %s\n",
>>> @@ -1034,14 +1034,14 @@ void intel_dmc_init(struct drm_i915_private *i915)
>>>  		dmc->max_fw_size = BXT_DMC_MAX_FW_SIZE;
>>>  	}
>>>
>>> -	if (i915->params.dmc_firmware_path) {
>>> -		if (strlen(i915->params.dmc_firmware_path) == 0) {
>>> +	if (i915->display.params.dmc_firmware_path) {
>>> +		if (strlen(i915->display.params.dmc_firmware_path) == 0) {
>>>  			drm_info(&i915->drm,
>>>  				 "Disabling DMC firmware and runtime PM\n");
>>>  			goto out;
>>>  		}
>>>
>>> -		dmc->fw_path = i915->params.dmc_firmware_path;
>>> +		dmc->fw_path = i915->display.params.dmc_firmware_path;
>>>  	}
>>>
>>>  	if (!dmc->fw_path) {
>>> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
>>> index de43048543e8..8c00169e3ab7 100644
>>> --- a/drivers/gpu/drm/i915/i915_params.c
>>> +++ b/drivers/gpu/drm/i915/i915_params.c
>>> @@ -108,9 +108,6 @@ i915_param_named_unsafe(guc_firmware_path, charp, 0400,
>>>  i915_param_named_unsafe(huc_firmware_path, charp, 0400,
>>>  	"HuC firmware path to use instead of the default one");
>>>
>>> -i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
>>> -	"DMC firmware path to use instead of the default one");
>>> -
>>>  i915_param_named_unsafe(gsc_firmware_path, charp, 0400,
>>>  	"GSC firmware path to use instead of the default one");
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
>>> index 1315d7fac850..2eb3f2115ff2 100644
>>> --- a/drivers/gpu/drm/i915/i915_params.h
>>> +++ b/drivers/gpu/drm/i915/i915_params.h
>>> @@ -51,7 +51,6 @@ struct drm_printer;
>>>  	param(int, guc_log_level, -1, 0400) \
>>>  	param(char *, guc_firmware_path, NULL, 0400) \
>>>  	param(char *, huc_firmware_path, NULL, 0400) \
>>> -	param(char *, dmc_firmware_path, NULL, 0400) \
>>>  	param(char *, gsc_firmware_path, NULL, 0400) \
>>>  	param(bool, memtest, false, 0400) \
>>>  	param(int, mmio_debug, -IS_ENABLED(CONFIG_DRM_I915_DEBUG_MMIO), 0600) \
>>> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
>>> index 9785eef2e5a4..eeab2002d6db 100644
>>> --- a/drivers/gpu/drm/xe/xe_device_types.h
>>> +++ b/drivers/gpu/drm/xe/xe_device_types.h
>>> @@ -524,9 +524,6 @@ struct xe_device {
>>>  		unsigned int fsb_freq, mem_freq, is_ddr3;
>>>  		u8 vblank_enabled;
>>>  	};
>>> -	struct {
>>> -		const char *dmc_firmware_path;
>>> -	} params;
>>>
>>>  	void *pxp;
>>>  #endif
>>
>>-- 
>>Jani Nikula, Intel
Lucas De Marchi March 22, 2024, 4:06 p.m. UTC | #4
On Fri, Mar 22, 2024 at 10:48:43AM +0200, Jani Nikula wrote:
>On Thu, 21 Mar 2024, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>> On Thu, Mar 21, 2024 at 06:20:57PM +0200, Jani Nikula wrote:
>>>On Thu, 21 Mar 2024, Jani Nikula <jani.nikula@intel.com> wrote:
>>>> The dmc_firmware_path parameter is clearly a display parameter. Move it
>>>> there. This also cleans up the ugly member in struct xe_device.
>>>
>>>Hmm, does this actually fix the parameter on xe?!
>>
>> not sure what you meant here. Patches makes sense to me.
>
>Unless I'm mistaken, the parameter currently does not work on xe at
>all. I only realized after posting the patch that this probably fixes
>that issue too.

+Gustavo

I never really tried the dmc_firmware_path param, but current code
contains:

drivers/gpu/drm/i915/display/intel_dmc.c:       if (err == -ENOENT && !i915->params.dmc_firmware_path) {
drivers/gpu/drm/i915/display/intel_dmc.c:       if (i915->params.dmc_firmware_path) {
drivers/gpu/drm/i915/display/intel_dmc.c:               if (strlen(i915->params.dmc_firmware_path) == 0) {
drivers/gpu/drm/i915/display/intel_dmc.c:               dmc->fw_path = i915->params.dmc_firmware_path;
drivers/gpu/drm/i915/i915_params.c:i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
drivers/gpu/drm/i915/i915_params.h:     param(char *, dmc_firmware_path, NULL, 0400) \
drivers/gpu/drm/xe/xe_device_types.h:           const char *dmc_firmware_path;

So dmc_firmware_path is only dealt with inside display... it would be
odd if it was not working. I'll double check.

Lucas De Marchi
Lucas De Marchi March 22, 2024, 6:32 p.m. UTC | #5
On Fri, Mar 22, 2024 at 11:06:20AM -0500, Lucas De Marchi wrote:
>On Fri, Mar 22, 2024 at 10:48:43AM +0200, Jani Nikula wrote:
>>On Thu, 21 Mar 2024, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>>>On Thu, Mar 21, 2024 at 06:20:57PM +0200, Jani Nikula wrote:
>>>>On Thu, 21 Mar 2024, Jani Nikula <jani.nikula@intel.com> wrote:
>>>>>The dmc_firmware_path parameter is clearly a display parameter. Move it
>>>>>there. This also cleans up the ugly member in struct xe_device.
>>>>
>>>>Hmm, does this actually fix the parameter on xe?!
>>>
>>>not sure what you meant here. Patches makes sense to me.
>>
>>Unless I'm mistaken, the parameter currently does not work on xe at
>>all. I only realized after posting the patch that this probably fixes
>>that issue too.
>
>+Gustavo
>
>I never really tried the dmc_firmware_path param, but current code
>contains:
>
>drivers/gpu/drm/i915/display/intel_dmc.c:       if (err == -ENOENT && !i915->params.dmc_firmware_path) {
>drivers/gpu/drm/i915/display/intel_dmc.c:       if (i915->params.dmc_firmware_path) {
>drivers/gpu/drm/i915/display/intel_dmc.c:               if (strlen(i915->params.dmc_firmware_path) == 0) {
>drivers/gpu/drm/i915/display/intel_dmc.c:               dmc->fw_path = i915->params.dmc_firmware_path;
>drivers/gpu/drm/i915/i915_params.c:i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
>drivers/gpu/drm/i915/i915_params.h:     param(char *, dmc_firmware_path, NULL, 0400) \
>drivers/gpu/drm/xe/xe_device_types.h:           const char *dmc_firmware_path;
>
>So dmc_firmware_path is only dealt with inside display... it would be
>odd if it was not working. I'll double check.


oh, now I understand. You mean that xe module doesn't have the param
because it's only declared in drivers/gpu/drm/i915/i915_params.c.

Could you extend the commit message with something like this?

	The dmc_firmware_path parameter is clearly a display parameter. Move it
	there so it's available to both i915 and xe modules ....

thanks
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

Lucas De Marchi

>
>Lucas De Marchi
Jani Nikula April 2, 2024, 8:47 a.m. UTC | #6
On Fri, 22 Mar 2024, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> oh, now I understand. You mean that xe module doesn't have the param
> because it's only declared in drivers/gpu/drm/i915/i915_params.c.
>
> Could you extend the commit message with something like this?
>
> 	The dmc_firmware_path parameter is clearly a display parameter. Move it
> 	there so it's available to both i915 and xe modules ....
>
> thanks
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

Thanks for the review, pushed to drm-intel-next with an amended commit
message.

BR,
Jani.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
index 11e03cfb774d..c8e3d6892e23 100644
--- a/drivers/gpu/drm/i915/display/intel_display_params.c
+++ b/drivers/gpu/drm/i915/display/intel_display_params.c
@@ -27,6 +27,9 @@  static struct intel_display_params intel_display_modparams __read_mostly = {
  * debugfs mode to 0.
  */
 
+intel_display_param_named_unsafe(dmc_firmware_path, charp, 0400,
+	"DMC firmware path to use instead of the default one");
+
 intel_display_param_named_unsafe(vbt_firmware, charp, 0400,
 	"Load VBT from specified file under /lib/firmware");
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_params.h b/drivers/gpu/drm/i915/display/intel_display_params.h
index 6206cc51df04..f95a6f79904f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_params.h
+++ b/drivers/gpu/drm/i915/display/intel_display_params.h
@@ -24,6 +24,7 @@  struct drm_i915_private;
  *       debugfs file
  */
 #define INTEL_DISPLAY_PARAMS_FOR_EACH(param) \
+	param(char *, dmc_firmware_path, NULL, 0400) \
 	param(char *, vbt_firmware, NULL, 0400) \
 	param(int, lvds_channel_mode, 0, 0400) \
 	param(int, panel_use_ssc, -1, 0600) \
diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
index 3fa851b5c7a6..b4e730882ce2 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
@@ -927,7 +927,7 @@  static void dmc_load_work_fn(struct work_struct *work)
 
 	err = request_firmware(&fw, dmc->fw_path, i915->drm.dev);
 
-	if (err == -ENOENT && !i915->params.dmc_firmware_path) {
+	if (err == -ENOENT && !i915->display.params.dmc_firmware_path) {
 		fallback_path = dmc_fallback_path(i915);
 		if (fallback_path) {
 			drm_dbg_kms(&i915->drm, "%s not found, falling back to %s\n",
@@ -1034,14 +1034,14 @@  void intel_dmc_init(struct drm_i915_private *i915)
 		dmc->max_fw_size = BXT_DMC_MAX_FW_SIZE;
 	}
 
-	if (i915->params.dmc_firmware_path) {
-		if (strlen(i915->params.dmc_firmware_path) == 0) {
+	if (i915->display.params.dmc_firmware_path) {
+		if (strlen(i915->display.params.dmc_firmware_path) == 0) {
 			drm_info(&i915->drm,
 				 "Disabling DMC firmware and runtime PM\n");
 			goto out;
 		}
 
-		dmc->fw_path = i915->params.dmc_firmware_path;
+		dmc->fw_path = i915->display.params.dmc_firmware_path;
 	}
 
 	if (!dmc->fw_path) {
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index de43048543e8..8c00169e3ab7 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -108,9 +108,6 @@  i915_param_named_unsafe(guc_firmware_path, charp, 0400,
 i915_param_named_unsafe(huc_firmware_path, charp, 0400,
 	"HuC firmware path to use instead of the default one");
 
-i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
-	"DMC firmware path to use instead of the default one");
-
 i915_param_named_unsafe(gsc_firmware_path, charp, 0400,
 	"GSC firmware path to use instead of the default one");
 
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index 1315d7fac850..2eb3f2115ff2 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -51,7 +51,6 @@  struct drm_printer;
 	param(int, guc_log_level, -1, 0400) \
 	param(char *, guc_firmware_path, NULL, 0400) \
 	param(char *, huc_firmware_path, NULL, 0400) \
-	param(char *, dmc_firmware_path, NULL, 0400) \
 	param(char *, gsc_firmware_path, NULL, 0400) \
 	param(bool, memtest, false, 0400) \
 	param(int, mmio_debug, -IS_ENABLED(CONFIG_DRM_I915_DEBUG_MMIO), 0600) \
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index 9785eef2e5a4..eeab2002d6db 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -524,9 +524,6 @@  struct xe_device {
 		unsigned int fsb_freq, mem_freq, is_ddr3;
 		u8 vblank_enabled;
 	};
-	struct {
-		const char *dmc_firmware_path;
-	} params;
 
 	void *pxp;
 #endif