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 72CCDA0A02; Tue, 18 May 2021 22:42:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC3AD4068E; Tue, 18 May 2021 22:42:19 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mails.dpdk.org (Postfix) with ESMTP id D511D40041 for ; Tue, 18 May 2021 22:42:17 +0200 (CEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14IKYDwo035041; Tue, 18 May 2021 16:42:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=xanZ6EfGySAtmp6DSm17rWYupQw33VexHz9iE7iH2/o=; b=i/q6dcM31gIxVo1xWV6xL9c7vduc6rRUjEwwfGsuQMiKHnB8363vLWzQAQWDtE5Loxhm acZ1iaWHQ6es+K2HNmHQj7KP4JKDugKPuDqRKjM3wkJfUF0WNBzOnf9KyxPcdGb20s0k p1yYfwihDRkzMSaUzMugPovmEGfNVu2PH5Ha+2bpPvYRwaXiKAWFBXrthyjUGonUCeHs fhHF5DczG627Xb9wMyxZkJCSafRcjrxbVxoS0UoAhaNrM8yK+/80hEHiHdH0JEFjvBZY Pyw+1xVpvcelQKoj1xe2pvJKcM0SrHTe4QnxdhM3y5fGVQ4C5OPXvlFq28N+yY5qrlJr 3Q== Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 38mmhj0ea3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 May 2021 16:42:16 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14IKb2iV005195; Tue, 18 May 2021 20:42:15 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma02wdc.us.ibm.com with ESMTP id 38jyu22ha7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 May 2021 20:42:15 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14IKgEIL15532534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 May 2021 20:42:14 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72A0A7805E; Tue, 18 May 2021 20:42:14 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 506DD7806A; Tue, 18 May 2021 20:42:14 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.163.5.228]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 18 May 2021 20:42:14 +0000 (GMT) To: Piotr Kubaj Cc: dev@dpdk.org References: <20210517004621.64357-1-pkubaj@FreeBSD.org> From: David Christensen Message-ID: <6435d3f6-c80b-d50e-bc11-70c8044d2b19@linux.vnet.ibm.com> Date: Tue, 18 May 2021 13:42:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210517004621.64357-1-pkubaj@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ud-ijdATzGvjNt9bfBlG2o-4oCmS1mpm X-Proofpoint-ORIG-GUID: Ud-ijdATzGvjNt9bfBlG2o-4oCmS1mpm X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-18_10:2021-05-18, 2021-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105180142 Subject: Re: [dpdk-dev] [PATCH] ppc64le: fix build without glibc and using Clang 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 Sender: "dev" On 5/16/21 5:46 PM, Piotr Kubaj wrote: > __ppc_get_timebase() is only present when glibc is used. > > Signed-off-by: Piotr Kubaj > --- > lib/eal/ppc/include/rte_altivec.h | 3 +++ > lib/eal/ppc/include/rte_cycles.h | 12 ++++++++++++ > lib/eal/ppc/rte_cycles.c | 16 ++++++++++++++++ > 3 files changed, 31 insertions(+) > > diff --git a/lib/eal/ppc/include/rte_altivec.h b/lib/eal/ppc/include/rte_altivec.h > index 1551a94544..3fcc819c11 100644 > --- a/lib/eal/ppc/include/rte_altivec.h > +++ b/lib/eal/ppc/include/rte_altivec.h > @@ -7,6 +7,9 @@ > #define _RTE_ALTIVEC_H_ > > /* To include altivec.h, GCC version must be >= 4.8 */ > +#ifdef __clang__ > +#define vector __vector > +#endif > #include > > /* > diff --git a/lib/eal/ppc/include/rte_cycles.h b/lib/eal/ppc/include/rte_cycles.h > index 5585f9273c..a8307ceaff 100644 > --- a/lib/eal/ppc/include/rte_cycles.h > +++ b/lib/eal/ppc/include/rte_cycles.h > @@ -10,7 +10,13 @@ > extern "C" { > #endif > > +#ifdef linux > +#include > +#endif > + > +#ifdef __GLIBC__ > #include > +#endif > > #include "generic/rte_cycles.h" > > @@ -26,7 +32,13 @@ extern "C" { > static inline uint64_t > rte_rdtsc(void) > { > +#ifdef __GLIBC__ > return __ppc_get_timebase(); > +#else > + uint64_t __tb; > + __asm__ volatile ("mfspr %0, 268" : "=r" (__tb)); > + return __tb; > +#endif > } > > static inline uint64_t > diff --git a/lib/eal/ppc/rte_cycles.c b/lib/eal/ppc/rte_cycles.c > index 3180adb0ff..48545c4d67 100644 > --- a/lib/eal/ppc/rte_cycles.c > +++ b/lib/eal/ppc/rte_cycles.c > @@ -2,12 +2,28 @@ > * Copyright (C) IBM Corporation 2019. > */ > > +#ifdef linux > +#include > +#elif defined(__FreeBSD__) > +#include > +#include > +#endif > + > +#ifdef __GLIBC__ > #include > +#endif > > #include "eal_private.h" > > uint64_t > get_tsc_freq_arch(void) > { > +#ifdef __GLIBC__ > return __ppc_get_timebase_freq(); > +#elif defined(__FreeBSD__) > + uint64_t freq; > + size_t length = sizeof(freq); > + sysctlbyname("kern.timecounter.tc.timebase.frequency", &freq, &length, NULL, 0); > + return freq; > +#endif > } > Reviewed-by: David Christensen