All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-virtualization][PATCH] xvisor: Initial commit of Xvisor Hypervisor
@ 2020-02-03 21:50 Alistair Francis
  2020-02-03 21:50 ` [PATCH] " Alistair Francis
  0 siblings, 1 reply; 5+ messages in thread
From: Alistair Francis @ 2020-02-03 21:50 UTC (permalink / raw)
  To: meta-virtualization; +Cc: bruce.ashfield, alistair23, Alistair Francis

This commit adds support for building the baremetal Xvisor Hypervisor.

I have only tested this with RISC-V so currently only RISC-V is marked
as a COMPATIBLE_HOST, although Xvisor does support multiple other
architectures.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 ...n-t-specify-mabi-or-march-for-RISC-V.patch | 34 ++++++++++++++
 recipes-extended/xvisor/xvisor-configs.inc    | 25 +++++++++++
 recipes-extended/xvisor/xvisor_0.3.0.bb       | 44 +++++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
 create mode 100644 recipes-extended/xvisor/xvisor-configs.inc
 create mode 100644 recipes-extended/xvisor/xvisor_0.3.0.bb

diff --git a/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
new file mode 100644
index 0000000..2e53943
--- /dev/null
+++ b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
@@ -0,0 +1,34 @@
+From 022c885d077dce6fad3eca5fd2f54b2070c375d2 Mon Sep 17 00:00:00 2001
+From: Alistair Francis <alistair.francis@wdc.com>
+Date: Fri, 17 May 2019 14:21:44 -0700
+Subject: [PATCH] TESTS: Don't specify mabi or march for RISC-V
+
+To avoid
+    can't link double-float modules with soft-float modules
+errors when building 32-bit baremetal guests don't specify mabi
+or march.
+
+Upstream-Status: Inappropriate [Fixes a 32-bit Yocto flow bug]
+Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
+---
+ tests/riscv/common/basic/Makefile.inc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/riscv/common/basic/Makefile.inc b/tests/riscv/common/basic/Makefile.inc
+index 9fa5abed..f3ff1864 100644
+--- a/tests/riscv/common/basic/Makefile.inc
++++ b/tests/riscv/common/basic/Makefile.inc
+@@ -24,8 +24,8 @@
+ ARCH_CPPFLAGS=$(board_cppflags) -DFIRMWARE_BOOT
+ ARCH_CPPFLAGS+=-DTEXT_START=$(board_text_start)
+ ifeq ($(board_32bit),y)
+-ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
+-ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
++ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
++ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
+ else
+ ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
+ ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
+-- 
+2.21.0
+
diff --git a/recipes-extended/xvisor/xvisor-configs.inc b/recipes-extended/xvisor/xvisor-configs.inc
new file mode 100644
index 0000000..099128d
--- /dev/null
+++ b/recipes-extended/xvisor/xvisor-configs.inc
@@ -0,0 +1,25 @@
+def get_oemake_config(d):
+    plat = d.getVar('XVISOR_PLAT')
+
+    if plat is None:
+        return ""
+
+    if 'riscv/virt32' in plat:
+        return "generic-32b-defconfig"
+    if 'riscv/virt64' in plat:
+        return "generic-64b-defconfig"
+
+    return ""
+
+def map_xvisor_arch(a, d):
+    import re
+
+    if   re.match('(i.86|x86.64)$', a):  return 'x86'
+    elif re.match('armeb$', a):                 return 'arm'
+    elif re.match('aarch64$', a):               return 'arm'
+    elif re.match('aarch64_be$', a):            return 'arm'
+    elif re.match('aarch64_ilp32$', a):         return 'arm'
+    elif re.match('aarch64_be_ilp32$', a):      return 'arm'
+    elif re.match('riscv(32|64|)(eb|)$', a):    return 'riscv'
+    else:
+        bb.error("cannot map '%s' to a Xvisor architecture" % a)
diff --git a/recipes-extended/xvisor/xvisor_0.3.0.bb b/recipes-extended/xvisor/xvisor_0.3.0.bb
new file mode 100644
index 0000000..66ad618
--- /dev/null
+++ b/recipes-extended/xvisor/xvisor_0.3.0.bb
@@ -0,0 +1,44 @@
+SUMMARY = "Xvisor is an open-source type-1 hypervisor, which aims at providing a monolithic, light-weight, portable, and flexible virtualization solution."
+DESCRIPTION = "Xvisor primarily supports Full virtualization hence, supports a wide range of unmodified guest operating systems. Paravirtualization is optional for Xvisor and will be supported in an architecture independent manner (such as VirtIO PCI/MMIO devices) to ensure no-change in guest OS for using paravirtualization."
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+DEPENDS += "dtc-native dosfstools-native mtools-native"
+
+require xvisor-configs.inc
+
+inherit autotools-brokensep
+
+SRCREV = "58592ef18c71526a0045935d1e8eed5e8553b7d6"
+SRC_URI = "git://github.com/xvisor/xvisor.git \
+           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
+          "
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE += "ARCH=\"${@map_xvisor_arch(d.getVar('TARGET_ARCH'), d)}\" I=${D}"
+
+CONFIG = "${@get_oemake_config(d)}"
+
+do_configure() {
+    oe_runmake ${CONFIG}
+}
+
+do_install_append() {
+    install -d ${D}
+    install -m 755 ${B}/build/vmm.* ${D}/
+
+    # We don't need this
+    rm ${D}/system.map
+}
+
+do_deploy () {
+    install -d ${DEPLOY_DIR_IMAGE}
+    install -m 755 ${D}/vmm.* ${DEPLOY_DIR_IMAGE}/
+}
+
+addtask deploy after do_install
+
+FILES_${PN} += "/vmm.*"
+
+COMPATIBLE_HOST = "(riscv64|riscv32).*"
+INHIBIT_PACKAGE_STRIP = "1"
-- 
2.25.0


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

* [PATCH] xvisor: Initial commit of Xvisor Hypervisor
  2020-02-03 21:50 [meta-virtualization][PATCH] xvisor: Initial commit of Xvisor Hypervisor Alistair Francis
@ 2020-02-03 21:50 ` Alistair Francis
  2020-02-11 21:04   ` Bruce Ashfield
  0 siblings, 1 reply; 5+ messages in thread
From: Alistair Francis @ 2020-02-03 21:50 UTC (permalink / raw)
  To: meta-virtualization; +Cc: bruce.ashfield, alistair23, Alistair Francis

This commit adds support for building the baremetal Xvisor Hypervisor.

I have only tested this with RISC-V so currently only RISC-V is marked
as a COMPATIBLE_HOST, although Xvisor does support multiple other
architectures.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 ...n-t-specify-mabi-or-march-for-RISC-V.patch | 34 ++++++++++++++
 recipes-extended/xvisor/xvisor-configs.inc    | 25 +++++++++++
 recipes-extended/xvisor/xvisor_0.3.0.bb       | 44 +++++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
 create mode 100644 recipes-extended/xvisor/xvisor-configs.inc
 create mode 100644 recipes-extended/xvisor/xvisor_0.3.0.bb

diff --git a/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
new file mode 100644
index 0000000..2e53943
--- /dev/null
+++ b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
@@ -0,0 +1,34 @@
+From 022c885d077dce6fad3eca5fd2f54b2070c375d2 Mon Sep 17 00:00:00 2001
+From: Alistair Francis <alistair.francis@wdc.com>
+Date: Fri, 17 May 2019 14:21:44 -0700
+Subject: [PATCH] TESTS: Don't specify mabi or march for RISC-V
+
+To avoid
+    can't link double-float modules with soft-float modules
+errors when building 32-bit baremetal guests don't specify mabi
+or march.
+
+Upstream-Status: Inappropriate [Fixes a 32-bit Yocto flow bug]
+Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
+---
+ tests/riscv/common/basic/Makefile.inc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/riscv/common/basic/Makefile.inc b/tests/riscv/common/basic/Makefile.inc
+index 9fa5abed..f3ff1864 100644
+--- a/tests/riscv/common/basic/Makefile.inc
++++ b/tests/riscv/common/basic/Makefile.inc
+@@ -24,8 +24,8 @@
+ ARCH_CPPFLAGS=$(board_cppflags) -DFIRMWARE_BOOT
+ ARCH_CPPFLAGS+=-DTEXT_START=$(board_text_start)
+ ifeq ($(board_32bit),y)
+-ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
+-ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
++ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
++ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
+ else
+ ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
+ ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
+-- 
+2.21.0
+
diff --git a/recipes-extended/xvisor/xvisor-configs.inc b/recipes-extended/xvisor/xvisor-configs.inc
new file mode 100644
index 0000000..099128d
--- /dev/null
+++ b/recipes-extended/xvisor/xvisor-configs.inc
@@ -0,0 +1,25 @@
+def get_oemake_config(d):
+    plat = d.getVar('XVISOR_PLAT')
+
+    if plat is None:
+        return ""
+
+    if 'riscv/virt32' in plat:
+        return "generic-32b-defconfig"
+    if 'riscv/virt64' in plat:
+        return "generic-64b-defconfig"
+
+    return ""
+
+def map_xvisor_arch(a, d):
+    import re
+
+    if   re.match('(i.86|x86.64)$', a):  return 'x86'
+    elif re.match('armeb$', a):                 return 'arm'
+    elif re.match('aarch64$', a):               return 'arm'
+    elif re.match('aarch64_be$', a):            return 'arm'
+    elif re.match('aarch64_ilp32$', a):         return 'arm'
+    elif re.match('aarch64_be_ilp32$', a):      return 'arm'
+    elif re.match('riscv(32|64|)(eb|)$', a):    return 'riscv'
+    else:
+        bb.error("cannot map '%s' to a Xvisor architecture" % a)
diff --git a/recipes-extended/xvisor/xvisor_0.3.0.bb b/recipes-extended/xvisor/xvisor_0.3.0.bb
new file mode 100644
index 0000000..66ad618
--- /dev/null
+++ b/recipes-extended/xvisor/xvisor_0.3.0.bb
@@ -0,0 +1,44 @@
+SUMMARY = "Xvisor is an open-source type-1 hypervisor, which aims at providing a monolithic, light-weight, portable, and flexible virtualization solution."
+DESCRIPTION = "Xvisor primarily supports Full virtualization hence, supports a wide range of unmodified guest operating systems. Paravirtualization is optional for Xvisor and will be supported in an architecture independent manner (such as VirtIO PCI/MMIO devices) to ensure no-change in guest OS for using paravirtualization."
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+DEPENDS += "dtc-native dosfstools-native mtools-native"
+
+require xvisor-configs.inc
+
+inherit autotools-brokensep
+
+SRCREV = "58592ef18c71526a0045935d1e8eed5e8553b7d6"
+SRC_URI = "git://github.com/xvisor/xvisor.git \
+           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
+          "
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE += "ARCH=\"${@map_xvisor_arch(d.getVar('TARGET_ARCH'), d)}\" I=${D}"
+
+CONFIG = "${@get_oemake_config(d)}"
+
+do_configure() {
+    oe_runmake ${CONFIG}
+}
+
+do_install_append() {
+    install -d ${D}
+    install -m 755 ${B}/build/vmm.* ${D}/
+
+    # We don't need this
+    rm ${D}/system.map
+}
+
+do_deploy () {
+    install -d ${DEPLOY_DIR_IMAGE}
+    install -m 755 ${D}/vmm.* ${DEPLOY_DIR_IMAGE}/
+}
+
+addtask deploy after do_install
+
+FILES_${PN} += "/vmm.*"
+
+COMPATIBLE_HOST = "(riscv64|riscv32).*"
+INHIBIT_PACKAGE_STRIP = "1"
-- 
2.25.0


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

* Re: [PATCH] xvisor: Initial commit of Xvisor Hypervisor
  2020-02-03 21:50 ` [PATCH] " Alistair Francis
