From: David Christensen <drc@linux.vnet.ibm.com>
To: Duncan Bellamy <dunk@denkimushi.com>, dev@dpdk.org
Subject: Re: [PATCH v2] lib/eal/ppc fix compilation for musl
Date: Mon, 2 May 2022 10:42:58 -0700 [thread overview]
Message-ID: <270b3adb-ac05-26e3-37c0-0cab45a240c7@linux.vnet.ibm.com> (raw)
In-Reply-To: <20220502142615.3705639-1-dunk@denkimushi.com>
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 <dunk@denkimushi.com>
> ---
> 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 <sys/platform/ppc.h>
> +#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 <sys/platform/ppc.h>
> +#else
> +#include <string.h>
> +#include <stdio.h>
> +#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
next prev parent reply other threads:[~2022-05-02 17:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220502115228.3AAAB1242D4@dpdk.org>
2022-05-02 14:26 ` Duncan Bellamy
2022-05-02 17:41 ` David Marchand
2022-05-02 20:18 ` Dunk
2022-05-02 17:42 ` David Christensen [this message]
2022-05-02 20:20 ` Dunk
2022-05-07 9:47 ` [PATCH v3] " Duncan Bellamy
2022-05-07 19:43 ` [PATCH v4] " Duncan Bellamy
2022-05-07 21:03 ` [PATCH v5] " Duncan Bellamy
2022-05-07 21:15 ` [PATCH v6] " Duncan Bellamy
2022-05-09 12:06 ` David Marchand
2022-05-09 22:39 ` Dunk
2022-05-14 7:14 ` [PATCH v7] eal/ppc: " Duncan Bellamy
2022-05-19 16:18 ` David Marchand
2022-05-31 17:24 ` David Christensen
2022-06-01 15:06 ` 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=270b3adb-ac05-26e3-37c0-0cab45a240c7@linux.vnet.ibm.com \
--to=drc@linux.vnet.ibm.com \
--cc=dev@dpdk.org \
--cc=dunk@denkimushi.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).