media: iris: fix 64-bit division in iris_set_slice_count()
Subsystems (4)
PATCH 1/1 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.
--- drivers/media/platform/qcom/iris/iris_ctrls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_ctrls.c +4 -2
@@ -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
Signature · 1 line
2.53.0
Quoted 51 lines · Sasha Levin
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_BYTESmode is derived from the BITRATE capability, whose value is an s64, so both the division by the frame rate and theDIV_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 andDIV_ROUND_UP_ULL()for the rounding. Include <linux/math64.h> fordiv_u64()instead of relying on it being pulled in indirectly.Reported-by kernelci.org bot <[email protected]>Fixes 5f21cd9a4ae4 ("media: iris: add support for multi_slice in iris encoder")Assisted-by LLMSigned-off-by Sasha Levin <[email protected]>--- drivers/media/platform/qcom/iris/iris_ctrls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/media/platform/qcom/iris/iris_ctrls.c +4
-3@@ -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 --
Quoted 2 lines
2.53.0