Skip to content

Commit

Permalink
Add VirtIO Viomem Driver support
Browse files Browse the repository at this point in the history
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
  • Loading branch information
kostyanf14 committed Mar 25, 2024
1 parent bf594f3 commit f38c698
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/engines/hcktest/drivers/viomem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "VirtIO Viomem Driver",
"device": "virtio-mem-pci",
"inf": "viomem.inf",
"install_method": "PNP",
"type": 0,
"support": false,
"reject_test_names": [
"Hardware-enforced Stack Protection Compatibility Test"
]
}
10 changes: 10 additions & 0 deletions lib/setupmanagers/qemuhck/devices/virtio-mem-pci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "virtio-mem-pci",
"command_line": [
"-object memory-backend-ram,id=mem_backend,size=@pluggable_memory@",
"-device virtio-mem-pci@device_extra_param@,memdev=mem_backend,requested-size=1G,bus=@[email protected]"
],
"define_variables": {
"@pluggable_memory_gb@": 2
}
}
22 changes: 20 additions & 2 deletions lib/setupmanagers/qemuhck/qemu_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,24 @@ def machine_replacement_list
}
end

def memory_replacement_list
pluggable_memory_gb = @define_variables['@pluggable_memory_gb@']
memory_gb = option_config('memory_gb')

if pluggable_memory_gb.nil?
{
'@memory@' => "#{memory_gb}G",
'@max_memory@' => "#{memory_gb}G"
}
else
{
'@memory@' => "#{memory_gb}G",
'@pluggable_memory@' => "#{pluggable_memory_gb}G",
'@max_memory@' => "#{memory_gb + pluggable_memory_gb}G"
}
end
end

def options_replacement_list
{
'@machine_extra_param@' => @machine_extra_param.join,
Expand All @@ -358,7 +376,6 @@ def full_replacement_list
'@run_id_second@' => @id_second,
'@client_id@' => @client_id,
'@workspace@' => @workspace_path,
'@memory@' => "#{option_config('memory_gb')}G",
'@cpu@' => option_config('cpu'),
'@cpu_count@' => option_config('cpu_count'),
'@cpu_model@' => option_config('cpu_model'),
Expand All @@ -367,6 +384,7 @@ def full_replacement_list
'@qemu_monitor_port@' => @monitor_port
}.merge(config_replacement_list)
.merge(machine_replacement_list)
.merge(memory_replacement_list)
.merge(options_replacement_list)
.merge(@define_variables)
end
Expand Down Expand Up @@ -486,7 +504,7 @@ def process_devices
def base_cmd
[
'@qemu_bin@ -enable-kvm -machine @machine_name@@machine_extra_param@ ',
'-m @memory@ -smp @cpu_count@,cores=@cpu_count@ ',
'-m @memory@,maxmem=@max_memory@ -smp @cpu_count@,cores=@cpu_count@ ',
'-cpu @cpu_options@ -boot order=cd,menu=on ',
'-nodefaults -no-user-config -usb -device usb-tablet -vnc :@vnc_id@ ',
'-global kvm-pit.lost_tick_policy=discard -rtc base=localtime,clock=host,driftfix=slew ',
Expand Down

0 comments on commit f38c698

Please sign in to comment.