mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Ohad Sharabi <osharabi@habana.ai>
Subject: [PATCH 2/8] habanalabs/gaudi: read div_sel value from firmware
Date: Sun, 31 Jul 2022 13:50:31 +0300	[thread overview]
Message-ID: <20220731105037.545106-2-ogabbay@kernel.org> (raw)
In-Reply-To: <20220731105037.545106-1-ogabbay@kernel.org>

From: Ohad Sharabi <osharabi@habana.ai>

Even when running with unsecured f/w, we should read the PLL div_sel
value from the f/w as this register is always privileged.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/misc/habanalabs/gaudi/gaudi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 866dc4b891d6..7f52935dc603 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -899,12 +899,13 @@ static int gaudi_early_fini(struct hl_device *hdev)
  */
 static int gaudi_fetch_psoc_frequency(struct hl_device *hdev)
 {
-	struct asic_fixed_properties *prop = &hdev->asic_prop;
 	u32 nr = 0, nf = 0, od = 0, div_fctr = 0, pll_clk, div_sel;
+	struct asic_fixed_properties *prop = &hdev->asic_prop;
 	u16 pll_freq_arr[HL_PLL_NUM_OUTPUTS], freq;
 	int rc;
 
-	if (hdev->asic_prop.fw_security_enabled) {
+	if ((hdev->fw_components & FW_TYPE_LINUX) &&
+			(prop->fw_app_cpu_boot_dev_sts0 & CPU_BOOT_DEV_STS0_PLL_INFO_EN)) {
 		struct gaudi_device *gaudi = hdev->asic_specific;
 
 		if (!(gaudi->hw_cap_initialized & HW_CAP_CPU_Q))
-- 
2.25.1


  reply	other threads:[~2022-07-31 10:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31 10:50 [PATCH 1/8] habanalabs/gaudi: fix print format for div_sel Oded Gabbay
2022-07-31 10:50 ` Oded Gabbay [this message]
2022-07-31 10:50 ` [PATCH 3/8] habanalabs: fix command submission sanity check Oded Gabbay
2022-07-31 10:50 ` [PATCH 4/8] habanalabs: avoid returning a valid handle if map_block() fails Oded Gabbay
2022-07-31 10:50 ` [PATCH 5/8] habanalabs: fix vma fields assignments order in hl_hw_block_mmap() Oded Gabbay
2022-07-31 10:50 ` [PATCH 6/8] habanalabs: add a missing lock for in_reset indication Oded Gabbay
2022-07-31 10:50 ` [PATCH 7/8] habanalabs/uapi: move defines to better place inside file Oded Gabbay
2022-07-31 10:50 ` [PATCH 8/8] habanalabs: move common function out of debugfs.c Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220731105037.545106-2-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osharabi@habana.ai \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome