Skip to contentSkip to conversation

vagrant arm64: arch indep kconfig/ansible options

PATCH In review Ross Vandegrift 2 participants 6 messages Sep 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 vagrant arm64: arch indep kconfig/ansible options

Vagrant arm64 will require a handful of new libvirt parameters. Most are architecture independent. But they're currently unnecessary because libvirt/qemu has defaults are tailored for x86-64.

This adds support for the following, along with reasonable defaults for x86-64:
- graphics type
- mouse bus
- uefi loader & nvram storage

---
Thanks for the feedback on the previous version. I opted to keep the arch-independant options separate - since I'd already setup so much of it, this ended up being less work. As before, everything though make bringup works.

---
 playbooks/roles/gen_nodes/defaults/main.yml   |  4 ++
 .../roles/gen_nodes/templates/Vagrantfile.j2  |  7 +++
 scripts/gen-nodes.Makefile                    | 15 +++++++
 vagrant/Kconfig                               | 43 +++++++++++++++++++
 4 files changed, 69 insertions(+)
playbooks/roles/gen_nodes/defaults/main.yml +4 -0
index c57effe7..d44ba8bb 100644
@@ -60,6 +60,10 @@ libvirt_extra_storage_aio_cache_mode: "none"
 libvirt_extra_storage_nvme_logical_block_size: 512
 libvirt_extra_storage_virtio_logical_block_size: 512
 libvirt_extra_storage_virtio_physical_block_size: 512
+libvirt_graphics_type: none
+libvirt_input_mouse_bus: ps2
+libvirt_loader: ""
+libvirt_nvram_dir: /var/lib/libvirt/qemu/nvram
 
 libvirt_largeio_enable: False
 libvirt_largeio_logical_compat: False
playbooks/roles/gen_nodes/templates/Vagrantfile.j2 +7 -0
index 7ed59ff7..0d20ed6d 100644
@@ -229,6 +229,13 @@ Vagrant.configure("2") do |config|
             libvirt.machine_type = global_data['libvirt_cfg']['machine_type']
           end
         end
+        libvirt.graphics_type = '{{ libvirt_graphics_type }}'
+        libvirt.input :type => "mouse", :bus => "{{ libvirt_input_mouse_bus }}"
+{% if libvirt_loader %}
+        libvirt.loader = "{{ libvirt_loader }}"
+        libvirt.nvram = "{{ libvirt_nvram_dir }}/%s.fd" % host_name
+{% endif %}
+
         # Add an extra spare PCI or PCI-E root bus to be used for extra drives.
         #
         # We use a dedicated PCI or PCI-E root bus to not clash with defaults
scripts/gen-nodes.Makefile +15 -0
index 533b19db..9c1f1e09 100644
@@ -203,4 +203,19 @@ endif # CONFIG_QEMU_ENABLE_CXL
 
 endif # CONFIG_LIBVIRT_MACHINE_TYPE_Q35
 
+ifneq (,$(CONFIG_LIBVIRT_GRAPHICS_TYPE))
+GEN_NODES_EXTRA_ARGS += libvirt_graphics_type='$(subst ",,$(CONFIG_LIBVIRT_GRAPHICS_TYPE))'
+endif
+
+ifeq (y,$(CONFIG_LIBVIRT_INPUT_PS2_MOUSE))
+GEN_NODES_EXTRA_ARGS += libvirt_input_mouse_bus='ps2'
+else ifeq (y, $(CONFIG_LIBVIRT_INPUT_VIRTIO_MOUSE))
+GEN_NODES_EXTRA_ARGS += libvirt_input_mouse_bus='virtio'
+endif
+
+ifneq (,$(CONFIG_LIBVIRT_LOADER))
+GEN_NODES_EXTRA_ARGS += libvirt_loader='$(subst ",,$(CONFIG_LIBVIRT_LOADER))'
+GEN_NODES_EXTRA_ARGS += libvirt_nvram_dir='$(subst ",,$(CONFIG_LIBVIRT_NVRAM_DIR))'
+endif
+
 ANSIBLE_EXTRA_ARGS += $(GEN_NODES_EXTRA_ARGS)
vagrant/Kconfig +43 -0

49 lines not on this page · raw message

Signature · 1 line
2.39.2
#1 lore raw
Quoted 27 lines · Ross Vandegrift

Vagrant arm64 will require a handful of new libvirt parameters. Most are architecture independent. But they're currently unnecessary because libvirt/qemu has defaults are tailored for x86-64.

