summaryrefslogtreecommitdiffstats
path: root/drivers/misc/habanalabs/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/habanalabs/common')
-rw-r--r--drivers/misc/habanalabs/common/device.c3
-rw-r--r--drivers/misc/habanalabs/common/habanalabs.h25
-rw-r--r--drivers/misc/habanalabs/common/habanalabs_drv.c14
-rw-r--r--drivers/misc/habanalabs/common/pci/pci.c24
4 files changed, 23 insertions, 43 deletions
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 5b345fc3dcc1..4b6b6ba5b2fa 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -348,8 +348,7 @@ static void hpriv_release(struct kref *ref)
list_del(&hpriv->dev_node);
mutex_unlock(&hdev->fpriv_list_lock);
- if ((hdev->reset_if_device_not_idle && !device_is_idle) ||
- hdev->reset_upon_device_release) {
+ if (!device_is_idle || hdev->reset_upon_device_release) {
hl_device_reset(hdev, HL_DRV_RESET_DEV_RELEASE);
} else {
int rc = hdev->asic_funcs->scrub_device_mem(hdev);
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index fbe4face2ed1..6a552aa66c4e 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -2968,7 +2968,6 @@ struct hl_reset_info {
* @disabled: is device disabled.
* @late_init_done: is late init stage was done during initialization.
* @hwmon_initialized: is H/W monitor sensors was initialized.
- * @heartbeat: is heartbeat sanity check towards CPU-CP enabled.
* @reset_on_lockup: true if a reset should be done in case of stuck CS, false
* otherwise.
* @dram_default_page_mapping: is DRAM default page mapping enabled.
@@ -3001,6 +3000,21 @@ struct hl_reset_info {
* @is_compute_ctx_active: Whether there is an active compute context executing.
* @compute_ctx_in_release: true if the current compute context is being released.
* @supports_mmu_prefetch: true if prefetch is supported, otherwise false.
+ * @reset_upon_device_release: reset the device when the user closes the file descriptor of the
+ * device.
+ * @nic_ports_mask: Controls which NIC ports are enabled. Used only for testing.
+ * @fw_components: Controls which f/w components to load to the device. There are multiple f/w
+ * stages and sometimes we want to stop at a certain stage. Used only for testing.
+ * @mmu_enable: Whether to enable or disable the device MMU(s). Used only for testing.
+ * @cpu_queues_enable: Whether to enable queues communication vs. the f/w. Used only for testing.
+ * @pldm: Whether we are running in Palladium environment. Used only for testing.
+ * @hard_reset_on_fw_events: Whether to do device hard-reset when a fatal event is received from
+ * the f/w. Used only for testing.
+ * @bmc_enable: Whether we are running in a box with BMC. Used only for testing.
+ * @reset_on_preboot_fail: Whether to reset the device if preboot f/w fails to load.
+ * Used only for testing.
+ * @heartbeat: Controls if we want to enable the heartbeat mechanism vs. the f/w, which verifies
+ * that the f/w is always alive. Used only for testing.
*/
struct hl_device {
struct pci_dev *pdev;
@@ -3108,7 +3122,6 @@ struct hl_device {
u8 disabled;
u8 late_init_done;
u8 hwmon_initialized;
- u8 heartbeat;
u8 reset_on_lockup;
u8 dram_default_page_mapping;
u8 memory_scrub;
@@ -3132,22 +3145,18 @@ struct hl_device {
u8 is_compute_ctx_active;
u8 compute_ctx_in_release;
u8 supports_mmu_prefetch;
+ u8 reset_upon_device_release;
/* Parameters for bring-up */
u64 nic_ports_mask;
u64 fw_components;
u8 mmu_enable;
- u8 mmu_huge_page_opt;
- u8 reset_pcilink;
u8 cpu_queues_enable;
u8 pldm;
- u8 sram_scrambler_enable;
- u8 dram_scrambler_enable;
u8 hard_reset_on_fw_events;
u8 bmc_enable;
u8 reset_on_preboot_fail;
- u8 reset_upon_device_release;
- u8 reset_if_device_not_idle;
+ u8 heartbeat;
};
diff --git a/drivers/misc/habanalabs/common/habanalabs_drv.c b/drivers/misc/habanalabs/common/habanalabs_drv.c
index 3a41dbef14f8..7362387bdd80 100644
--- a/drivers/misc/habanalabs/common/habanalabs_drv.c
+++ b/drivers/misc/habanalabs/common/habanalabs_drv.c
@@ -280,19 +280,15 @@ out_err:
static void set_driver_behavior_per_device(struct hl_device *hdev)
{
- hdev->pldm = 0;
+ hdev->nic_ports_mask = 0;
hdev->fw_components = FW_TYPE_ALL_TYPES;
- hdev->cpu_queues_enable = 1;
- hdev->heartbeat = 1;
hdev->mmu_enable = 1;
- hdev->sram_scrambler_enable = 1;
- hdev->dram_scrambler_enable = 1;
- hdev->bmc_enable = 1;
+ hdev->cpu_queues_enable = 1;
+ hdev->pldm = 0;
hdev->hard_reset_on_fw_events = 1;
+ hdev->bmc_enable = 1;
hdev->reset_on_preboot_fail = 1;
- hdev->reset_if_device_not_idle = 1;
-
- hdev->reset_pcilink = 0;
+ hdev->heartbeat = 1;
}
static void copy_kernel_module_params_to_device(struct hl_device *hdev)
diff --git a/drivers/misc/habanalabs/common/pci/pci.c b/drivers/misc/habanalabs/common/pci/pci.c
index af0f58e75c9a..5fe3da5fba30 100644
--- a/drivers/misc/habanalabs/common/pci/pci.c
+++ b/drivers/misc/habanalabs/common/pci/pci.c
@@ -225,27 +225,6 @@ int hl_pci_iatu_write(struct hl_device *hdev, u32 addr, u32 data)
}
/**
- * hl_pci_reset_link_through_bridge() - Reset PCI link.
- * @hdev: Pointer to hl_device structure.
- */
-static void hl_pci_reset_link_through_bridge(struct hl_device *hdev)
-{
- struct pci_dev *pdev = hdev->pdev;
- struct pci_dev *parent_port;
- u16 val;
-
- parent_port = pdev->bus->self;
- pci_read_config_word(parent_port, PCI_BRIDGE_CONTROL, &val);
- val |= PCI_BRIDGE_CTL_BUS_RESET;
- pci_write_config_word(parent_port, PCI_BRIDGE_CONTROL, val);
- ssleep(1);
-
- val &= ~(PCI_BRIDGE_CTL_BUS_RESET);
- pci_write_config_word(parent_port, PCI_BRIDGE_CONTROL, val);
- ssleep(3);
-}
-
-/**
* hl_pci_set_inbound_region() - Configure inbound region
* @hdev: Pointer to hl_device structure.
* @region: Inbound region number.
@@ -394,9 +373,6 @@ int hl_pci_init(struct hl_device *hdev)
struct pci_dev *pdev = hdev->pdev;
int rc;
- if (hdev->reset_pcilink)
- hl_pci_reset_link_through_bridge(hdev);
-
rc = pci_enable_device_mem(pdev);
if (rc) {
dev_err(hdev->dev, "can't enable PCI device\n");