Skip to content

Commit 610b5d2

Browse files
committed
Revert "accel/ivpu: Use cached buffers for FW loading"
This reverts commit 645d694. The commit cause issues with memory access from the device side. Switch back to write-combined memory mappings until the issues will be properly addressed. Add extra wmb() needed when boot_params->save_restore_ret_address() is modified. Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231017121353.532466-1-stanislaw.gruszka@linux.intel.com
1 parent 828d630 commit 610b5d2

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

drivers/accel/ivpu/ivpu_fw.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)
220220
if (ret)
221221
return ret;
222222

223-
fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size,
224-
DRM_IVPU_BO_CACHED | DRM_IVPU_BO_NOSNOOP);
223+
fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, DRM_IVPU_BO_WC);
225224
if (!fw->mem) {
226225
ivpu_err(vdev, "Failed to allocate firmware runtime memory\n");
227226
return -ENOMEM;
@@ -331,7 +330,7 @@ int ivpu_fw_load(struct ivpu_device *vdev)
331330
memset(start, 0, size);
332331
}
333332

334-
clflush_cache_range(fw->mem->kvaddr, fw->mem->base.size);
333+
wmb(); /* Flush WC buffers after writing fw->mem */
335334

336335
return 0;
337336
}
@@ -433,7 +432,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
433432
if (!ivpu_fw_is_cold_boot(vdev)) {
434433
boot_params->save_restore_ret_address = 0;
435434
vdev->pm->is_warmboot = true;
436-
clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K);
435+
wmb(); /* Flush WC buffers after writing save_restore_ret_address */
437436
return;
438437
}
439438

@@ -495,7 +494,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
495494
boot_params->punit_telemetry_sram_size = ivpu_hw_reg_telemetry_size_get(vdev);
496495
boot_params->vpu_telemetry_enable = ivpu_hw_reg_telemetry_enable_get(vdev);
497496

498-
clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K);
497+
wmb(); /* Flush WC buffers after writing bootparams */
499498

500499
ivpu_fw_boot_params_print(vdev, boot_params);
501500
}

drivers/accel/ivpu/ivpu_gem.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include <drm/drm_gem.h>
99
#include <drm/drm_mm.h>
1010

11-
#define DRM_IVPU_BO_NOSNOOP 0x10000000
12-
1311
struct dma_buf;
1412
struct ivpu_bo_ops;
1513
struct ivpu_file_priv;
@@ -85,9 +83,6 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo)
8583

8684
static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo)
8785
{
88-
if (bo->flags & DRM_IVPU_BO_NOSNOOP)
89-
return false;
90-
9186
return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED;
9287
}
9388

0 commit comments

Comments
 (0)