Re: [PATCH] MIPS: elf_hwcap: Export microMIPS and vz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jiaxun,

On Wed, Oct 23, 2019 at 11:25:51PM +0800, Jiaxun Yang wrote:
> After further discussion with userland library develpoer,
> we addressed another two ASEs that can be used runtimely in programs.
> 
> Export them in hwcap as well to benefit userspace programs.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx> # 4.4+
> ---
>  arch/mips/include/uapi/asm/hwcap.h | 2 ++
>  arch/mips/kernel/cpu-probe.c       | 7 ++++++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/uapi/asm/hwcap.h b/arch/mips/include/uapi/asm/hwcap.h
> index 1ade1daa4921..e1a9bac62149 100644
> --- a/arch/mips/include/uapi/asm/hwcap.h
> +++ b/arch/mips/include/uapi/asm/hwcap.h
> @@ -17,5 +17,7 @@
>  #define HWCAP_LOONGSON_MMI  (1 << 11)
>  #define HWCAP_LOONGSON_EXT  (1 << 12)
>  #define HWCAP_LOONGSON_EXT2 (1 << 13)
> +#define HWCAP_MIPS_MICROMIPS (1 << 14)
> +#define HWCAP_MIPS_VZ       (1 << 15)

What's the motivation for exposing VZ? Userland can't actually use it
without something like KVM, which already exposes a means of detecting
whether VZ is supported (try the creating a VM of type KVM_VM_MIPS_VZ &
see if it works). I'm not sure what userland would be able to do with
this information in AT_HWCAP.

Thanks,
    Paul

>  #endif /* _UAPI_ASM_HWCAP_H */
> diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> index f521cbf934e7..11e853d88aae 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -2213,8 +2213,13 @@ void cpu_probe(void)
>  	if (cpu_has_loongson_ext2)
>  		elf_hwcap |= HWCAP_LOONGSON_EXT2;
>  
> -	if (cpu_has_vz)
> +	if (cpu_has_mmips)
> +		elf_hwcap |= HWCAP_MIPS_MICROMIPS;
> +
> +	if (cpu_has_vz) {
> +		elf_hwcap |= HWCAP_MIPS_VZ;
>  		cpu_probe_vz(c);
> +	}
>  
>  	cpu_probe_vmbits(c);
>  
> -- 
> 2.23.0
> 



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux