From 695e041bb91dbe793c0e1a72080c4253c551c695 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kostiuk Date: Wed, 6 Nov 2024 14:42:54 +0200 Subject: [PATCH] QemuHCK: Fix missing iommu_device_param on device Signed-off-by: Kostiantyn Kostiuk --- lib/models/qemuhck_device.rb | 1 + lib/setupmanagers/qemuhck/qemu_machine.rb | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/models/qemuhck_device.rb b/lib/models/qemuhck_device.rb index 30cb7806..4f9501dc 100644 --- a/lib/models/qemuhck_device.rb +++ b/lib/models/qemuhck_device.rb @@ -16,6 +16,7 @@ class QemuHCKDevice < T::Struct const :post_stop_commands, T::Array[String], default: [] const :machine_options, T::Array[String], default: [] const :pluggable_memory_gb, Integer, default: 0 + const :iommu_device_param, T.nilable(String) end end end diff --git a/lib/setupmanagers/qemuhck/qemu_machine.rb b/lib/setupmanagers/qemuhck/qemu_machine.rb index b98b56ed..fcc42b52 100644 --- a/lib/setupmanagers/qemuhck/qemu_machine.rb +++ b/lib/setupmanagers/qemuhck/qemu_machine.rb @@ -183,7 +183,6 @@ def define_local_variables @device_commands = [] @machine_options = %w[@machine_name@] @device_extra_param = [] - @iommu_device_param = [] @cpu_options = %w[@cpu@ +x2apic +fsgsbase model=@cpu_model@] @drive_cache_options = [] @define_variables = {} @@ -322,7 +321,7 @@ def options_replacement_map { '@machine_options@' => (@machine_options + device_machine_options).join(','), '@device_extra_param@' => @device_extra_param.join, - '@iommu_device_param@' => @iommu_device_param.join, + '@iommu_device_param@' => device_iommu_device_param.join, '@cpu_options@' => @cpu_options.join(','), '@drive_cache_options@' => @drive_cache_options.join } @@ -353,6 +352,11 @@ def device_machine_options @device_infos.map(&:machine_options).flatten.compact end + sig { returns(T::Array[String]) } + def device_iommu_device_param + @device_infos.map(&:iommu_device_param).flatten.compact + end + def full_replacement_map ReplacementMap.new({ '@run_id@' => @id, @@ -400,7 +404,7 @@ def read_device(device) end def normalize_lists - [@device_commands, @machine_options, @device_extra_param, @iommu_device_param, + [@device_commands, @machine_options, @device_extra_param, @cpu_options, @drive_cache_options].each do |arr| arr.flatten! arr.compact!