All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl
@ 2019-03-03 23:23 Vadim Kochan
  2019-03-07 21:58 ` Thomas Petazzoni
  2019-03-25 12:24 ` Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Vadim Kochan @ 2019-03-03 23:23 UTC (permalink / raw)
  To: buildroot

musl does not provide inx/outx API for ARM arch, so use
io memory access via pointers which is actually done this
way in glibc/ulibc.

Fixes:
    http://autobuild.buildroot.net/results/bf10cbe40c0f672c34db72e4eea4c168d5932bd4/

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---

PATCH v1:
       1) Tested on board with A13 SoC

RFT v2:
       1) Fixed mistaken copy-paste-n-replace of outl by sunxi_io_write in sunxi_io_mask(...)
 ...-meminfo-Access-to-io-memory-via-pointers.patch | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 package/sunxi-tools/0001-meminfo-Access-to-io-memory-via-pointers.patch

diff --git a/package/sunxi-tools/0001-meminfo-Access-to-io-memory-via-pointers.patch b/package/sunxi-tools/0001-meminfo-Access-to-io-memory-via-pointers.patch
new file mode 100644
index 0000000000..997c413f23
--- /dev/null
+++ b/package/sunxi-tools/0001-meminfo-Access-to-io-memory-via-pointers.patch
@@ -0,0 +1,59 @@
+From 5c0a443ba336f10a8db6a99c769aa84ad37ed4d2 Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <vadim4j@gmail.com>
+Date: Wed, 20 Feb 2019 02:48:43 +0200
+Subject: [PATCH] meminfo: Access to io memory via pointers
+
+The main reason for this is to be able compile with musl library,
+because there is no support of inx/outx functions for ARM platform.
+
+Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
+---
+ meminfo.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/meminfo.c b/meminfo.c
+index 0b0ff23..7d9f10f 100644
+--- a/meminfo.c
++++ b/meminfo.c
+@@ -22,7 +22,6 @@
+ #include <sys/mman.h>
+ #include <stdint.h>
+ #include <errno.h>
+-#include <sys/io.h>
+ #include <stdbool.h>
+ 
+ #include "common.h"
+@@ -74,24 +73,26 @@ static enum sunxi_soc_version soc_version;
+ unsigned int
+ sunxi_io_read(void *base, int offset)
+ {
+-	return inl((unsigned long) (base + offset));
++	unsigned long port = (unsigned long) (base + offset);
++	return *((volatile unsigned long *) port);
+ }
+ 
+ void
+ sunxi_io_write(void *base, int offset, unsigned int value)
+ {
+-	outl(value, (unsigned long) (base + offset));
++	unsigned long port = (unsigned long) (base + offset);
++	*((volatile unsigned long *) port) = value;
+ }
+ 
+ void
+ sunxi_io_mask(void *base, int offset, unsigned int value, unsigned int mask)
+ {
+-	unsigned int tmp = inl((unsigned long) (base + offset));
++	unsigned int tmp = sunxi_io_read(base, offset);
+ 
+ 	tmp &= ~mask;
+ 	tmp |= value & mask;
+ 
+-	outl(tmp, (unsigned long) (base + offset));
++	sunxi_io_write(base, offset, tmp);
+ }
+ 
+ 
+-- 
+2.14.1
+
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl
  2019-03-03 23:23 [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl Vadim Kochan
@ 2019-03-07 21:58 ` Thomas Petazzoni
  2019-03-07 22:11   ` Vadim Kochan
  2019-03-25 12:24 ` Peter Korsgaard
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2019-03-07 21:58 UTC (permalink / raw)
  To: buildroot

On Mon,  4 Mar 2019 01:23:40 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> musl does not provide inx/outx API for ARM arch, so use
> io memory access via pointers which is actually done this
> way in glibc/ulibc.
> 
> Fixes:
>     http://autobuild.buildroot.net/results/bf10cbe40c0f672c34db72e4eea4c168d5932bd4/
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> ---

Applied to master, thanks. Could you please submit this patch
upstream ? The project is on Github, so submitting a pull request is
fairly trivial.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl
  2019-03-07 21:58 ` Thomas Petazzoni
@ 2019-03-07 22:11   ` Vadim Kochan
  0 siblings, 0 replies; 4+ messages in thread
From: Vadim Kochan @ 2019-03-07 22:11 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Thu, Mar 07, 2019 at 10:58:57PM +0100, Thomas Petazzoni wrote:
> On Mon,  4 Mar 2019 01:23:40 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
> 
> > musl does not provide inx/outx API for ARM arch, so use
> > io memory access via pointers which is actually done this
> > way in glibc/ulibc.
> > 
> > Fixes:
> >     http://autobuild.buildroot.net/results/bf10cbe40c0f672c34db72e4eea4c168d5932bd4/
> > 
> > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> > ---
> 
> Applied to master, thanks. Could you please submit this patch
> upstream ? The project is on Github, so submitting a pull request is
> fairly trivial.
> 
> Thanks!

Already there:

    https://github.com/linux-sunxi/sunxi-tools/pull/122

Regards,
Vadim Kochan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl
  2019-03-03 23:23 [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl Vadim Kochan
  2019-03-07 21:58 ` Thomas Petazzoni
@ 2019-03-25 12:24 ` Peter Korsgaard
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2019-03-25 12:24 UTC (permalink / raw)
  To: buildroot

>>>>> "Vadim" == Vadim Kochan <vadim4j@gmail.com> writes:

 > musl does not provide inx/outx API for ARM arch, so use
 > io memory access via pointers which is actually done this
 > way in glibc/ulibc.

 > Fixes:
 >     http://autobuild.buildroot.net/results/bf10cbe40c0f672c34db72e4eea4c168d5932bd4/

 > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
 > ---

 > PATCH v1:
 >        1) Tested on board with A13 SoC

 > RFT v2:
 >        1) Fixed mistaken copy-paste-n-replace of outl by sunxi_io_write in sunxi_io_mask(...)

Committed to 2019.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-25 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-03 23:23 [Buildroot] [PATCH] package/sunxi-tools: Fix build meminfo with musl Vadim Kochan
2019-03-07 21:58 ` Thomas Petazzoni
2019-03-07 22:11   ` Vadim Kochan
2019-03-25 12:24 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.