DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dunk <dunk@denkimushi.com>
To: David Christensen <drc@linux.vnet.ibm.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v2] lib/eal/ppc fix compilation for musl
Date: Mon, 2 May 2022 21:20:04 +0100	[thread overview]
Message-ID: <7B587899-D01E-43B2-A892-0A463C7CD69F@denkimushi.com> (raw)
In-Reply-To: <270b3adb-ac05-26e3-37c0-0cab45a240c7@linux.vnet.ibm.com>



> On 2 May 2022, at 18:43, David Christensen <drc@linux.vnet.ibm.com> wrote:
> 
> 
> 
>> 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

Okay will move, will change glibc check back to ifdef as well.

Duncan 

  reply	other threads:[~2022-05-02 20:20 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
2022-05-02 20:20     ` Dunk [this message]
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=7B587899-D01E-43B2-A892-0A463C7CD69F@denkimushi.com \
    --to=dunk@denkimushi.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.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).