Received: from ravenhurst.kallisti.us (ravenhurst.kallisti.us [69.164.210.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C945A45 for ; Wed, 13 Sep 2023 06:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kallisti.us ; s=20220106; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TUE2KjllJr4OzF7BLw81x1KcPDskGzDwrgFGQ5jebFM=; b=NofNYb9RgbWE92aib3t4ySPPTq G5dAem9eZmrrBHY3qEK8X65AzgC7IBpjwwS/uydInXymquQgS8nRYMgzC0yj7HBY865tA6IuH8COv t0JghaOJhXQrsxoCuxN8+dTaIRW2U+y8NS70ivvVkmASC0TdccDDA3D0r5m47u7o8QL17GqgE3aIp uSyZ6DNDYDvw74EbFrxioDyDT504BmG4K1d28liLXUqdUSvr3n1+2Q6FpaRaoA4kVzVcC2UiUExzy jgE+OKHt1f4q6Hm4rF4igZ7vPeBY4RtvzVKYNyFhbTUKEwkc6cYA5XASqmiMYvRyACrCxQaKHDbcJ QCjLVZaw==; Received: from [50.52.114.95] (helo=localhost) by ravenhurst.kallisti.us with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgIXJ-00Atjt-8D; Wed, 13 Sep 2023 01:35:37 -0400 From: Ross Vandegrift To: mcgrof@kernel.org Cc: kdevops@lists.linux.dev, Ross Vandegrift Subject: [PATCH v2 2/3] vagrant arm64: kconfig/ansible to enable arm64 Date: Tue, 12 Sep 2023 21:35:12 -0700 Message-Id: <20230913043512.6083-2-ross@kallisti.us> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913043512.6083-1-ross@kallisti.us> References: <20230913043512.6083-1-ross@kallisti.us> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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