Linux-RISC-V Archive on lore.kernel.org
 help / Atom feed
* [PATCH] tools uapi: fix RISC-V 64-bit support
@ 2018-12-25 14:46 Aurelien Jarno
  2018-12-26 17:19 ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2018-12-25 14:46 UTC (permalink / raw)
  To: linux-riscv; +Cc: Aurelien Jarno

The BPF library is not built on 64-bit RISC-V, as the BPF feature is
not detected. Looking more in details, feature/test-bpf.c fails to build
with the following error:

| In file included from /tmp/linux-4.19.12/tools/include/uapi/asm/bitsperlong.h:17,
|                  from /tmp/linux-4.19.12/tools/include/uapi/asm-generic/unistd.h:2,
|                  from /usr/include/riscv64-linux-gnu/asm/unistd.h:1,
|                  from test-bpf.c:2:
| /tmp/linux-4.19.12/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h
|  #error Inconsistent word size. Check asm/bitsperlong.h
|   ^~~~~

The UAPI from the tools directory is missing RISC-V support, therefore
bitsperlong.h from asm-generic is used, defaulting to 32 bits.

Fix that by adding tools/arch/riscv/include/uapi/asm/bitsperlong.h as
a copy of arch/riscv/include/uapi/asm/bitsperlong.h and by updating
tools/include/uapi/asm/bitsperlong.h.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 .../arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++++++++++++++
 tools/include/uapi/asm/bitsperlong.h          |  2 ++
 2 files changed, 27 insertions(+)
 create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h

diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
new file mode 100644
index 000000000000..0b3cb52fd29d
--- /dev/null
+++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 ARM Ltd.
+ * Copyright (C) 2015 Regents of the University of California
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
+#define _UAPI_ASM_RISCV_BITSPERLONG_H
+
+#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
+
+#include <asm-generic/bitsperlong.h>
+
+#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h
index 8dd6aefdafa4..fd92ce8388fc 100644
--- a/tools/include/uapi/asm/bitsperlong.h
+++ b/tools/include/uapi/asm/bitsperlong.h
@@ -13,6 +13,8 @@
 #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
 #elif defined(__ia64__)
 #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
+#elif defined(__riscv)
+#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
 #else
 #include <asm-generic/bitsperlong.h>
 #endif
-- 
2.19.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] tools uapi: fix RISC-V 64-bit support
  2018-12-25 14:46 [PATCH] tools uapi: fix RISC-V 64-bit support Aurelien Jarno
@ 2018-12-26 17:19 ` Palmer Dabbelt
  2018-12-26 20:13   ` Aurelien Jarno
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2018-12-26 17:19 UTC (permalink / raw)
  To: aurelien; +Cc: linux-riscv, aurelien

On Tue, 25 Dec 2018 06:46:24 PST (-0800), aurelien@aurel32.net wrote:
> The BPF library is not built on 64-bit RISC-V, as the BPF feature is
> not detected. Looking more in details, feature/test-bpf.c fails to build
> with the following error:
>
> | In file included from /tmp/linux-4.19.12/tools/include/uapi/asm/bitsperlong.h:17,
> |                  from /tmp/linux-4.19.12/tools/include/uapi/asm-generic/unistd.h:2,
> |                  from /usr/include/riscv64-linux-gnu/asm/unistd.h:1,
> |                  from test-bpf.c:2:
> | /tmp/linux-4.19.12/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h
> |  #error Inconsistent word size. Check asm/bitsperlong.h
> |   ^~~~~
>
> The UAPI from the tools directory is missing RISC-V support, therefore
> bitsperlong.h from asm-generic is used, defaulting to 32 bits.
>
> Fix that by adding tools/arch/riscv/include/uapi/asm/bitsperlong.h as
> a copy of arch/riscv/include/uapi/asm/bitsperlong.h and by updating
> tools/include/uapi/asm/bitsperlong.h.
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  .../arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++++++++++++++
>  tools/include/uapi/asm/bitsperlong.h          |  2 ++
>  2 files changed, 27 insertions(+)
>  create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h
>
> diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
> new file mode 100644
> index 000000000000..0b3cb52fd29d
> --- /dev/null
> +++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2012 ARM Ltd.
> + * Copyright (C) 2015 Regents of the University of California
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
> +#define _UAPI_ASM_RISCV_BITSPERLONG_H
> +
> +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
> +
> +#include <asm-generic/bitsperlong.h>
> +
> +#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
> diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h
> index 8dd6aefdafa4..fd92ce8388fc 100644
> --- a/tools/include/uapi/asm/bitsperlong.h
> +++ b/tools/include/uapi/asm/bitsperlong.h
> @@ -13,6 +13,8 @@
>  #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
>  #elif defined(__ia64__)
>  #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
> +#elif defined(__riscv)
> +#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
>  #else
>  #include <asm-generic/bitsperlong.h>
>  #endif

