linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, Meng Zhuo <mengzhuo1203@gmail.com>,
	linux-mips@vger.kernel.org, Paul Burton <paul.burton@mips.com>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 4.14 027/119] MIPS: elf_hwcap: Export userspace ASEs
Date: Tue, 29 Oct 2019 18:50:38 +0800	[thread overview]
Message-ID: <c7cea5a0-bb68-b8ad-0548-6f246465a8b6@flygoat.com> (raw)
In-Reply-To: <20191027203308.417745883@linuxfoundation.org>


在 2019/10/28 上午5:00, Greg Kroah-Hartman 写道:
> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
>
> [ Upstream commit 38dffe1e4dde1d3174fdce09d67370412843ebb5 ]
>
> A Golang developer reported MIPS hwcap isn't reflecting instructions
> that the processor actually supported so programs can't apply optimized
> code at runtime.
>
> Thus we export the ASEs that can be used in userspace programs.
>
> Reported-by: Meng Zhuo <mengzhuo1203@gmail.com>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Cc: linux-mips@vger.kernel.org
> Cc: Paul Burton <paul.burton@mips.com>
> Cc: <stable@vger.kernel.org> # 4.14+
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   arch/mips/include/uapi/asm/hwcap.h | 11 ++++++++++
>   arch/mips/kernel/cpu-probe.c       | 33 ++++++++++++++++++++++++++++++
>   2 files changed, 44 insertions(+)
>
> diff --git a/arch/mips/include/uapi/asm/hwcap.h b/arch/mips/include/uapi/asm/hwcap.h
> index 600ad8fd68356..2475294c3d185 100644
> --- a/arch/mips/include/uapi/asm/hwcap.h
> +++ b/arch/mips/include/uapi/asm/hwcap.h
> @@ -5,5 +5,16 @@
>   /* HWCAP flags */
>   #define HWCAP_MIPS_R6		(1 << 0)
>   #define HWCAP_MIPS_MSA		(1 << 1)
> +#define HWCAP_MIPS_MIPS16	(1 << 3)
> +#define HWCAP_MIPS_MDMX     (1 << 4)
> +#define HWCAP_MIPS_MIPS3D   (1 << 5)
> +#define HWCAP_MIPS_SMARTMIPS (1 << 6)
> +#define HWCAP_MIPS_DSP      (1 << 7)
> +#define HWCAP_MIPS_DSP2     (1 << 8)
> +#define HWCAP_MIPS_DSP3     (1 << 9)
> +#define HWCAP_MIPS_MIPS16E2 (1 << 10)
> +#define HWCAP_LOONGSON_MMI  (1 << 11)
> +#define HWCAP_LOONGSON_EXT  (1 << 12)
> +#define HWCAP_LOONGSON_EXT2 (1 << 13)
>   
>   #endif /* _UAPI_ASM_HWCAP_H */
> diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> index 3007ae1bb616a..c38cd62879f4e 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -2080,6 +2080,39 @@ void cpu_probe(void)
>   		elf_hwcap |= HWCAP_MIPS_MSA;
>   	}
>   
> +	if (cpu_has_mips16)
> +		elf_hwcap |= HWCAP_MIPS_MIPS16;
> +
> +	if (cpu_has_mdmx)
> +		elf_hwcap |= HWCAP_MIPS_MDMX;
> +
> +	if (cpu_has_mips3d)
> +		elf_hwcap |= HWCAP_MIPS_MIPS3D;
> +
> +	if (cpu_has_smartmips)
> +		elf_hwcap |= HWCAP_MIPS_SMARTMIPS;
> +
> +	if (cpu_has_dsp)
> +		elf_hwcap |= HWCAP_MIPS_DSP;
> +
> +	if (cpu_has_dsp2)
> +		elf_hwcap |= HWCAP_MIPS_DSP2;
> +
> +	if (cpu_has_dsp3)
> +		elf_hwcap |= HWCAP_MIPS_DSP3;
> +
> +	if (cpu_has_loongson_mmi)
> +		elf_hwcap |= HWCAP_LOONGSON_MMI;
> +
> +	if (cpu_has_loongson_mmi)
> +		elf_hwcap |= HWCAP_LOONGSON_CAM;

Hi:

Sorry, there is a typo causing build failure.

Should be:

