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 29FA6A0579 for ; Fri, 19 Mar 2021 15:58:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 52907140F75; Fri, 19 Mar 2021 15:58:04 +0100 (CET) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id CCAA0140F6F; Fri, 19 Mar 2021 15:58:02 +0100 (CET) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 2F4F3147F; Fri, 19 Mar 2021 10:58:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 19 Mar 2021 10:58:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=aSoI9SC4iXoWX pRZ8fHXPXRkhD1ozbxwb9PCXe1/7tg=; b=x1npxk+0PF6qMBRcnyjDrh5p5O+Hk 2Q8cs5Ap1Xte/bHeLEs0TwFej61hdrnbUoELHpowf5MCpt0dxPnZdd75QDXk/8ke +mMcVh2UVGaFluUdt1QcqfIdsVry0MuBNecdMEL2qe3MOqM9kg1mJnr+QFYtbz/F xR8hwnSMA+bqK+LbUbY2vmFRc3oLbzlb1FOMdc7Ws2WJHt1rOoxH7PMl/5vidOKp 5e0gk4Wjzsv08jsOeiBwkT00Nf1gZNO5lNTOL+LQZn7FbB4PhyzPAEYwcktz8fB3 AHSQY6C6/0RmrMLP/N6g+o7eDGkpzvqMZfLuEeE7ubUMNRdFHsKCOd3lg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=aSoI9SC4iXoWXpRZ8fHXPXRkhD1ozbxwb9PCXe1/7tg=; b=OmRC6xw6 0ccxqMZkm5XbQVOTFhgk5RSukQUFhFep2eMcMqu+eN9K7nxJyN4UBbTEiElq1yLZ XF6cfdhnmlqlVgzc0WYUWfeChjz7EhopxxTLggUwHHsD32gixKpGuoE7Fbvvsx2u e/DfJPk8TJ1gaXMZmfF4cMfI4Ty347QFEYz30vBazhxgpOstrAl2WgA4Uwq2KE4Z TOVO13P7Gw50kMp0gPNBAEtLW8T0e9rrfTaQMl2+98CIaShzuH3T9aMI0TwR1sJG Pi54v5s5WR+oih4mtUq/Sj1CyamUtUGYciBLV/ZF6D/g51zKqqdp8iuvjzQ7TVyn 8r2JE4zVexQ6rg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudefkedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E617424006B; Fri, 19 Mar 2021 10:57:58 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ncopa@alpinelinux.org, stable@dpdk.org, Andrew Rybchenko , David Marchand , Ferruh Yigit , Yuanhan Liu , David Marchand Date: Fri, 19 Mar 2021 15:57:24 +0100 Message-Id: <20210319145730.3555384-12-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210319145730.3555384-1-thomas@monjalon.net> References: <20190313170657.16688-1-ncopa@alpinelinux.org> <20210319145730.3555384-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v7 11/17] bus/pci: support I/O port operations with musl X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Add a fallback for non-GNU libc systems like musl libc for the non-standard functions outl_p, outw_p and outb_p. It solves the following errors when building with musl libc: pci_uio.c: undefined reference to 'outw_p' pci_uio.c: undefined reference to 'outl_p' pci_uio.c: undefined reference to 'outb_p' Bugzilla ID: 35 Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API") Cc: stable@dpdk.org Reported-by: Natanael Copa Signed-off-by: Thomas Monjalon Acked-by: Andrew Rybchenko Acked-by: David Marchand --- drivers/bus/pci/linux/pci_uio.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 0907051e04..39ebeac2a0 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -526,13 +526,18 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, #endif #if defined(RTE_ARCH_X86) + static inline uint8_t ioread8(void *addr) { uint8_t val; val = (uint64_t)(uintptr_t)addr >= PIO_MAX ? *(volatile uint8_t *)addr : +#ifdef __GLIBC__ inb_p((unsigned long)addr); +#else + inb((unsigned long)addr); +#endif return val; } @@ -543,7 +548,11 @@ static inline uint16_t ioread16(void *addr) val = (uint64_t)(uintptr_t)addr >= PIO_MAX ? *(volatile uint16_t *)addr : +#ifdef __GLIBC__ inw_p((unsigned long)addr); +#else + inw((unsigned long)addr); +#endif return val; } @@ -554,7 +563,11 @@ static inline uint32_t ioread32(void *addr) val = (uint64_t)(uintptr_t)addr >= PIO_MAX ? *(volatile uint32_t *)addr : +#ifdef __GLIBC__ inl_p((unsigned long)addr); +#else + inl((unsigned long)addr); +#endif return val; } @@ -563,23 +576,37 @@ static inline void iowrite8(uint8_t val, void *addr) { (uint64_t)(uintptr_t)addr >= PIO_MAX ? *(volatile uint8_t *)addr = val : +#ifdef __GLIBC__ outb_p(val, (unsigned long)addr); +#else + outb(val, (unsigned long)addr); +#endif } static inline void iowrite16(uint16_t val, void *addr) { (uint64_t)(uintptr_t)addr >= PIO_MAX ? *(volatile uint16_t *)addr = val : +#ifdef __GLIBC__ outw_p(val, (unsigned long)addr); +#else + outw(val, (unsigned long)addr); +#endif } static inline void iowrite32(uint32_t val, void *addr) { (uint64_t)(uintptr_t)addr >= PIO_MAX ? *(volatile uint32_t *)addr = val : +#ifdef __GLIBC__ outl_p(val, (unsigned long)addr); -} #else + outl(val, (unsigned long)addr); +#endif +} + +#else /* !RTE_ARCH_X86 */ + static inline uint8_t ioread8(void *addr) { return *(volatile uint8_t *)addr; @@ -609,7 +636,8 @@ static inline void iowrite32(uint32_t val, void *addr) { *(volatile uint32_t *)addr = val; } -#endif + +#endif /* !RTE_ARCH_X86 */ void pci_uio_ioport_read(struct rte_pci_ioport *p, -- 2.30.1