From: David Christensen <drc@linux.vnet.ibm.com>
To: Piotr Kubaj <pkubaj@anongoth.pl>,
David Marchand <david.marchand@redhat.com>
Cc: Nicolas Chautru <nicolas.chautru@intel.com>,
Declan Doherty <declan.doherty@intel.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Beilei Xing <beilei.xing@intel.com>, Jeff Guo <jia.guo@intel.com>,
"Wang, Haiyue" <haiyue.wang@intel.com>,
Jiawen Wu <jiawenwu@trustnetic.com>,
Jian Wang <jianwang@trustnetic.com>, dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
Date: Fri, 7 May 2021 13:28:55 -0700 [thread overview]
Message-ID: <082cada4-05cd-6029-600e-da7b6680310e@linux.vnet.ibm.com> (raw)
In-Reply-To: <YJMes69UJORrjT1G@KGPE-D16>
On 5/5/21 3:39 PM, Piotr Kubaj wrote:
> diff --git a/lib/librte_eal/ppc/include/rte_altivec.h b/lib/librte_eal/ppc/include/rte_altivec.h
> index 1551a9454..3fcc819c1 100644
> --- a/lib/librte_eal/ppc/include/rte_altivec.h
> +++ b/lib/librte_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 <altivec.h>
>
> /*
> diff --git a/lib/librte_eal/ppc/include/rte_cycles.h b/lib/librte_eal/ppc/include/rte_cycles.h
> index 5585f9273..a8307ceaf 100644
> --- a/lib/librte_eal/ppc/include/rte_cycles.h
> +++ b/lib/librte_eal/ppc/include/rte_cycles.h
> @@ -10,7 +10,13 @@
> extern "C" {
> #endif
>
> +#ifdef linux
> +#include <features.h>
> +#endif
> +
> +#ifdef __GLIBC__
> #include <sys/platform/ppc.h>
> +#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/librte_eal/ppc/rte_cycles.c b/lib/librte_eal/ppc/rte_cycles.c
> index 3180adb0f..48545c4d6 100644
> --- a/lib/librte_eal/ppc/rte_cycles.c
> +++ b/lib/librte_eal/ppc/rte_cycles.c
> @@ -2,12 +2,28 @@
> * Copyright (C) IBM Corporation 2019.
> */
>
> +#ifdef linux
> +#include <features.h>
> +#elif defined(__FreeBSD__)
> +#include <sys/types.h>
> +#include <sys/sysctl.h>
> +#endif
> +
> +#ifdef __GLIBC__
> #include <sys/platform/ppc.h>
> +#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
> }
> --
> 2.31.0
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
next prev parent reply other threads:[~2021-05-07 20:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 16:11 Piotr Kubaj
2021-03-11 20:58 ` Ajit Khaparde
2021-03-15 19:48 ` David Christensen
2021-03-22 20:14 ` Piotr Kubaj
2021-03-22 23:42 ` Piotr Kubaj
2021-05-05 14:58 ` David Marchand
[not found] ` <YJMes69UJORrjT1G@KGPE-D16>
2021-05-07 20:28 ` David Christensen [this message]
2021-05-07 20:30 ` David Christensen
[not found] ` <YJXae53gvmmXwY4n@KGPE-D16>
2021-05-11 14:02 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=082cada4-05cd-6029-600e-da7b6680310e@linux.vnet.ibm.com \
--to=drc@linux.vnet.ibm.com \
--cc=ajit.khaparde@broadcom.com \
--cc=beilei.xing@intel.com \
--cc=david.marchand@redhat.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=haiyue.wang@intel.com \
--cc=jia.guo@intel.com \
--cc=jianwang@trustnetic.com \
--cc=jiawenwu@trustnetic.com \
--cc=nicolas.chautru@intel.com \
--cc=pkubaj@anongoth.pl \
--cc=somnath.kotur@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).