Re: [PATCH] media: iris: fix 64-bit division in iris_set_slice_count()

From: Bryan O'Donoghue

Date: Wed Sep 30 2026 - 20:57:55 EST


On 01/10/2026 01:46, Sasha Levin wrote:
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@xxxxxxxxxxxx>
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@xxxxxxxxxx>
---
drivers/media/platform/qcom/iris/iris_ctrls.c | 6 ++++--
1 file 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 8c4c47944f22f..4f2633bbb49f8 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
--
2.53.0

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>