diff --git a/repos/ports/run/microcode.run b/repos/ports/run/microcode.run index 13c3b850a..bbb034ef5 100644 --- a/repos/ports/run/microcode.run +++ b/repos/ports/run/microcode.run @@ -1,5 +1,9 @@ assert_spec x86 +set ::env(MAKEFLAGS) s +set path_microcode "[exec [genode_dir]/tool/ports/current microcode_intel]/src/app/intel/intel-ucode" +set microcode_files [glob -nocomplain -dir $path_microcode *-*-*] + if { [get_cmd_switch --autopilot] } { if {[have_include "power_on/qemu"]} { @@ -9,8 +13,23 @@ if { [get_cmd_switch --autopilot] } { # platform_info data about CPUs on other kernels missing assert_spec nova + + if { [have_spec x86_64] } { + file copy -force $path_microcode/06-3c-03 bin/micro.code + } else { + file copy -force $path_microcode/06-17-06 bin/micro.code + } } +if {![file exists bin/micro.code]} { + puts "\nMissing bin/micro.code file for your target machine." + puts "Please select for your target CPU the microcode patch located in $path_microcode/xx-xx-xx." + puts "and copy it to bin/micro.code. xx-xx-xx stands for your target CPU, family-model-stepping\n" + exit 0 +} + +proc apply_microcode { } { return true } + build "core init test/microcode" create_boot_directory @@ -33,10 +52,6 @@ install_config { } -set ::env(MAKEFLAGS) s -set path_microcode [exec [genode_dir]/tool/ports/current microcode_intel] -set microcode_files [glob -dir $path_microcode/src/app/intel *-*-*] - file copy -force {*}$microcode_files bin/ @@ -57,6 +72,7 @@ run_genode_until "microcode check done" 30 # cleanup if { [get_cmd_switch --autopilot] } { + file delete -force bin/micro.code foreach file $microcode_files { file delete bin/$file } diff --git a/tool/autopilot.list b/tool/autopilot.list index ebbfadba2..3f6ed181e 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -128,3 +128,4 @@ vmm weak_ptr xml_generator xml_node +microcode diff --git a/tool/boot/README b/tool/boot/README index 70f69efef..809465ac2 100644 --- a/tool/boot/README +++ b/tool/boot/README @@ -2,16 +2,19 @@ This directory contains boot-loader files needed to boot Genode and to create boot images. The tools are available in binary form. Pointers to the source code respectively the download source of binaries are described below. -:'bender' +:'bender', 'microcode' - The 'bender' tool is part of the 'morbo' toolchain available under GPL. + The tools are part of the 'morbo' toolchain available under GPL. The toolchain was obtained from https://github.com/TUD-OS/morbo. - For Genode the bender was modified so that binaries are only relocated up + For Genode bender was modified so that binaries are only relocated up to 2G physical. Additional, relocation can be limited to 256M for sel4. + The microcode tools expect to find a module named micro.code which contains + a valid Intel microcode file for the target CPU. + The changes are available from https://github.com/alex-ab/morbo.git. - branch genode_bender, git commit e4744198ed481886c48e3dee12c1fbd47411770f + git commit 003016e096fa132e2086b4db52d1fd965dbd7363 :'pulsar': diff --git a/tool/boot/bender b/tool/boot/bender index b79f5b7ba..52617f61e 100755 Binary files a/tool/boot/bender and b/tool/boot/bender differ diff --git a/tool/boot/microcode b/tool/boot/microcode new file mode 100644 index 000000000..86668ae8c Binary files /dev/null and b/tool/boot/microcode differ diff --git a/tool/run/boot_dir/nova b/tool/run/boot_dir/nova index 8cc20416d..73f0e4d93 100644 --- a/tool/run/boot_dir/nova +++ b/tool/run/boot_dir/nova @@ -9,6 +9,7 @@ proc run_boot_string { } { return "\nHypervisor reports " } +proc apply_microcode { } { return false } proc core_link_address { } { return "0x100000" } @@ -66,6 +67,11 @@ proc run_boot_dir {binaries} { set serial_bender_opt "" + if {[apply_microcode]} { + exec cp bin/micro.code [run_dir]/boot/ + exec cp [genode_dir]/tool/boot/microcode [run_dir]/boot/ + } + if {[have_include "image/disk"]} { exec mkdir -p [run_dir]/boot/grub exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender @@ -126,6 +132,10 @@ proc run_boot_dir {binaries} { puts $fh " insmod multiboot2" puts $fh " insmod gzio" puts $fh " multiboot2 /boot/bender $serial_bender_opt" + if {[apply_microcode]} { + puts $fh " module2 /boot/microcode serial" + puts $fh " module2 /boot/micro.code micro.code" + } puts $fh " module2 /boot/hypervisor hypervisor iommu novpid [kernel_output]" puts $fh " module2 /boot/image.elf.gz image.elf" puts $fh "}" @@ -143,11 +153,20 @@ proc run_boot_dir {binaries} { # install_pxe_bootloader_to_run_dir + if {[apply_microcode]} { + exec cp [genode_dir]/tool/boot/microcode [run_dir]/boot/ + exec cp bin/micro.code [run_dir]/boot/ + } + # # Generate pulsar config file # set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"] puts $fh " exec /boot/bender" + if {[apply_microcode]} { + puts $fh " load /boot/microcode serial" + puts $fh " load /boot/micro.code micro.code" + } puts $fh " load /boot/hypervisor iommu novpid [kernel_output]" puts $fh " load /boot/image.elf" close $fh