driver: platform: tegra: remove pfn_valid usage

Use ioremap after phys_to_virt to get the kernel accessible
read/write memory region. Hence remove pfn_valid check.

Bug 3804913

Change-Id: I798ea0a47133b4eb4a8f1d23585ce48ae4f1e53e
Signed-off-by: Sandipan Patra <spatra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3195495
Reviewed-by: Preetham Chandru R <pchandru@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
This commit is contained in:
Sandipan Patra
2024-08-14 07:27:40 +00:00
committed by mobile promotions
parent 80c7d7a67b
commit a863247bfc

View File

@@ -394,7 +394,6 @@ static int __init tegra_bootloader_debuginit(void)
if (tegra_bl_debug_data_start && tegra_bl_debug_data_size) { if (tegra_bl_debug_data_start && tegra_bl_debug_data_size) {
tegra_bl_mapped_debug_data_start = tegra_bl_mapped_debug_data_start =
phys_to_virt(tegra_bl_debug_data_start); phys_to_virt(tegra_bl_debug_data_start);
if (!pfn_valid(__phys_to_pfn(tegra_bl_debug_data_start))) {
ptr_bl_debug_data_start = ioremap(tegra_bl_debug_data_start, ptr_bl_debug_data_start = ioremap(tegra_bl_debug_data_start,
tegra_bl_debug_data_size); tegra_bl_debug_data_size);
@@ -413,7 +412,6 @@ static int __init tegra_bootloader_debuginit(void)
tegra_bl_mapped_debug_data_start = tegra_bl_mapped_debug_data_start =
(__force void *)ptr_bl_debug_data_start; (__force void *)ptr_bl_debug_data_start;
} }
}
/* /*
* The BCP can be optional, so ignore creating if variables are not set * The BCP can be optional, so ignore creating if variables are not set
@@ -429,7 +427,6 @@ static int __init tegra_bootloader_debuginit(void)
tegra_bl_mapped_boot_cfg_start = tegra_bl_mapped_boot_cfg_start =
phys_to_virt(tegra_bl_bcp_start); phys_to_virt(tegra_bl_bcp_start);
if (!pfn_valid(__phys_to_pfn(tegra_bl_bcp_start))) {
ptr_bl_boot_cfg_start = ioremap(tegra_bl_bcp_start, ptr_bl_boot_cfg_start = ioremap(tegra_bl_bcp_start,
tegra_bl_bcp_size); tegra_bl_bcp_size);
@@ -444,7 +441,6 @@ static int __init tegra_bootloader_debuginit(void)
(__force void *)ptr_bl_boot_cfg_start; (__force void *)ptr_bl_boot_cfg_start;
} }
} }
}
#endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_DEBUG_FS */
boot_profiler_kobj = kobject_create_and_add(dir_name, kernel_kobj); boot_profiler_kobj = kobject_create_and_add(dir_name, kernel_kobj);
if (IS_ERR_OR_NULL(boot_profiler_kobj)) { if (IS_ERR_OR_NULL(boot_profiler_kobj)) {
@@ -469,7 +465,6 @@ static int __init tegra_bootloader_debuginit(void)
goto out_err; goto out_err;
} }
if (!pfn_valid(__phys_to_pfn(tegra_bl_prof_start))) {
ptr_bl_prof_carveout = ioremap(tegra_bl_prof_start, tegra_bl_prof_size); ptr_bl_prof_carveout = ioremap(tegra_bl_prof_start, tegra_bl_prof_size);
if (!ptr_bl_prof_carveout) { if (!ptr_bl_prof_carveout) {
pr_err("%s: failed to map tegra_bl_prof_start\n", __func__); pr_err("%s: failed to map tegra_bl_prof_start\n", __func__);
@@ -483,10 +478,8 @@ static int __init tegra_bootloader_debuginit(void)
(u64)tegra_bl_prof_size); (u64)tegra_bl_prof_size);
tegra_bl_mapped_prof_start = (__force void *)ptr_bl_prof_carveout; tegra_bl_mapped_prof_start = (__force void *)ptr_bl_prof_carveout;
}
if (tegra_bl_prof_ro_start != 0 && tegra_bl_prof_ro_size != 0 && if (tegra_bl_prof_ro_start != 0 && tegra_bl_prof_ro_size != 0) {
!pfn_valid(__phys_to_pfn(tegra_bl_prof_ro_start))) {
ptr_bl_prof_ro_carveout = ioremap(tegra_bl_prof_ro_start, tegra_bl_prof_ro_size); ptr_bl_prof_ro_carveout = ioremap(tegra_bl_prof_ro_start, tegra_bl_prof_ro_size);
if (!ptr_bl_prof_ro_carveout) { if (!ptr_bl_prof_ro_carveout) {
pr_err("%s: failed to map tegra_bl_prof_ro_start\n", __func__); pr_err("%s: failed to map tegra_bl_prof_ro_start\n", __func__);
@@ -596,9 +589,7 @@ static int __init tegra_bl_args(char *options, phys_addr_t *tegra_bl_arg_size,
*tegra_bl_arg_size = memparse(p, &p); *tegra_bl_arg_size = memparse(p, &p);
if (!p) if (!p || *p != '@')
return -EINVAL;
if (*p != '@')
return -EINVAL; return -EINVAL;
*tegra_bl_arg_start = memparse(p + 1, &p); *tegra_bl_arg_start = memparse(p + 1, &p);
@@ -606,16 +597,6 @@ static int __init tegra_bl_args(char *options, phys_addr_t *tegra_bl_arg_size,
if (!(*tegra_bl_arg_size) || !(*tegra_bl_arg_start)) { if (!(*tegra_bl_arg_size) || !(*tegra_bl_arg_start)) {
*tegra_bl_arg_size = 0; *tegra_bl_arg_size = 0;
*tegra_bl_arg_start = 0; *tegra_bl_arg_start = 0;
return 0;
}
if (pfn_valid(__phys_to_pfn(*tegra_bl_arg_start))) {
pr_err("pfn_valid is true for %08llx@%08llx\n",
(u64)*tegra_bl_arg_size,
(u64)*tegra_bl_arg_start);
*tegra_bl_arg_size = 0;
*tegra_bl_arg_start = 0;
return -ENXIO;
} }
return 0; return 0;