Re: [PATCH v4 2/4] drm/xe/xe_drm_ras: Add support for drm ras

Riana Tauro
2026-01-28T07:34:44Z

On 1/28/2026 12:45 PM, Raag Jadav wrote:
> On Wed, Jan 28, 2026 at 12:21:18PM +0530, Riana Tauro wrote:
>> On 1/20/2026 10:31 PM, Raag Jadav wrote:
>>> On Mon, Jan 19, 2026 at 09:30:24AM +0530, Riana Tauro wrote:
>>>> Allocate correctable, uncorrectable nodes for every xe device
>>>> Each node contains error classes, counters and respective
>>>> query counter functions.
>>>
>>> ...
>>>
>>>> +static int hw_query_error_counter(struct xe_drm_ras_counter *info,
>>>> + u32 error_id, const char **name, u32 *val)
>>>> +{
>>>> + if (error_id < DRM_XE_RAS_ERROR_CLASS_GT || error_id >= DRM_XE_RAS_ERROR_CLASS_MAX)
>>>
>>> This looks like it can be in_range().
>>
>> in_range has start+len. Should again use count here.
>> This seems simpler
>
> I just had another look at this and wondering if we really need lower
> bound check? error_id is already unsigned right?

added this because error_id starts from 1 and not 0.

the entire condition can be removed. This is already being checked in
the first patch

+ if (error_id < node->error_counter_range.first ||
+ error_id > node->error_counter_range.last)
+ return -EINVAL;

Will remove this in next rev

Thanks
Riana

>
> Raag
>
>>>> + return -EINVAL;
>>>> +
>>>> + if (!info[error_id].name)
>>>> + return -ENOENT;
>>>> +
>>>> + *name = info[error_id].name;
>>>> + *val = atomic64_read(&info[error_id].counter);
>>>> +
>>>> + return 0;
>>>> +}