* [PATCH] media: iris: fix 64-bit division in iris_set_slice_count()
@ 2026-10-01 0:46 ` Sasha Levin
2026-10-01 0:49 ` Bryan O'Donoghue
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-10-01 0:46 UTC (permalink / raw)
To: Vikash Garodia, Dikshita Agarwal, Bryan O'Donoghue,
Mauro Carvalho Chehab, Sachin Kumar Garg
Cc: Sasha Levin, kernelci.org bot, Abhinav Kumar, linux-media,
linux-arm-msm, linux-kernel
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>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: iris: fix 64-bit division in iris_set_slice_count()
2026-10-01 0:46 ` [PATCH] media: iris: fix 64-bit division in iris_set_slice_count() Sasha Levin
@ 2026-10-01 0:49 ` Bryan O'Donoghue
0 siblings, 0 replies; 2+ messages in thread
From: Bryan O'Donoghue @ 2026-10-01 0:49 UTC (permalink / raw)
To: Sasha Levin, Vikash Garodia, Dikshita Agarwal,
Mauro Carvalho Chehab, Sachin Kumar Garg
Cc: kernelci.org bot, Abhinav Kumar, linux-media, linux-arm-msm,
linux-kernel
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@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>
> ---
> 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@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-01 0:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <WGjCcYNrTTl1nX0egc4fFtnjES8VeY1nYXm4v7kHVBNOSkChhctiUs2iU0KupHeUVt5uzgS6b3Re1MNJNK9riQ==@protonmail.internalid>
2026-10-01 0:46 ` [PATCH] media: iris: fix 64-bit division in iris_set_slice_count() Sasha Levin
2026-10-01 0:49 ` Bryan O'Donoghue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®