---
  arch/mips/include/uapi/asm/hwcap.h | 11 ++++++++++
  arch/mips/kernel/cpu-probe.c       | 33 ++++++++++++++++++++++++++++++
  2 files changed, 44 insertions(+)

diff --git a/arch/mips/include/uapi/asm/hwcap.h b/arch/mips/include/uapi/asm/hwcap.h
index a2aba4b059e6..1ade1daa4921 100644
--- a/arch/mips/include/uapi/asm/hwcap.h
+++ b/arch/mips/include/uapi/asm/hwcap.h
@@ -6,5 +6,16 @@
  #define HWCAP_MIPS_R6		(1 << 0)
  #define HWCAP_MIPS_MSA		(1 << 1)
  #define HWCAP_MIPS_CRC32	(1 << 2)
+#define HWCAP_MIPS_MIPS16	(1 << 3)
+#define HWCAP_MIPS_MDMX     (1 << 4)
+#define HWCAP_MIPS_MIPS3D   (1 << 5)
+#define HWCAP_MIPS_SMARTMIPS (1 << 6)
+#define HWCAP_MIPS_DSP      (1 << 7)
+#define HWCAP_MIPS_DSP2     (1 << 8)
+#define HWCAP_MIPS_DSP3     (1 << 9)
+#define HWCAP_MIPS_MIPS16E2 (1 << 10)
+#define HWCAP_LOONGSON_MMI  (1 << 11)
+#define HWCAP_LOONGSON_EXT  (1 << 12)
+#define HWCAP_LOONGSON_EXT2 (1 << 13)
  
  #endif /* _UAPI_ASM_HWCAP_H */
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index c2eb392597bf..f521cbf934e7 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -2180,6 +2180,39 @@ void cpu_probe(void)
  		elf_hwcap |= HWCAP_MIPS_MSA;
  	}
  
+	if (cpu_has_mips16)
+		elf_hwcap |= HWCAP_MIPS_MIPS16;
+
+	if (cpu_has_mdmx)
+		elf_hwcap |= HWCAP_MIPS_MDMX;
+
+	if (cpu_has_mips3d)
+		elf_hwcap |= HWCAP_MIPS_MIPS3D;
+
+	if (cpu_has_smartmips)
+		elf_hwcap |= HWCAP_MIPS_SMARTMIPS;
+
+	if (cpu_has_dsp)
+		elf_hwcap |= HWCAP_MIPS_DSP;
+
+	if (cpu_has_dsp2)
+		elf_hwcap |= HWCAP_MIPS_DSP2;
+
+	if (cpu_has_dsp3)
+		elf_hwcap |= HWCAP_MIPS_DSP3;
+
+	if (cpu_has_mips16e2)
+		elf_hwcap |= HWCAP_MIPS_MIPS16E2;
+
+	if (cpu_has_loongson_mmi)
+		elf_hwcap |= HWCAP_LOONGSON_MMI;
+
+	if (cpu_has_loongson_ext)
+		elf_hwcap |= HWCAP_LOONGSON_EXT;
+
+	if (cpu_has_loongson_ext2)
+		elf_hwcap |= HWCAP_LOONGSON_EXT2;
+
  	if (cpu_has_vz)
  		cpu_probe_vz(c);
  
-- 2.23.0



  reply	other threads:[~2019-10-29 10:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191027203259.948006506@linuxfoundation.org>
2019-10-27 20:59 ` [PATCH 4.14 008/119] MIPS: dts: ar9331: fix interrupt-controller size Greg Kroah-Hartman
2019-10-27 20:59 ` [PATCH 4.14 012/119] mips: Loongson: Fix the link time qualifier of serial_exit() Greg Kroah-Hartman
2019-10-27 21:00 ` [PATCH 4.14 026/119] MIPS: Treat Loongson Extensions as ASEs Greg Kroah-Hartman
2019-10-27 21:00 ` [PATCH 4.14 027/119] MIPS: elf_hwcap: Export userspace ASEs Greg Kroah-Hartman
2019-10-29 10:50   ` Jiaxun Yang [this message]
2019-10-30  9:02     ` Greg Kroah-Hartman
2019-10-27 21:01 ` [PATCH 4.14 085/119] MIPS: tlbex: Fix build_restore_pagemask KScratch restore Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7cea5a0-bb68-b8ad-0548-6f246465a8b6@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=mengzhuo1203@gmail.com \
    --cc=paul.burton@mips.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).