From patchwork Thu Mar 23 11:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13185544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D4C5C6FD1C for ; Thu, 23 Mar 2023 11:35:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 02C1A10E010; Thu, 23 Mar 2023 11:35:35 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A89010E010 for ; Thu, 23 Mar 2023 11:35:33 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E396C62606; Thu, 23 Mar 2023 11:35:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6980FC433D2; Thu, 23 Mar 2023 11:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679571332; bh=tDRuSr+FoMDrwJWKloBZGemtUGb1lIUmrv7XdcHche8=; h=From:To:Cc:Subject:Date:From; b=nKadjOjIgE94tTgfh6sxWOIRWNYWpVARRRJEpgR5LZzxyzTd3ZnFbzNQO44zRN9Jl tbcexM2w+C7vczbYtIumHOOWpmlWIyUw3bTQH0kADTmTExC+0vhmBX1CZ3HdWr9a7M +7XwS4cHQJBXPXJTA7Zqsk84mebahtS2VzhNEZW35w8nTTsEQkHd+kZwuCQUiW7iaw j7k5mv+gtYkZosr31A0oRKD+8oTP0+rjHLdi28mDjahND7wrtXQu+0w/MsNTafe7LU CdY9I4wFMENerYB2YunJNYDvcT31RxFkvGeANyoTmkkmirYRmpL8JR2vSpi+X/Pk41 S5sG719u21ijw== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/6] accel/habanalabs: unmap mapped memory when TLB inv fails Date: Thu, 23 Mar 2023 13:35:20 +0200 Message-Id: <20230323113525.959176-1-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Koby Elbaz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Koby Elbaz Once a memory mapping is added to the page tables, it's followed by a TLB invalidation request which could potentially fail (HW failure). Removing the mapping is simply a part of this failure handling routine. TLB invalidation failure prints were updated to be more accurate. Signed-off-by: Koby Elbaz Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/command_buffer.c | 15 ++++++++++++--- drivers/accel/habanalabs/common/mmu/mmu.c | 8 ++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/accel/habanalabs/common/command_buffer.c b/drivers/accel/habanalabs/common/command_buffer.c index 3a0535ac28b1..6e09f48750a0 100644 --- a/drivers/accel/habanalabs/common/command_buffer.c +++ b/drivers/accel/habanalabs/common/command_buffer.c @@ -45,20 +45,29 @@ static int cb_map_mem(struct hl_ctx *ctx, struct hl_cb *cb) } mutex_lock(&hdev->mmu_lock); + rc = hl_mmu_map_contiguous(ctx, cb->virtual_addr, cb->bus_address, cb->roundup_size); if (rc) { dev_err(hdev->dev, "Failed to map VA %#llx to CB\n", cb->virtual_addr); - goto err_va_umap; + goto err_va_pool_free; } + rc = hl_mmu_invalidate_cache(hdev, false, MMU_OP_USERPTR | MMU_OP_SKIP_LOW_CACHE_INV); + if (rc) + goto err_mmu_unmap; + mutex_unlock(&hdev->mmu_lock); cb->is_mmu_mapped = true; - return rc; -err_va_umap: + return 0; + +err_mmu_unmap: + hl_mmu_unmap_contiguous(ctx, cb->virtual_addr, cb->roundup_size); +err_va_pool_free: mutex_unlock(&hdev->mmu_lock); gen_pool_free(ctx->cb_va_pool, cb->virtual_addr, cb->roundup_size); + return rc; } diff --git a/drivers/accel/habanalabs/common/mmu/mmu.c b/drivers/accel/habanalabs/common/mmu/mmu.c index 17581b1bcc77..f379e5b461a6 100644 --- a/drivers/accel/habanalabs/common/mmu/mmu.c +++ b/drivers/accel/habanalabs/common/mmu/mmu.c @@ -679,7 +679,9 @@ int hl_mmu_invalidate_cache(struct hl_device *hdev, bool is_hard, u32 flags) rc = hdev->asic_funcs->mmu_invalidate_cache(hdev, is_hard, flags); if (rc) - dev_err_ratelimited(hdev->dev, "MMU cache invalidation failed\n"); + dev_err_ratelimited(hdev->dev, + "%s cache invalidation failed, rc=%d\n", + flags == VM_TYPE_USERPTR ? "PMMU" : "HMMU", rc); return rc; } @@ -692,7 +694,9 @@ int hl_mmu_invalidate_cache_range(struct hl_device *hdev, bool is_hard, rc = hdev->asic_funcs->mmu_invalidate_cache_range(hdev, is_hard, flags, asid, va, size); if (rc) - dev_err_ratelimited(hdev->dev, "MMU cache range invalidation failed\n"); + dev_err_ratelimited(hdev->dev, + "%s cache range invalidation failed: va=%#llx, size=%llu, rc=%d", + flags == VM_TYPE_USERPTR ? "PMMU" : "HMMU", va, size, rc); return rc; } From patchwork Thu Mar 23 11:35:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13185545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AD82C6FD1C for ; Thu, 23 Mar 2023 11:35:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E5F410E46E; Thu, 23 Mar 2023 11:35:39 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10E4410E46E for ; Thu, 23 Mar 2023 11:35:35 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69C5C62609; Thu, 23 Mar 2023 11:35:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E384FC433EF; Thu, 23 Mar 2023 11:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679571333; bh=26GGfpqebp+jBczWyB97hblNZUF38ckgczf+y3PXm+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=en+5pSIig5Sjv95Z0FiaEOJKyeQxWuhkh9EDa92KXPshdTXR1Z5CpOyTH/+fquNx5 4BIv5s/W3uV93XZ2/LVMrR2McVHjF20AkrDgaBviBaPk6oojkNfkJ6YupEMnSASNWd DAQaM+aZaSGLAhEVX000s2W2C4GW7X5pYMBMsIuIwRJiq6UkMZx2TWdWNXNLsDg92B wdUfHQAMqrKloSKm6hEYTj3ifjLmaOKiFBOMr3p+duKAoAG8460oer3OsA/JnwDTJo xw85Uy2gfFP+TtD/25N73l+eYN+81UhO+QXLNUrmxvX9duDbzeCH4W1Ut68wbgkMWm 5sxqmuOFD10PA== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/6] accel/habanalabs: print event type when device is disabled Date: Thu, 23 Mar 2023 13:35:21 +0200 Message-Id: <20230323113525.959176-2-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230323113525.959176-1-ogabbay@kernel.org> References: <20230323113525.959176-1-ogabbay@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tal Cohen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Tal Cohen When the device is in disabled state, the driver isn't suppose to receive any events from FW. Printing the event type, as part of the message that was already printed, shall help to get more info if this unexpected message is received. Signed-off-by: Tal Cohen Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/irq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/accel/habanalabs/common/irq.c b/drivers/accel/habanalabs/common/irq.c index fab1abc5c910..0d59bb7c9063 100644 --- a/drivers/accel/habanalabs/common/irq.c +++ b/drivers/accel/habanalabs/common/irq.c @@ -415,8 +415,8 @@ irqreturn_t hl_irq_handler_eq(int irq, void *arg) struct hl_eq_entry *eq_base; struct hl_eqe_work *handle_eqe_work; bool entry_ready; - u32 cur_eqe; - u16 cur_eqe_index; + u32 cur_eqe, ctl; + u16 cur_eqe_index, event_type; eq_base = eq->kernel_address; @@ -449,7 +449,10 @@ irqreturn_t hl_irq_handler_eq(int irq, void *arg) dma_rmb(); if (hdev->disabled && !hdev->reset_info.in_compute_reset) { - dev_warn(hdev->dev, "Device disabled but received an EQ event\n"); + ctl = le32_to_cpu(eq_entry->hdr.ctl); + event_type = ((ctl & EQ_CTL_EVENT_TYPE_MASK) >> EQ_CTL_EVENT_TYPE_SHIFT); + dev_warn(hdev->dev, + "Device disabled but received an EQ event (%u)\n", event_type); goto skip_irq; } From patchwork Thu Mar 23 11:35:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13185546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1553C6FD1D for ; Thu, 23 Mar 2023 11:35:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D6F810EA6E; Thu, 23 Mar 2023 11:35:40 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A6ED10E46E for ; Thu, 23 Mar 2023 11:35:36 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E13A062606; Thu, 23 Mar 2023 11:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6852FC4339B; Thu, 23 Mar 2023 11:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679571335; bh=WcoQqs1nDbhSzgIdgSJjl18bpwV96ePf17ORSFkoyLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVlZLNNqqiymnGvf2krtB6MChFikZ3WjbK2XV6rSpzgqGysB901uoi3DbWkXZXnGJ rQqMqkC73ChTCHhFGv0yIlIpVIqfLnD9GavJ1J5di1hQ3DEa7EWdAVnh4cKK14G/mZ DPmW6jD+wbH9ESg3haCdydXQxluTkvxMcFqWRCcdqL18nx0o/Bbrh5ZGkk1JUyCg8u hSzGcCOutH2qA4W5prkGmaEa0sggkfhnIIrcl8z5BJgm8ep1gh5F5KCCyKL3GG+JZZ xJtbFLppRwH8uM7g1TxO1qJPYbR53pndIlPdVKUs8ONOw1DPJaDCGKaf3+g1COXdOP Mgc4UhBXV73VA== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/6] accel/habanalabs: check return value of add_va_block_locked Date: Thu, 23 Mar 2023 13:35:22 +0200 Message-Id: <20230323113525.959176-3-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230323113525.959176-1-ogabbay@kernel.org> References: <20230323113525.959176-1-ogabbay@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dafna Hirschfeld Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Dafna Hirschfeld since the function might fail and we should propagate the failure. Signed-off-by: Dafna Hirschfeld Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/memory.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/accel/habanalabs/common/memory.c b/drivers/accel/habanalabs/common/memory.c index 17b79d717896..a7b6a273ce21 100644 --- a/drivers/accel/habanalabs/common/memory.c +++ b/drivers/accel/habanalabs/common/memory.c @@ -605,6 +605,7 @@ static u64 get_va_block(struct hl_device *hdev, bool is_align_pow_2 = is_power_of_2(va_range->page_size); bool is_hint_dram_addr = hl_is_dram_va(hdev, hint_addr); bool force_hint = flags & HL_MEM_FORCE_HINT; + int rc; if (is_align_pow_2) align_mask = ~((u64)va_block_align - 1); @@ -722,9 +723,13 @@ static u64 get_va_block(struct hl_device *hdev, kfree(new_va_block); } - if (add_prev) - add_va_block_locked(hdev, &va_range->list, prev_start, - prev_end); + if (add_prev) { + rc = add_va_block_locked(hdev, &va_range->list, prev_start, prev_end); + if (rc) { + reserved_valid_start = 0; + goto out; + } + } print_va_list_locked(hdev, &va_range->list); out: From patchwork Thu Mar 23 11:35:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13185547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45713C6FD1D for ; Thu, 23 Mar 2023 11:35:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67D8110EA70; Thu, 23 Mar 2023 11:35:47 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7BE810E46E for ; Thu, 23 Mar 2023 11:35:37 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E95D6260A; Thu, 23 Mar 2023 11:35:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E297CC433D2; Thu, 23 Mar 2023 11:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679571336; bh=+5Ahn+K+Q1efmLhyeeZTykldUeRIz/+pE+wVFDHfSyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgzmPFMHUYG4GLqxzvi/+Lk2dxPOwvT2wrLn3SLGz6wXwAuMMGb1TDuBsByy1juVy OqGcu1vcg79SWazlvfjz03R+UaOZ1KaN/xUyL3y69MHdU5aeWm1xpYIODSUBn6CAy5 g3yEO4xCCeskcmgQmWH15+Owg7pluL30IapkgysaznQYtaf2NFk/3Ahqqo56doDyDg 9ZeQ+wQ3xCYGegPDk4qHFiptxL4ZvCJtwqggi/XFWbMgMlVcgMUtj+g/HhDd5lHbz1 KyI4kNZOyZPTOl0KYPsZOtVI4KqcG3OSOzpie4os9UvQP0VFOfoHYG9qNYZVGaqdM3 iYiYepPqYWBCA== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/6] accel/habanalabs: change COMMS warning messages to error level Date: Thu, 23 Mar 2023 13:35:23 +0200 Message-Id: <20230323113525.959176-4-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230323113525.959176-1-ogabbay@kernel.org> References: <20230323113525.959176-1-ogabbay@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Koby Elbaz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Koby Elbaz COMMS protocol is used for LKD <--> FW communication, and any communication failure between the two might turn out to be destructive, hence, it should be well emphasized. Signed-off-by: Koby Elbaz Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/firmware_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/accel/habanalabs/common/firmware_if.c b/drivers/accel/habanalabs/common/firmware_if.c index 7ea611392f8c..96027a1c124d 100644 --- a/drivers/accel/habanalabs/common/firmware_if.c +++ b/drivers/accel/habanalabs/common/firmware_if.c @@ -1263,7 +1263,7 @@ void hl_fw_ask_hard_reset_without_linux(struct hl_device *hdev) COMMS_RST_DEV, 0, false, hdev->fw_loader.cpu_timeout); if (rc) - dev_warn(hdev->dev, "Failed sending COMMS_RST_DEV\n"); + dev_err(hdev->dev, "Failed sending COMMS_RST_DEV\n"); } else { WREG32(static_loader->kmd_msg_to_cpu_reg, KMD_MSG_RST_DEV); } @@ -1284,7 +1284,7 @@ void hl_fw_ask_halt_machine_without_linux(struct hl_device *hdev) COMMS_GOTO_WFE, 0, true, hdev->fw_loader.cpu_timeout); if (rc) - dev_warn(hdev->dev, "Failed sending COMMS_GOTO_WFE\n"); + dev_err(hdev->dev, "Failed sending COMMS_GOTO_WFE\n"); } else { WREG32(static_loader->kmd_msg_to_cpu_reg, KMD_MSG_GOTO_WFE); msleep(static_loader->cpu_reset_wait_msec); From patchwork Thu Mar 23 11:35:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13185549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3DFAC6FD1C for ; Thu, 23 Mar 2023 11:35:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6B1210E470; Thu, 23 Mar 2023 11:35:55 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6135E10E46E for ; Thu, 23 Mar 2023 11:35:39 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2DAD62609; Thu, 23 Mar 2023 11:35:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 678BFC433EF; Thu, 23 Mar 2023 11:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679571338; bh=2Btq5FdclpupmmuU4lrWKvcrkBQS9WTb8XZbGA+fXCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hln/N/hDJJhQ77vKHcjVqmNFv0l3CCTsoj23sDJ4jO13fLPrJhB6Qtf5O294R0Ije 0GVCJT+6K56OrraPWTALwRiAkGNZGdYvh0ulKbvtNmAdOiSdSL/KFVvZj40ORfOy9r eQ9qo2qXkV4dmlWb8v7z5B59u/CjWTO4SxygEW2M6l3c7qnSlTbWIa/ye4Iwvou5Fg QJFyXBaO45Ft3v8eZdjqfsQnK/z66w4Og+WXs7m/jw8+mAFv3vPMfwXcMOqlZn02DT EMAR9khRgBcS431Gpg9ABwzRjUgbDgdkuJcMXZ3CLlXNXqIDEOgidP18NR16CMwPLN NWI78SxAB3h2w== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/6] accel/habanalabs: remove duplicated disable pci msg Date: Thu, 23 Mar 2023 13:35:24 +0200 Message-Id: <20230323113525.959176-5-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230323113525.959176-1-ogabbay@kernel.org> References: <20230323113525.959176-1-ogabbay@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tal Cohen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Tal Cohen The disable pci message is sent in reset device. It informs the FW not to raise more EQs. The Driver may ignore received EQs, when the device is in disabled mode. The duplication happens when hard reset is scheduled during compute reset and also performs 'escalate_reset_flow'. Signed-off-by: Tal Cohen Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/device.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index 2fb1e2ec3a83..c36de13d6729 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -1822,9 +1822,7 @@ int hl_device_reset(struct hl_device *hdev, u32 flags) dev_info(hdev->dev, "Performing hard reset scheduled during compute reset\n"); flags = hdev->reset_info.hard_reset_schedule_flags; hdev->reset_info.hard_reset_schedule_flags = 0; - hdev->disabled = true; hard_reset = true; - handle_reset_trigger(hdev, flags); goto escalate_reset_flow; } } From patchwork Thu Mar 23 11:35:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13185548 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C684BC7619A for ; Thu, 23 Mar 2023 11:35:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B7E810EA77; Thu, 23 Mar 2023 11:35:47 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B88510EA70 for ; Thu, 23 Mar 2023 11:35:40 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0C16062610; Thu, 23 Mar 2023 11:35:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4002C4339C; Thu, 23 Mar 2023 11:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679571339; bh=XxChU2DRmNqvM/7mb3Pwax4+tTIFzcoI2cT/7bhOkZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAtFyzDP4kwbywafonEtfa8DdM3iqQhIUtaTrMrWRdkMS2qOMqX/pAzRqWjqRImCh fJrfcf8aDdzFsXKRcEESSem0bSwkXnND0Xp7wI7WaXA2ZCo4OIUJvmKGG5pnErA4us VFJXEXjpal105M5B3Qqnps5PFAgoE8DlOVPn4WMAQ6uNEEY/qH94K276/GfP4Jqg28 7+vO0LpT8V4NXuWYYZ9bzWF2JE30JrZ4BObxG1hPyF6C6oiokrZW0LamSIzDW/zOxg vM3dbEQ8fvNSdTrE+8MMxK/bSUFAvauzxBIoX6xpHHSi+capPc/Ql+s6uVtorJyXXz kSpEBgplRX0Dg== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/6] accel/habanalabs: send disable pci when compute ctx is active Date: Thu, 23 Mar 2023 13:35:25 +0200 Message-Id: <20230323113525.959176-6-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230323113525.959176-1-ogabbay@kernel.org> References: <20230323113525.959176-1-ogabbay@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tal Cohen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Tal Cohen Fix an issue in hard reset flow in which the driver didn't send a disable pci message if there was an active compute context. In hard reset, disable pci message should be sent no matter if a compute context exists or not. Signed-off-by: Tal Cohen Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index c36de13d6729..3c1af9d43b65 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -1386,7 +1386,7 @@ static void handle_reset_trigger(struct hl_device *hdev, u32 flags) /* No consecutive mechanism when user context exists */ if (hdev->is_compute_ctx_active) - return; + goto disable_pci; /* * 'reset cause' is being updated here, because getting here @@ -1425,6 +1425,8 @@ static void handle_reset_trigger(struct hl_device *hdev, u32 flags) * If F/W is performing the reset, no need to send it a message to disable * PCI access */ + +disable_pci: if ((flags & HL_DRV_RESET_HARD) && !(flags & (HL_DRV_RESET_HEARTBEAT | HL_DRV_RESET_BYPASS_REQ_TO_FW))) { /* Disable PCI access from device F/W so he won't send