Re: [PATCH v2 3/7] drm/i915: Assert that device info bitmasks have enough bits

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

 



On Fri, 02 Jun 2023, Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> wrote:
> On Wed, 31 May 2023, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
>> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>>
>> Sprinkle in some BUILD_BUG_ON()s to make sure some of
>> the bitmasks used in the device info have enough bits.
>>
>> Do we have a better place for this sort of stuff?
>
> *grin* intel_display_device_info_runtime_init()
>
> https://patchwork.freedesktop.org/patch/msgid/20230601212535.675751-1-matthew.d.roper@xxxxxxxxx
>
> It'll conflict, again. :/

static_assert in the global scope is an option.

Also,

Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>

>
>>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>> ---
>>  drivers/gpu/drm/i915/intel_device_info.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
>> index f79142983f28..8a35005c46c0 100644
>> --- a/drivers/gpu/drm/i915/intel_device_info.c
>> +++ b/drivers/gpu/drm/i915/intel_device_info.c
>> @@ -419,6 +419,10 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
>>  		DISPLAY_RUNTIME_INFO(dev_priv);
>>  	enum pipe pipe;
>>  
>> +	BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->pipe_mask) < I915_MAX_PIPES);
>> +	BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->cpu_transcoder_mask) < I915_MAX_TRANSCODERS);
>> +	BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->port_mask) < I915_MAX_PORTS);
>> +
>>  	/* Wa_14011765242: adl-s A0,A1 */
>>  	if (IS_ADLS_DISPLAY_STEP(dev_priv, STEP_A0, STEP_A2))
>>  		for_each_pipe(dev_priv, pipe)

-- 
Jani Nikula, Intel Open Source Graphics Center




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux