[libvirt] [PATCH v2 03/11] util: add RISC-V architectures

Lubomir Rintel posted 11 patches 7 years ago
Only 10 patches received!
There is a newer version of this series
[libvirt] [PATCH v2 03/11] util: add RISC-V architectures
Posted by Lubomir Rintel 7 years ago
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 src/qemu/qemu_domain.c | 2 ++
 src/util/virarch.c     | 3 +++
 src/util/virarch.h     | 6 ++++++
 3 files changed, 11 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index dfaba677b1..275090fb58 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3224,6 +3224,8 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
     case VIR_ARCH_OR32:
     case VIR_ARCH_PARISC:
     case VIR_ARCH_PARISC64:
+    case VIR_ARCH_RISCV32:
+    case VIR_ARCH_RISCV64:
     case VIR_ARCH_PPCLE:
     case VIR_ARCH_UNICORE32:
     case VIR_ARCH_XTENSA:
diff --git a/src/util/virarch.c b/src/util/virarch.c
index be48bcfb89..77b893b0ac 100644
--- a/src/util/virarch.c
+++ b/src/util/virarch.c
@@ -65,6 +65,9 @@ static const struct virArchData {
     { "ppc64le",      64, VIR_ARCH_LITTLE_ENDIAN },
     { "ppcemb",       32, VIR_ARCH_BIG_ENDIAN },
 
+    { "riscv32",      32, VIR_ARCH_LITTLE_ENDIAN },
+    { "riscv64",      64, VIR_ARCH_LITTLE_ENDIAN },
+
     { "s390",         32, VIR_ARCH_BIG_ENDIAN },
     { "s390x",        64, VIR_ARCH_BIG_ENDIAN },
     { "sh4",          32, VIR_ARCH_LITTLE_ENDIAN },
diff --git a/src/util/virarch.h b/src/util/virarch.h
index af5ff83528..806a23fade 100644
--- a/src/util/virarch.h
+++ b/src/util/virarch.h
@@ -55,6 +55,9 @@ typedef enum {
     VIR_ARCH_PPC64LE,      /* PowerPC     64 LE http://en.wikipedia.org/wiki/PowerPC */
     VIR_ARCH_PPCEMB,       /* PowerPC     32 BE http://en.wikipedia.org/wiki/PowerPC */
 
+    VIR_ARCH_RISCV32,      /* RISC-V     64 LE http://en.wikipedia.org/wiki/RISC-V */
+    VIR_ARCH_RISCV64,      /* RISC-V     32 BE http://en.wikipedia.org/wiki/RISC-V */
+
     VIR_ARCH_S390,         /* S390        32 BE http://en.wikipedia.org/wiki/S390 */
     VIR_ARCH_S390X,        /* S390        64 BE http://en.wikipedia.org/wiki/S390x */
     VIR_ARCH_SH4,          /* SuperH4     32 LE http://en.wikipedia.org/wiki/SuperH */
@@ -87,6 +90,9 @@ typedef enum {
                              (arch) == VIR_ARCH_ARMV7B ||\
                              (arch) == VIR_ARCH_AARCH64)
 
+# define ARCH_IS_RISCV(arch) ((arch) == VIR_ARCH_RISCV32 ||\
+                              (arch) == VIR_ARCH_RISCV64)
+
 # define ARCH_IS_S390(arch) ((arch) == VIR_ARCH_S390 ||\
                              (arch) == VIR_ARCH_S390X)
 
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 03/11] util: add RISC-V architectures
Posted by Andrea Bolognani 7 years ago
On Thu, 2018-06-14 at 22:32 +0200, Lubomir Rintel wrote:
[...]
> diff --git a/src/util/virarch.c b/src/util/virarch.c
> index be48bcfb89..77b893b0ac 100644
> --- a/src/util/virarch.c
> +++ b/src/util/virarch.c
> @@ -65,6 +65,9 @@ static const struct virArchData {
>      { "ppc64le",      64, VIR_ARCH_LITTLE_ENDIAN },
>      { "ppcemb",       32, VIR_ARCH_BIG_ENDIAN },
>  
> +    { "riscv32",      32, VIR_ARCH_LITTLE_ENDIAN },
> +    { "riscv64",      64, VIR_ARCH_LITTLE_ENDIAN },
> +
>      { "s390",         32, VIR_ARCH_BIG_ENDIAN },
>      { "s390x",        64, VIR_ARCH_BIG_ENDIAN },
>      { "sh4",          32, VIR_ARCH_LITTLE_ENDIAN },
> diff --git a/src/util/virarch.h b/src/util/virarch.h
> index af5ff83528..806a23fade 100644
> --- a/src/util/virarch.h
> +++ b/src/util/virarch.h
> @@ -55,6 +55,9 @@ typedef enum {
>      VIR_ARCH_PPC64LE,      /* PowerPC     64 LE http://en.wikipedia.org/wiki/PowerPC */
>      VIR_ARCH_PPCEMB,       /* PowerPC     32 BE http://en.wikipedia.org/wiki/PowerPC */
>  
> +    VIR_ARCH_RISCV32,      /* RISC-V     64 LE http://en.wikipedia.org/wiki/RISC-V */
> +    VIR_ARCH_RISCV64,      /* RISC-V     32 BE http://en.wikipedia.org/wiki/RISC-V */
> +
>      VIR_ARCH_S390,         /* S390        32 BE http://en.wikipedia.org/wiki/S390 */
>      VIR_ARCH_S390X,        /* S390        64 BE http://en.wikipedia.org/wiki/S390x */
>      VIR_ARCH_SH4,          /* SuperH4     32 LE http://en.wikipedia.org/wiki/SuperH */

Both here and in the header file, we keep enum entries grouped
five by five, so you'll have to do a little regrouping...

With that taken care of

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list