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 988B6A034C; Mon, 2 May 2022 22:20:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74DE6410FB; Mon, 2 May 2022 22:20:20 +0200 (CEST) Received: from tentoumushi.denkimushi.com (tentoumushi.denkimushi.com [81.187.253.217]) by mails.dpdk.org (Postfix) with ESMTP id B269740C35 for ; Mon, 2 May 2022 22:20:12 +0200 (CEST) Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denkimushi.com; s=dkim; t=1651522805; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X73HbrYknzSeJNAQYT21SWpaT9ZujtXRsOI1Jq6ubAE=; b=S/py4zAMlZf4tcs26bD5jjgIMsn0Tb53s3ZyAR2fa3V8sB0rc73LUGd+pOtxd9ToxK37Fp lTeNizZMADhnuiHt4rODYtCNPgRwz3BxU9fVnLJMEOGzHxQBUvBGUvuav8tzQnOLuSXfn5 opB9dO+5CmM/0V5/dNV1pTpQgppDX40= Content-Transfer-Encoding: quoted-printable From: Dunk MIME-Version: 1.0 (1.0) Subject: Re: [PATCH v2] lib/eal/ppc fix compilation for musl Date: Mon, 2 May 2022 21:20:04 +0100 Message-Id: <7B587899-D01E-43B2-A892-0A463C7CD69F@denkimushi.com> References: <270b3adb-ac05-26e3-37c0-0cab45a240c7@linux.vnet.ibm.com> Cc: dev@dpdk.org In-Reply-To: <270b3adb-ac05-26e3-37c0-0cab45a240c7@linux.vnet.ibm.com> To: David Christensen ARC-Seal: i=1; s=dkim; d=denkimushi.com; t=1651522805; a=rsa-sha256; cv=none; b=unz7VKp2XwZC4tkuRva8gyeZLM8AR04UVqU6GyXeIg78x0rHss31qwEy0fkxhuVCNM/Nba FRqxAg3EQxqVFn6+Wc+xi7IgIOwQ6jLelSq8XHZk2HroF21me43AoLhL1YbBtZ/V+4jyiB rtUKj8YeyPZ+VnRrUZWYAszCMiUQjwI= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=dunk@denkimushi.com smtp.mailfrom=dunk@denkimushi.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=denkimushi.com; s=dkim; t=1651522805; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X73HbrYknzSeJNAQYT21SWpaT9ZujtXRsOI1Jq6ubAE=; b=KeNPp32b+0tBNTAfMVv5jAd4/UO04k0KPc2a87a2w4yNu0qD021UZ8Vx1oqrvbtsjzhXR4 kURN59B0hMJE1E+WQwfdtok5eaYqVqa3Kf2vQCd5Z66V98qikEJKD+sF8oKeAm17AOygtf 4MVyIadjz7Y+vC/+KR4u2CASr520HpA= 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 2 May 2022, at 18:43, David Christensen wrote:= >=20 > =EF=BB=BF >=20 >> 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=3D06b03f70fb94972286c0c9f62= 78df89e53903833 >> 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_c= ycles.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 =3D fopen("/proc/cpuinfo", "rb"); >=20 > 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', w= ith stubs for FreeBSD/Windows. > Dave Okay will move, will change glibc check back to ifdef as well. Duncan=20=