Merge branch 'misc.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / drivers / misc / habanalabs / goya / goya.c
index ae98719..031c184 100644 (file)
@@ -469,6 +469,8 @@ int goya_set_fixed_properties(struct hl_device *hdev)
        prop->hard_reset_done_by_fw = false;
        prop->gic_interrupts_enable = true;
 
+       prop->server_type = HL_SERVER_TYPE_UNKNOWN;
+
        return 0;
 }
 
@@ -652,14 +654,14 @@ pci_init:
                                        GOYA_BOOT_FIT_REQ_TIMEOUT_USEC);
        if (rc) {
                if (hdev->reset_on_preboot_fail)
-                       hdev->asic_funcs->hw_fini(hdev, true);
+                       hdev->asic_funcs->hw_fini(hdev, true, false);
                goto pci_fini;
        }
 
        if (goya_get_hw_state(hdev) == HL_DEVICE_HW_STATE_DIRTY) {
                dev_info(hdev->dev,
                        "H/W state is dirty, must reset before initializing\n");
-               hdev->asic_funcs->hw_fini(hdev, true);
+               hdev->asic_funcs->hw_fini(hdev, true, false);
        }
 
        if (!hdev->pldm) {
@@ -958,8 +960,9 @@ static int goya_sw_init(struct hl_device *hdev)
        hdev->supports_coresight = true;
        hdev->supports_soft_reset = true;
        hdev->allow_external_soft_reset = true;
+       hdev->supports_wait_for_multi_cs = false;
 
-       goya_set_pci_memory_regions(hdev);
+       hdev->asic_funcs->set_pci_memory_regions(hdev);
 
        return 0;
 
@@ -2377,7 +2380,7 @@ static void goya_disable_timestamp(struct hl_device *hdev)
        WREG32(mmPSOC_TIMESTAMP_BASE - CFG_BASE, 0);
 }
 
-static void goya_halt_engines(struct hl_device *hdev, bool hard_reset)
+static void goya_halt_engines(struct hl_device *hdev, bool hard_reset, bool fw_reset)
 {
        u32 wait_timeout_ms;
 
@@ -2496,6 +2499,7 @@ static void goya_init_firmware_loader(struct hl_device *hdev)
        struct fw_load_mgr *fw_loader = &hdev->fw_loader;
 
        /* fill common fields */
+       fw_loader->linux_loaded = false;
        fw_loader->boot_fit_img.image_name = GOYA_BOOT_FIT_FILE;
        fw_loader->linux_img.image_name = GOYA_LINUX_FW_FILE;
        fw_loader->cpu_timeout = GOYA_CPU_TIMEOUT_USEC;
@@ -2699,14 +2703,7 @@ disable_queues:
        return rc;
 }
 
-/*
- * goya_hw_fini - Goya hardware tear-down code
- *
- * @hdev: pointer to hl_device structure
- * @hard_reset: should we do hard reset to all engines or just reset the
- *              compute/dma engines
- */
-static void goya_hw_fini(struct hl_device *hdev, bool hard_reset)
+static void goya_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
 {
        struct goya_device *goya = hdev->asic_specific;
        u32 reset_timeout_ms, cpu_timeout_ms, status;
@@ -4800,6 +4797,12 @@ void goya_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entry)
                                >> EQ_CTL_EVENT_TYPE_SHIFT);
        struct goya_device *goya = hdev->asic_specific;
 
+       if (event_type >= GOYA_ASYNC_EVENT_ID_SIZE) {
+               dev_err(hdev->dev, "Event type %u exceeds maximum of %u",
+                               event_type, GOYA_ASYNC_EVENT_ID_SIZE - 1);
+               return;
+       }
+
        goya->events_stat[event_type]++;
        goya->events_stat_aggregate[event_type]++;
 
@@ -5478,14 +5481,14 @@ u64 goya_get_device_time(struct hl_device *hdev)
        return device_time | RREG32(mmPSOC_TIMESTAMP_CNTCVL);
 }
 
-static void goya_collective_wait_init_cs(struct hl_cs *cs)
+static int goya_collective_wait_init_cs(struct hl_cs *cs)
 {
-
+       return 0;
 }
 
 static int goya_collective_wait_create_jobs(struct hl_device *hdev,
                struct hl_ctx *ctx, struct hl_cs *cs, u32 wait_queue_id,
-               u32 collective_engine_id)
+               u32 collective_engine_id, u32 encaps_signal_offset)
 {
        return -EINVAL;
 }
@@ -5573,6 +5576,16 @@ static void goya_state_dump_init(struct hl_device *hdev)
        hdev->state_dump_specs.funcs = goya_state_dump_funcs;
 }
 
+static u32 goya_get_sob_addr(struct hl_device *hdev, u32 sob_id)
+{
+       return 0;
+}
+
+static u32 *goya_get_stream_master_qid_arr(void)
+{
+       return NULL;
+}
+
 static const struct hl_asic_funcs goya_funcs = {
        .early_init = goya_early_init,
        .early_fini = goya_early_fini,
@@ -5660,6 +5673,9 @@ static const struct hl_asic_funcs goya_funcs = {
        .init_firmware_loader = goya_init_firmware_loader,
        .init_cpu_scrambler_dram = goya_cpu_init_scrambler_dram,
        .state_dump_init = goya_state_dump_init,
+       .get_sob_addr = &goya_get_sob_addr,
+       .set_pci_memory_regions = goya_set_pci_memory_regions,
+       .get_stream_master_qid_arr = goya_get_stream_master_qid_arr,
 };
 
 /*