drivers: tsec: use already exported cache API

Earlier we modified the kernel to expose a low level
cache API namely dcache_clean_inval_poc, instead we
can use the already exported arch_invalidate_pmem API
and for ARM invlidating the cache is same as clean
and invalidate

Bug 3817626

Change-Id: Ideb29f2818aece98753aaa40242eaf1246c928cb
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801851
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Nikesh Oswal
2022-11-02 12:32:06 +00:00
committed by Laxman Dewangan
parent 4de7c8f6d0
commit 5889401827
2 changed files with 3 additions and 5 deletions

View File

@@ -173,10 +173,7 @@ static int tsec_read_img_and_desc(struct platform_device *dev,
for (w = 0; w < fw_image->size/sizeof(u32); w++)
rv_data->backdoor_img_va[w] = le32_to_cpu(((__le32 *)fw_image->data)[w]);
#if (KERNEL_VERSION(5, 14, 0) <= LINUX_VERSION_CODE)
#ifdef CONFIG_EXPORT_DCACHE_OPS
dcache_clean_inval_poc((unsigned long)rv_data->backdoor_img_va,
(unsigned long)rv_data->backdoor_img_va + rv_data->backdoor_img_size);
#endif
arch_invalidate_pmem(rv_data->backdoor_img_va, rv_data->backdoor_img_size);
#else
__flush_dcache_area((void *)rv_data->backdoor_img_va, fw_image->size);
#endif

View File

@@ -35,11 +35,12 @@
#include <linux/version.h> /* for KERNEL_VERSION */
#include <linux/interrupt.h> /* for enable_irq */
#include <linux/firmware.h> /* for request_firmware */
#include <asm/cacheflush.h> /* for __flush_dcache_area */
#if (KERNEL_VERSION(5, 14, 0) <= LINUX_VERSION_CODE)
#include <soc/tegra/mc.h> /* for tegra_mc_get_carveout_info */
#include <linux/libnvdimm.h> /* for arch_invalidate_pmem */
#else
#include <linux/platform/tegra/tegra_mc.h> /* for mc_get_carveout_info */
#include <asm/cacheflush.h> /* for __flush_dcache_area */
#endif
#endif /* TSEC_LINUX_H */