patch 'eal/ppc: fix compilation for musl' has been queued to stable release 21.11.2

Kevin Traynor ktraynor at redhat.com
Thu Jun 9 13:37:01 CEST 2022


Hi,

FYI, your patch has been queued to stable release 21.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/52c9e902beb02d3d458a13eaa484c23b4487eae7

Thanks.

Kevin

---
>From 52c9e902beb02d3d458a13eaa484c23b4487eae7 Mon Sep 17 00:00:00 2001
From: Duncan Bellamy <dunk at denkimushi.com>
Date: Sat, 14 May 2022 08:14:35 +0100
Subject: [PATCH] eal/ppc: fix compilation for musl

[ upstream commit 0615dd2aa139312a93ae312233a80e164c8f1048 ]

musl lacks __ppc_get_timebase() but has __builtin_ppc_get_timebase()

Signed-off-by: Duncan Bellamy <dunk at denkimushi.com>
Reviewed-by: David Christensen <drc at linux.vnet.ibm.com>
---
 lib/eal/ppc/include/rte_cycles.h |  7 ++++++
 lib/eal/ppc/rte_cycles.c         | 39 ++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/lib/eal/ppc/include/rte_cycles.h b/lib/eal/ppc/include/rte_cycles.h
index 5585f9273c..666fc9b0bf 100644
--- a/lib/eal/ppc/include/rte_cycles.h
+++ b/lib/eal/ppc/include/rte_cycles.h
@@ -11,5 +11,8 @@ extern "C" {
 #endif
 
+#include <features.h>
+#ifdef __GLIBC__
 #include <sys/platform/ppc.h>
+#endif
 
 #include "generic/rte_cycles.h"
@@ -27,5 +30,9 @@ static inline uint64_t
 rte_rdtsc(void)
 {
+#ifdef __GLIBC__
 	return __ppc_get_timebase();
+#else
+	return __builtin_ppc_get_timebase();
+#endif
 }
 
diff --git a/lib/eal/ppc/rte_cycles.c b/lib/eal/ppc/rte_cycles.c
index 3180adb0ff..cd4bdff8b8 100644
--- a/lib/eal/ppc/rte_cycles.c
+++ b/lib/eal/ppc/rte_cycles.c
@@ -3,5 +3,11 @@
  */
 
+#include <features.h>
+#ifdef __GLIBC__
 #include <sys/platform/ppc.h>
+#elif RTE_EXEC_ENV_LINUX
+#include <string.h>
+#include <stdio.h>
+#endif
 
 #include "eal_private.h"
@@ -10,4 +16,37 @@ uint64_t
 get_tsc_freq_arch(void)
 {
+#ifdef __GLIBC__
 	return __ppc_get_timebase_freq();
+#elif RTE_EXEC_ENV_LINUX
+	static unsigned long base;
+	char buf[512];
+	ssize_t nr;
+	FILE *f;
+
+	if (base != 0)
+		goto out;
+
+	f = fopen("/proc/cpuinfo", "rb");
+	if (f == NULL)
+		goto out;
+
+	while (fgets(buf, sizeof(buf), f) != NULL) {
+		char *ret = strstr(buf, "timebase");
+
+		if (ret == NULL)
+			continue;
+		ret += sizeof("timebase") - 1;
+		ret = strchr(ret, ':');
+		if (ret == NULL)
+			continue;
+		base = strtoul(ret + 1, NULL, 10);
+		break;
+	}
+	fclose(f);
+out:
+	return (uint64_t) base;
+#else
+	return 0;
+#endif
+
 }
-- 
2.34.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-09 12:34:31.438797115 +0100
+++ 0074-eal-ppc-fix-compilation-for-musl.patch	2022-06-09 12:34:29.814980758 +0100
@@ -1 +1 @@
-From 0615dd2aa139312a93ae312233a80e164c8f1048 Mon Sep 17 00:00:00 2001
+From 52c9e902beb02d3d458a13eaa484c23b4487eae7 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,2 @@
+
+[ upstream commit 0615dd2aa139312a93ae312233a80e164c8f1048 ]



More information about the stable mailing list