Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2242143ybg; Sun, 27 Oct 2019 14:12:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwobj98DPlFMGrcIkKxg5FLReZZKKDw4jzhzVycTE/i5FBo7BkGKPSamNzmqzuk1UOe3L/t X-Received: by 2002:a17:906:c793:: with SMTP id cw19mr14049832ejb.25.1572210729573; Sun, 27 Oct 2019 14:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210729; cv=none; d=google.com; s=arc-20160816; b=tHPrKidNIUj7ucSzHOWHATT42jicoV5CH6y2ecnBMF4Hboxn9922f00fT4Stvu4sPz 2R5ziauIz9oGcS24bsNk+zyn5Uh5HnDUvTpul6HUFPNzBQ55xD20EwxQ27ivaN0aD9c6 y7gyy9YVGXRpk6oYo9CdfmNVMR2usdF7qmH6dgfco2hwNpna2SG/83Ja7HFM0uEfGtE5 J4SlDeiaZlYgVTccnxIt1+Csx4ItM5C5YTlcdygtaE69LH1aptlvfwpSEENmChyAwxSL WqkVMomZVz2kR4eIVEGD+oR5qLiGN2K0rE0N72kfR2QMpP2J9lPPKYyNs++44FM6c0tq iiDw== 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=VehHDj90/UWn2LsiNqjXRSKcmTE6zvMlm+W0BM0ghxk=; b=Oo/CGaHMn6i7QrtYCg8dqO8yXHm4BnXqT+Q0igvSq0xMKcyCW7ryQyf4/DTwAzUM/U NthSItbPu4QpjiWsz9NHmGKlEbfO5qhjfu8ey0gomreXA9ZjUW8jhtlnzxPM4siqiuuP sHoqn17gWsMBRcgkoNo1qKYCSleObTdE0e2YBVwIHmoqp9+HyxrDJvae6JWOP+oXDfsV UE5dOf1IoRHwGA+LkyPOMZJQGLlqD9Jx1s5e/Hep4kdsgmbX7tijnK5PIDpl3e2G0Ojq cvfVLR0QVwxtj/4Z+vxc775+r2Hh/snWu7HF74jllhqd7ov4bYOjwlnOQXsPdGmFES93 tdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gny+0+SX; 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 e48si5961319edb.370.2019.10.27.14.11.46; Sun, 27 Oct 2019 14:12:09 -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=gny+0+SX; 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 S1728409AbfJ0VH5 (ORCPT + 99 others); Sun, 27 Oct 2019 17:07:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:54046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729292AbfJ0VHz (ORCPT ); Sun, 27 Oct 2019 17:07:55 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 0BA8F20B7C; Sun, 27 Oct 2019 21:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210474; bh=kuX5mAEoLi/OrgOw1uhIk96xDrHkNVQQCDF2B474aFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gny+0+SXTkJFBh6rgXxnSz6/vKTyRKzkrlfQd8wpkPsw2I6j87EltTCnM9LwLy7hf jVlDwRCPHfoDU1nNLWHzIls65WfudfPetC+4VV+WB4Bh70r54nn+nkgMIDaz+t6VVe jUI0C1cmyQEHjcnr1aOs9HmHz26La5hqiQG5yEqs= 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 , Sasha Levin Subject: [PATCH 4.14 027/119] MIPS: elf_hwcap: Export userspace ASEs Date: Sun, 27 Oct 2019 22:00:04 +0100 Message-Id: <20191027203308.417745883@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203259.948006506@linuxfoundation.org> References: <20191027203259.948006506@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 [ 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 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: Sasha Levin --- 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; + + if (cpu_has_loongson_ext) + elf_hwcap |= HWCAP_LOONGSON_EXT; + + if (cpu_has_loongson_ext) + elf_hwcap |= HWCAP_LOONGSON_EXT2; + if (cpu_has_vz) cpu_probe_vz(c); -- 2.20.1