diff options
| author | Sasha Levin <sashal@kernel.org> | 2026-09-30 20:46:17 -0400 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2026-10-02 11:39:15 +0200 |
| commit | 89a3d2a2237e017cdbefcb036db71ce74e67faf5 (patch) | |
| tree | 8d7186dcc2dbbf227d9b06e6e58a0ac1c7202b47 /drivers | |
| parent | 65444446f0c595c0e250368cde88735b59ccc446 (diff) | |
media: iris: fix 64-bit division in iris_set_slice_count()
32-bit ARM builds fail at modpost:
ERROR: modpost: drivers/media/platform/qcom/iris/qcom-iris.ko:
symbol '__aeabi_ldivmod' undefined!
The maximum average slice size in MAX_BYTES mode is derived from the
BITRATE capability, whose value is an s64, so both the division by
the frame rate and the DIV_ROUND_UP() by the number of slices are
64-bit divisions. 32-bit ARM has no instruction for these and the
compiler emits calls to __aeabi_ldivmod(), which the kernel does not
provide.
The bitrate is always positive, so use div_u64() for the division by
the frame rate and DIV_ROUND_UP_ULL() for the rounding. Include
<linux/math64.h> for div_u64() instead of relying on it being pulled
in indirectly.
Reported-by: kernelci.org bot <bot@kernelci.org>
Closes: https://d.kernelci.org/i/maestro:4935f1aae20e7f957e60f8fde09c4e6d153c7909
Fixes: 5f21cd9a4ae4 ("media: iris: add support for multi_slice in iris encoder")
Assisted-by: LLM
Signed-off-by: Sasha Levin <sashal@kernel.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/media/platform/qcom/iris/iris_ctrls.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/platform/qcom/iris/iris_ctrls.c index 8c4c47944f22..4f2633bbb49f 100644 --- a/drivers/media/platform/qcom/iris/iris_ctrls.c +++ b/drivers/media/platform/qcom/iris/iris_ctrls.c @@ -3,6 +3,7 @@ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ +#include <linux/math64.h> #include <linux/types.h> #include <media/v4l2-mem2mem.h> @@ -1588,8 +1589,9 @@ int iris_set_slice_count(struct iris_inst *inst, enum platform_inst_fw_cap_type } else if (slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES) { hfi_value = inst->fw_caps[SLICE_MAX_BYTES].value; if (rc_type != HFI_RC_OFF) { - max_avg_slicesize = DIV_ROUND_UP((inst->fw_caps[BITRATE].value / fps) / 8, - slice_caps->max_slices_per_frame); + max_avg_slicesize = + DIV_ROUND_UP_ULL(div_u64(inst->fw_caps[BITRATE].value, fps) / 8, + slice_caps->max_slices_per_frame); } else { /* * No bitrate target exists under RC_OFF, so approximate a |
