aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@sifive.com>2019-10-05 14:52:03 -0700
committerAndy Lutomirski <luto@kernel.org>2019-10-05 14:52:03 -0700
commit4e14432f32328032ca46c8d5bec97734b454aaca (patch)
tree1a8b1b3114f21497a366ee015ff80c6708276e66
parente6a86f7ea54b68a791a81dfc7245127331f1a101 (diff)
downloadvirtme-4e14432f32328032ca46c8d5bec97734b454aaca.tar.gz
Add RISC-V support
This expects a kernel with the plan 9 stuff supported (not yet in defconfig) and a new QEMU (as described in the README). I'm also not 100% sure it's working, as I'm getting /bin/sh: exec: line 1: /run/virtme/guesttools/virtme-init: not found Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
-rw-r--r--README.md8
-rw-r--r--virtme/architectures.py25
2 files changed, 33 insertions, 0 deletions
diff --git a/README.md b/README.md
index 51b6583..d53a456 100644
--- a/README.md
+++ b/README.md
@@ -112,6 +112,14 @@ PPC64
PPC64 appears to be reasonably functional.
+RISC-V
+------
+
+riscv64 works out of the box, but you'll neet at least QEMU-4.1.0 to be
+able to run `vmlinux`-style kernels. riscv32 is not supported because
+there are no existing userspace images for it. Support is provided via
+QEMU's `virt` machine with OpenSBI for firmware.
+
Others
------
diff --git a/virtme/architectures.py b/virtme/architectures.py
index 9871ea4..ee84494 100644
--- a/virtme/architectures.py
+++ b/virtme/architectures.py
@@ -207,6 +207,30 @@ class Arch_ppc64(Arch):
# Apparently SLOF (QEMU's bundled firmware?) can't boot a zImage.
return 'vmlinux'
+class Arch_riscv64(Arch):
+ def __init__(self, name):
+ Arch.__init__(self, name)
+
+ self.defconfig_target = 'riscv64_defconfig'
+ self.qemuname = 'riscv64'
+ self.linuxname = 'riscv'
+ self.gccname = 'riscv64'
+
+ def qemuargs(self, is_native):
+ ret = Arch.qemuargs(is_native)
+
+ ret.extend(['-machine', 'virt'])
+ ret.extend(['-bios', 'default'])
+
+ return ret
+
+ @staticmethod
+ def serial_console_args():
+ return ['console=ttyS0']
+
+ def kimg_path(self):
+ return 'arch/riscv/boot/Image'
+
class Arch_sparc64(Arch):
def __init__(self, name):
Arch.__init__(self, name)
@@ -264,6 +288,7 @@ ARCHES = {
'arm': Arch_arm,
'aarch64': Arch_aarch64,
'ppc64': Arch_ppc64,
+ 'riscv64': Arch_riscv64,
'sparc64': Arch_sparc64,
's390x': Arch_s390x,
}