Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Type mismatch in the `min()` macro arguments will trigger strict 
type-checking compiler errors.
--

--- Patch [6]: [RFC PATCH v1 6/8] misc/arm-cla: Set up memory translation 
context ---
commit 5af1b39fed17c5b5bbf7cdc121a0531df0a24e2d
Author: Ryan Roberts <[email protected]>

misc/arm-cla: Set up memory translation context

This commit sets up a Memory Translation Context (MTC) during CLA bringup for
CPU MMU DMA configurations. It populates the MTC from EL1 configuration,
configuring the accelerator to run as EL0 and installing user translation
contexts via TTBR0.

> diff --git a/drivers/misc/arm-cla/cla-ops.c b/drivers/misc/arm-cla/cla-ops.c
> index 7ddb973927e99..4d3f4f453e0b4 100644
> --- a/drivers/misc/arm-cla/cla-ops.c
> +++ b/drivers/misc/arm-cla/cla-ops.c
> @@ -180,6 +180,10 @@ static int cla_op_access_reg(struct cla_dev *dev, u8 op,
>       case CLA_LAUNCH_OP_REGWRITE:
>               max_regidx = 0x100000000;
>               break;
> +     case CLA_LAUNCH_OP_SETCTX:
> +     case CLA_LAUNCH_OP_GETCTX:
> +             max_regidx = 0x80;
> +             break;
>       default:
>               WARN_ON(1);
>               return -EINVAL;

[Severity: Low]
Will this result in a build failure due to strict type checking in the min()
macro?

Further down in cla_op_access_reg(), the code calculates the max register
using min():

    while (nregs > 0) {
        unsigned int reg_group = ALIGN_DOWN(regidx, 8);
        unsigned int max_reg = min(regidx + nregs, reg_group + 8);

Since nregs is a size_t (64-bit on ARM64) and reg_group is an unsigned int
(32-bit), the min() macro will catch the type mismatch between its arguments.
Could this be resolved by using min_t() or casting the arguments to matching
types?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=6

Reply via email to