From 68ea0dc35bd9522f9d0ee5f629ddfe0821abacdb Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Sun, 10 May 2020 10:06:15 +0530 Subject: [PATCH] nvadsp: fix build error due to elf_hwcap Build error is seen on 5.4 kernel due to 'elf_hwcap' not being available. Commit aec0bff757c9 ("arm64: HWCAP: encapsulate elf_hwcap") in upstream removes direct expose of 'elf_hwcap' and instead provides a helper function cpu_get_elf_hwcap() for it. To fix build error this patch includes 'asm/hwcap.h' which works well for all supported kernel versions in downstream. The macro ELF_HWCAP, from this header, can be used for this purpose. * For kernel < 5.4 : ELF_HWCAP --> elf_hwcap * For kernel >= 5.4 : ELF_HWCAP --> cpu_get_elf_hwcap() Bug 200593718 Change-Id: I3ef3527be5972d6f6ba6ab6ef6dc50936dff73fd Signed-off-by: Sameer Pujar Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2341654 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mohan Kumar D Reviewed-by: Sharad Gupta Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/platform/tegra/nvadsp/app_loader_linker.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/platform/tegra/nvadsp/app_loader_linker.c b/drivers/platform/tegra/nvadsp/app_loader_linker.c index 3e64bdd9..303d6993 100644 --- a/drivers/platform/tegra/nvadsp/app_loader_linker.c +++ b/drivers/platform/tegra/nvadsp/app_loader_linker.c @@ -3,7 +3,7 @@ * * ADSP OS App management * - * Copyright (C) 2014-2017 NVIDIA Corporation. All rights reserved. + * Copyright (C) 2014-2020 NVIDIA Corporation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -24,6 +24,7 @@ #include #include #include +#include #include "os.h" #include "dram_app_mem_manager.h" @@ -789,7 +790,7 @@ static int elf_check_arch_arm32(const struct elf32_hdr *x) /* Make sure the entry address is reasonable */ if (x->e_entry & 1) { - if (!(elf_hwcap & HWCAP_THUMB)) + if (!(ELF_HWCAP & HWCAP_THUMB)) return 0; } else if (x->e_entry & 3) return 0; @@ -799,13 +800,13 @@ static int elf_check_arch_arm32(const struct elf32_hdr *x) unsigned int flt_fmt; /* APCS26 is only allowed if the CPU supports it */ - if ((eflags & EF_ARM_APCS_26) && !(elf_hwcap & HWCAP_26BIT)) + if ((eflags & EF_ARM_APCS_26) && !(ELF_HWCAP & HWCAP_26BIT)) return 0; flt_fmt = eflags & (EF_ARM_VFP_FLOAT | EF_ARM_SOFT_FLOAT); /* VFP requires the supporting code */ - if (flt_fmt == EF_ARM_VFP_FLOAT && !(elf_hwcap & HWCAP_VFP)) + if (flt_fmt == EF_ARM_VFP_FLOAT && !(ELF_HWCAP & HWCAP_VFP)) return 0; } return 1;