From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B474A00C2; Mon, 2 May 2022 19:43:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BC9140F35; Mon, 2 May 2022 19:43:19 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id F3B6A40E28 for ; Mon, 2 May 2022 19:43:17 +0200 (CEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 242HDZ14017196; Mon, 2 May 2022 17:43:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=hEC0cwx6cQToxUoKjUVtWVi7KfRbhUXm/KxJobPlIeo=; b=gm6fEOqFzSj/2gtAUB7ENRl+0ghFgiYa1XUgUaZDqr2oSLPxIdsjse9IHhqSDaiP5Il9 Wdn5e+7tloe8H83ohD4I7+wxpjZi/7kwxlktk0VqSjmbs+/NpNmLhGTLwvmzPmyeOJjv 5zacNYskqRpCcSCvXzQVTVKI0CBg1usuq/trHdz2rgppHMNp3UOwZ1kmJsDsKD/F3W7C iveAAe3Ene5z5QojyEPoKJ1175chMknPCl6+bu0Dlm0PKupUmz4/N/M6XvCqIiLs4Wao TDbcdkUtxlIw2aV4ERqWtg4/qLHeBLS0foIitEJ53WEft1IhBpqqVaA3Pt9Ee+v8IFgX ZA== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ftkgs0g3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 May 2022 17:43:01 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 242HfsKo018585; Mon, 2 May 2022 17:43:00 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04dal.us.ibm.com with ESMTP id 3frvr9afdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 May 2022 17:43:00 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 242HgxcU30933386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 May 2022 17:42:59 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AA86BE051; Mon, 2 May 2022 17:42:59 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 309F0BE058; Mon, 2 May 2022 17:42:59 +0000 (GMT) Received: from [9.211.103.207] (unknown [9.211.103.207]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 2 May 2022 17:42:59 +0000 (GMT) Message-ID: <270b3adb-ac05-26e3-37c0-0cab45a240c7@linux.vnet.ibm.com> Date: Mon, 2 May 2022 10:42:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2] lib/eal/ppc fix compilation for musl Content-Language: en-US To: Duncan Bellamy , dev@dpdk.org References: <20220502115228.3AAAB1242D4@dpdk.org> <20220502142615.3705639-1-dunk@denkimushi.com> From: David Christensen In-Reply-To: <20220502142615.3705639-1-dunk@denkimushi.com> Content-Type: text/plain; charset=UTF-8; format=flowed X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Oa16htMzzINaY6be23WG8cwx9uHLy18e X-Proofpoint-ORIG-GUID: Oa16htMzzINaY6be23WG8cwx9uHLy18e Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-02_05,2022-05-02_03,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 impostorscore=0 mlxlogscore=636 malwarescore=0 adultscore=0 clxscore=1011 bulkscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205020132 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 5/2/22 7:26 AM, Duncan Bellamy wrote: > musl lacks __ppc_get_timebase() but has __builtin_ppc_get_timebase() > > the __ppc_get_timebase_freq() is taken from: > https://git.alpinelinux.org/aports/commit/?id=06b03f70fb94972286c0c9f6278df89e53903833 > > Signed-off-by: Duncan Bellamy > --- > lib/eal/ppc/include/rte_cycles.h | 6 ++++++ > lib/eal/ppc/rte_cycles.c | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 38 insertions(+) > > diff --git a/lib/eal/ppc/include/rte_cycles.h b/lib/eal/ppc/include/rte_cycles.h > index 5585f9273c..98ffbd2592 100644 > --- a/lib/eal/ppc/include/rte_cycles.h > +++ b/lib/eal/ppc/include/rte_cycles.h > @@ -10,7 +10,9 @@ > extern "C" { > #endif > > +#if defined(__GLIBC__) > #include > +#endif > > #include "generic/rte_cycles.h" > > @@ -26,7 +28,11 @@ extern "C" { > static inline uint64_t > rte_rdtsc(void) > { > +#if defined(__GLIBC__) > return __ppc_get_timebase(); > +#else > + return __builtin_ppc_get_timebase(); > +#endif > } > > static inline uint64_t > diff --git a/lib/eal/ppc/rte_cycles.c b/lib/eal/ppc/rte_cycles.c > index 3180adb0ff..154eba722c 100644 > --- a/lib/eal/ppc/rte_cycles.c > +++ b/lib/eal/ppc/rte_cycles.c > @@ -2,12 +2,44 @@ > * Copyright (C) IBM Corporation 2019. > */ > > +#if defined(__GLIBC__) > #include > +#else > +#include > +#include > +#endif > > #include "eal_private.h" > > uint64_t > get_tsc_freq_arch(void) > { > +#if defined(__GLIBC__) > return __ppc_get_timebase_freq(); > +#else > + static uint64_t base; > + if (!base) { > + FILE *f = fopen("/proc/cpuinfo", "rb"); Code is valid but Linux specific. Access to /proc/cpuinfo needs to live in lib/eal/linux/eal_timer.c, surrounded by '#ifndef RTE_ARCH_PPC_64/#endif', with stubs for FreeBSD/Windows. Dave