This adds support for the following, along with reasonable defaults for x86-64:
- graphics type
- mouse bus
- uefi loader & nvram storage

---
Thanks for the feedback on the previous version. I opted to keep the arch-independant options separate - since I'd already setup so much of it, this ended up being less work. As before, everything though make bringup works.

---
 playbooks/roles/gen_nodes/defaults/main.yml   |  4 ++
 .../roles/gen_nodes/templates/Vagrantfile.j2  |  7 +++
 scripts/gen-nodes.Makefile                    | 15 +++++++
 vagrant/Kconfig                               | 43 +++++++++++++++++++
 4 files changed, 69 insertions(+)
playbooks/roles/gen_nodes/defaults/main.yml +0 -0
index c57effe7..d44ba8bb 100644

playbooks/roles/gen_nodes/defaults/main.yml libvirt_extra_storage_aio_cache_mode: "none" · line 63

Quoted 4 lines
playbooks/roles/gen_nodes/defaults/main.yml +1 -0
@@ -60,6 +60,10 @@ libvirt_extra_storage_aio_cache_mode: "none"
 libvirt_extra_storage_nvme_logical_block_size: 512
 libvirt_extra_storage_virtio_logical_block_size: 512
 libvirt_extra_storage_virtio_physical_block_size: 512
+libvirt_graphics_type: none

This alone should be its own patch as it is a functional change and it makes the graphics type switch to none as defualt. That is welcomed.

playbooks/roles/gen_nodes/defaults/main.yml libvirt_extra_storage_aio_cache_mode: "none" · line 65

Quoted 2 lines
playbooks/roles/gen_nodes/defaults/main.yml +2 -0
+libvirt_input_mouse_bus: ps2
+libvirt_loader: ""

You want a default:

libvirt_loader_enable: False

playbooks/roles/gen_nodes/defaults/main.yml libvirt_extra_storage_aio_cache_mode: "none" · line 66

Quoted 1 line
playbooks/roles/gen_nodes/defaults/main.yml +1 -0
+libvirt_nvram_dir: /var/lib/libvirt/qemu/nvram

Then this can be a default Kconfig string. What you do then is create a Kconfig choise and make the deafult for different architectures.

But I'll explain more below.

playbooks/roles/gen_nodes/templates/Vagrantfile.j2 Vagrant.configure("2") do |config| · line 233

Quoted 13 lines
playbooks/roles/gen_nodes/defaults/main.yml +0 -0
 libvirt_largeio_enable: False
 libvirt_largeio_logical_compat: False
playbooks/roles/gen_nodes/templates/Vagrantfile.j2 +2 -0
index 7ed59ff7..0d20ed6d 100644
@@ -229,6 +229,13 @@ Vagrant.configure("2") do |config|
             libvirt.machine_type = global_data['libvirt_cfg']['machine_type']
           end
         end
+        libvirt.graphics_type = '{{ libvirt_graphics_type }}'
+        libvirt.input :type => "mouse", :bus => "{{ libvirt_input_mouse_bus }}"

This seems fine.

playbooks/roles/gen_nodes/templates/Vagrantfile.j2 Vagrant.configure("2") do |config| · line 234

Quoted 1 line
playbooks/roles/gen_nodes/templates/Vagrantfile.j2 +1 -0
+{% if libvirt_loader %}

Here you'd use the libvirt_loader_enable instead of libvirt_loader so to be very precise about a boolean.

Quoted 19 lines
playbooks/roles/gen_nodes/templates/Vagrantfile.j2 +4 -0
+        libvirt.loader = "{{ libvirt_loader }}"
+        libvirt.nvram = "{{ libvirt_nvram_dir }}/%s.fd" % host_name
+{% endif %}
+
         # Add an extra spare PCI or PCI-E root bus to be used for extra drives.
         #
         # We use a dedicated PCI or PCI-E root bus to not clash with defaults
scripts/gen-nodes.Makefile +4 -0
index 533b19db..9c1f1e09 100644
@@ -203,4 +203,19 @@ endif # CONFIG_QEMU_ENABLE_CXL
 
 endif # CONFIG_LIBVIRT_MACHINE_TYPE_Q35
 
+ifneq (,$(CONFIG_LIBVIRT_GRAPHICS_TYPE))
+GEN_NODES_EXTRA_ARGS += libvirt_graphics_type='$(subst ",,$(CONFIG_LIBVIRT_GRAPHICS_TYPE))'
+endif
+

scripts/gen-nodes.Makefile endif # CONFIG_QEMU_ENABLE_CXL · line 219

