habanalabs: fix rc when new CPUCP opcodes are not supported
authorTomer Tayar <ttayar@habana.ai>
Fri, 18 Nov 2022 13:08:33 +0000 (15:08 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Wed, 23 Nov 2022 14:44:02 +0000 (16:44 +0200)
When the new CPUCP opcodes are not supported and a CPUCP packet fails,
the return value is the F/W error resposone which is a positive value.
If this packet is sent from IOCTL and the positive value is used, the
ICOTL will not be considered as unsuccessful.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/firmware_if.c

index c0909d7..cf8147e 100644 (file)
@@ -324,6 +324,7 @@ int hl_fw_send_cpu_message(struct hl_device *hdev, u32 hw_queue_id, u32 *msg,
 
                if (!prop->supports_advanced_cpucp_rc) {
                        dev_dbg(hdev->dev, "F/W ERROR %d for CPU packet %d\n", rc, opcode);
+                       rc = -EIO;
                        goto scrub_descriptor;
                }