From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 5876438582B2 for ; Thu, 25 Jan 2024 17:28:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5876438582B2 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5876438582B2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706203702; cv=none; b=ZkKFGKLm4LJVl78WL+0UdpV65A9P5suJGOB+Oy36fNzBY5AibCoXeVRoRRFEgumCiFSoO40eO3lUC6E5KrT+t+8xRjR7n+M5okD2f+rQqEDweXfrxpkjg4orgTdofT6rOVSQtrn8WBW11/FNz/BYt99ztw0QhzIrQYSkIy86MzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706203702; c=relaxed/simple; bh=TboxtGAtXB3jHUFO/KqTSAxJylYaOikcaXtX34SfDMY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=IA6SiQ+W0IONQPjsbwjCKsIB6EQRKOocJrWHQkMR05U0NsqimD72kw+OKbkK7sMm4E7VMxQL+NBs0eIStjIo3MerFIkE+LtE47v+lcW+utyrYfiK3N55g+n88AiQvJ1fMwe2w9mBL2rIl2FJpVpNlxx3yhbeMbJ3+X1sx3BAmII= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6E26B1FB; Thu, 25 Jan 2024 09:29:05 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4AADA3F73F; Thu, 25 Jan 2024 09:28:20 -0800 (PST) From: Richard Sandiford To: Victor Do Nascimento Mail-Followup-To: Victor Do Nascimento ,, , , richard.sandiford@arm.com Cc: , , Subject: Re: [PATCH v4 2/4] libatomic: Add support for __ifunc_arg_t arg in ifunc resolver References: <20240124171853.3112540-1-victor.donascimento@arm.com> <20240124171853.3112540-3-victor.donascimento@arm.com> Date: Thu, 25 Jan 2024 17:28:19 +0000 In-Reply-To: <20240124171853.3112540-3-victor.donascimento@arm.com> (Victor Do Nascimento's message of "Wed, 24 Jan 2024 17:17:31 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Victor Do Nascimento writes: > With support for new atomic features in Armv9.4-a being indicated by > HWCAP2 bits, Libatomic's ifunc resolver must now query its second > argument, of type __ifunc_arg_t*. > > We therefore make this argument known to libatomic, allowing us to > query hwcap2 bits in the following manner: > > bool > resolver (unsigned long hwcap, const __ifunc_arg_t *features); > { > return (features->hwcap2 & HWCAP2_); > } > > libatomic/ChangeLog: > > * config/linux/aarch64/host-config.h (__ifunc_arg_t): > Conditionally-defined if `sys/ifunc.h' not found. > (_IFUNC_ARG_HWCAP): Likewise. > (IFUNC_COND_1): Pass __ifunc_arg_t argument to ifunc. > (ifunc1): Modify function signature to accept __ifunc_arg_t > argument. > * configure.tgt: Add second `const __ifunc_arg_t *features' > argument to IFUNC_RESOLVER_ARGS. OK, thanks. Richard > --- > libatomic/config/linux/aarch64/host-config.h | 15 +++++++++++++-- > libatomic/configure.tgt | 2 +- > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/libatomic/config/linux/aarch64/host-config.h b/libatomic/config/linux/aarch64/host-config.h > index 4200293c4e3..8fd4fe3321a 100644 > --- a/libatomic/config/linux/aarch64/host-config.h > +++ b/libatomic/config/linux/aarch64/host-config.h > @@ -24,9 +24,20 @@ > #if HAVE_IFUNC > #include > > +#if __has_include() > +# include > +#else > +typedef struct __ifunc_arg_t { > + unsigned long _size; > + unsigned long _hwcap; > + unsigned long _hwcap2; > +} __ifunc_arg_t; > +# define _IFUNC_ARG_HWCAP (1ULL << 62) > +#endif > + > #ifdef HWCAP_USCAT > # if N == 16 > -# define IFUNC_COND_1 ifunc1 (hwcap) > +# define IFUNC_COND_1 ifunc1 (hwcap, features) > # else > # define IFUNC_COND_1 (hwcap & HWCAP_ATOMICS) > # endif > @@ -48,7 +59,7 @@ > #define MIDR_PARTNUM(midr) (((midr) >> 4) & 0xfff) > > static inline bool > -ifunc1 (unsigned long hwcap) > +ifunc1 (unsigned long hwcap, const __ifunc_arg_t *features) > { > if (hwcap & HWCAP_USCAT) > return true; > diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt > index b7609132c58..67a5f2dff80 100644 > --- a/libatomic/configure.tgt > +++ b/libatomic/configure.tgt > @@ -194,7 +194,7 @@ esac > # The type may be different on different architectures. > case "${target}" in > aarch64*-*-*) > - IFUNC_RESOLVER_ARGS="uint64_t hwcap" > + IFUNC_RESOLVER_ARGS="uint64_t hwcap, const __ifunc_arg_t *features" > ;; > *) > IFUNC_RESOLVER_ARGS="void"