Quoted 10 lines
scripts/gen-nodes.Makefile +10 -0
+ifeq (y,$(CONFIG_LIBVIRT_INPUT_PS2_MOUSE))
+GEN_NODES_EXTRA_ARGS += libvirt_input_mouse_bus='ps2'
+else ifeq (y, $(CONFIG_LIBVIRT_INPUT_VIRTIO_MOUSE))
+GEN_NODES_EXTRA_ARGS += libvirt_input_mouse_bus='virtio'
+endif
+
+ifneq (,$(CONFIG_LIBVIRT_LOADER))
+GEN_NODES_EXTRA_ARGS += libvirt_loader='$(subst ",,$(CONFIG_LIBVIRT_LOADER))'
+GEN_NODES_EXTRA_ARGS += libvirt_nvram_dir='$(subst ",,$(CONFIG_LIBVIRT_NVRAM_DIR))'
+endif

You replace most of this with just Kconfig language, the only thing you'd need is a conversion to True for the libvirt_loader_enable.

Then in the future, once we get support to make kconfig spit out extra_vars.yaml for us from .config input source we can remove those Makefile hacks. This let's us scale better.

Luis

#2 lore raw

PATCH v2 2/3 vagrant arm64: kconfig/ansible to enable arm64

In reply to Ross Vandegrift

This adds new Kconfig options to support arm64 kdevops guests under vagrant + libvirt. They are plumbed through to ansible, and make bringup works.

To test with this change, you need a local arm64 vagrant image. Debian's cloud images support building them, but they aren't published yet. openSUSE defaults will be added next.

---
 kconfigs/Kconfig.bringup                      |  2 +-
 playbooks/roles/gen_nodes/defaults/main.yml   |  2 +
 .../roles/gen_nodes/templates/Vagrantfile.j2  |  3 ++
 scripts/gen-nodes.Makefile                    | 13 ++++++
 vagrant/Kconfig                               | 43 +++++++++++++++++--
 5 files changed, 58 insertions(+), 5 deletions(-)
kconfigs/Kconfig.bringup +1 -1
index 1eaa2c99..d559a877 100644
@@ -5,7 +5,7 @@ choice
 config VAGRANT
 	bool "Vagrant for local virtualization (KVM / VirtualBox)"
 	select KDEVOPS_SSH_CONFIG_UPDATE_STRICT
-	depends on TARGET_ARCH_X86_64
+	depends on TARGET_ARCH_X86_64 || TARGET_ARCH_ARM64
 	help
 	  This option will enable use of Vagrant. Enable this if you want to
 	  use local virtualization technologies such as KVM with libvirt or
playbooks/roles/gen_nodes/defaults/main.yml +2 -0
index d44ba8bb..8e8efcb7 100644
@@ -64,6 +64,8 @@ libvirt_graphics_type: none
 libvirt_input_mouse_bus: ps2
 libvirt_loader: ""
 libvirt_nvram_dir: /var/lib/libvirt/qemu/nvram
+libvirt_arm64_enable: False
+libvirt_arm64_gic_version: "3"
 
 libvirt_largeio_enable: False
 libvirt_largeio_logical_compat: False
playbooks/roles/gen_nodes/templates/Vagrantfile.j2 +3 -0
index 0d20ed6d..43b2c030 100644
@@ -235,6 +235,9 @@ Vagrant.configure("2") do |config|
         libvirt.loader = "{{ libvirt_loader }}"
         libvirt.nvram = "{{ libvirt_nvram_dir }}/%s.fd" % host_name
 {% endif %}
+{% if libvirt_arm64_enable %}
+        libvirt.features = ["acpi", "gic version='{{ libvirt_arm64_gic_version }}'"]
+{% endif %}
 
         # Add an extra spare PCI or PCI-E root bus to be used for extra drives.
         #
scripts/gen-nodes.Makefile +13 -0
index 9c1f1e09..43aa7b76 100644
@@ -218,4 +218,17 @@ GEN_NODES_EXTRA_ARGS += libvirt_loader='$(subst ",,$(CONFIG_LIBVIRT_LOADER))'
 GEN_NODES_EXTRA_ARGS += libvirt_nvram_dir='$(subst ",,$(CONFIG_LIBVIRT_NVRAM_DIR))'
 endif
 
