drm/xe/oa: Allow oa_exponent value of 0
authorUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Fri, 21 Feb 2025 21:33:52 +0000 (13:33 -0800)
committerUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Mon, 24 Feb 2025 21:44:34 +0000 (13:44 -0800)
OA exponent value of 0 is a valid value for periodic reports. Allow user
to pass 0 for the OA sampling interval since it gets converted to 2 gt
clock ticks.

v2: Update the check in xe_oa_stream_init as well (Ashutosh)
v3: Fix mi-rpc failure by setting default exponent to -1 (CI)
v4: Add the Fixes tag

Fixes: b6fd51c62119 ("drm/xe/oa/uapi: Define and parse OA stream properties")
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250221213352.1712932-1-umesh.nerlige.ramappa@intel.com
drivers/gpu/drm/xe/xe_oa.c

index 2c5a24a13e87a7c545a6b022d2518e1965d2538b..6bf5b793b29f8977796bccee41e4e82da600a037 100644 (file)
@@ -1690,7 +1690,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
        stream->oa_buffer.format = &stream->oa->oa_formats[param->oa_format];
 
        stream->sample = param->sample;
-       stream->periodic = param->period_exponent > 0;
+       stream->periodic = param->period_exponent >= 0;
        stream->period_exponent = param->period_exponent;
        stream->no_preempt = param->no_preempt;
        stream->wait_num_reports = param->wait_num_reports;
@@ -1971,6 +1971,7 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
        }
 
        param.xef = xef;
+       param.period_exponent = -1;
        ret = xe_oa_user_extensions(oa, XE_OA_USER_EXTN_FROM_OPEN, data, 0, &param);
        if (ret)
                return ret;
@@ -2025,7 +2026,7 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
                goto err_exec_q;
        }
 
-       if (param.period_exponent > 0) {
+       if (param.period_exponent >= 0) {
                u64 oa_period, oa_freq_hz;
 
                /* Requesting samples from OAG buffer is a privileged operation */