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
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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git