From patchwork Thu Feb 2 14:50:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 13126380 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 6AFFBC61DA4 for ; Thu, 2 Feb 2023 15:29:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4EAC6B0085; Thu, 2 Feb 2023 10:29:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BFCCD6B0083; Thu, 2 Feb 2023 10:29:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93DE66B0085; Thu, 2 Feb 2023 10:29:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 819D46B0080 for ; Thu, 2 Feb 2023 10:29:23 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5EEF81A05B9 for ; Thu, 2 Feb 2023 15:29:23 +0000 (UTC) X-FDA: 80422735806.07.2DB14BC Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf15.hostedemail.com (Postfix) with ESMTP id 95135A0016 for ; Thu, 2 Feb 2023 15:29:21 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=ZUZ1EWs+; spf=none (imf15.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675351761; 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:in-reply-to: references:references:dkim-signature; bh=4C3XvlEzMOWDLYDQ8XunR/mwzv7K56/vPk2XJ/CM7ag=; b=uRg+jRdFBD2WwUhOAMmYjT2k/H2Lrr4OocYmJ4yVS1D7/7xkzQK3jyCDOO2Lg4G+8hRAKy sA4Q3IemrPA2f39kg8ezo0TjYYtnDtVtsVD7yOkiSf2mUOgZVh/128180pYkPuxknKQtfp WzH0zFfHrsp0d8ohpbNQ3Ae7BX8ZDvc= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=ZUZ1EWs+; spf=none (imf15.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675351761; a=rsa-sha256; cv=none; b=Ewz/63ewXZR/JULljwtZIjIHWuUx9cbje2cM7aI9LeYO9tEIRAArFBBSBBT+7qbOQL2UvA sPszh/ANuvjQPaqEdIHdkcHCT3lX/9tSFDbdFb6fzg1SUpfWsTJzfsXtXQsHUmCELGRY1+ UHYnI87stG4dP5jvIJKpNMedyr2xFy0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=4C3XvlEzMOWDLYDQ8XunR/mwzv7K56/vPk2XJ/CM7ag=; b=ZUZ1EWs+4c6vvynJYe49Tmql6x E9Hwyf28DeRTT6vZ+IaEtJqSkdzqvVmas2ZpgoVLuZkqPEKd3ve/jHYhAKkHBhSE1Vruzdjv9NFAg sg0Ucbnq82V8ZGLKw74u4lh5Andr5WgxZ+l7vsftcEhZsa0tiiLRuIwKokYbHWpFDD3Z0bMsXQi5a BiZifR9/6fYGl3k8uVPVTlhK5cuHqpARfsBWDyuaKd9ptgf8fyagi0kS64lLeh/PurgpcMdHjY7n7 mIXERrd2lrAuy5AeTjEMyW8XGqNrNKGWJEjt3SIwCVKjHIcXLjpiPYUY2tz2OrZsdsVzHgkt9cEsl USOkEkfQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pNbVT-005CFg-1p; Thu, 02 Feb 2023 15:28:12 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0552A300ECD; Thu, 2 Feb 2023 16:28:40 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 8796E23F305BD; Thu, 2 Feb 2023 16:28:40 +0100 (CET) Message-ID: <20230202152655.313053173@infradead.org> User-Agent: quilt/0.66 Date: Thu, 02 Feb 2023 15:50:32 +0100 From: Peter Zijlstra To: torvalds@linux-foundation.org Cc: corbet@lwn.net, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, mark.rutland@arm.com, catalin.marinas@arm.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, joro@8bytes.org, suravee.suthikulpanit@amd.com, robin.murphy@arm.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, Arnd Bergmann , Herbert Xu , davem@davemloft.net, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, Andrew Morton , vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v2 02/10] types: Introduce [us]128 References: <20230202145030.223740842@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: c866nhbdadmiqu9rzxoopyc86aj48cwj X-Rspamd-Queue-Id: 95135A0016 X-HE-Tag: 1675351761-822186 X-HE-Meta: U2FsdGVkX1/zcErIfam1HGHcUIkPFP+828rM5qw78jQvQrZ35cDC8Vol+29SFXozu0zzQLnuw5aJMnKOsix/KDg2Zka0rKMPvuVeYqL3eAKitzVOiyJk6u7BugyryDmtZYYmhibkFWY3P4Qc8Sq24DjZXAOhFnofHKNFwvlQ1aP20Bn4RGGPLGWJWJdUrAIhcreee6tEnxxNXD49SJnBigxSRx/NRThFgB6vKn4urlQ7+4yeffch07R4tLetrvUIoqx81ROvuSpnmQjcKmyqUNcXSP4e9LXa/S9JY3LELwW/8rE48zzJZ3+DpSI1k9XFD2HP8uXrLV8s/PgaWzPVRJMIDe0JWvEGWknp6uaDAGedj+2wfd892yo6xk14p2efbA1tMHHl0GXc16D+TiUOMs0uQ8Efuk6+XVf5C5jaT1NcOhQG1hnBw030cvVl08VWsi5utXFhE3G4+4KNw2xIY4BdEfJJRk5Col7E0Zu4856VnpBSeZydTQm/WqrPtubm6N3ON3W5VoD/8YolCdw6iGRGkIJR1GqbFiVgmWuND7VTEAyrQ2swB839OlPhkeoDfivMISI7FDy8A1lbifzvPCelQclmJBwie2yN1CI0tYhoDKExEoduffi+hEJt/JuY90yH8aCu0AmW7Xz2xp2JWUf16THwiBejkv05a3yqUQeudWHCQcHbNtusndkC71OIOS1ka6k0IAflwvbcZ00qxjI/fAv62ewQsczbxo0sPxMgQxr4BtM0j2yd1os1f2uI9rBYepssQiMWh7Ka+/Jk7LzEUQmohL9QIakF65qV6oSbtw5O9QoppOvmNKOhf5vlpUjaZFqZKFdSDPTo0NFJYxM6UYmPIJTG+Yp9oJpM5cVFH0znn/2LCSh6ACsV4d6F8X7OQzOgqDf58iDjz1/MoxE8YJW4ecir2ApFhjPBK2HfcWVe76CKdz+Z69+7c4CxgqrCdg05RR9yRst+XfB xEvPh2sL 5AKQQWEVlrreZXUxnfQBV1ChaKRbzhoLXGwJ5ez61AyxboIJlBhGvQfovO14gA7tn+ckCZeYLiagv64KSnhDJ0VfbHmIAYNuv5DHwdvSkaJGhfF1heDCW/2jMLdwS61yVboyk0ZNSz4WAzEIGKhiod3x5CFHvRFxQa14cNMYCcROzDmfSqblNmWLwKEHob2GLQmC0tDWG3ZUnk8KK1uQGJNFCN/zmd4a1CVHqNOS41YBSuuLZ8qDI7eUYxND0dO+3xvDqmbnbWDk+p0QQhl6ERs/50I+cRhKCNyXZj5LSkwDfpgbwsoWIql14YN/vkUYocRVn2ja5e3nveT1NyE7X6LHXVMJmFVtbsMElsmk3DGYOynlLMoSwl//5OWnfhXDmTPHkOTz2Dsj31rM= 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: Introduce [us]128 (when available). Unlike [us]64, ensure they are always naturally aligned. This also enables 128bit wide atomics (which require natural alignment) such as cmpxchg128(). Signed-off-by: Peter Zijlstra (Intel) --- include/linux/types.h | 5 +++++ include/uapi/linux/types.h | 4 ++++ 2 files changed, 9 insertions(+) --- a/include/linux/types.h +++ b/include/linux/types.h @@ -10,6 +10,11 @@ #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] +#ifdef __SIZEOF_INT128__ +typedef __s128 s128; +typedef __u128 u128; +#endif + typedef u32 __kernel_dev_t; typedef __kernel_fd_set fd_set; --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -13,6 +13,10 @@ #include +#ifdef __SIZEOF_INT128__ +typedef __signed__ __int128 __s128 __attribute__((aligned(16))); +typedef unsigned __int128 __u128 __attribute__((aligned(16))); +#endif /* * Below are truly Linux-specific types that should never collide with --- a/lib/crypto/curve25519-hacl64.c +++ b/lib/crypto/curve25519-hacl64.c @@ -14,8 +14,6 @@ #include #include -typedef __uint128_t u128; - static __always_inline u64 u64_eq_mask(u64 a, u64 b) { u64 x = a ^ b; --- a/lib/crypto/poly1305-donna64.c +++ b/lib/crypto/poly1305-donna64.c @@ -10,8 +10,6 @@ #include #include -typedef __uint128_t u128; - void poly1305_core_setkey(struct poly1305_core_key *key, const u8 raw_key[POLY1305_BLOCK_SIZE]) {