Skip to contentSkip to conversation

habanalabs: failure to open device due to reset is debug level

PATCH New Oded Gabbay 1 participant 2 messages Sep 19, 2022 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 habanalabs: failure to open device due to reset is debug level

If the user wants to open the device, and the device is currently in reset, the user will get an error from the open().

We don't need to display an error in the dmesg for that as it is not a real error and we can spam the kernel log with this message.

---
 drivers/misc/habanalabs/common/habanalabs_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/common/habanalabs_drv.c +2 -2
index 5250bfb6790e..112632afe7d5 100644
@@ -161,7 +161,7 @@ int hl_device_open(struct inode *inode, struct file *filp)
 	mutex_lock(&hdev->fpriv_list_lock);
 
 	if (!hl_device_operational(hdev, &status)) {
-		dev_err_ratelimited(hdev->dev,
+		dev_dbg_ratelimited(hdev->dev,
 			"Can't open %s because it is %s\n",
 			dev_name(hdev->dev), hdev->status[status]);
 
@@ -271,7 +271,7 @@ int hl_device_open_ctrl(struct inode *inode, struct file *filp)
 	mutex_lock(&hdev->fpriv_ctrl_list_lock);
 
 	if (!hl_device_operational(hdev, NULL)) {
-		dev_err_ratelimited(hdev->dev_ctrl,
+		dev_dbg_ratelimited(hdev->dev_ctrl,
 			"Can't open %s because it is disabled or in reset\n",
 			dev_name(hdev->dev_ctrl));
 		rc = -EPERM;
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 habanalabs/gaudi2: allow user to flush PCIE by read

From: Ofir Bitton <[email protected]>

In order for the user to flush PCIE he needs to read some register from PCIE block. The chosen register is SPECIAL_GLBL_SPARE_0 and hence needs to be unsecured.

---
 .../misc/habanalabs/gaudi2/gaudi2_security.c  |   7 +-
 .../include/gaudi2/asic_reg/gaudi2_regs.h     |   1 +
 .../gaudi2/asic_reg/pcie_wrap_special_regs.h  | 185 ++++++++++++++++++
 3 files changed, 192 insertions(+), 1 deletion(-)
 create mode 100644 drivers/misc/habanalabs/include/gaudi2/asic_reg/pcie_wrap_special_regs.h
drivers/misc/habanalabs/gaudi2/gaudi2_security.c +6 -1
index c4165db06db2..c6906fb14229 100644
@@ -2559,6 +2559,10 @@ static const u32 gaudi2_pb_pcie[] = {
 	mmPCIE_WRAP_BASE,
 };
 
+static const u32 gaudi2_pb_pcie_unsecured_regs[] = {
+	mmPCIE_WRAP_SPECIAL_GLBL_SPARE_0,
+};
+
 static const u32 gaudi2_pb_thermal_sensor0[] = {
 	mmDCORE0_XFT_BASE,
 	mmDCORE0_TSTDVS_BASE,
@@ -3418,7 +3422,8 @@ static int gaudi2_init_protection_bits(struct hl_device *hdev)
 	rc |= hl_init_pb(hdev, HL_PB_SHARED, HL_PB_NA,
 			HL_PB_SINGLE_INSTANCE, HL_PB_NA,
 			gaudi2_pb_pcie, ARRAY_SIZE(gaudi2_pb_pcie),
-			NULL, HL_PB_NA);
+			gaudi2_pb_pcie_unsecured_regs,
+			ARRAY_SIZE(gaudi2_pb_pcie_unsecured_regs));
 
 	/* Thermal Sensor.
 	 * Skip when security is enabled in F/W, because the blocks are protected by privileged RR.
drivers/misc/habanalabs/include/gaudi2/asic_reg/gaudi2_regs.h +1 -0
index bfda4223bdc8..6aa1b1412462 100644
@@ -132,6 +132,7 @@
 #include "dcore0_mme_ctrl_lo_arch_tensor_a_regs.h"
 #include "dcore0_mme_ctrl_lo_arch_tensor_b_regs.h"
 #include "dcore0_mme_ctrl_lo_arch_tensor_cout_regs.h"
+#include "pcie_wrap_special_regs.h"
 
 #include "pdma0_qm_masks.h"
 #include "pdma0_core_masks.h"
drivers/misc/habanalabs/include/gaudi2/asic_reg/pcie_wrap_special_regs.h new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
2.25.1