kdevops.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Ross Vandegrift <ross@kallisti.us>
To: mcgrof@kernel.org
Cc: kdevops@lists.linux.dev, Ross Vandegrift <ross@kallisti.us>
Subject: [PATCH v2 2/3] vagrant arm64: kconfig/ansible to enable arm64
Date: Tue, 12 Sep 2023 21:35:12 -0700	[thread overview]
Message-ID: <20230913043512.6083-2-ross@kallisti.us> (raw)
In-Reply-To: <20230913043512.6083-1-ross@kallisti.us>

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.

Signed-off-by: Ross Vandegrift <ross@kallisti.us>
---
 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(-)

diff --git a/kconfigs/Kconfig.bringup b/kconfigs/Kconfig.bringup
index 1eaa2c99..d559a877 100644
--- a/kconfigs/Kconfig.bringup
+++ b/kconfigs/Kconfig.bringup
@@ -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
diff --git a/playbooks/roles/gen_nodes/defaults/main.yml b/playbooks/roles/gen_nodes/defaults/main.yml
index d44ba8bb..8e8efcb7 100644
--- a/playbooks/roles/gen_nodes/defaults/main.yml
+++ b/playbooks/roles/gen_nodes/defaults/main.yml
@@ -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
diff --git a/playbooks/roles/gen_nodes/templates/Vagrantfile.j2 b/playbooks/roles/gen_nodes/templates/Vagrantfile.j2
index 0d20ed6d..43b2c030 100644
--- a/playbooks/roles/gen_nodes/templates/Vagrantfile.j2
+++ b/playbooks/roles/gen_nodes/templates/Vagrantfile.j2
@@ -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.
         #
diff --git a/scripts/gen-nodes.Makefile b/scripts/gen-nodes.Makefile
index 9c1f1e09..43aa7b76 100644
--- a/scripts/gen-nodes.Makefile
+++ b/scripts/gen-nodes.Makefile
@@ -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)
diff --git a/vagrant/Kconfig b/vagrant/Kconfig
index e9e8b3d9..5d7d9657 100644
--- a/vagrant/Kconfig
+++ b/vagrant/Kconfig
@@ -6,12 +6,14 @@ choice
 
 config VAGRANT_LIBVIRT
 	bool "Libvirt"
+	select LIBVIRT_ARM64_ENABLE if TARGET_ARCH_ARM64
 	help
 	  Select this option if you want to use KVM / libvirt for
 	  local virtualization.
 
 config VAGRANT_VIRTUALBOX
 	bool "Virtualbox"
+	depends on TARGET_ARCH_X86_64
 	select EXTRA_STORAGE_SUPPORTS_512
 	select EXTRA_STORAGE_SUPPORTS_1K
 	select EXTRA_STORAGE_SUPPORTS_2K
@@ -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)
 
 config LIBVIRT_MACHINE_TYPE_DEFAULT
 	bool "Use the default machine type"
@@ -215,10 +219,18 @@ config LIBVIRT_MACHINE_TYPE_DEFAULT
 
 config LIBVIRT_MACHINE_TYPE_Q35
 	bool "q35"
+	depends on TARGET_ARCH_X86_64
 	help
 	  Use q35 for the machine type. This will be required for things like
 	  CXL or PCIe passthrough.
 
+config LIBVIRT_MACHINE_TYPE_VIRT
+	bool "virt"
+	depends on TARGET_ARCH_ARM64
+	select LIBVIRT_HOST_PASSTHROUGH
+	help
+	  Use the arm64 virt machine type.
+
 endchoice
 
 config LIBVIRT_HOST_PASSTHROUGH
@@ -251,6 +263,7 @@ config LIBVIRT_GRAPHICS_TYPE
 choice
 	prompt "Libvirt input config"
 	default LIBVIRT_INPUT_PS2_MOUSE if TARGET_ARCH_X86_64
+	default LIBVIRT_INPUT_VIRTIO_MOUSE if !TARGET_ARCH_X86_64
 
 config LIBVIRT_INPUT_PS2_MOUSE
 	bool "PS/2 mouse"