@ 2020-02-11 21:04   ` Bruce Ashfield
  2020-03-03 17:47     ` Alistair Francis
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Ashfield @ 2020-02-11 21:04 UTC (permalink / raw)
  To: Alistair Francis; +Cc: meta-virtualization, alistair23

In message: [PATCH] xvisor: Initial commit of Xvisor Hypervisor
on 03/02/2020 Alistair Francis wrote:

> This commit adds support for building the baremetal Xvisor Hypervisor.
> 
> I have only tested this with RISC-V so currently only RISC-V is marked
> as a COMPATIBLE_HOST, although Xvisor does support multiple other
> architectures.
> 
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  ...n-t-specify-mabi-or-march-for-RISC-V.patch | 34 ++++++++++++++
>  recipes-extended/xvisor/xvisor-configs.inc    | 25 +++++++++++
>  recipes-extended/xvisor/xvisor_0.3.0.bb       | 44 +++++++++++++++++++
>  3 files changed, 103 insertions(+)
>  create mode 100644 recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
>  create mode 100644 recipes-extended/xvisor/xvisor-configs.inc
>  create mode 100644 recipes-extended/xvisor/xvisor_0.3.0.bb
> 
> diff --git a/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> new file mode 100644
> index 0000000..2e53943
> --- /dev/null
> +++ b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> @@ -0,0 +1,34 @@
> +From 022c885d077dce6fad3eca5fd2f54b2070c375d2 Mon Sep 17 00:00:00 2001
> +From: Alistair Francis <alistair.francis@wdc.com>
> +Date: Fri, 17 May 2019 14:21:44 -0700
> +Subject: [PATCH] TESTS: Don't specify mabi or march for RISC-V
> +
> +To avoid
> +    can't link double-float modules with soft-float modules
> +errors when building 32-bit baremetal guests don't specify mabi
> +or march.
> +
> +Upstream-Status: Inappropriate [Fixes a 32-bit Yocto flow bug]
> +Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> +---
> + tests/riscv/common/basic/Makefile.inc | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/tests/riscv/common/basic/Makefile.inc b/tests/riscv/common/basic/Makefile.inc
> +index 9fa5abed..f3ff1864 100644
> +--- a/tests/riscv/common/basic/Makefile.inc
> ++++ b/tests/riscv/common/basic/Makefile.inc
> +@@ -24,8 +24,8 @@
> + ARCH_CPPFLAGS=$(board_cppflags) -DFIRMWARE_BOOT
> + ARCH_CPPFLAGS+=-DTEXT_START=$(board_text_start)
> + ifeq ($(board_32bit),y)
> +-ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
> +-ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
> ++ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
> ++ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
> + else
> + ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
> + ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
> +-- 
> +2.21.0
> +
> diff --git a/recipes-extended/xvisor/xvisor-configs.inc b/recipes-extended/xvisor/xvisor-configs.inc
> new file mode 100644
> index 0000000..099128d
> --- /dev/null
> +++ b/recipes-extended/xvisor/xvisor-configs.inc
> @@ -0,0 +1,25 @@
> +def get_oemake_config(d):
> +    plat = d.getVar('XVISOR_PLAT')
> +
> +    if plat is None:
> +        return ""
> +
> +    if 'riscv/virt32' in plat:
> +        return "generic-32b-defconfig"
> +    if 'riscv/virt64' in plat:
> +        return "generic-64b-defconfig"
> +
> +    return ""
> +
> +def map_xvisor_arch(a, d):
> +    import re
> +
> +    if   re.match('(i.86|x86.64)$', a):  return 'x86'
> +    elif re.match('armeb$', a):                 return 'arm'
> +    elif re.match('aarch64$', a):               return 'arm'
> +    elif re.match('aarch64_be$', a):            return 'arm'
> +    elif re.match('aarch64_ilp32$', a):         return 'arm'
> +    elif re.match('aarch64_be_ilp32$', a):      return 'arm'
> +    elif re.match('riscv(32|64|)(eb|)$', a):    return 'riscv'
> +    else:
> +        bb.error("cannot map '%s' to a Xvisor architecture" % a)