Reviewed-by: Palmer Dabbelt <palmer@sifive.com>

Do you want me to put this in my tree?

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] tools uapi: fix RISC-V 64-bit support
  2018-12-26 17:19 ` Palmer Dabbelt
@ 2018-12-26 20:13   ` Aurelien Jarno
  2019-01-07 15:55     ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2018-12-26 20:13 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: linux-riscv

On 2018-12-26 09:19, Palmer Dabbelt wrote:
> On Tue, 25 Dec 2018 06:46:24 PST (-0800), aurelien@aurel32.net wrote:
> > The BPF library is not built on 64-bit RISC-V, as the BPF feature is
> > not detected. Looking more in details, feature/test-bpf.c fails to build
> > with the following error:
> > 
> > | In file included from /tmp/linux-4.19.12/tools/include/uapi/asm/bitsperlong.h:17,
> > |                  from /tmp/linux-4.19.12/tools/include/uapi/asm-generic/unistd.h:2,
> > |                  from /usr/include/riscv64-linux-gnu/asm/unistd.h:1,
> > |                  from test-bpf.c:2:
> > | /tmp/linux-4.19.12/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h
> > |  #error Inconsistent word size. Check asm/bitsperlong.h
> > |   ^~~~~
> > 
> > The UAPI from the tools directory is missing RISC-V support, therefore
> > bitsperlong.h from asm-generic is used, defaulting to 32 bits.
> > 
> > Fix that by adding tools/arch/riscv/include/uapi/asm/bitsperlong.h as
> > a copy of arch/riscv/include/uapi/asm/bitsperlong.h and by updating
> > tools/include/uapi/asm/bitsperlong.h.
> > 
> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > ---
> >  .../arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++++++++++++++
> >  tools/include/uapi/asm/bitsperlong.h          |  2 ++
> >  2 files changed, 27 insertions(+)
> >  create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h
> > 
> > diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
> > new file mode 100644
> > index 000000000000..0b3cb52fd29d
> > --- /dev/null
> > +++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
> > @@ -0,0 +1,25 @@
> > +/*
> > + * Copyright (C) 2012 ARM Ltd.
> > + * Copyright (C) 2015 Regents of the University of California
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> > + */
> > +
> > +#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
> > +#define _UAPI_ASM_RISCV_BITSPERLONG_H
> > +
> > +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
> > +
> > +#include <asm-generic/bitsperlong.h>
> > +
> > +#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
> > diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h
> > index 8dd6aefdafa4..fd92ce8388fc 100644
> > --- a/tools/include/uapi/asm/bitsperlong.h
> > +++ b/tools/include/uapi/asm/bitsperlong.h
> > @@ -13,6 +13,8 @@
> >  #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
> >  #elif defined(__ia64__)
> >  #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
> > +#elif defined(__riscv)
> > +#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
> >  #else
> >  #include <asm-generic/bitsperlong.h>
> >  #endif
> 
> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>

Thanks for the review.

> Do you want me to put this in my tree?
> 

It's not clear for me how this should get merged and get_maintainer.pl
is not that useful here. If it is possible to merge it through your
tree, I would indeed appreciate if you can put it there.

