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 1/3] vagrant arm64: arch indep kconfig/ansible options
Date: Tue, 12 Sep 2023 21:35:11 -0700	[thread overview]
Message-ID: <20230913043512.6083-1-ross@kallisti.us> (raw)

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

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

diff --git a/playbooks/roles/gen_nodes/defaults/main.yml b/playbooks/roles/gen_nodes/defaults/main.yml
index c57effe7..d44ba8bb 100644
--- a/playbooks/roles/gen_nodes/defaults/main.yml
+++ b/playbooks/roles/gen_nodes/defaults/main.yml
@@ -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
diff --git a/playbooks/roles/gen_nodes/templates/Vagrantfile.j2 b/playbooks/roles/gen_nodes/templates/Vagrantfile.j2
index 7ed59ff7..0d20ed6d 100644
--- a/playbooks/roles/gen_nodes/templates/Vagrantfile.j2
+++ b/playbooks/roles/gen_nodes/templates/Vagrantfile.j2
@@ -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
diff --git a/scripts/gen-nodes.Makefile b/scripts/gen-nodes.Makefile
index 533b19db..9c1f1e09 100644
--- a/scripts/gen-nodes.Makefile
+++ b/scripts/gen-nodes.Makefile
@@ -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)
diff --git a/vagrant/Kconfig b/vagrant/Kconfig
index 4927012a..e9e8b3d9 100644
--- a/vagrant/Kconfig
+++ b/vagrant/Kconfig
@@ -241,6 +241,49 @@ config LIBVIRT_HOST_PASSTHROUGH
 	      --pre 'make -s mrproper defconfig' \
 	    \-- make -s -j$(nproc) bzImage
 
+config LIBVIRT_GRAPHICS_TYPE
+	string "Graphics type"
+	default "none"
+	help
+	  Sets the protocol used to expose the guest display.  Possible values
+	  are `sdl`, `curses`, `none`, `gtk`, `vnc` or `spice`.
+
+choice
+	prompt "Libvirt input config"
+	default LIBVIRT_INPUT_PS2_MOUSE if TARGET_ARCH_X86_64
+
+config LIBVIRT_INPUT_PS2_MOUSE
+	bool "PS/2 mouse"
+	depends on TARGET_ARCH_X86_64
+	help
+	  Use an emulated PS/2 bouse for input.  Default for X86_64, and
+	  probably can't work on any other architectures.
+
+config LIBVIRT_INPUT_VIRTIO_MOUSE
+	bool "Virtio mouse"
+	help
+	  Use a virtio mouse for input.  Should work on any architecture.
+
+endchoice
+
+config LIBVIRT_LOADER
+	string "Path to a custom UEFI loader."
+	default ""
+	help
+	  On some architectures, qemu may not automatically load the UEFI
+	  firmware from the correct location.  Set this variable to help it out.
+
+	  You may need to install the OVMF packages for your architecture.  On
+	  Debian ARM64, that's qemu-efi-aarch64.
+
+config LIBVIRT_NVRAM_DIR
+	string "Path to storage for UEFI NVRAM."
+	default ""
+	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 QEMU_BUILD
 	bool "Should we build QEMU for you?"
 	select NEEDS_LOCAL_DEVELOPMENT_PATH
-- 
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 Ross Vandegrift [this message]
2023-09-13  4:35 ` [PATCH v2 2/3] vagrant arm64: kconfig/ansible to enable arm64 Ross Vandegrift
2023-09-13  6:36   ` 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-1-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).