This all looks fine to me (for the 1st revision), I did wonder if the
mappings are any different than the kernel mappings (but didn't check) ..
and if so, we could avoid the code to map the arch.

It would also be nice to eventually have a README or some other test
information captured in the layer, that way people can have an idea
about why they'd want to use this, some expected behaviour and how
they can boot it.

Bruce

> diff --git a/recipes-extended/xvisor/xvisor_0.3.0.bb b/recipes-extended/xvisor/xvisor_0.3.0.bb
> new file mode 100644
> index 0000000..66ad618
> --- /dev/null
> +++ b/recipes-extended/xvisor/xvisor_0.3.0.bb
> @@ -0,0 +1,44 @@
> +SUMMARY = "Xvisor is an open-source type-1 hypervisor, which aims at providing a monolithic, light-weight, portable, and flexible virtualization solution."
> +DESCRIPTION = "Xvisor primarily supports Full virtualization hence, supports a wide range of unmodified guest operating systems. Paravirtualization is optional for Xvisor and will be supported in an architecture independent manner (such as VirtIO PCI/MMIO devices) to ensure no-change in guest OS for using paravirtualization."
> +LICENSE = "GPLv2"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
> +DEPENDS += "dtc-native dosfstools-native mtools-native"
> +
> +require xvisor-configs.inc
> +
> +inherit autotools-brokensep
> +
> +SRCREV = "58592ef18c71526a0045935d1e8eed5e8553b7d6"
> +SRC_URI = "git://github.com/xvisor/xvisor.git \
> +           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
> +          "
> +
> +S = "${WORKDIR}/git"
> +
> +EXTRA_OEMAKE += "ARCH=\"${@map_xvisor_arch(d.getVar('TARGET_ARCH'), d)}\" I=${D}"
> +
> +CONFIG = "${@get_oemake_config(d)}"
> +
> +do_configure() {
> +    oe_runmake ${CONFIG}
> +}
> +
> +do_install_append() {
> +    install -d ${D}
> +    install -m 755 ${B}/build/vmm.* ${D}/
> +
> +    # We don't need this
> +    rm ${D}/system.map
> +}
> +
> +do_deploy () {
> +    install -d ${DEPLOY_DIR_IMAGE}
> +    install -m 755 ${D}/vmm.* ${DEPLOY_DIR_IMAGE}/
> +}
> +
> +addtask deploy after do_install
> +
> +FILES_${PN} += "/vmm.*"
> +
> +COMPATIBLE_HOST = "(riscv64|riscv32).*"
> +INHIBIT_PACKAGE_STRIP = "1"
> -- 
> 2.25.0
> 

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

* Re: [PATCH] xvisor: Initial commit of Xvisor Hypervisor
  2020-02-11 21:04   ` Bruce Ashfield
@ 2020-03-03 17:47     ` Alistair Francis
  2020-03-04  0:27       ` Bruce Ashfield
  0 siblings, 1 reply; 5+ messages in thread
From: Alistair Francis @ 2020-03-03 17:47 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: Alistair Francis, meta-virtualization

On Tue, Feb 11, 2020 at 1:04 PM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
>
> In message: [PATCH] xvisor: Initial commit of Xvisor Hypervisor
> on 03/02/2020 Alistair Francis wrote:
>
> > This commit adds support for building the baremetal Xvisor Hypervisor.
> >
> > I have only tested this with RISC-V so currently only RISC-V is marked
> > as a COMPATIBLE_HOST, although Xvisor does support multiple other
> > architectures.
> >
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> >  ...n-t-specify-mabi-or-march-for-RISC-V.patch | 34 ++++++++++++++
> >  recipes-extended/xvisor/xvisor-configs.inc    | 25 +++++++++++
> >  recipes-extended/xvisor/xvisor_0.3.0.bb       | 44 +++++++++++++++++++
> >  3 files changed, 103 insertions(+)
> >  create mode 100644 recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> >  create mode 100644 recipes-extended/xvisor/xvisor-configs.inc
> >  create mode 100644 recipes-extended/xvisor/xvisor_0.3.0.bb
> >
> > diff --git a/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> > new file mode 100644
> > index 0000000..2e53943
> > --- /dev/null
> > +++ b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> > @@ -0,0 +1,34 @@
> > +From 022c885d077dce6fad3eca5fd2f54b2070c375d2 Mon Sep 17 00:00:00 2001
> > +From: Alistair Francis <alistair.francis@wdc.com>
> > +Date: Fri, 17 May 2019 14:21:44 -0700
> > +Subject: [PATCH] TESTS: Don't specify mabi or march for RISC-V
> > +
> > +To avoid
> > +    can't link double-float modules with soft-float modules
> > +errors when building 32-bit baremetal guests don't specify mabi
> > +or march.
> > +
> > +Upstream-Status: Inappropriate [Fixes a 32-bit Yocto flow bug]
> > +Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > +---
> > + tests/riscv/common/basic/Makefile.inc | 4 ++--
> > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/tests/riscv/common/basic/Makefile.inc b/tests/riscv/common/basic/Makefile.inc
> > +index 9fa5abed..f3ff1864 100644
> > +--- a/tests/riscv/common/basic/Makefile.inc
> > ++++ b/tests/riscv/common/basic/Makefile.inc
> > +@@ -24,8 +24,8 @@
> > + ARCH_CPPFLAGS=$(board_cppflags) -DFIRMWARE_BOOT
> > + ARCH_CPPFLAGS+=-DTEXT_START=$(board_text_start)
> > + ifeq ($(board_32bit),y)
> > +-ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
> > +-ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
> > ++ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
> > ++ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
> > + else
> > + ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
> > + ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
> > +--
> > +2.21.0
> > +
> > diff --git a/recipes-extended/xvisor/xvisor-configs.inc b/recipes-extended/xvisor/xvisor-configs.inc
> > new file mode 100644
> > index 0000000..099128d
> > --- /dev/null
> > +++ b/recipes-extended/xvisor/xvisor-configs.inc
> > @@ -0,0 +1,25 @@
> > +def get_oemake_config(d):
> > +    plat = d.getVar('XVISOR_PLAT')
> > +
> > +    if plat is None:
> > +        return ""
> > +
> > +    if 'riscv/virt32' in plat:
> > +        return "generic-32b-defconfig"
> > +    if 'riscv/virt64' in plat:
> > +        return "generic-64b-defconfig"
> > +
> > +    return ""
> > +
> > +def map_xvisor_arch(a, d):
> > +    import re
> > +
> > +    if   re.match('(i.86|x86.64)$', a):  return 'x86'
> > +    elif re.match('armeb$', a):                 return 'arm'
> > +    elif re.match('aarch64$', a):               return 'arm'
> > +    elif re.match('aarch64_be$', a):            return 'arm'
> > +    elif re.match('aarch64_ilp32$', a):         return 'arm'
> > +    elif re.match('aarch64_be_ilp32$', a):      return 'arm'
> > +    elif re.match('riscv(32|64|)(eb|)$', a):    return 'riscv'
> > +    else:
> > +        bb.error("cannot map '%s' to a Xvisor architecture" % a)
>
> This all looks fine to me (for the 1st revision), I did wonder if the
> mappings are any different than the kernel mappings (but didn't check) ..
> and if so, we could avoid the code to map the arch.

They are similar but not the same, for example Xvisor uses "arm" for
ARMv7 and AArch64.

>
> It would also be nice to eventually have a README or some other test
> information captured in the layer, that way people can have an idea
> about why they'd want to use this, some expected behaviour and how
> they can boot it.

Where do you think this should go?

Alistair

>
> Bruce
>
> > diff --git a/recipes-extended/xvisor/xvisor_0.3.0.bb b/recipes-extended/xvisor/xvisor_0.3.0.bb
> > new file mode 100644
> > index 0000000..66ad618
> > --- /dev/null
> > +++ b/recipes-extended/xvisor/xvisor_0.3.0.bb
> > @@ -0,0 +1,44 @@
> > +SUMMARY = "Xvisor is an open-source type-1 hypervisor, which aims at providing a monolithic, light-weight, portable, and flexible virtualization solution."
> > +DESCRIPTION = "Xvisor primarily supports Full virtualization hence, supports a wide range of unmodified guest operating systems. Paravirtualization is optional for Xvisor and will be supported in an architecture independent manner (such as VirtIO PCI/MMIO devices) to ensure no-change in guest OS for using paravirtualization."
> > +LICENSE = "GPLv2"
> > +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
> > +DEPENDS += "dtc-native dosfstools-native mtools-native"
> > +
> > +require xvisor-configs.inc
> > +
> > +inherit autotools-brokensep
> > +
> > +SRCREV = "58592ef18c71526a0045935d1e8eed5e8553b7d6"
> > +SRC_URI = "git://github.com/xvisor/xvisor.git \
> > +           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
> > +          "
> > +
> > +S = "${WORKDIR}/git"
> > +
> > +EXTRA_OEMAKE += "ARCH=\"${@map_xvisor_arch(d.getVar('TARGET_ARCH'), d)}\" I=${D}"
> > +
> > +CONFIG = "${@get_oemake_config(d)}"
> > +
> > +do_configure() {
> > +    oe_runmake ${CONFIG}
> > +}
> > +
> > +do_install_append() {
> > +    install -d ${D}
> > +    install -m 755 ${B}/build/vmm.* ${D}/
> > +
> > +    # We don't need this
> > +    rm ${D}/system.map
> > +}
> > +
> > +do_deploy () {
> > +    install -d ${DEPLOY_DIR_IMAGE}
> > +    install -m 755 ${D}/vmm.* ${DEPLOY_DIR_IMAGE}/
> > +}
> > +
> > +addtask deploy after do_install
> > +
> > +FILES_${PN} += "/vmm.*"
> > +
> > +COMPATIBLE_HOST = "(riscv64|riscv32).*"
> > +INHIBIT_PACKAGE_STRIP = "1"
> > --
> > 2.25.0
> >

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

* Re: [PATCH] xvisor: Initial commit of Xvisor Hypervisor
  2020-03-03 17:47     ` Alistair Francis
@ 2020-03-04  0:27       ` Bruce Ashfield
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2020-03-04  0:27 UTC (permalink / raw)
  To: Alistair Francis; +Cc: Alistair Francis, meta-virtualization

On Tue, Mar 3, 2020 at 12:54 PM Alistair Francis <alistair23@gmail.com> wrote:
>
> On Tue, Feb 11, 2020 at 1:04 PM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> >
> > In message: [PATCH] xvisor: Initial commit of Xvisor Hypervisor
> > on 03/02/2020 Alistair Francis wrote:
> >
> > > This commit adds support for building the baremetal Xvisor Hypervisor.
> > >
> > > I have only tested this with RISC-V so currently only RISC-V is marked
> > > as a COMPATIBLE_HOST, although Xvisor does support multiple other
> > > architectures.
> > >
> > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > ---
> > >  ...n-t-specify-mabi-or-march-for-RISC-V.patch | 34 ++++++++++++++
> > >  recipes-extended/xvisor/xvisor-configs.inc    | 25 +++++++++++
> > >  recipes-extended/xvisor/xvisor_0.3.0.bb       | 44 +++++++++++++++++++
> > >  3 files changed, 103 insertions(+)
> > >  create mode 100644 recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> > >  create mode 100644 recipes-extended/xvisor/xvisor-configs.inc
> > >  create mode 100644 recipes-extended/xvisor/xvisor_0.3.0.bb
> > >
> > > diff --git a/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> > > new file mode 100644
> > > index 0000000..2e53943
> > > --- /dev/null
> > > +++ b/recipes-extended/xvisor/files/0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch
> > > @@ -0,0 +1,34 @@
> > > +From 022c885d077dce6fad3eca5fd2f54b2070c375d2 Mon Sep 17 00:00:00 2001
> > > +From: Alistair Francis <alistair.francis@wdc.com>
> > > +Date: Fri, 17 May 2019 14:21:44 -0700
> > > +Subject: [PATCH] TESTS: Don't specify mabi or march for RISC-V
> > > +
> > > +To avoid
> > > +    can't link double-float modules with soft-float modules
> > > +errors when building 32-bit baremetal guests don't specify mabi
> > > +or march.
> > > +
> > > +Upstream-Status: Inappropriate [Fixes a 32-bit Yocto flow bug]
> > > +Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > +---
> > > + tests/riscv/common/basic/Makefile.inc | 4 ++--
> > > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > > +
> > > +diff --git a/tests/riscv/common/basic/Makefile.inc b/tests/riscv/common/basic/Makefile.inc
> > > +index 9fa5abed..f3ff1864 100644
> > > +--- a/tests/riscv/common/basic/Makefile.inc
> > > ++++ b/tests/riscv/common/basic/Makefile.inc
> > > +@@ -24,8 +24,8 @@
> > > + ARCH_CPPFLAGS=$(board_cppflags) -DFIRMWARE_BOOT
> > > + ARCH_CPPFLAGS+=-DTEXT_START=$(board_text_start)
> > > + ifeq ($(board_32bit),y)
> > > +-ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
> > > +-ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=ilp32 -march=rv32imafdc -mcmodel=medany
> > > ++ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
> > > ++ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mcmodel=medany
> > > + else
> > > + ARCH_CFLAGS=$(board_cflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
> > > + ARCH_ASFLAGS=$(board_asflags) -fno-omit-frame-pointer -fno-optimize-sibling-calls -mno-save-restore -mstrict-align -mabi=lp64 -march=rv64imafdc -mcmodel=medany
> > > +--
> > > +2.21.0
> > > +
> > > diff --git a/recipes-extended/xvisor/xvisor-configs.inc b/recipes-extended/xvisor/xvisor-configs.inc
> > > new file mode 100644
> > > index 0000000..099128d
> > > --- /dev/null
> > > +++ b/recipes-extended/xvisor/xvisor-configs.inc
> > > @@ -0,0 +1,25 @@
> > > +def get_oemake_config(d):
> > > +    plat = d.getVar('XVISOR_PLAT')
> > > +
> > > +    if plat is None:
> > > +        return ""
> > > +
> > > +    if 'riscv/virt32' in plat:
> > > +        return "generic-32b-defconfig"
> > > +    if 'riscv/virt64' in plat:
> > > +        return "generic-64b-defconfig"
> > > +
> > > +    return ""
> > > +
> > > +def map_xvisor_arch(a, d):
> > > +    import re
> > > +
> > > +    if   re.match('(i.86|x86.64)$', a):  return 'x86'
> > > +    elif re.match('armeb$', a):                 return 'arm'
> > > +    elif re.match('aarch64$', a):               return 'arm'
> > > +    elif re.match('aarch64_be$', a):            return 'arm'
> > > +    elif re.match('aarch64_ilp32$', a):         return 'arm'
> > > +    elif re.match('aarch64_be_ilp32$', a):      return 'arm'
> > > +    elif re.match('riscv(32|64|)(eb|)$', a):    return 'riscv'
> > > +    else:
> > > +        bb.error("cannot map '%s' to a Xvisor architecture" % a)
> >
> > This all looks fine to me (for the 1st revision), I did wonder if the
> > mappings are any different than the kernel mappings (but didn't check) ..
> > and if so, we could avoid the code to map the arch.
>
> They are similar but not the same, for example Xvisor uses "arm" for
> ARMv7 and AArch64.

cool.

>
> >
> > It would also be nice to eventually have a README or some other test
> > information captured in the layer, that way people can have an idea
> > about why they'd want to use this, some expected behaviour and how
> > they can boot it.
>
> Where do you think this should go?

there's a little used "docs" directory at the root of the layer, I
have plans to gather more things like this in that directory.

I'm writing up similar information for microk8s and k3s as I work on them.

Bruce

>
> Alistair
>
> >
> > Bruce
> >
> > > diff --git a/recipes-extended/xvisor/xvisor_0.3.0.bb b/recipes-extended/xvisor/xvisor_0.3.0.bb
> > > new file mode 100644
> > > index 0000000..66ad618
> > > --- /dev/null
> > > +++ b/recipes-extended/xvisor/xvisor_0.3.0.bb
> > > @@ -0,0 +1,44 @@
> > > +SUMMARY = "Xvisor is an open-source type-1 hypervisor, which aims at providing a monolithic, light-weight, portable, and flexible virtualization solution."
> > > +DESCRIPTION = "Xvisor primarily supports Full virtualization hence, supports a wide range of unmodified guest operating systems. Paravirtualization is optional for Xvisor and will be supported in an architecture independent manner (such as VirtIO PCI/MMIO devices) to ensure no-change in guest OS for using paravirtualization."
> > > +LICENSE = "GPLv2"
> > > +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
> > > +DEPENDS += "dtc-native dosfstools-native mtools-native"
> > > +
> > > +require xvisor-configs.inc
> > > +
> > > +inherit autotools-brokensep
> > > +
> > > +SRCREV = "58592ef18c71526a0045935d1e8eed5e8553b7d6"
> > > +SRC_URI = "git://github.com/xvisor/xvisor.git \
> > > +           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
> > > +          "
> > > +
> > > +S = "${WORKDIR}/git"
> > > +
> > > +EXTRA_OEMAKE += "ARCH=\"${@map_xvisor_arch(d.getVar('TARGET_ARCH'), d)}\" I=${D}"
> > > +
> > > +CONFIG = "${@get_oemake_config(d)}"
> > > +
> > > +do_configure() {
> > > +    oe_runmake ${CONFIG}
> > > +}
> > > +
> > > +do_install_append() {
> > > +    install -d ${D}
> > > +    install -m 755 ${B}/build/vmm.* ${D}/
> > > +
> > > +    # We don't need this
> > > +    rm ${D}/system.map
> > > +}
> > > +
> > > +do_deploy () {
> > > +    install -d ${DEPLOY_DIR_IMAGE}
> > > +    install -m 755 ${D}/vmm.* ${DEPLOY_DIR_IMAGE}/
> > > +}
> > > +
> > > +addtask deploy after do_install
> > > +
> > > +FILES_${PN} += "/vmm.*"
> > > +
> > > +COMPATIBLE_HOST = "(riscv64|riscv32).*"
> > > +INHIBIT_PACKAGE_STRIP = "1"
> > > --
> > > 2.25.0
> > >



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

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

end of thread, other threads:[~2020-03-04  0:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 21:50 [meta-virtualization][PATCH] xvisor: Initial commit of Xvisor Hypervisor Alistair Francis
2020-02-03 21:50 ` [PATCH] " Alistair Francis
2020-02-11 21:04   ` Bruce Ashfield
2020-03-03 17:47     ` Alistair Francis
2020-03-04  0:27       ` Bruce Ashfield

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.