From patchwork Tue Mar 12 10:16:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 51113 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 056724C8F; Tue, 12 Mar 2019 11:16:50 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [74.117.190.25]) by dpdk.org (Postfix) with ESMTP id 5A3A344C3 for ; Tue, 12 Mar 2019 11:16:48 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 05ED09E0455; Tue, 12 Mar 2019 10:16:47 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 3AD3D9E0026; Tue, 12 Mar 2019 10:16:45 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org Cc: Natanael Copa Date: Tue, 12 Mar 2019 11:16:30 +0100 Message-Id: <20190312101630.18250-1-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190311173702.24471-4-ncopa@alpinelinux.org> References: <20190311173702.24471-4-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add a fallback for non-GNU libc systems like musl libc for the non-standard functions outl_p, outw_p and outb_p. This ifixes the following buildtime errors when building with musl libc: pci_uio.c:(.text+0xaa1): undefined reference to `outw_p' pci_uio.c:(.text+0xac5): undefined reference to `outl_p' pci_uio.c:(.text+0xadf): undefined reference to `outb_p' fixes https://bugs.dpdk.org/show_bug.cgi?id=35 Signed-off-by: Natanael Copa --- v2 - fixed coding style issues reported by checkpatch drivers/bus/pci/linux/pci_uio.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 09ecbb7aa..e1dd8c875 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -14,6 +14,32 @@ #if defined(RTE_ARCH_X86) #include +#if defined(__GLIBC__) +#define pci_uio_outl_p outl_p +#define pci_uio_outw_p outw_p +#define pci_uio_outb_p outb_p +#else +static inline void +pci_uio_outl_p(unsigned int value, unsigned short int port) +{ + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value), + "Nd" (port)); +} + +static inline void +pci_uio_outw_p(unsigned short int value, unsigned short int port) +{ + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value), + "Nd" (port)); +} + +static inline void +pci_uio_outb_p(unsigned char value, unsigned short int port) +{ + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value), + "Nd" (port)); +} +#endif #endif #include @@ -527,21 +553,21 @@ pci_uio_ioport_write(struct rte_pci_ioport *p, if (len >= 4) { size = 4; #if defined(RTE_ARCH_X86) - outl_p(*(const uint32_t *)s, reg); + pci_uio_outl_p(*(const uint32_t *)s, reg); #else *(volatile uint32_t *)reg = *(const uint32_t *)s; #endif } else if (len >= 2) { size = 2; #if defined(RTE_ARCH_X86) - outw_p(*(const uint16_t *)s, reg); + pci_uio_outw_p(*(const uint16_t *)s, reg); #else *(volatile uint16_t *)reg = *(const uint16_t *)s; #endif } else { size = 1; #if defined(RTE_ARCH_X86) - outb_p(*s, reg); + pci_uio_outb_p(*s, reg); #else *(volatile uint8_t *)reg = *s; #endif From patchwork Tue Mar 12 10:18:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 51115 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90BE24C9D; Tue, 12 Mar 2019 11:18:51 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [74.117.190.25]) by dpdk.org (Postfix) with ESMTP id 7CCA8239 for ; Tue, 12 Mar 2019 11:18:49 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 839479E0455; Tue, 12 Mar 2019 10:18:48 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id A787E9E0026; Tue, 12 Mar 2019 10:18:47 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org Cc: Natanael Copa Date: Tue, 12 Mar 2019 11:18:36 +0100 Message-Id: <20190312101836.18447-1-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190311173702.24471-5-ncopa@alpinelinux.org> References: <20190311173702.24471-5-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" define the macros so we can remove various #if defined(RTE_ARCH_X86) Ref: https://bugs.dpdk.org/show_bug.cgi?id=35#c6 Signed-off-by: Natanael Copa --- v1 -> v2 fixed coding style issues reported by checkpatch drivers/bus/pci/linux/pci_uio.c | 54 +++++++++++++++------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index e1dd8c875..b0470358d 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -14,11 +14,18 @@ #if defined(RTE_ARCH_X86) #include + +#define pci_uio_inl(reg) inl(reg) +#define pci_uio_inw(reg) inw(reg) +#define pci_uio_inb(reg) inb(reg) + #if defined(__GLIBC__) + #define pci_uio_outl_p outl_p #define pci_uio_outw_p outw_p #define pci_uio_outb_p outb_p -#else + +#else /* defined(__GLIBC__) */ static inline void pci_uio_outl_p(unsigned int value, unsigned short int port) { @@ -39,8 +46,19 @@ pci_uio_outb_p(unsigned char value, unsigned short int port) __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value), "Nd" (port)); } -#endif -#endif +#endif /* defined(__GLIBC__) */ + +#else /* RTE_ARCH_X86 */ + +#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg)) +#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg)) +#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg)) + +#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value)) +#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value)) +#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value)) + +#endif /* RTE_ARCH_X86 */ #include #include @@ -518,25 +536,13 @@ pci_uio_ioport_read(struct rte_pci_ioport *p, for (d = data; len > 0; d += size, reg += size, len -= size) { if (len >= 4) { size = 4; -#if defined(RTE_ARCH_X86) - *(uint32_t *)d = inl(reg); -#else - *(uint32_t *)d = *(volatile uint32_t *)reg; -#endif + *(uint32_t *)d = pci_uio_inl(reg); } else if (len >= 2) { size = 2; -#if defined(RTE_ARCH_X86) - *(uint16_t *)d = inw(reg); -#else - *(uint16_t *)d = *(volatile uint16_t *)reg; -#endif + *(uint16_t *)d = pci_uio_inw(reg); } else { size = 1; -#if defined(RTE_ARCH_X86) - *d = inb(reg); -#else - *d = *(volatile uint8_t *)reg; -#endif + *d = pci_uio_inb(reg); } } } @@ -552,25 +558,13 @@ pci_uio_ioport_write(struct rte_pci_ioport *p, for (s = data; len > 0; s += size, reg += size, len -= size) { if (len >= 4) { size = 4; -#if defined(RTE_ARCH_X86) pci_uio_outl_p(*(const uint32_t *)s, reg); -#else - *(volatile uint32_t *)reg = *(const uint32_t *)s; -#endif } else if (len >= 2) { size = 2; -#if defined(RTE_ARCH_X86) pci_uio_outw_p(*(const uint16_t *)s, reg); -#else - *(volatile uint16_t *)reg = *(const uint16_t *)s; -#endif } else { size = 1; -#if defined(RTE_ARCH_X86) pci_uio_outb_p(*s, reg); -#else - *(volatile uint8_t *)reg = *s; -#endif } } } From patchwork Tue Mar 12 10:20:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 51117 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BBCFD44C3; Tue, 12 Mar 2019 11:20:44 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [74.117.190.25]) by dpdk.org (Postfix) with ESMTP id BC422239 for ; Tue, 12 Mar 2019 11:20:43 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 032229E0449; Tue, 12 Mar 2019 10:20:43 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 276729E0026; Tue, 12 Mar 2019 10:20:41 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org Cc: Natanael Copa Date: Tue, 12 Mar 2019 11:20:20 +0100 Message-Id: <20190312102020.18636-1-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190311173702.24471-13-ncopa@alpinelinux.org> References: <20190311173702.24471-13-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 12/15] crypto/dpaa2_sec: build fix for musl libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The swab16/swab32/swab64 are Linux specific and nog GNU libc specific. Keep the check for __GLIBC__ just in case other GNU systems depends on this (Hurd or GNU/kFreeBSD). This fixes a build error with musl libc. Signed-off-by: Natanael Copa --- v1 -> v2 fixed coding style issues reported by checkpatch: WARNING:SPACING: space prohibited between function name and open parenthesis '(' #76: FILE: drivers/crypto/dpaa2_sec/hw/compat.h:104: +#if defined(__linux__) || defined (__GLIBC__) drivers/crypto/dpaa2_sec/hw/compat.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h b/drivers/crypto/dpaa2_sec/hw/compat.h index ce946ccb5..1362045ca 100644 --- a/drivers/crypto/dpaa2_sec/hw/compat.h +++ b/drivers/crypto/dpaa2_sec/hw/compat.h @@ -11,7 +11,7 @@ #include #include -#ifdef __GLIBC__ +#ifdef __linux__ #include #include #include @@ -40,7 +40,7 @@ #define __maybe_unused __attribute__((unused)) #endif -#if defined(__GLIBC__) && !defined(pr_debug) +#if !defined(pr_debug) #if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG) #define pr_debug(fmt, ...) \ RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) @@ -49,7 +49,7 @@ #endif #endif /* pr_debug */ -#if defined(__GLIBC__) && !defined(pr_err) +#if !defined(pr_err) #if !defined(SUPPRESS_PRINTS) #define pr_err(fmt, ...) \ RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) @@ -58,7 +58,7 @@ #endif #endif /* pr_err */ -#if defined(__GLIBC__) && !defined(pr_warn) +#if !defined(pr_warn) #if !defined(SUPPRESS_PRINTS) #define pr_warn(fmt, ...) \ RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) @@ -101,7 +101,7 @@ #endif /* Use Linux naming convention */ -#ifdef __GLIBC__ +#if defined(__linux__) || defined(__GLIBC__) #define swab16(x) rte_bswap16(x) #define swab32(x) rte_bswap32(x) #define swab64(x) rte_bswap64(x) From patchwork Tue Mar 12 10:22:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 51118 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DB963772; Tue, 12 Mar 2019 11:22:55 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [74.117.190.25]) by dpdk.org (Postfix) with ESMTP id 1C1593572 for ; Tue, 12 Mar 2019 11:22:54 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 73DCD9E0456; Tue, 12 Mar 2019 10:22:53 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 92B9A9E0026; Tue, 12 Mar 2019 10:22:51 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org Cc: Natanael Copa Date: Tue, 12 Mar 2019 11:22:36 +0100 Message-Id: <20190312102236.18812-1-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190311112129.068377a0@shemminger-XPS-13-9360> References: <20190311112129.068377a0@shemminger-XPS-13-9360> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 15/15] eal/linux: simplify debug message in sigbus_handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" There is no guarantee that pthread_self() returns the thread ID or that pthread_t is an integer. The thread ID is not that useful so simply remove it. This fixes the following warning when building with musl libc: ../lib/librte_eal/linuxapp/eal/eal_dev.c: In function 'sigbus_handler': ../lib/librte_eal/linuxapp/eal/eal_dev.c:70:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] (int)pthread_self(), info->si_addr); ^ Signed-off-by: Natanael Copa --- v1 -> v2: remove gettid() and remove thread id from debug message. lib/librte_eal/linuxapp/eal/eal_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c index 2830c8687..c41809380 100644 --- a/lib/librte_eal/linuxapp/eal/eal_dev.c +++ b/lib/librte_eal/linuxapp/eal/eal_dev.c @@ -66,8 +66,8 @@ static void sigbus_handler(int signum, siginfo_t *info, { int ret; - RTE_LOG(DEBUG, EAL, "Thread[%d] catch SIGBUS, fault address:%p\n", - (int)pthread_self(), info->si_addr); + RTE_LOG(DEBUG, EAL, "Thread catch SIGBUS, fault address:%p\n", + info->si_addr); rte_spinlock_lock(&failure_handle_lock); ret = rte_bus_sigbus_handler(info->si_addr);