Hardware virtualisation (AMD-V) support on Igel M340C (AMD GX-424CC)

I successfully have done this with Arch Linux (rolling release, May 2022), x86-64 and 'grml64-full 2021.07'-live media with internet to install 'efivar'.

Target: Igel M340C Thin client, SOC: AMD GX-424CC.

May work on other devices with InsydeH2O BIOS too.

Background

There is no BIOS setting to enable CPU-virtualisation. The tools H2ouve.exe are difficult to source. And the windows version needs at least WinRE environment to execute. And in my case it falied due to lack on any driver.

If you see this in your log-files, then the virtualisation is not turned on:

   May 11 18:06:03 igel340 kernel: kvm: support for 'kvm_amd' disabled by bios

After this patch, you should see:

   May 31 13:15:08 igel340 kernel: SVM: TSC scaling supported
   May 31 13:15:08 igel340 kernel: kvm: Nested Virtualization enabled
   May 31 13:15:08 igel340 kernel: SVM: kvm: Nested Paging enabled
   May 31 13:15:08 igel340 kernel: SVM: LBR virtualization supported

My Igel M340C has this BIOS version:

   May 11 18:06:02 igel340 kernel: efi: EFI v2.31 by INSYDE Corp.
   May 11 18:06:02 igel340 kernel: efi: ACPI=0x76bfe000 ACPI 2.0=0x76bfe014 SMBIOS=0x766bef98 
   May 11 18:06:02 igel340 kernel: SMBIOS 2.8 present.
   May 11 18:06:02 igel340 kernel: DMI: IGEL Technology GmbH M340C/M340C, BIOS M340C V:3.A.13-03202018 03/20/2018

Warning

At your own risk! No waranty! You may brick your device! Animals can be harmed!

Patching the BIOS settings with linux

  1. Install efivar and some kind of a hexeditor (recommended: hexedit). On Arch-Linux I installed:

      pacman -S efivar hexedit
    

    It should be possible to use the Arch-Linux install media without the need to install Arch-Linux.

    With grmli64-full 2021.07 (live media) you need internet access do this:

      apt update
      apt install efivar
    
  2. Boot system in UEFI-Mode to get access to UEFI vars (location: /sys/firmware/efi/efivars)

  3. Change to efivars virtual filesystem (should be mounted, if booted in UEFI mode)

      cd /sys/firmware/efi/efivars
    
  4. The complete BIOS-setup is stored in this blob/var Setup-a04a27f4-df00-4d42-b552-39511302113d, dump it

      cat Setup-a04a27f4-df00-4d42-b552-39511302113d > /tmp/setup_dumped.bin
    
  5. Watch out: the first 4 bytes dumped by this method are containing the UUID for the var. Remove this with dd:

      dd if=/tmp/setup_dumped.bin of=~/setup.bin bs=1 skip=4
    

    The size of the file should now 631 bytes, please check!

  6. Now the plain blob with settings are in ~/setup.bin make a copy..

      cp ~/setup.bin ~/setup_mod.bin
    
  7. Modify the blob with tools like hexedit (press CTRL-X to exit, confirm to save the changes)

      hexedit ~/setup_mod.bin
    

    These values were changed:

    This is a diff between the files:

    --- /mnt/igel/efivar_setup.txt    2022-06-02 12:25:04.000000000 +0000
    +++ /mnt/igel/efivar_setup_mod.txt    2022-06-02 12:25:56.000000000 +0000
    @@ -19,13 +19,13 @@
     000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     000000c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     000000d0  00 00 00 00 00 00 00 00  00 00 00 00 01 00 00 01  |................|
    -000000e0  00 00 00 00 00 00 00 00  00 00 00 01 01 00 00 00  |................|
    +000000e0  00 00 00 00 00 00 00 00  00 00 00 01 01 00 01 00  |................|
     000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 01 00  |................|
     00000100  00 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     00000120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     00000130  00 00 00 00 00 00 00 00  00 00 01 00 00 00 01 01  |................|
    -00000140  01 01 01 00 00 00 00 00  00 01 00 02 03 02 00 02  |................|
    +00000140  01 01 01 00 00 00 00 00  00 00 00 02 03 02 00 02  |................|
     00000150  00 02 03 00 00 00 01 00  00 00 04 01 00 00 04 01  |................|
     00000160  00 00 04 00 00 00 04 00  00 00 00 00 00 00 00 00  |................|
     00000170  00 00 00 00 00 00 00 00  00 00 01 00 00 00 00 80  |................|
    

    After modifications in hexedit:

    modification applied

  8. Make the efivar writable

      chattr -i Setup-a04a27f4-df00-4d42-b552-39511302113d
    
  9. write the modified blob to the efivar with the efivar tool, remind the slighly changed name of the variable due to efivars requirements

      efivar -w -n a04a27f4-df00-4d42-b552-39511302113d-Setup -f ~/setup_mod.bin
    
  10. Verify the last step, only two values should be altered

      efivar -n a04a27f4-df00-4d42-b552-39511302113d-Setup
    

    If you messed up things here, you can write your unmodified setup.bin with the efivar-cmd:

       efivar -w -n a04a27f4-df00-4d42-b552-39511302113d-Setup -f ~/setup.bin
    
  11. Now fingers crossed and reboot the system

  12. After reboot check the log for somethings like:

      May 31 13:15:08 igel340 kernel: SVM: TSC scaling supported
      May 31 13:15:08 igel340 kernel: kvm: Nested Virtualization enabled
      May 31 13:15:08 igel340 kernel: SVM: kvm: Nested Paging enabled
      May 31 13:15:08 igel340 kernel: SVM: LBR virtualization supported
    
  13. That's all.