Thanks,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] tools uapi: fix RISC-V 64-bit support
  2018-12-26 20:13   ` Aurelien Jarno
@ 2019-01-07 15:55     ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2019-01-07 15:55 UTC (permalink / raw)
  To: aurelien; +Cc: linux-riscv

On Wed, 26 Dec 2018 12:13:14 PST (-0800), aurelien@aurel32.net wrote:
> On 2018-12-26 09:19, Palmer Dabbelt wrote:
>> On Tue, 25 Dec 2018 06:46:24 PST (-0800), aurelien@aurel32.net wrote:
>> > The BPF library is not built on 64-bit RISC-V, as the BPF feature is
>> > not detected. Looking more in details, feature/test-bpf.c fails to build
>> > with the following error:
>> >
>> > | In file included from /tmp/linux-4.19.12/tools/include/uapi/asm/bitsperlong.h:17,
>> > |                  from /tmp/linux-4.19.12/tools/include/uapi/asm-generic/unistd.h:2,
>> > |                  from /usr/include/riscv64-linux-gnu/asm/unistd.h:1,
>> > |                  from test-bpf.c:2:
>> > | /tmp/linux-4.19.12/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h
>> > |  #error Inconsistent word size. Check asm/bitsperlong.h
>> > |   ^~~~~
>> >
>> > The UAPI from the tools directory is missing RISC-V support, therefore
>> > bitsperlong.h from asm-generic is used, defaulting to 32 bits.
>> >
>> > Fix that by adding tools/arch/riscv/include/uapi/asm/bitsperlong.h as
>> > a copy of arch/riscv/include/uapi/asm/bitsperlong.h and by updating
>> > tools/include/uapi/asm/bitsperlong.h.
>> >
>> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>> > ---
>> >  .../arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++++++++++++++
>> >  tools/include/uapi/asm/bitsperlong.h          |  2 ++
>> >  2 files changed, 27 insertions(+)
>> >  create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h
>> >
>> > diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
>> > new file mode 100644
>> > index 000000000000..0b3cb52fd29d
>> > --- /dev/null
>> > +++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
>> > @@ -0,0 +1,25 @@
>> > +/*
>> > + * Copyright (C) 2012 ARM Ltd.
>> > + * Copyright (C) 2015 Regents of the University of California
>> > + *
>> > + * This program is free software; you can redistribute it and/or modify
>> > + * it under the terms of the GNU General Public License version 2 as
>> > + * published by the Free Software Foundation.
>> > + *
>> > + * This program is distributed in the hope that it will be useful,
>> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> > + * GNU General Public License for more details.
>> > + *
>> > + * You should have received a copy of the GNU General Public License
>> > + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>> > + */
>> > +
>> > +#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
>> > +#define _UAPI_ASM_RISCV_BITSPERLONG_H
>> > +
>> > +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
>> > +
>> > +#include <asm-generic/bitsperlong.h>
>> > +
>> > +#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
>> > diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h
>> > index 8dd6aefdafa4..fd92ce8388fc 100644
>> > --- a/tools/include/uapi/asm/bitsperlong.h
>> > +++ b/tools/include/uapi/asm/bitsperlong.h
>> > @@ -13,6 +13,8 @@
>> >  #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
>> >  #elif defined(__ia64__)
>> >  #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
>> > +#elif defined(__riscv)
>> > +#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
>> >  #else
>> >  #include <asm-generic/bitsperlong.h>
>> >  #endif
>>
>> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
>
> Thanks for the review.
>
>> Do you want me to put this in my tree?
>>
>
> It's not clear for me how this should get merged and get_maintainer.pl
> is not that useful here. If it is possible to merge it through your
> tree, I would indeed appreciate if you can put it there.

OK, I'll send it up.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-25 14:46 [PATCH] tools uapi: fix RISC-V 64-bit support Aurelien Jarno
2018-12-26 17:19 ` Palmer Dabbelt
2018-12-26 20:13   ` Aurelien Jarno
2019-01-07 15:55     ` Palmer Dabbelt

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org infradead-linux-riscv@archiver.kernel.org
	public-inbox-index linux-riscv


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/ public-inbox