+ifeq (y,$(CONFIG_LIBVIRT_MACHINE_TYPE_VIRT))
+GEN_NODES_EXTRA_ARGS += libvirt_override_machine_type='True'
+GEN_NODES_EXTRA_ARGS += libvirt_machine_type='virt'
+endif
+
+ifneq (,$(CONFIG_LIBVIRT_ARM64_ENABLED))
+GEN_NODES_EXTRA_ARGS += libvirt_arm64_enabled='True'
+endif
+
+ifneq (,$(CONFIG_LIBVIRT_FEATURE_ARM64_GIC_VERSION))
+GEN_NODES_EXTRA_ARGS += libvirt_arm64_gic_version='$(subst ",,$(CONFIG_LIBVIRT_FEATURE_ARM64_GIC_VERSION))'
+endif
+
 ANSIBLE_EXTRA_ARGS += $(GEN_NODES_EXTRA_ARGS)
vagrant/Kconfig +39 -4

104 lines not on this page · raw message

Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH v2 2/3] vagrant arm64: kconfig/ansible to enable arm64

vagrant/Kconfig endif # HAVE_LIBVIRT_PCIE_PASSTHROUGH · line 205

Quoted 12 lines · Ross Vandegrift
vagrant/Kconfig +3 -1
index e9e8b3d9..5d7d9657 100644
@@ -198,7 +200,9 @@ endif # HAVE_LIBVIRT_PCIE_PASSTHROUGH
 
 choice
 	prompt "Machine type to use"
-	default LIBVIRT_MACHINE_TYPE_Q35
+	default LIBVIRT_MACHINE_TYPE_Q35 if TARGET_ARCH_X86_64
+	default LIBVIRT_MACHINE_TYPE_VIRT if TARGET_ARCH_ARM64
+	default LIBVIRT_MACHINE_TYPE_DEFAULT if (!TARGET_ARCH_X86_64 && !TARGET_ARCH_ARM64)

We might as well delete LIBVIRT_MACHINE_TYPE_DEFAULT :)

vagrant/Kconfig endchoice · line 1745

Quoted 6 lines
vagrant/Kconfig +6 -0
+config LIBVIRT_ARM64_ENABLE
+	bool
+	depends on TARGET_ARCH_ARM64
+	help
+	  True if arch is arm64 and libvirt is enabled.
+

config LIBVIRT_ARM64_ENABLE
bool
default TARGET_ARCH_ARM64

So long as that is put under libvirt, ie, when libvirt is enabled.

Otherwise looks good!

Luis

#4 lore raw

PATCH v2 3/3 vagrant arm64: add opensuse arm64 images

In reply to Ross Vandegrift

Tumbleweed has arm64 vagrant images already and the one I tested booted up as expected.

---
 vagrant/Kconfig.opensuse | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
vagrant/Kconfig.opensuse +30 -1
index 2ffb1f31..685018b7 100644
@@ -3,7 +3,8 @@ if VAGRANT_OPENSUSE
 
 choice
 	prompt "OpenSUSE release to use"
-	default VAGRANT_OPENSUSE_X86_64_LEAP_15_3
+	default VAGRANT_OPENSUSE_X86_64_LEAP_15_3 if TARGET_ARCH_X86_64
+	default VAGRANT_OPENSUSE_ARM64_TW_20230828 if TARGET_ARCH_ARM64
 
 config VAGRANT_OPENSUSE_X86_64_TW
 	bool "opensuse/Tumbleweed.x86_64"
@@ -78,6 +79,13 @@ config VAGRANT_OPENSUSE_X86_64_LEAP_15_4
 	help
 	  This enables the OpenSUSE Leap 15.4 release.
 
+config VAGRANT_OPENSUSE_ARM64_TW
+	bool "opensuse/Tumbleweed.aarch64"
+	depends on TARGET_ARCH_ARM64
+	help
+	  Enable this to be able to select between the supported OpenSUSE
+	  Tumbleweed releases.
+
 endchoice
 
 if VAGRANT_OPENSUSE_X86_64_TW
@@ -157,6 +165,27 @@ endchoice
 
 endif # VAGRANT_OPENSUSE_X86_64_TW
 
