habanalabs: fix validation of WREG32 to DMA completion
authorOded Gabbay <oded.gabbay@gmail.com>
Thu, 28 Feb 2019 08:46:14 +0000 (10:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Feb 2019 12:04:59 +0000 (13:04 +0100)
This patch fix a bug in the validation of WREG32 in DMA queues. The
validation was too strict. It allowed the user to set the completion
address only for DMA channel 1.

The fix allows the user to set the completion address for all 5 DMA
channels.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/habanalabs/goya/goya.c

index 5444cd0824b446aa86a6f01b126fad0fb3a381df..6f0075c4e9357b8eb9603b27a79af26e134d01d9 100644 (file)
@@ -3769,7 +3769,7 @@ static int goya_validate_wreg32(struct hl_device *hdev,
        dev_dbg(hdev->dev, "reg_offset == 0x%x\n", reg_offset);
        dev_dbg(hdev->dev, "value      == 0x%x\n", wreg_pkt->value);
 
-       if (reg_offset != (mmDMA_CH_1_WR_COMP_ADDR_LO & 0xFFFF)) {
+       if (reg_offset != (mmDMA_CH_0_WR_COMP_ADDR_LO & 0x1FFF)) {
                dev_err(hdev->dev, "WREG32 packet with illegal address 0x%x\n",
                        reg_offset);
                return -EPERM;