linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: elf_hwcap: Export microMIPS and vz
@ 2019-10-23 15:25 Jiaxun Yang
  2019-10-24  4:06 ` Paul Burton
  2019-10-24  8:13 ` Sergei Shtylyov
  0 siblings, 2 replies; 4+ messages in thread
From: Jiaxun Yang @ 2019-10-23 15:25 UTC (permalink / raw)
  To: linux-mips; +Cc: paul.burton, Jiaxun Yang, stable

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@flygoat.com>
Cc: <stable@vger.kernel.org> # 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)
 
 #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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: elf_hwcap: Export microMIPS and vz
  2019-10-23 15:25 [PATCH] MIPS: elf_hwcap: Export microMIPS and vz Jiaxun Yang
@ 2019-10-24  4:06 ` Paul Burton
  2019-10-24  6:32   ` Jiaxun Yang
  2019-10-24  8:13 ` Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Burton @ 2019-10-24  4:06 UTC (permalink / raw)
  To: Jiaxun Yang; +Cc: linux-mips, paul.burton, stable

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@flygoat.com>
> Cc: <stable@vger.kernel.org> # 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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: elf_hwcap: Export microMIPS and vz
  2019-10-24  4:06 ` Paul Burton
@ 2019-10-24  6:32   ` Jiaxun Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Jiaxun Yang @ 2019-10-24  6:32 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, paul.burton, stable



于 2019年10月24日 GMT+08:00 下午12:06:24, Paul Burton <paulburton@kernel.org> 写到:
>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@flygoat.com>
>> Cc: <stable@vger.kernel.org> # 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

Hi Paul,

Well, that was preposed by a kvm developer from Loongson. They want to use it to implement CPU_AUTOPROBE and load required modules automatically.

As they said they will submit KVM support to mainline later, I'm just occupied a place for them.

Out of tree commit:

http://cgit.loongnix.org/cgit/linux-3.10/commit/?id=4db9301cca3b49358d46fd0da67c01ab2ae4a3e3

-- 
Jiaxun Yang

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: elf_hwcap: Export microMIPS and vz
  2019-10-23 15:25 [PATCH] MIPS: elf_hwcap: Export microMIPS and vz Jiaxun Yang
  2019-10-24  4:06 ` Paul Burton
@ 2019-10-24  8:13 ` Sergei Shtylyov
  1 sibling, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2019-10-24  8:13 UTC (permalink / raw)
  To: Jiaxun Yang, linux-mips; +Cc: paul.burton, stable

Hello!

On 23.10.2019 18:25, Jiaxun Yang wrote:

> After further discussion with userland library develpoer,

    Developer. :-)

> we addressed another two ASEs that can be used runtimely in programs.

    I'm afraid there's no such word "runtimely". It's "at run time" probably...

> Export them in hwcap as well to benefit userspace programs.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Cc: <stable@vger.kernel.org> # 4.4+
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-24  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 15:25 [PATCH] MIPS: elf_hwcap: Export microMIPS and vz Jiaxun Yang
2019-10-24  4:06 ` Paul Burton
2019-10-24  6:32   ` Jiaxun Yang
2019-10-24  8:13 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).