@@ -268,7 +281,8 @@ endchoice
 
 config LIBVIRT_LOADER
 	string "Path to a custom UEFI loader."
-	default ""
+	default "/usr/share/AAVMF/AAVMF_CODE.fd" if TARGET_ARCH_ARM64
+	default "" if !TARGET_ARCH_ARM64
 	help
 	  On some architectures, qemu may not automatically load the UEFI
 	  firmware from the correct location.  Set this variable to help it out.
@@ -279,11 +293,24 @@ config LIBVIRT_LOADER
 config LIBVIRT_NVRAM_DIR
 	string "Path to storage for UEFI NVRAM."
 	default ""
+	default "/var/lib/libvirt/qemu/nvram" if TARGET_ARCH_ARM64
+	default "" if !TARGET_ARCH_ARM64
 	help
 	  Some architectures may require storage on the host for UEFI NVRAM.
 	  This will take 64MiB per guest.  The default directory is
 	  /var/lib/libvirt/qemu/nvram/.
 
+config LIBVIRT_FEATURE_ARM64_GIC_VERSION
+	string "GIC version"
+	depends on TARGET_ARCH_ARM64
+	default "3"
+	help
+	  Specify which Generic Interrupt Controller (GIC) version libvirt
+	  should use.  Newer GIC versions can support more cores.  For details
+	  see: https://developer.arm.com/Architectures/Generic%20Interrupt%20Controller
+	  Since ARM64 uses host cpu passthrough, some configs might not be
+	  available due to the underlying hardware.
+
 config QEMU_BUILD
 	bool "Should we build QEMU for you?"
 	select NEEDS_LOCAL_DEVELOPMENT_PATH
@@ -366,8 +393,10 @@ endif # QEMU_BUILD
 
 config QEMU_BIN_PATH_LIBVIRT
 	string "QEMU binary path to use"
-	default "/usr/local/bin/qemu-system-x86_64" if QEMU_USE_DEVELOPMENT_VERSION
-	default "/usr/bin/qemu-system-x86_64" if !QEMU_USE_DEVELOPMENT_VERSION
+	default "/usr/local/bin/qemu-system-x86_64" if TARGET_ARCH_X86_64 && QEMU_USE_DEVELOPMENT_VERSION
+	default "/usr/bin/qemu-system-x86_64" if TARGET_ARCH_X86_64 && !QEMU_USE_DEVELOPMENT_VERSION
+	default "/usr/local/bin/qemu-system-aarch64" if TARGET_ARCH_ARM64 && QEMU_USE_DEVELOPMENT_VERSION
+	default "/usr/bin/qemu-system-aarch64" if TARGET_ARCH_ARM64 && !QEMU_USE_DEVELOPMENT_VERSION
 
 config QEMU_INSTALL_DIR_LIBVIRT
 	string "Path to install QEMU"
@@ -1708,4 +1737,10 @@ endchoice
 
 endif # QEMU_ENABLE_CXL
 
+config LIBVIRT_ARM64_ENABLE
+	bool
+	depends on TARGET_ARCH_ARM64
+	help
+	  True if arch is arm64 and libvirt is enabled.
+
 endif # VAGRANT
-- 
2.39.2


  reply	other threads:[~2023-09-13  6:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13  4:35 [PATCH v2 1/3] vagrant arm64: arch indep kconfig/ansible options Ross Vandegrift
2023-09-13  4:35 ` Ross Vandegrift [this message]
2023-09-13  6:36   ` [PATCH v2 2/3] vagrant arm64: kconfig/ansible to enable arm64 Luis Chamberlain
2023-09-13  4:35 ` [PATCH v2 3/3] vagrant arm64: add opensuse arm64 images Ross Vandegrift
2023-09-13  6:45   ` Luis Chamberlain
2023-09-13  6:07 ` [PATCH v2 1/3] vagrant arm64: arch indep kconfig/ansible options Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230913043512.6083-2-ross@kallisti.us \
    --to=ross@kallisti.us \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).