From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id B13373860C3A for ; Thu, 1 Oct 2020 18:56:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B13373860C3A Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 091IW1p1183417 for ; Thu, 1 Oct 2020 14:56:43 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33wkjdjdgy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 01 Oct 2020 14:56:43 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 091IWWPA187146 for ; Thu, 1 Oct 2020 14:56:42 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 33wkjdjdgu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Oct 2020 14:56:42 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 091Ib8Ie001596; Thu, 1 Oct 2020 18:56:42 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma01dal.us.ibm.com with ESMTP id 33sw9a4xpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Oct 2020 18:56:41 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 091IufJ036045194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 1 Oct 2020 18:56:41 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38775B2066; Thu, 1 Oct 2020 18:56:41 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA300B2065; Thu, 1 Oct 2020 18:56:40 +0000 (GMT) Received: from li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com (unknown [9.80.215.135]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTPS; Thu, 1 Oct 2020 18:56:40 +0000 (GMT) Date: Thu, 1 Oct 2020 13:56:39 -0500 From: "Paul A. Clarke" To: Florian Weimer Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 18/28] powerpc64le: Add glibc-hwcaps support Message-ID: <20201001185639.GA132840@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com> References: <01faff4932d02c7e3224b50a1cdb5956354b1fc2.1601569371.git.fweimer@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01faff4932d02c7e3224b50a1cdb5956354b1fc2.1601569371.git.fweimer@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-01_06:2020-10-01, 2020-10-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010010150 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2020 18:56:54 -0000 On Thu, Oct 01, 2020 at 06:33:29PM +0200, Florian Weimer via Libc-alpha wrote: > The "power10" and "power9" subdirectories are selected. > --- > .../powerpc/powerpc64/le/dl-hwcaps-subdirs.c | 34 +++++++++++++++++++ > 1 file changed, 34 insertions(+) > create mode 100644 sysdeps/powerpc/powerpc64/le/dl-hwcaps-subdirs.c > > diff --git a/sysdeps/powerpc/powerpc64/le/dl-hwcaps-subdirs.c b/sysdeps/powerpc/powerpc64/le/dl-hwcaps-subdirs.c > new file mode 100644 > index 0000000000..496daf0fa0 > --- /dev/null > +++ b/sysdeps/powerpc/powerpc64/le/dl-hwcaps-subdirs.c > @@ -0,0 +1,34 @@ > +/* Architecture-specific glibc-hwcaps subdirectories. powerpc64le version. > + Copyright (C) 2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > +#include > + > +const char _dl_hwcaps_subdirs[] = "power10:power9"; > + > +int32_t Is 32 bits enough? Any reason not to make this 64 bits? > +_dl_hwcaps_subdirs_active (void) > +{ > + if (GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_1) > + return 3; > + > + if (GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_00) > + return 1; Is there some way to tie these magic numbers closer to their meaning? The bits are also inverse the the relative offset in the string, which could be confusing (index 0 is the 2nd bit and index 1 is the 1st). Perhaps something like (not tested): -- const char * const _dl_hwcaps_subdirs[] = { #define _DL_HWCAPS_SUBDIR_POWER10_BIT 0x2 /* or 1 to preserve same order. */ "power10", #define _DL_HWCAPS_SUBDIR_POWER9_BIT 0x1 /* or 2. */ "power9" }; int32_t _dl_hwcaps_subdirs_active (void) { int32_t result = 0; if (GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_1) result |= _DL_HWCAPS_SUBDIR_POWER10_BIT; if (GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_00) result |= _DL_HWCAPS_SUBDIR_POWER9_BIT; return result; } -- Of course, that would require changes to the code that parses _dl_hwcaps_subdirs. > + > + return 0; > +} PC