+if VAGRANT_OPENSUSE_ARM64_TW
+
+choice
+	prompt "opensuse/Tumbleweed.aarch64 version to use"
+	default VAGRANT_OPENSUSE_X86_64_TW_1020230828
+
+config VAGRANT_OPENSUSE_X86_64_TW_1020230828
+	bool "opensuse/Tumbleweed.aarch64 1.0.20230828"
+	select HAVE_VAGRANT_BOX_VERSION
+	select HAVE_DISTRO_XFS_SUPPORTS_CRC if FSTESTS_XFS
+	select HAVE_DISTRO_XFS_SUPPORTS_EXTERNAL_LOG if FSTESTS_XFS
+	select HAVE_DISTRO_XFS_SUPPORTS_REFLINKS if FSTESTS_XFS
+	select HAVE_DISTRO_XFS_SUPPORTS_BIGBLOCKS if FSTESTS_XFS
+	help
+	  This option will set the target guest to opensuse/Tumbleweed.aarch64
+	  release 1.0.20230828.
+
+endchoice
+
+endif # VAGRANT_OPENSUSE_ARM64_TW
+
 config VAGRANT_OPENSUSE_BOX_SHORT
 	string
 	default "tw" if VAGRANT_OPENSUSE_X86_64_TW
Signature · 1 line
2.39.2
#5 lore raw

Re: [PATCH v2 3/3] vagrant arm64: add opensuse arm64 images

Quoted 13 lines · Ross Vandegrift

Tumbleweed has arm64 vagrant images already and the one I tested booted up as expected.

---
 vagrant/Kconfig.opensuse | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
vagrant/Kconfig.opensuse +0 -0
index 2ffb1f31..685018b7 100644

vagrant/Kconfig.opensuse if VAGRANT_OPENSUSE · line 7

Quoted 6 lines
vagrant/Kconfig.opensuse +2 -1
@@ -3,7 +3,8 @@ if VAGRANT_OPENSUSE
 
 choice
 	prompt "OpenSUSE release to use"
-	default VAGRANT_OPENSUSE_X86_64_LEAP_15_3
+	default VAGRANT_OPENSUSE_X86_64_LEAP_15_3 if TARGET_ARCH_X86_64
+	default VAGRANT_OPENSUSE_ARM64_TW_20230828 if TARGET_ARCH_ARM64

Did you mean VAGRANT_OPENSUSE_ARM64_TW here instead of VAGRANT_OPENSUSE_ARM64_TW_20230828?

Quoted 18 lines
vagrant/Kconfig.opensuse +7 -0
 config VAGRANT_OPENSUSE_X86_64_TW
 	bool "opensuse/Tumbleweed.x86_64"
@@ -78,6 +79,13 @@ config VAGRANT_OPENSUSE_X86_64_LEAP_15_4
 	help
 	  This enables the OpenSUSE Leap 15.4 release.
 
+config VAGRANT_OPENSUSE_ARM64_TW
+	bool "opensuse/Tumbleweed.aarch64"
+	depends on TARGET_ARCH_ARM64
+	help
+	  Enable this to be able to select between the supported OpenSUSE
+	  Tumbleweed releases.
+
 endchoice
 
 if VAGRANT_OPENSUSE_X86_64_TW

vagrant/Kconfig.opensuse endchoice · line 174

Quoted 10 lines
vagrant/Kconfig.opensuse +7 -0
@@ -157,6 +165,27 @@ endchoice
 
 endif # VAGRANT_OPENSUSE_X86_64_TW
 
+if VAGRANT_OPENSUSE_ARM64_TW
+
+choice
+	prompt "opensuse/Tumbleweed.aarch64 version to use"
+	default VAGRANT_OPENSUSE_X86_64_TW_1020230828
+
+config VAGRANT_OPENSUSE_X86_64_TW_1020230828

These twho are x86 above.. while this is for arm64.

Quoted 19 lines
vagrant/Kconfig.opensuse +14 -0
+	bool "opensuse/Tumbleweed.aarch64 1.0.20230828"
+	select HAVE_VAGRANT_BOX_VERSION
+	select HAVE_DISTRO_XFS_SUPPORTS_CRC if FSTESTS_XFS
+	select HAVE_DISTRO_XFS_SUPPORTS_EXTERNAL_LOG if FSTESTS_XFS
+	select HAVE_DISTRO_XFS_SUPPORTS_REFLINKS if FSTESTS_XFS
+	select HAVE_DISTRO_XFS_SUPPORTS_BIGBLOCKS if FSTESTS_XFS
+	help
+	  This option will set the target guest to opensuse/Tumbleweed.aarch64
+	  release 1.0.20230828.
+
+endchoice
+
+endif # VAGRANT_OPENSUSE_ARM64_TW
+
 config VAGRANT_OPENSUSE_BOX_SHORT
 	string
 	default "tw" if VAGRANT_OPENSUSE_X86_64_TW
Signature · 1 line
2.39.2

Seems like you are missing the corresponding VAGRANT_BOX and VAGRANT_BOX_VERSION updates needed on vagrant/Kconfig.

Luis