Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2010530lqb; Mon, 27 May 2024 05:13:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3xMa6AvVG2OJiFTLPsQqQxxSSAWmsqzxesMBm64daeabIFFpAWtJJy39wmFmPEp8TSL/XZjMwxsoB+PtW3vzMHEN2ipO5NaRJBHvLig== X-Google-Smtp-Source: AGHT+IEWBxuos24s+tc2BQmP5469t0w7zob5b9Kf2ZNt5E2iXmAVPwnKnz/Rmb9aWzb6bwIaM4N1 X-Received: by 2002:a50:f60d:0:b0:574:c3e4:1fa3 with SMTP id 4fb4d7f45d1cf-57857e0f3a5mr6132951a12.20.1716812026842; Mon, 27 May 2024 05:13:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716812026; cv=pass; d=google.com; s=arc-20160816; b=xb3XmJaRh+KJzMK5d8rcof9V+l6gCoaazQ/N7Y1Z9BLRV8yfGh2/3Ece9h2NxJH5Ao hgcAQfL0RWvDt8MMMNb5hzDch+5wH3TLu4c5xn670yX6oJF4HMqJXHj6sHDoW7/4qjyd B8b0Bhe3BcHHm6B1mArNil9y8cSjKydgxz6UV/BbzCN1ulKwi8xLMeZWBiro8fzuiyfr YDBcA8/zXOEUlpP1hY3hbCvw4pf1o9BAUwI1k/9HiyvhinbA/Q1KraUyJBWZzKxZtc3y r14GszNA2i8b0fUuinM1wP9dvRMu2B9pLW0pU7GxFiCIXTJmmUV+CCqRvc/+T4r0xv9r T+Mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4mv1zdiWD2MnmNKadXPq96zfKDU4Vctuu68STsY27h0=; fh=V54BVPs49mTldOrR7dHX4twJjw0Ji4qGRFqX5qRehjA=; b=K7Dgv3ZPtqopQ3gDh/oPjqn9EG2wV/WH2r6OULhOg5IV195cvNRR2TOUXLxZAE0rw6 JJ+YhYoqKnD/qvNxLPx/0bWKMneMsspgDkQii0WAiTfw8vrjWr3Q7DA9BTFNbGwTqpIW jaT8xlbfrgTVqh4UYaF7Otg3jPJuee4ug01k/wtQ5i5FJB5tVZHEkKvioj0eYQeDgU47 1ve8M+eEOYb+gPKYl+NRni4P1phVtqjgANLwiIfGnLpitqA0p/imi1Nh4yD6FzT1EfMJ 94BXr17m1JrIfqEbdalrToNRwQX5jqt215L8eGuSR6grGkvLOMGcH+7AaM8dhHIeruDc YyPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@habana.ai header.s=default header.b=LcQCWYKU; arc=pass (i=1 spf=pass spfdomain=habana.ai dkim=pass dkdomain=habana.ai dmarc=pass fromdomain=habana.ai); spf=pass (google.com: domain of linux-kernel+bounces-190542-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=habana.ai Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5786294728esi3276708a12.351.2024.05.27.05.13.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 05:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190542-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@habana.ai header.s=default header.b=LcQCWYKU; arc=pass (i=1 spf=pass spfdomain=habana.ai dkim=pass dkdomain=habana.ai dmarc=pass fromdomain=habana.ai); spf=pass (google.com: domain of linux-kernel+bounces-190542-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=habana.ai Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 673E91F21EDB for ; Mon, 27 May 2024 12:13:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CA9615ECC0; Mon, 27 May 2024 12:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=habana.ai header.i=@habana.ai header.b="LcQCWYKU" Received: from mail02.habana.ai (habanamailrelay.habana.ai [213.57.90.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFAD615DBC7 for ; Mon, 27 May 2024 12:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.57.90.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716811994; cv=none; b=fu1P7VGlIYX/7VVQhOJ0CQwVGO84i/hwjy3tcSzS8YTJMbfuNDvhx/CEkaiBPdILXM8CxnTYvmwfl71Ak8btW/Q9QKEKU1mC9TvSivKBHTj3MpfaoIBAfyYDausNK99bkfbtWP5zq/6lUeO3qBlOhF6oSFxFBp1+cms1qv6qz6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716811994; c=relaxed/simple; bh=6fkm+Ekorc42aQ0DgvCRfc8pbcF22Uheaaz/c06hl/o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xi8cUKB9Puw5LIM2GEijOxELy00sKaTFB3+QT317VLoH7j1ZAxF0L0MotA3tj6BRtHjYVO1ArbhUZThX+QKtbgGGOmZo4TJRY5sdB/rNBfnT2UKisp7UgLb2ZJ6EAwAtbZnhw+D4XlxUm+u2PwAERR6rdcTMqNxuSGSafv2E5WQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=habana.ai; spf=pass smtp.mailfrom=habana.ai; dkim=pass (2048-bit key) header.d=habana.ai header.i=@habana.ai header.b=LcQCWYKU; arc=none smtp.client-ip=213.57.90.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=habana.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=habana.ai Received: internal info suppressed DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=habana.ai; s=default; t=1716811993; bh=6fkm+Ekorc42aQ0DgvCRfc8pbcF22Uheaaz/c06hl/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LcQCWYKUKob8FxyRRMksHjTJjtqkXFFJhp0EEZg6JpkjOSenDkGStR7NJby89TSSW TZanMV8UbA1hd9R1uTK620Eodt+tA4htDm3++AatDc1Idwd/T5a9c+ecMIaVvDEQzM 6OUfr9X5A+ubbdKNT5hJNMwaDCWF44tzGAreq4dO9r/fDNVI5YZdfuoOJnZNt2Ezxt xwtjGmr67clZlMO39sCnM+l6YHT4GSFHgonr1XWW6qpKog+M3hcpwVv9fAJK0ryIfo AebwE8OVcR7ZaAto8gIq2gQcS9APkf/mdB/5YdF0tLI1185ouPvO8nYq8t/55TyW7F r2/HVYSqr0qQg== Received: from obitton-vm-u22.habana-labs.com (localhost [127.0.0.1]) by obitton-vm-u22.habana-labs.com (8.15.2/8.15.2/Debian-22ubuntu3) with ESMTP id 44RCCuas1921351; Mon, 27 May 2024 15:12:57 +0300 From: Ofir Bitton To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Farah Kassabri Subject: [PATCH 2/8] accel/habanalabs: check for errors after preboot is ready Date: Mon, 27 May 2024 15:12:48 +0300 Message-Id: <20240527121254.1921306-2-obitton@habana.ai> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527121254.1921306-1-obitton@habana.ai> References: <20240527121254.1921306-1-obitton@habana.ai> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Farah Kassabri Driver should check and report any fatal errors detected by preboot, before it attempts to load the boot fit. Some errors may cause the driver to stop the boot process and mark the device as unusable. This check will allow the driver to fail and print the error reported by preboot and skip the time wasting attempt of trying to load the boot fit, which will fail due to the error. Signed-off-by: Farah Kassabri Reviewed-by: Ofir Bitton --- drivers/accel/habanalabs/common/firmware_if.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/accel/habanalabs/common/firmware_if.c b/drivers/accel/habanalabs/common/firmware_if.c index 886b3c07503d..6f0c40b12072 100644 --- a/drivers/accel/habanalabs/common/firmware_if.c +++ b/drivers/accel/habanalabs/common/firmware_if.c @@ -1482,7 +1482,7 @@ int hl_fw_wait_preboot_ready(struct hl_device *hdev) { struct pre_fw_load_props *pre_fw_load = &hdev->fw_loader.pre_fw_load; u32 status = 0, timeout; - int rc, tries = 1; + int rc, tries = 1, fw_err = 0; bool preboot_still_runs; /* Need to check two possible scenarios: @@ -1522,18 +1522,18 @@ int hl_fw_wait_preboot_ready(struct hl_device *hdev) } } - if (rc) { + /* If we read all FF, then something is totally wrong, no point + * of reading specific errors + */ + if (status != -1) + fw_err = fw_read_errors(hdev, pre_fw_load->boot_err0_reg, + pre_fw_load->boot_err1_reg, + pre_fw_load->sts_boot_dev_sts0_reg, + pre_fw_load->sts_boot_dev_sts1_reg); + if (rc || fw_err) { detect_cpu_boot_status(hdev, status); - dev_err(hdev->dev, "CPU boot ready timeout (status = %d)\n", status); - - /* If we read all FF, then something is totally wrong, no point - * of reading specific errors - */ - if (status != -1) - fw_read_errors(hdev, pre_fw_load->boot_err0_reg, - pre_fw_load->boot_err1_reg, - pre_fw_load->sts_boot_dev_sts0_reg, - pre_fw_load->sts_boot_dev_sts1_reg); + dev_err(hdev->dev, "CPU boot %s (status = %d)\n", + fw_err ? "failed due to an error" : "ready timeout", status); return -EIO; } -- 2.34.1