Revert "accel/ivpu: Use cached buffers for FW loading"
PATCH 1/1 Revert "accel/ivpu: Use cached buffers for FW loading"
This reverts commit 645d694559cab36fe6a57c717efcfa27d9321396.
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 <[email protected]>
Signed-off-by Stanislaw Gruszka <[email protected]>
--- drivers/accel/ivpu/ivpu_fw.c | 9 ++++----- drivers/accel/ivpu/ivpu_gem.h | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/accel/ivpu/ivpu_fw.c +4 -5
@@ -220,8 +220,7 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)if (ret)return ret; - fw->mem =ivpu_bo_alloc_internal (vdev, fw->runtime_addr, fw->runtime_size, -DRM_IVPU_BO_CACHED |DRM_IVPU_BO_NOSNOOP ); + fw->mem =ivpu_bo_alloc_internal (vdev, fw->runtime_addr, fw->runtime_size,DRM_IVPU_BO_WC );if (!fw->mem) {ivpu_err (vdev,"Failed to allocate firmware runtime memory\n" );return -ENOMEM ;
@@ -331,7 +330,7 @@ int ivpu_fw_load(struct ivpu_device *vdev)memset (start,0 , size); } -clflush_cache_range (fw->mem->kvaddr, fw->mem->base.size); +wmb ();/* Flush WC buffers after writing fw->mem */ return 0 ; }
@@ -433,7 +432,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_paramsif (!ivpu_fw_is_cold_boot (vdev)) { boot_params->save_restore_ret_address =0 ; vdev->pm->is_warmboot = true; -clflush_cache_range (vdev->fw->mem->kvaddr,SZ_4K ); +wmb ();/* Flush WC buffers after writing save_restore_ret_address */ return ; }
@@ -495,7 +494,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params boot_params->punit_telemetry_sram_size =ivpu_hw_reg_telemetry_size_get (vdev); boot_params->vpu_telemetry_enable =ivpu_hw_reg_telemetry_enable_get (vdev); -clflush_cache_range (vdev->fw->mem->kvaddr,SZ_4K ); +wmb ();/* Flush WC buffers after writing bootparams */ ivpu_fw_boot_params_print (vdev, boot_params); }
drivers/accel/ivpu/ivpu_gem.h +0 -5
@@ -8,8 +8,6 @@#include <drm/drm_gem.h> #include <drm/drm_mm.h> -#define DRM_IVPU_BO_NOSNOOP 0x10000000 -struct dma_buf ;struct ivpu_bo_ops ;struct ivpu_file_priv ;
@@ -85,9 +83,6 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo)static inline bool ivpu_bo_is_snooped (struct ivpu_bo *bo) { -if (bo->flags &DRM_IVPU_BO_NOSNOOP ) -return false; -return ivpu_bo_cache_mode (bo) ==DRM_IVPU_BO_CACHED ; }
Signature · 1 line
2.25.1
Stanislaw Gruszka
AppliedQuoted 11 lines · Stanislaw Gruszka
This reverts commit
645d694559cab36fe6a57c717efcfa27d9321396.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 whenboot_params->save_restore_ret_address()is modified.Reviewed-by Karol Wachowski <[email protected]>Signed-off-by Stanislaw Gruszka <[email protected]>
Applied to drm-misc-fixes
Thanks
Stanislaw
Quoted 72 lines
--- drivers/accel/ivpu/ivpu_fw.c | 9 ++++----- drivers/accel/ivpu/ivpu_gem.h | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-)drivers/accel/ivpu/ivpu_fw.c +4
-5@@ -220,8 +220,7 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)if (ret)return ret; - fw->mem =ivpu_bo_alloc_internal (vdev, fw->runtime_addr, fw->runtime_size, -DRM_IVPU_BO_CACHED |DRM_IVPU_BO_NOSNOOP ); + fw->mem =ivpu_bo_alloc_internal (vdev, fw->runtime_addr, fw->runtime_size,DRM_IVPU_BO_WC );if (!fw->mem) {ivpu_err (vdev,"Failed to allocate firmware runtime memory\n" );return -ENOMEM ;@@ -331,7 +330,7 @@ int ivpu_fw_load(struct ivpu_device *vdev)memset (start,0 , size); } -clflush_cache_range (fw->mem->kvaddr, fw->mem->base.size); +wmb ();/* Flush WC buffers after writing fw->mem */ return 0 ; }@@ -433,7 +432,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_paramsif (!ivpu_fw_is_cold_boot (vdev)) { boot_params->save_restore_ret_address =0 ; vdev->pm->is_warmboot = true; -clflush_cache_range (vdev->fw->mem->kvaddr,SZ_4K ); +wmb ();/* Flush WC buffers after writing save_restore_ret_address */ return ; }@@ -495,7 +494,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params boot_params->punit_telemetry_sram_size =ivpu_hw_reg_telemetry_size_get (vdev); boot_params->vpu_telemetry_enable =ivpu_hw_reg_telemetry_enable_get (vdev); -clflush_cache_range (vdev->fw->mem->kvaddr,SZ_4K ); +wmb ();/* Flush WC buffers after writing bootparams */ ivpu_fw_boot_params_print (vdev, boot_params); }drivers/accel/ivpu/ivpu_gem.h +0
-5@@ -8,8 +8,6 @@#include <drm/drm_gem.h> #include <drm/drm_mm.h> -#define DRM_IVPU_BO_NOSNOOP 0x10000000 -struct dma_buf ;struct ivpu_bo_ops ;struct ivpu_file_priv ;@@ -85,9 +83,6 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo)static inline bool ivpu_bo_is_snooped (struct ivpu_bo *bo) { -if (bo->flags &DRM_IVPU_BO_NOSNOOP ) -return false; -return ivpu_bo_cache_mode (bo) ==DRM_IVPU_BO_CACHED ; }Signature · 1 line
2.25.1