Skip to content

Commit 19c72ec

Browse files
robherringSasha Levin
authored andcommitted
accel: ethosu: Fix NPU_OP_ELEMENTWISE validation with scalar
[ Upstream commit 838ae99 ] The NPU_OP_ELEMENTWISE instruction uses a scalar value for IFM2 if the IFM2_BROADCAST "scalar" mode is set. It is a bit (7) on the u65 and part of a field (bits 3:0) on the u85. The driver was hardcoded to the u85. Fixes: 5a5e9c0 ("accel: Add Arm Ethos-U NPU driver") Reviewed-and-Tested-by: Anders Roxell <anders.roxell@linaro.org> Link: https://patch.msgid.link/20260218-ethos-fixes-v1-2-be3fa3ea9a30@kernel.org Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent de71b3d commit 19c72ec

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/accel/ethosu/ethosu_gem.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ static int ethosu_gem_cmdstream_copy_and_validate(struct drm_device *ddev,
417417
return ret;
418418
break;
419419
case NPU_OP_ELEMENTWISE:
420-
use_ifm2 = !((st.ifm2.broadcast == 8) || (param == 5) ||
420+
use_scale = ethosu_is_u65(edev) ?
421+
(st.ifm2.broadcast & 0x80) :
422+
(st.ifm2.broadcast == 8);
423+
use_ifm2 = !(use_scale || (param == 5) ||
421424
(param == 6) || (param == 7) || (param == 0x24));
422425
use_ifm = st.ifm.broadcast != 8;
423426
ret = calc_sizes_elemwise(ddev, info, cmd, &st, use_ifm, use_ifm2);

0 commit comments

Comments
 (0)