From patchwork Fri Oct 4 20:26:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13822978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22FF8CF885A for ; Fri, 4 Oct 2024 20:29:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E3CF6B02AB; Fri, 4 Oct 2024 16:29:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 992EF6B02AC; Fri, 4 Oct 2024 16:29:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83FB26B02AD; Fri, 4 Oct 2024 16:29:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5C1A56B02AB for ; Fri, 4 Oct 2024 16:29:30 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 074321A13E2 for ; Fri, 4 Oct 2024 20:29:30 +0000 (UTC) X-FDA: 82637060100.02.9110754 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 45C75A0004 for ; Fri, 4 Oct 2024 20:29:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uEWkw0Pj; spf=pass (imf15.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728073594; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CcejZ0+EPQk2xoiVGTInjs2v871QaRgZ8Pb6wu9T/Ng=; b=diQ0ubbfngnx43ueXoHejt5/jkD3CZ4U/wONbzcDjmbKvLc91MKmizXiCSkZVmZafbbTKG boIF1qUfbPJ5b+2bwWMF2WOWP3N1kwhtiNCKOGmZu/ZRUUqYP6IgUvUFrSZ029p/oAb1k2 +D1O7vDHHpwlVvwY0FsY8/e6cHmWxYE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uEWkw0Pj; spf=pass (imf15.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728073594; a=rsa-sha256; cv=none; b=d7XZJBFIrsk0cP0i2XE+fPn3xhcna/XBrVmn+cnYS3JMJb8gHg42EXlpL+d8fj/ilcro/J 3QBjrMIBbeMA3qRBcH1Q5u6KIRH5gu8tc0CtwnbK2bRcaZtXSi44HE37FEsl2XbYdl0dFi Wv4dTQgPqHDCDBjUNR8XnFlDQzEkrNQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4F2CA5C58EB; Fri, 4 Oct 2024 20:29:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54D85C4CECC; Fri, 4 Oct 2024 20:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728073767; bh=EAWikPEgBRDcPQVvYschVwTUbFp2A2GnHRw6U8lWf/4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uEWkw0Pjiw8jWyrIk2sOJs1WxJD6fhDL5sW+VYmqI0nc3SGdkPygyhUxxwc0bzj+V cXQ5UgKZnCepgNi+H2KM0G5wCYdo4q4vr5bIIbnTDtsCtAXdSnsEYW+dffGpgI3fTK Fh1QkZIjmcIzIseor/Xhe18NXFqX0sG9KBXGJHZs3LIrpry8QjgbmdsKuk6+UNjI1w LoteBJfguzR23NfKBz0dVwmUQxwyQmsxkuQuPWyl80AY/5RW4Lzf0AyWMsIu6fIsOs 1oJoyLqck5qguyPFWxUA9pvK3aYNl+inpbYtCYdoq1wj8m9ZSc0FB4LfNNUNQ5cw64 vv/HaYpDnwD8A== From: Mark Brown Date: Fri, 04 Oct 2024 21:26:29 +0100 Subject: [PATCH RFC v2 1/2] binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4 MIME-Version: 1.0 Message-Id: <20241004-arm64-elf-hwcap3-v2-1-799d1daad8b0@kernel.org> References: <20241004-arm64-elf-hwcap3-v2-0-799d1daad8b0@kernel.org> In-Reply-To: <20241004-arm64-elf-hwcap3-v2-0-799d1daad8b0@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , Catalin Marinas , Will Deacon , Jonathan Corbet Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yury Khrustalev , Wilco Dijkstra , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=2313; i=broonie@kernel.org; h=from:subject:message-id; bh=EAWikPEgBRDcPQVvYschVwTUbFp2A2GnHRw6U8lWf/4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnAFAfEtsuUDv/4hQuE+NlcqOoKmOut3E+Mphu2SzM 02DaJeaJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZwBQHwAKCRAk1otyXVSH0PYRB/ 4k1lZXzkyNW2MOkIOzxzR9UIzyGg7f6hVKp6g+zvkR+sWx+qyl3ES0fxiZ7dlzvY3dA1v3smeW27hF l8a+Je0xn2rLSYd6IuoiacEn57zEUd0Hzkdzzw4O2mVH2WwIkWw/7YnYe6PVRLuxunkhrVS6Aalmjp pbbuL94P0JufS2k9tsv4cQA2a7jWsv2k7iHFEKB8XDH4Dwp/EV+wTtHL/TR6BWCeR1a+qBp2/0oQf5 dZRK07kZ9H2M8/3ioktfSs75pAHwT63xDy7LvCJHrneU4HrdeoZVADkBhdbfVuoFOVKerP2+qrKmmj QK3OHTRSMnREjhop7O/MS2MPVcomaD X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 45C75A0004 X-Stat-Signature: 33gpu7t879k8fyb1fhehihsdqks118oy X-Rspam-User: X-HE-Tag: 1728073768-190227 X-HE-Meta: U2FsdGVkX1+VJt6oBK3qvid3yto7L7QsJM2v3aQZpB1EWkicuSzqlnGJ3oBmxMy90l7v03MU/ZEkiF0XnrrZA3NYTdD3n4pIP0P588qPhLPfV9YaqY3yjupVX+qZkSUdBf1ZUEMxbQKdI432TtJjXDCD+TA3Utd3LSXjNPjvuQRmATSB+s5eFyJTy8WpyFPJYqKAryg/2gfZN3nbzhECPRFNhy7nq/hcCr5fwuZc91J+4TrDJwCXQzmmuplK23ZU4D9mkz8dS0UHSHNzNoaBBBTBMmX/+zk2cT45ek4qTYLOTilltIITGEHhDKxtY12DV/oeTLksMeWoTJYxsfcjOc8LD/QN4bYWhTiasXexx+1CLmOZfdTKwVKK2gv4GldmXNPdayB17SC1vkKC7VitN1nBtLpe8s8Un6y+Q+7Z/lXRVqpUwxC3cp8A9I06MRdwIEVi494shfan3oA8fJIHFCrUTWWDp4G4MSP4VZQEdhYHuBfE3YhnXiSbdC9rn8IfyHAJC2jzWzw6ZyV2LTHo8tqgwoWY5UNgQcWzSrz18pDJITU3j/NTgf6sjjdH3MfEE1XmJoQxShARFaUzS0L96PaxmQ4D+HAdxz/ja9E0cC+vtxOHujjjOcZzAxlK30jOeVTjs4IiBU2yNxTgS0gTIcfJgD6BwvYZYCzHPvelu8bj9rWB0K5QrkfHmF5mXAwTlgtDt6521ho8TTJTW89t8sXW//vU1xIDuGpLkFBzJcJW3gqJJkJf582TkeoDXjta+nuJ5loq+Lx+MoqzprggrNzEiF932/sDvmWjNJeBj2/ttceGf3r1S8mJC4SK5lQxeg/Kqb32jZFV/Gph7BG0jYjdoI6AWhLHUDISCXcYkZBeWghSbx6JHs3cpM1U/zJmijltyj02aNu5ZgcGufGlwYtRnOcORlXz2DSjEWyto8/AhkUkLqvAwifJXGNgjNagSdWpXj0rsMDWClW1TAr WL8hItLc g+PJfOylRIU/LcME9ta1xh/+XUyLcilPYSpjFw9TTUi7R2thmAIFAs3K7/MBJlWU8Q+n0+gns5yvPDb/GjObbpG/S8aCGDQ367VMCfiXDOZL90u3/RKcjiTUNuYO7NGFS1ip37s1ljfu7kXpJ/NXLh+t3KtIBw8sf0uotLB9t9RRga6U1DOR+0nqiBv/mjLfF9gpH3+kmT82HHE+uIPTfWRXDlAPbdbgYHoQYtg/IAUZvYvciWxxLxzkXAdQlSfO9AmjYJnUqyek5ZMZ6vCKcgZTSJE7sosjhLCNo X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: AT_HWCAP3 and AT_HWCAP4 were recently defined for use on PowerPC in commit 3281366a8e79 ("uapi/auxvec: Define AT_HWCAP3 and AT_HWCAP4 aux vector, entries"). Since we want to start using AT_HWCAP3 on arm64 add support for exposing both these new hwcaps via binfmt_elf. Signed-off-by: Mark Brown Acked-by: Kees Cook Reviewed-by: Anshuman Khandual --- fs/binfmt_elf.c | 6 ++++++ fs/binfmt_elf_fdpic.c | 6 ++++++ fs/compat_binfmt_elf.c | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 06dc4a57ba78a7939bbde96bf181eefa950ea13a..3039a6b7aba4bd38f26e21b626b579cc03f3a03e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -257,6 +257,12 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec, NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); +#endif +#ifdef ELF_HWCAP3 + NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3); +#endif +#ifdef ELF_HWCAP4 + NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4); #endif NEW_AUX_ENT(AT_EXECFN, bprm->exec); if (k_platform) { diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 4fe5bb9f1b1f5e0be6e8d1ef5b20492935b90633..31d253bd3961a8679678c600f4346bba23502598 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -623,6 +623,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); +#endif +#ifdef ELF_HWCAP3 + NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3); +#endif +#ifdef ELF_HWCAP4 + NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4); #endif NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE); NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c index 8f0af4f626316ed2e92204ff9bf381cd14103ae9..d5ef5469e4e620f6ee97f40ce9cbbfa48e37e33c 100644 --- a/fs/compat_binfmt_elf.c +++ b/fs/compat_binfmt_elf.c @@ -80,6 +80,16 @@ #define ELF_HWCAP2 COMPAT_ELF_HWCAP2 #endif +#ifdef COMPAT_ELF_HWCAP3 +#undef ELF_HWCAP3 +#define ELF_HWCAP3 COMPAT_ELF_HWCAP3 +#endif + +#ifdef COMPAT_ELF_HWCAP4 +#undef ELF_HWCAP4 +#define ELF_HWCAP4 COMPAT_ELF_HWCAP4 +#endif + #ifdef COMPAT_ARCH_DLINFO #undef ARCH_DLINFO #define ARCH_DLINFO COMPAT_ARCH_DLINFO From patchwork Fri Oct 4 20:26:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13822979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92037CF885B for ; Fri, 4 Oct 2024 20:29:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 244C06B02AE; Fri, 4 Oct 2024 16:29:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CCCF6B02B3; Fri, 4 Oct 2024 16:29:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 047C36B02B2; Fri, 4 Oct 2024 16:29:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D97CB6B02AD for ; Fri, 4 Oct 2024 16:29:33 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8F8E01A0308 for ; Fri, 4 Oct 2024 20:29:33 +0000 (UTC) X-FDA: 82637060226.08.67DCBDB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id BF45A10001C for ; Fri, 4 Oct 2024 20:29:31 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kPfnVwr8; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728073665; a=rsa-sha256; cv=none; b=hp2yMk5D0RJ752shcvdw0b0enNENXwZZH2XYj9h/G65N8HyNpF8d2+0PYVbWUyfxB2Na6h UO8vZL7JJRNWfLLDjSVkUiO9KGUM8pw8dbU0ai0wu6Jfmxz6yGjVFc+1bpf6ZFBduIQsoE LVeEkT+b8065DSNlyq6EHTIyu5+UZSE= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kPfnVwr8; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728073665; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QGrbr+9fd07ji0wETl8H+7l9HeI4HM8dzkTBIS3jCoE=; b=gTGmyq7aB4HbSskiFXB5bW0rgLmPiOrBas97r6V8DLlGxvVntfwiFdbfgJJxBRgzRdg5kh 71XKHc3yk9IFMRrYpnwc/9SouZ3Gs9Zv9uESSxiMHHEzQg7U2pA6+4iwbzx5RmK5NAELIY JYT0wAZyySCv9YCotdj7avIW6ZSGIgQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BE33C5C5946; Fri, 4 Oct 2024 20:29:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9738C4CECD; Fri, 4 Oct 2024 20:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728073770; bh=Q29JrkLZxdArYwY+rVpKpTkNxIyN30A+TtF5u4a+d1w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kPfnVwr8SWBws2rU3nHv5pCJNfCkH6R5u4eQ6sEHY7b59UXTp/29XlR7QsZn9vLeY WxIgMlZAJkzfbjX23C1S0RchYA9z7k4Mx1MP0RNEhoqER0TOP5/zXDAd70UkVyVxHV BpmsVOnqD0ZsgItThc4CVUsNMAssHg/YGdBqsGcvUSkYp5Y1d5Hitf4F2Tx1QXnLFx oV3YoL7FLZOHQECi6q89+XiFzeErqfXK7h5pHa9lSLUNSps7JTqqC10yOUrBRM0Uno 88hn/JpoqAeAZVNZulJ1piBT6ushRc5l8Crzi//csirZiLsV5XtSVEXa6Wy6Ld1Hqt V3bUp2d9d7Vfg== From: Mark Brown Date: Fri, 04 Oct 2024 21:26:30 +0100 Subject: [PATCH RFC v2 2/2] arm64: Support AT_HWCAP3 MIME-Version: 1.0 Message-Id: <20241004-arm64-elf-hwcap3-v2-2-799d1daad8b0@kernel.org> References: <20241004-arm64-elf-hwcap3-v2-0-799d1daad8b0@kernel.org> In-Reply-To: <20241004-arm64-elf-hwcap3-v2-0-799d1daad8b0@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , Catalin Marinas , Will Deacon , Jonathan Corbet Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yury Khrustalev , Wilco Dijkstra , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=4678; i=broonie@kernel.org; h=from:subject:message-id; bh=Q29JrkLZxdArYwY+rVpKpTkNxIyN30A+TtF5u4a+d1w=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnAFAfn7BPFjo4XljvMQXJ1vgo1LJghNjRRFv/EHRJ dSaDGdWJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZwBQHwAKCRAk1otyXVSH0HXCB/ sHPZyH0C3p8kpDx3xx/v8pAStV7iXI+CDLK+jDe+taJ/8wYG3EaQtVb3UfwJFVBhine4yNr8GKd5td NnTguPxISjp9da3eMg+/Ev+VRxbfRCzTlCboqTDAIF602zHJu0z516cRbb7gcrKXWQkyZNk9jWj+NY JKt7w8bnejgF0i8MEbTOyvq8JpW2FCdeGqzLs60Lm15nNnHnUzno0S05Yi5fhQAfJv7ia0XTf8iSim 7FWdQhvTkjNAHa5BU2ro3B2dKdcr/Z3wKkaj4wlkWXdCuJIqCXpATbAiPSYX1GhNYCGtZA4QftstDo pX9bsUtoq7432pKjQDX0iVx2mJaUBA X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BF45A10001C X-Stat-Signature: kzuewxincjkupqxcj64k1w8w5wx7ya7f X-Rspam-User: X-HE-Tag: 1728073771-392855 X-HE-Meta: U2FsdGVkX18FP6bJppI5GY5RrdJaxGkdDXEgo/cwrL8gWY7MEGbyHdzqIydbVuc6T+SI645UMwTyiDRNB1MCDypXJxPsRV/0q2JPYZKaTdpi7sqdRieO4VrWUPJLgAJ9IOShaxUE8bd71yNyacrs2E4CH1PV9xQCDTjKq0s3YEJ7o9DIbEyVxrjOZGBhI1bM4GFVQQQNUYTmmFG/UzMH5Y1hEWyRs2VG4u2b3lQ5m5I2kvXXLAUkUxrCIY714rNstQE84LDC0N539zO+aLoly+r5P++qFiA2IE//L9N+yEPJyttS7PYolfUCMmgwTbqMUvOJAMrt8nAm7wc9/CmZpwlkbK3jzWf2yuFyWTtullg52ocRYz26MtKw69BO/RW2aV4000PpKyASWjmp5AJj6iOmNDC4L0fWS2Q2oO8oY2tsTaupdM2UX0K8o4t/ZG4bGLN0rccw+CW9MI3rMfibjjyh+1osTxz+L49cfWk/1x7f4VoKdUm4wONtOHZeBxYMVHuxzdlWTvgq6aFfQK0p8HJ129K3dU3p/dROQBI6MjSN8Sn5WYPpwIZrbu7bGZf9Zen7tYf0y4VtdFN0xv9OoIkhO2HMVNtmDPGpp4YdMoJjRaaQsNU2ExbJPWAOAzHkB/S89v/CDinaMIHQRfePhTDKNS7GtJ+k0YwON/IjDrB44LGIPXOpcDmBstvVxOYe93nTmlh4bqZINzLhGLI7wLl7RsQdz/l4s4y/y1tj4pQK43R07Spr8dmaTxJ3iPyZxp4BzeqBNYTtGgi1bGUgLU+ll3Frp0tpInmGXmGG56Ob0mpWLtXhVP1f7zQkK3FnMDyTNztiTtZSdLoBAPkaFkoPJ2jLkf7ONmEvdKRNy7lgNfuhjm7GQtHjOSVbXFUqDSauLmvomOk4zRIF936+t/FlipmWSjKXskI6Iat29vLcHSN6BONFZ42/Vxo1UQjEI3UPEvWawZ+q22O+xU6 2PgX18oH 3hYEb5r9FzrjaqMwxJqSrXofg2vafeFwG67AjLp3OrqJW1Npe7DTBDz8Du+X4Nc7xSqgq0BMUnEwdaLqnwIxzTtHiCMn0DyP78fZgoeOYhTi7KjAcjf1zXoDfiTjj1Zf0v8wzlVbzvDpLj2TY32DcbHVKlWbcdiSQt/nyTqr4xrn5I7f5sO1LrjUuiThu7FXFe4adGQCI6sGmyASTIJ0iLTADbwQz1MBVfzyXywAcgA/DyrGC1eEUg3mz1wzmd7upbw3JzXWJZsSPYusQX653xDkMAI3h8UfILK6Mi+J06ai3hSA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We have filled all 64 bits of AT_HWCAP2 so in order to support discovery of further features provide the framework to use the already defined AT_HWCAP3 for further CPU features. Signed-off-by: Mark Brown Reviewed-by: Anshuman Khandual --- Documentation/arch/arm64/elf_hwcaps.rst | 6 +++--- arch/arm64/include/asm/cpufeature.h | 3 ++- arch/arm64/include/asm/hwcap.h | 6 +++++- arch/arm64/include/uapi/asm/hwcap.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 6 ++++++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Documentation/arch/arm64/elf_hwcaps.rst b/Documentation/arch/arm64/elf_hwcaps.rst index 694f67fa07d196816b1292e896ebe6a1b599c125..dc1b11d6d1122bba928b054cd1874aad5073e05c 100644 --- a/Documentation/arch/arm64/elf_hwcaps.rst +++ b/Documentation/arch/arm64/elf_hwcaps.rst @@ -16,9 +16,9 @@ architected discovery mechanism available to userspace code at EL0. The kernel exposes the presence of these features to userspace through a set of flags called hwcaps, exposed in the auxiliary vector. -Userspace software can test for features by acquiring the AT_HWCAP or -AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant -flags are set, e.g.:: +Userspace software can test for features by acquiring the AT_HWCAP, +AT_HWCAP2 or AT_HWCAP3 entry of the auxiliary vector, and testing +whether the relevant flags are set, e.g.:: bool floating_point_is_present(void) { diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 3d261cc123c1e22ac7bc9cfcde463624c76b2084..38e7d1a44ea38ab0a06a6f22824ae023b128721b 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -12,7 +12,7 @@ #include #include -#define MAX_CPU_FEATURES 128 +#define MAX_CPU_FEATURES 192 #define cpu_feature(x) KERNEL_HWCAP_ ## x #define ARM64_SW_FEATURE_OVERRIDE_NOKASLR 0 @@ -438,6 +438,7 @@ void cpu_set_feature(unsigned int num); bool cpu_have_feature(unsigned int num); unsigned long cpu_get_elf_hwcap(void); unsigned long cpu_get_elf_hwcap2(void); +unsigned long cpu_get_elf_hwcap3(void); #define cpu_set_named_feature(name) cpu_set_feature(cpu_feature(name)) #define cpu_have_named_feature(name) cpu_have_feature(cpu_feature(name)) diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index a775adddecf25633e87d58fb9ac9e6293beac1b3..3b5c50df419ee94193a4d9e3a47516eb0739e89a 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -159,17 +159,21 @@ #define KERNEL_HWCAP_SME_SF8DP2 __khwcap2_feature(SME_SF8DP2) #define KERNEL_HWCAP_POE __khwcap2_feature(POE) +#define __khwcap3_feature(x) (const_ilog2(HWCAP3_ ## x) + 128) + /* * This yields a mask that user programs can use to figure out what * instruction set this cpu supports. */ #define ELF_HWCAP cpu_get_elf_hwcap() #define ELF_HWCAP2 cpu_get_elf_hwcap2() +#define ELF_HWCAP3 cpu_get_elf_hwcap3() #ifdef CONFIG_COMPAT #define COMPAT_ELF_HWCAP (compat_elf_hwcap) #define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2) -extern unsigned int compat_elf_hwcap, compat_elf_hwcap2; +#define COMPAT_ELF_HWCAP3 (compat_elf_hwcap3) +extern unsigned int compat_elf_hwcap, compat_elf_hwcap2, compat_elf_hwcap3; #endif enum { diff --git a/arch/arm64/include/uapi/asm/hwcap.h b/arch/arm64/include/uapi/asm/hwcap.h index 055381b2c61595361c2d57d38be936c2dfeaa195..3dd4a53a438a14bfb41882b2ab15bdd7ce617475 100644 --- a/arch/arm64/include/uapi/asm/hwcap.h +++ b/arch/arm64/include/uapi/asm/hwcap.h @@ -124,4 +124,8 @@ #define HWCAP2_SME_SF8DP2 (1UL << 62) #define HWCAP2_POE (1UL << 63) +/* + * HWCAP3 flags - for AT_HWCAP3 + */ + #endif /* _UAPI__ASM_HWCAP_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 718728a85430fad5151b73fa213a510efac3f834..7221636b790709b153b49126e00246cc3032a7bc 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -103,6 +103,7 @@ static DECLARE_BITMAP(elf_hwcap, MAX_CPU_FEATURES) __read_mostly; COMPAT_HWCAP_LPAE) unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT; unsigned int compat_elf_hwcap2 __read_mostly; +unsigned int compat_elf_hwcap3 __read_mostly; #endif DECLARE_BITMAP(system_cpucaps, ARM64_NCAPS); @@ -3499,6 +3500,11 @@ unsigned long cpu_get_elf_hwcap2(void) return elf_hwcap[1]; } +unsigned long cpu_get_elf_hwcap3(void) +{ + return elf_hwcap[2]; +} + static void __init setup_boot_cpu_capabilities(void) { /*