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 <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2341654
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sameer Pujar
2020-05-10 10:06:15 +05:30
committed by Laxman Dewangan
parent bff1871f76
commit 68ea0dc35b

View File

@@ -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 <linux/platform_device.h>
#include <linux/firmware.h>
#include <linux/kernel.h>
#include <asm/hwcap.h>
#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;