Thanks to

https://www.youtube.com/watch?v=kX-vljmiKPE (shows the pattern to change bytes)
https://github.com/elcaza/acere15amd-v.git (shows the pattern to change bytes in *.png)
https://www.parkytowers.me.uk/thin/
https://www.parkytowers.me.uk/thin/Igel/ud/ud3/M340C/firmware.shtml

Hexdumps

Content of Setup-a04a27f4-df00-4d42-b552-39511302113d), before patching, lenght: 631 bytes

GUID: a04a27f4-df00-4d42-b552-39511302113d
Name: "Setup"
Attributes:
    Non-Volatile
    Boot Service Access
    Runtime Service Access
Value:
00000000  00 00 00 00 00 00 00 00  01 00 01 03 04 00 00 01  |................|
00000010  01 03 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  01 07 00 03 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 02 00 00 00 00 00 00  |................|
00000040  00 00 00 02 02 02 02 01  01 01 00 00 00 00 00 00  |................|
00000050  00 00 00 01 01 01 00 00  00 00 00 00 00 00 00 00  |................|
00000060  03 00 00 00 04 01 00 00  00 05 00 00 00 00 00 00  |................|
00000070  01 01 00 00 00 00 00 01  00 00 01 01 00 02 00 00  |................|
00000080  00 00 00 00 00 01 01 00  00 00 00 00 01 05 02 ee  |................|
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000000a0  00 00 00 00 00 00 00 00  00 00 01 00 00 00 00 00  |................|
000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000d0  00 00 00 00 00 00 00 00  00 00 00 00 01 00 00 01  |................|
000000e0  00 00 00 00 00 00 00 00  00 00 00 01 01 00 00 00  |................|
000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 01 00  |................|
00000100  00 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000130  00 00 00 00 00 00 00 00  00 00 01 00 00 00 01 01  |................|
00000140  01 01 01 00 00 00 00 00  00 01 00 02 03 02 00 02  |................|
00000150  00 02 03 00 00 00 01 00  00 00 04 01 00 00 04 01  |................|
00000160  00 00 04 00 00 00 04 00  00 00 00 00 00 00 00 00  |................|
00000170  00 00 00 00 00 00 00 00  00 00 01 00 00 00 00 80  |................|
00000180  00 00 00 00 00 00 01 01  00 01 00 01 02 02 06 00  |................|
00000190  00 01 00 00 ff ff 01 01  04 00 00 00 00 01 e0 2e  |................|
000001a0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000001d0  00 01 00 00 00 00 03 00  01 00 00 00 00 00 00 00  |................|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000250  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000270  00 00 00 00 00 00 00                              |.......         |

Setup-Value after modifications

GUID: a04a27f4-df00-4d42-b552-39511302113d
Name: "Setup"
Attributes:
    Non-Volatile
    Boot Service Access
    Runtime Service Access
Value:
00000000  00 00 00 00 00 00 00 00  01 00 01 03 04 00 00 01  |................|
00000010  01 03 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  01 07 00 03 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 02 00 00 00 00 00 00  |................|
00000040  00 00 00 02 02 02 02 01  01 01 00 00 00 00 00 00  |................|
00000050  00 00 00 01 01 01 00 00  00 00 00 00 00 00 00 00  |................|
00000060  03 00 00 00 04 01 00 00  00 05 00 00 00 00 00 00  |................|
00000070  01 01 00 00 00 00 00 01  00 00 01 01 00 02 00 00  |................|
00000080  00 00 00 00 00 01 01 00  00 00 00 00 01 05 02 ee  |................|
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000000a0  00 00 00 00 00 00 00 00  00 00 01 00 00 00 00 00  |................|
000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000d0  00 00 00 00 00 00 00 00  00 00 00 00 01 00 00 01  |................|
000000e0  00 00 00 00 00 00 00 00  00 00 00 01 01 00 01 00  |................|
000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 01 00  |................|
00000100  00 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000130  00 00 00 00 00 00 00 00  00 00 01 00 00 00 01 01  |................|
00000140  01 01 01 00 00 00 00 00  00 00 00 02 03 02 00 02  |................|
00000150  00 02 03 00 00 00 01 00  00 00 04 01 00 00 04 01  |................|
00000160  00 00 04 00 00 00 04 00  00 00 00 00 00 00 00 00  |................|
00000170  00 00 00 00 00 00 00 00  00 00 01 00 00 00 00 80  |................|
00000180  00 00 00 00 00 00 01 01  00 01 00 01 02 02 06 00  |................|
00000190  00 01 00 00 ff ff 01 01  04 00 00 00 00 01 e0 2e  |................|
000001a0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000001d0  00 01 00 00 00 00 03 00  01 00 00 00 00 00 00 00  |................|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000250  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000270  00 00 00 00 00 00 00                              |.......         |

Contact and feedback

Contact: For feedback and questions please contact me at denis_boehme aaat web.de
Doc-Version: 0.8
Date: 16-07-2022
Doc-Name: igel_M340C_bios.md
Lizenz: CC BY-SA 4.0