Re: [systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2017-02-10 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Feb 10, 2017 at 12:45:51PM +, Richard W.M. Jones wrote:
> On Fri, Sep 30, 2016 at 04:45:01PM +0100, Richard W.M. Jones wrote:
> > Signed-off-by: Richard W.M. Jones 
> > ---
> >  src/basic/architecture.c | 14 ++
> >  src/basic/architecture.h | 16 
> >  2 files changed, 30 insertions(+)
> > 
> > diff --git a/src/basic/architecture.c b/src/basic/architecture.c
> > index b1c8e91..e1412be 100644
> > --- a/src/basic/architecture.c
> > +++ b/src/basic/architecture.c
> > @@ -123,6 +123,17 @@ int uname_architecture(void) {
> >  { "crisv32",ARCHITECTURE_CRIS },
> >  #elif defined(__nios2__)
> >  { "nios2",  ARCHITECTURE_NIOS2},
> > +#elif defined(__riscv__)
> > +{ "riscv32",ARCHITECTURE_RISCV32  },
> > +{ "riscv64",ARCHITECTURE_RISCV64  },
> > +{ "riscv128",   ARCHITECTURE_RISCV128 },
> > +#  if __SIZEOF_POINTER__ == 4
> > +{ "riscv",  ARCHITECTURE_RISCV32  },
> > +#  elif __SIZEOF_POINTER__ == 8
> > +{ "riscv",  ARCHITECTURE_RISCV64  },
> > +#  elif __SIZEOF_POINTER__ == 16
> > +{ "riscv",  ARCHITECTURE_RISCV128 },
> > +#  endif
> 
> I just want to say that after this change, RISC-V unilaterally removed
> __riscv__ (and __riscv64 etc which other projects were using).  I'm
> very annoyed about that as it breaks many patches that I sent upstream
> including to systemd.
> 
> GCC changes for RISC-V have subsequently been accepted upstream, so
> they cannot do this again.
> 
> The change is simply s/__riscv__/__riscv/g ie:
> 
> > -#elif defined(__riscv__)
> > +#elif defined(__riscv)
> 
> As we will need to rebuild the whole of Fedora/RISC-V to cope with
> this and other changes, I don't currently have a working GCC (and less
> still a working systemd) so I can't submit a formal patch right now.
> 
> Rich.

https://github.com/systemd/systemd/pull/5304

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2017-02-10 Thread Richard W.M. Jones
On Fri, Sep 30, 2016 at 04:45:01PM +0100, Richard W.M. Jones wrote:
> Signed-off-by: Richard W.M. Jones 
> ---
>  src/basic/architecture.c | 14 ++
>  src/basic/architecture.h | 16 
>  2 files changed, 30 insertions(+)
> 
> diff --git a/src/basic/architecture.c b/src/basic/architecture.c
> index b1c8e91..e1412be 100644
> --- a/src/basic/architecture.c
> +++ b/src/basic/architecture.c
> @@ -123,6 +123,17 @@ int uname_architecture(void) {
>  { "crisv32",ARCHITECTURE_CRIS },
>  #elif defined(__nios2__)
>  { "nios2",  ARCHITECTURE_NIOS2},
> +#elif defined(__riscv__)
> +{ "riscv32",ARCHITECTURE_RISCV32  },
> +{ "riscv64",ARCHITECTURE_RISCV64  },
> +{ "riscv128",   ARCHITECTURE_RISCV128 },
> +#  if __SIZEOF_POINTER__ == 4
> +{ "riscv",  ARCHITECTURE_RISCV32  },
> +#  elif __SIZEOF_POINTER__ == 8
> +{ "riscv",  ARCHITECTURE_RISCV64  },
> +#  elif __SIZEOF_POINTER__ == 16
> +{ "riscv",  ARCHITECTURE_RISCV128 },
> +#  endif

I just want to say that after this change, RISC-V unilaterally removed
__riscv__ (and __riscv64 etc which other projects were using).  I'm
very annoyed about that as it breaks many patches that I sent upstream
including to systemd.

GCC changes for RISC-V have subsequently been accepted upstream, so
they cannot do this again.

The change is simply s/__riscv__/__riscv/g ie:

> -#elif defined(__riscv__)
> +#elif defined(__riscv)

As we will need to rebuild the whole of Fedora/RISC-V to cope with
this and other changes, I don't currently have a working GCC (and less
still a working systemd) so I can't submit a formal patch right now.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2016-10-04 Thread Richard W.M. Jones
On Tue, Oct 04, 2016 at 03:36:48PM +0200, Lennart Poettering wrote:
> I created a github PR from this:
> 
> https://github.com/systemd/systemd/pull/4282
> 
> Would be good to follow up discussion there.

Thanks for the feedback Lennart.  Just FYI we are still building and
testing this package.  It's very painful and slow to compile, so
everything takes 10x longer than normal.  I'll follow up at the link
above when we have verified that it all or at least mostly works.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2016-10-04 Thread Lennart Poettering
On Fri, 30.09.16 16:45, Richard W.M. Jones (rjo...@redhat.com) wrote:

> [This is only compile-tested, as our kernel doesn't (yet) have
> enough configured features to run systemd, but I'll report back
> when I get it running.]
> 
> RISC-V is an open source ISA in development since 2010 at UCB.
> For more information, see https://riscv.org/
> 
> I am adding RISC-V support to Fedora:
> https://fedoraproject.org/wiki/Architectures/RISC-V
> 
> There are three major variants of the architecture (32-, 64- and
> 128-bit).  The 128-bit variant is a paper exercise, but the other two
> really exist in silicon.  RISC-V is always little endian.
> 
> On Linux, the default kernel uname(2) can return "riscv" for all
> variants.  However a patch was added recently which makes the kernel
> return one of "riscv32" or "riscv64" (or in future "riscv128").  So
> systemd should be prepared to handle any of "riscv", "riscv32",
> "riscv64" or "riscv128".  If the kernel returns "riscv" then you
> need to use the pointer size in order to know the real variant.
> 
> The Fedora/RISC-V kernel only ever returns "riscv64" since we're only
> doing Fedora for 64 bit at the moment, and we've patched the kernel so
> it doesn't return "riscv".
> 
> As well as the major bitsize variants, there are also architecture
> extensions.  However I'm trying to ensure that uname(2) does *not*
> return any other information about those in utsname.machine, so that
> we don't end up with "riscv64abcde" nonsense.  Instead those
> extensions will be exposed in /proc/cpuinfo similar to how flags work
> in x86.
> 
> I should also note that __SIZEOF_POINTER__ is a GCC extension, but it
> appears to be used already in systemd so I guess that's OK.

Any chance you can move this cover letter (or at least most of it into
the commit itself? I think it would be great to have all of this in
the commit).

Also, if riscv128 is a paper excercise for now, then I'd prefer if
this was left out of the current patch for now.

I created a github PR from this:

https://github.com/systemd/systemd/pull/4282

Would be good to follow up discussion there.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2016-09-30 Thread systemd github import bot
Patchset imported to github.
To create a pull request, one of the main developers has to initiate one via:


--
Generated by https://github.com/haraldh/mail2git
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2016-09-30 Thread Richard W.M. Jones
Signed-off-by: Richard W.M. Jones 
---
 src/basic/architecture.c | 14 ++
 src/basic/architecture.h | 16 
 2 files changed, 30 insertions(+)

diff --git a/src/basic/architecture.c b/src/basic/architecture.c
index b1c8e91..e1412be 100644
--- a/src/basic/architecture.c
+++ b/src/basic/architecture.c
@@ -123,6 +123,17 @@ int uname_architecture(void) {
 { "crisv32",ARCHITECTURE_CRIS },
 #elif defined(__nios2__)
 { "nios2",  ARCHITECTURE_NIOS2},
+#elif defined(__riscv__)
+{ "riscv32",ARCHITECTURE_RISCV32  },
+{ "riscv64",ARCHITECTURE_RISCV64  },
+{ "riscv128",   ARCHITECTURE_RISCV128 },
+#  if __SIZEOF_POINTER__ == 4
+{ "riscv",  ARCHITECTURE_RISCV32  },
+#  elif __SIZEOF_POINTER__ == 8
+{ "riscv",  ARCHITECTURE_RISCV64  },
+#  elif __SIZEOF_POINTER__ == 16
+{ "riscv",  ARCHITECTURE_RISCV128 },
+#  endif
 #else
 #error "Please register your architecture here!"
 #endif
@@ -174,6 +185,9 @@ static const char *const 
architecture_table[_ARCHITECTURE_MAX] = {
 [ARCHITECTURE_TILEGX] = "tilegx",
 [ARCHITECTURE_CRIS] = "cris",
 [ARCHITECTURE_NIOS2] = "nios2",
+[ARCHITECTURE_RISCV32] = "riscv32",
+[ARCHITECTURE_RISCV64] = "riscv64",
+[ARCHITECTURE_RISCV128] = "riscv128",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(architecture, int);
diff --git a/src/basic/architecture.h b/src/basic/architecture.h
index b3e4d85..b8830fc 100644
--- a/src/basic/architecture.h
+++ b/src/basic/architecture.h
@@ -58,6 +58,9 @@ enum {
 ARCHITECTURE_TILEGX,
 ARCHITECTURE_CRIS,
 ARCHITECTURE_NIOS2,
+ARCHITECTURE_RISCV32,
+ARCHITECTURE_RISCV64,
+ARCHITECTURE_RISCV128,
 _ARCHITECTURE_MAX,
 _ARCHITECTURE_INVALID = -1
 };
@@ -191,6 +194,19 @@ int uname_architecture(void);
 #elif defined(__nios2__)
 #  define native_architecture() ARCHITECTURE_NIOS2
 #  define LIB_ARCH_TUPLE "nios2-linux-gnu"
+#elif defined(__riscv__)
+#  if __SIZEOF_POINTER__ == 4
+#define native_architecture() ARCHITECTURE_RISCV32
+#define LIB_ARCH_TUPLE "riscv32-linux-gnu"
+#  elif __SIZEOF_POINTER__ == 8
+#define native_architecture() ARCHITECTURE_RISCV64
+#define LIB_ARCH_TUPLE "riscv64-linux-gnu"
+#  elif __SIZEOF_POINTER__ == 16
+#define native_architecture() ARCHITECTURE_RISCV128
+#define LIB_ARCH_TUPLE "riscv128-linux-gnu"
+#  else
+#error "Unrecognized riscv architecture variant"
+#  endif
 #else
 #  error "Please register your architecture here!"
 #endif
-- 
2.7.4

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] architecture: Add support for the RISC-V architecture.

2016-09-30 Thread Richard W.M. Jones
[This is only compile-tested, as our kernel doesn't (yet) have
enough configured features to run systemd, but I'll report back
when I get it running.]

RISC-V is an open source ISA in development since 2010 at UCB.
For more information, see https://riscv.org/

I am adding RISC-V support to Fedora:
https://fedoraproject.org/wiki/Architectures/RISC-V

There are three major variants of the architecture (32-, 64- and
128-bit).  The 128-bit variant is a paper exercise, but the other two
really exist in silicon.  RISC-V is always little endian.

On Linux, the default kernel uname(2) can return "riscv" for all
variants.  However a patch was added recently which makes the kernel
return one of "riscv32" or "riscv64" (or in future "riscv128").  So
systemd should be prepared to handle any of "riscv", "riscv32",
"riscv64" or "riscv128".  If the kernel returns "riscv" then you
need to use the pointer size in order to know the real variant.

The Fedora/RISC-V kernel only ever returns "riscv64" since we're only
doing Fedora for 64 bit at the moment, and we've patched the kernel so
it doesn't return "riscv".

As well as the major bitsize variants, there are also architecture
extensions.  However I'm trying to ensure that uname(2) does *not*
return any other information about those in utsname.machine, so that
we don't end up with "riscv64abcde" nonsense.  Instead those
extensions will be exposed in /proc/cpuinfo similar to how flags work
in x86.

I should also note that __SIZEOF_POINTER__ is a GCC extension, but it
appears to be used already in systemd so I guess that's OK.

Rich.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel