Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1345404ybp; Thu, 17 Oct 2019 11:22:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBZWQ56/kWbyDo9MQqb/k+xhyG7QfOvYWyIuOgdDkQyBRtYJXQ8AOlB7CfGgJ/+QdNYrQ+ X-Received: by 2002:a17:906:6a8e:: with SMTP id p14mr4794211ejr.137.1571336539324; Thu, 17 Oct 2019 11:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336539; cv=none; d=google.com; s=arc-20160816; b=rFGcCz1YWLVk0gG3CESWI60yVqqroqH6w0igGWEPpaMOexYG2lYITa9f8PsRdbBfA5 RoAU5wdnifG2QN2e047N3Oodi+1cS4JFaR048bda+U3MNTiko65UcJz6smsPwt8f//JE PhGfa111Vw2Nk770UOBgZxE0CnJh8WCc/6zgyO1Vrby1A6acOXeP1rKXGi0maljTCsWr iAD9JViNcCesc8AL0MHlTaNsjp07LUTdmciYDkFVdyo2oLwXtvlgLGowd5ADxwOM6GoN +mqab/Oo0xnCHgtGMlAaMC9F7ppfyCeu/aGt41ZMc3lrPIJHu+zJc4KcwAxiLIAWBkgy uR7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Z0yKwNrI9pFvKhRPqLYpBVJe/NGLdTIuNFZYIqkO9E=; b=bGEt0iLzgCoULvXWTL7zRxpAPwlD4ZoHVILSKL6xgoh7z50oRBX4UrogPlabzL2WkC HqhPGO9UZqR5Qb6snLMG+Kb29/oIIVePddnm/LSWV4X2jWFv4Hu/UQhReoGYImAp3u7y 3M5Y9Q3HMaVdUNRJJzXTJmgU0tewHkTu5tchwfuQHmZhHj1tuXVD570EtDlyt63scjhS zuEEooegotAv4WWFye9MmqGjpApw8uKWJVfsK72SDkG0suxAWmUJm58pldeInAHoTbYG Ay9SAbzfzEGGkQnaSQtt7Id0lULsusBDtxmCqHTrTrivmUYT45tOAXmLqTl9rg2CkMJa efEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hZQv0HEe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c38si2191501eda.46.2019.10.17.11.21.56; Thu, 17 Oct 2019 11:22:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hZQv0HEe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438833AbfJPWAi (ORCPT + 99 others); Wed, 16 Oct 2019 18:00:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438493AbfJPV7Y (ORCPT ); Wed, 16 Oct 2019 17:59:24 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F14A218DE; Wed, 16 Oct 2019 21:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263163; bh=u/Y53TAPxRLJPRHjG5gc+qtkO7jxIITbVNG7+QLOzPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZQv0HEes7lwb8e81mw+06sO0ygrQXskqI0Dms+hkADHRO/w8yCi0CFhet06H/Pv/ 1vwGuF7l+at8YG9fHXFxPqgzn5LMDkfeAM9mPwR2wAGNqrUE+PI2fZ5KkgRLMhfhiE pQ7G8gFUUT6C+lTpXkm3qUoCx/NYZaOPPOU1GV98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Zhuo , Jiaxun Yang , linux-mips@vger.kernel.org, Paul Burton Subject: [PATCH 5.3 091/112] MIPS: elf_hwcap: Export userspace ASEs Date: Wed, 16 Oct 2019 14:51:23 -0700 Message-Id: <20191016214905.514353521@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiaxun Yang commit 38dffe1e4dde1d3174fdce09d67370412843ebb5 upstream. 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 Signed-off-by: Jiaxun Yang Cc: linux-mips@vger.kernel.org Cc: Paul Burton Cc: # 4.14+ Signed-off-by: Paul Burton Signed-off-by: Greg Kroah-Hartman --- arch/mips/include/uapi/asm/hwcap.h | 11 +++++++++++ arch/mips/kernel/cpu-probe.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) --- 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 */ --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -2198,6 +2198,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);