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 933D8A050D; Sat, 16 Apr 2022 23:21:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A3F740687; Sat, 16 Apr 2022 23:21:34 +0200 (CEST) Received: from tentoumushi.denkimushi.com (tentoumushi.denkimushi.com [81.187.253.217]) by mails.dpdk.org (Postfix) with ESMTP id 537B740685 for ; Sat, 16 Apr 2022 23:21:26 +0200 (CEST) Content-Type: multipart/alternative; boundary=Apple-Mail-0A0CE462-3D92-4E33-B577-83CBA3C1565F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denkimushi.com; s=dkim; t=1650144078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tfNjSokvWBIBcZx0qonz74PBnvV0pHbJ0CKCkeSRLEU=; b=0hSzxKKLWpqfcL3VNTLh+LyhIYKAW77/lrT5WN/1hu9ihuHvlTNnyNTtcGA3b9FkOkh4cp ooJ31Ium4CAKr+nlLOJ1c1HWbKtqnZq54pgINISevTadkL27r0lNAKi1Bm60J5jIw4nv+S JsJvctMjOfV4vYOruZZa/q8kDvrPxJk= Content-Transfer-Encoding: 7bit From: Dunk MIME-Version: 1.0 (1.0) Date: Sat, 16 Apr 2022 22:21:17 +0100 Subject: [PATCH 1/1] fix compilation for ppc64le on musl/Alpine Message-Id: To: dev@dpdk.org ARC-Seal: i=1; s=dkim; d=denkimushi.com; t=1650144078; a=rsa-sha256; cv=none; b=h0WwmS9sSRHbLVS9WCcFHbPRGDG3/5QIQsRrcElhpa2y8PcutDdJIxTaz8p5yJjr3vDASk Yp1WqjChnKpG1+QqaAOZzNHPX/oceuOIazTl1dy0d1XCq9laE45A8pmujbs+ZEIQECNqax TMvd/etuYITd+hnNCmMkQzg5JjOXxs0= 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=1650144078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tfNjSokvWBIBcZx0qonz74PBnvV0pHbJ0CKCkeSRLEU=; b=rePTfg9w8nTsAkoNIpGhSmX8rg9cyKCRCWC601FU4Ofv+XHCbZTW1qcvwuTju07g59eBd6 MPiNEUA1X6Mxl7GvtVqI88yqktIrSIDKHgFeNYuc7DM6Qpu34nIWPIcsi0/R8Atz+x7oEG KGlzCSxhe7+MeoVV0cnfHhLbxe1EVwc= 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 --Apple-Mail-0A0CE462-3D92-4E33-B577-83CBA3C1565F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable 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=3D06b03f70fb94972286c0c9f6278d= f89e53903833 Signed-off-by: Duncan Bellamy --Apple-Mail-0A0CE462-3D92-4E33-B577-83CBA3C1565F Content-Type: multipart/mixed; boundary=Apple-Mail-1973D765-C8C2-4B60-95E2-2F4CCB6B97AD Content-Transfer-Encoding: 7bit --Apple-Mail-1973D765-C8C2-4B60-95E2-2F4CCB6B97AD Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
musl lacks __ppc_get_timebase() but has __builtin_ppc_get_timebase()

the __ppc_get_timebase_freq() is taken from:

Signed-off-by: Duncan Bellamy <dunk@denkimushi.com>
--Apple-Mail-1973D765-C8C2-4B60-95E2-2F4CCB6B97AD Content-Type: application/octet-stream; name=01-ppc.patch; x-apple-part-url=C4FF20AD-5713-4804-969D-9D96A4BA7A16 Content-Disposition: attachment; filename=01-ppc.patch Content-Transfer-Encoding: 7bit --- a/lib/eal/ppc/include/rte_cycles.h +++ b/lib/eal/ppc/include/rte_cycles.h @@ -10,7 +10,9 @@ extern "C" { #endif +#ifdef __GLIBC__ #include +#endif #include "generic/rte_cycles.h" @@ -26,7 +28,11 @@ static inline uint64_t rte_rdtsc(void) { +#ifdef __GLIBC__ return __ppc_get_timebase(); +#else + return __builtin_ppc_get_timebase(); +#endif } static inline uint64_t --- a/lib/eal/ppc/rte_cycles.c +++ b/lib/eal/ppc/rte_cycles.c @@ -2,12 +2,44 @@ * Copyright (C) IBM Corporation 2019. */ +#ifdef __GLIBC__ #include +#else +#include +#include +#endif #include "eal_private.h" uint64_t get_tsc_freq_arch(void) { +#ifdef __GLIBC__ return __ppc_get_timebase_freq(); +#else + static uint64_t base; + if (!base) { + FILE *f = fopen("/proc/cpuinfo", "rb"); + if (f) { + ssize_t nr; + /* virtually always big enough to hold the line */ + char buf[512]; + while (fgets(buf, sizeof(buf), f)) { + char *ret = strstr(buf, "timebase"); + if (!ret) { + continue; + } + ret += sizeof("timebase") - 1; + ret = strchr(ret, ':'); + if (!ret) { + continue; + } + base = strtoul(ret + 1, 0, 10); + break; + } + fclose(f); + } + } + return base;; +#endif } --Apple-Mail-1973D765-C8C2-4B60-95E2-2F4CCB6B97AD Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit

--Apple-Mail-1973D765-C8C2-4B60-95E2-2F4CCB6B97AD-- --Apple-Mail-0A0CE462-3D92-4E33-B577-83CBA3C1565F--