* [PATCH 1/4] habanalabs: ignore device unusable status
@ 2021-05-02 15:51 Oded Gabbay
2021-05-02 15:51 ` [PATCH 2/4] habanalabs: add missing space after casting Oded Gabbay
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Oded Gabbay @ 2021-05-02 15:51 UTC (permalink / raw)
To: linux-kernel
Some users might want to implement their own policy of when the device
is unusable so we need to ignore this status in the driver and continue
loading as normal.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/misc/habanalabs/common/firmware_if.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
index fc10cc06f401..a265753f2a53 100644
--- a/drivers/misc/habanalabs/common/firmware_if.c
+++ b/drivers/misc/habanalabs/common/firmware_if.c
@@ -441,9 +441,9 @@ static int fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg,
}
if (err_val & CPU_BOOT_ERR0_DEVICE_UNUSABLE_FAIL) {
- dev_err(hdev->dev,
- "Device boot error - device unusable\n");
- err_exists = true;
+ /* Ignore this bit, don't prevent driver loading */
+ dev_dbg(hdev->dev, "device unusable status is set\n");
+ err_val &= ~CPU_BOOT_ERR0_DEVICE_UNUSABLE_FAIL;
}
security_val = RREG32(cpu_security_boot_status_reg);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/4] habanalabs: add missing space after casting
2021-05-02 15:51 [PATCH 1/4] habanalabs: ignore device unusable status Oded Gabbay
@ 2021-05-02 15:51 ` Oded Gabbay
2021-05-02 15:51 ` [PATCH 3/4] habanalabs: better error print for pin failure Oded Gabbay
2021-05-02 15:51 ` [PATCH 4/4] habanalabs: set dma mask from fw once fw done iatu config Oded Gabbay
2 siblings, 0 replies; 4+ messages in thread
From: Oded Gabbay @ 2021-05-02 15:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Omer Shpigelman
From: Omer Shpigelman <oshpigelman@habana.ai>
Change casting code according to kernel coding style.
Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/misc/habanalabs/common/habanalabs_ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
index 33841c272eb6..6604d30246e6 100644
--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
@@ -95,7 +95,7 @@ static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args)
hw_ip.first_available_interrupt_id =
prop->first_available_user_msix_interrupt;
return copy_to_user(out, &hw_ip,
- min((size_t)size, sizeof(hw_ip))) ? -EFAULT : 0;
+ min((size_t) size, sizeof(hw_ip))) ? -EFAULT : 0;
}
static int hw_events_info(struct hl_device *hdev, bool aggregate,
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/4] habanalabs: better error print for pin failure
2021-05-02 15:51 [PATCH 1/4] habanalabs: ignore device unusable status Oded Gabbay
2021-05-02 15:51 ` [PATCH 2/4] habanalabs: add missing space after casting Oded Gabbay
@ 2021-05-02 15:51 ` Oded Gabbay
2021-05-02 15:51 ` [PATCH 4/4] habanalabs: set dma mask from fw once fw done iatu config Oded Gabbay
2 siblings, 0 replies; 4+ messages in thread
From: Oded Gabbay @ 2021-05-02 15:51 UTC (permalink / raw)
To: linux-kernel
Print the user given pointer and error code on failure to get user
pages for easier debugging.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/misc/habanalabs/common/memory.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index 43924e1c0315..a7a8984e6af2 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -1612,7 +1612,8 @@ static int get_user_memory(struct hl_device *hdev, u64 addr, u64 size,
if (rc != npages) {
dev_err(hdev->dev,
- "Failed to map host memory, user ptr probably wrong\n");
+ "Failed (%d) to pin host memory with user ptr 0x%llx\n",
+ rc, addr);
if (rc < 0)
goto destroy_pages;
npages = rc;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/4] habanalabs: set dma mask from fw once fw done iatu config
2021-05-02 15:51 [PATCH 1/4] habanalabs: ignore device unusable status Oded Gabbay
2021-05-02 15:51 ` [PATCH 2/4] habanalabs: add missing space after casting Oded Gabbay
2021-05-02 15:51 ` [PATCH 3/4] habanalabs: better error print for pin failure Oded Gabbay
@ 2021-05-02 15:51 ` Oded Gabbay
2 siblings, 0 replies; 4+ messages in thread
From: Oded Gabbay @ 2021-05-02 15:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Ohad Sharabi
From: Ohad Sharabi <osharabi@habana.ai>
When setting "DMA mask from FW" we are reading PSOC_GLOBAL_CONF register
which is allowed only once FW has done it's iATU configuration.
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/common/pci/pci.c | 10 ++++++----
drivers/misc/habanalabs/gaudi/gaudi.c | 4 +---
drivers/misc/habanalabs/goya/goya.c | 4 +---
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/habanalabs/common/pci/pci.c b/drivers/misc/habanalabs/common/pci/pci.c
index 8e7982be6191..d5bedf5ba011 100644
--- a/drivers/misc/habanalabs/common/pci/pci.c
+++ b/drivers/misc/habanalabs/common/pci/pci.c
@@ -421,6 +421,12 @@ int hl_pci_init(struct hl_device *hdev)
goto unmap_pci_bars;
}
+ /* Driver must sleep in order for FW to finish the iATU configuration */
+ if (hdev->asic_prop.iatu_done_by_fw) {
+ usleep_range(2000, 3000);
+ hdev->asic_funcs->set_dma_mask_from_fw(hdev);
+ }
+
rc = dma_set_mask_and_coherent(&pdev->dev,
DMA_BIT_MASK(hdev->dma_mask));
if (rc) {
@@ -430,10 +436,6 @@ int hl_pci_init(struct hl_device *hdev)
goto unmap_pci_bars;
}
- /* Driver must sleep in order for FW to finish the iATU configuration */
- if (hdev->asic_prop.iatu_done_by_fw)
- usleep_range(2000, 3000);
-
return 0;
unmap_pci_bars:
diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 683793c68e83..6c38009d6db7 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -600,10 +600,8 @@ static int gaudi_init_iatu(struct hl_device *hdev)
struct hl_outbound_pci_region outbound_region;
int rc;
- if (hdev->asic_prop.iatu_done_by_fw) {
- hdev->asic_funcs->set_dma_mask_from_fw(hdev);
+ if (hdev->asic_prop.iatu_done_by_fw)
return 0;
- }
/* Inbound Region 0 - Bar 0 - Point to SRAM + CFG */
inbound_region.mode = PCI_BAR_MATCH_MODE;
diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index ef0e3f7965cd..3b995e354c50 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -532,10 +532,8 @@ static int goya_init_iatu(struct hl_device *hdev)
struct hl_outbound_pci_region outbound_region;
int rc;
- if (hdev->asic_prop.iatu_done_by_fw) {
- hdev->asic_funcs->set_dma_mask_from_fw(hdev);
+ if (hdev->asic_prop.iatu_done_by_fw)
return 0;
- }
/* Inbound Region 0 - Bar 0 - Point to SRAM and CFG */
inbound_region.mode = PCI_BAR_MATCH_MODE;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-02 15:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-02 15:51 [PATCH 1/4] habanalabs: ignore device unusable status Oded Gabbay
2021-05-02 15:51 ` [PATCH 2/4] habanalabs: add missing space after casting Oded Gabbay
2021-05-02 15:51 ` [PATCH 3/4] habanalabs: better error print for pin failure Oded Gabbay
2021-05-02 15:51 ` [PATCH 4/4] habanalabs: set dma mask from fw once fw done iatu config Oded Gabbay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox