WorkingTipsOnGen12CentOS

CentOS7.6.1810,minimum installation.

# yum makecache
# yum install -y vim git gcc libevent-devel unzip flex bison
# vim /etc/selinux/config
SELINUX=disabled
# systemctl disable firewalld

Install gcc-7:

yum install centos-release-scl
yum install devtoolset-7-gcc-c++
scl enable devtoolset-7 bash

Install kernel related dependencies:

yum install -y devtoolset-7-elfutils-libelf-devel.x86_64  openssl-devel bc rpm-build pciutils

Clone the kernel code:

# mkdir Code
# cd Code
# git clone https://github.com/intel/linux-intel-lts.git
# cd linux-intel-lts
# git checkout gawougoweugowugo
# cp ~/kernel-config.zip .
# unzip kernel-config.zip
# cp ./kernel-config/x86_64_defconfig .config
# echo "" | make ARCH=x86_64 olddefconfig
# make ARCH=x86_64 -j16 LOCALVERSION=-lts2021-iotg -j8

Verification

Make sure you have the latest firmware(copy from the ubuntu):

# mkdir /lib/firmware/i915/backup
# mv /lib/firmware/i915/* /lib/firmware/i915/backup
# cp -ar /mnt/lib/firmware/i915/* /lib/firmware/i915/

Install the minimal system, install the built kernel rpms, then edit the grub:

# vim /etc/default/grub
......
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet i915.enable_guc=0x7 udmabuf.list_limit=8192 intel_iommu=on i915.force_probe=*"
......
# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
# cat /boot/grub2/grubenv 
    # GRUB Environment Block
    #saved_entry=CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)
    saved_entry=CentOS Linux (5.15.85+) 7 (Core)
# reboot

Check the status of SR-IOV:

# dmesg | grep SR-IOV
[    1.643471] i915 0000:00:02.0: Running in SR-IOV PF mode
# dmesg | grep GuC
[    1.844856] i915 0000:00:02.0: [drm] GuC error state capture buffer maybe too small: 2097152 < 2557128 (min = 852376)
[    1.846949] i915 0000:00:02.0: [drm] GuC firmware i915/tgl_guc_70.bin version 70.5.1
[    1.850099] i915 0000:00:02.0: [drm] GuC submission enabled
[    1.850099] i915 0000:00:02.0: [drm] GuC SLPC enabled
[    1.850430] i915 0000:00:02.0: [drm] GuC RC: enabled
# dmesg | grep HuC
[    1.846952] i915 0000:00:02.0: [drm] HuC firmware i915/tgl_huc.bin version 7.9.3
[    1.849623] i915 0000:00:02.0: [drm] HuC authenticated

Install necessary packages:

# yum install -y virt-manager
# yum groupinstall "GNOME Desktop"

Upgrade qemu:

# yum install centos-release-qemu-ev
# yum makecache
# yum install -y qemu-kvm-ev qemu-img-ev
# /usr/libexec/qemu-kvm --version
QEMU emulator version 2.12.0 (qemu-kvm-ev-2.12.0-44.1.el7_8.1)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

Create vf:

[root@cs76 ~]# lspci | grep -i vga
0000:00:02.0 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
[root@cs76 ~]# chmod 777 createvf.sh 
.[root@cs76 ~]# ./createvf.sh 
0x8086 0x4680
[root@cs76 ~]# lspci | grep -i vga
0000:00:02.0 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.1 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.2 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.3 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.4 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.5 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.6 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)
0000:00:02.7 VGA compatible controller: Intel Corporation Device 4680 (rev 0c)

Install some management tools:

yum install libvirt libvirt-python libguestfs-tools virt-install -y

switch to qemu 6.2

build ninja:

yum install -y gcc gcc-c++ python3 git
git clone https://github.com/ninja-build/ninja.git
cd ninja
git checkout release
./configure.py --bootstrap
cp ninja /usr/bin

Install qemu build dependencies:

yum install -y glib2-devel pixman-devel zlib-devel libusb-devel libusb libusbx-devel pulseaudio-libs-devel libcap-ng-devel libattr-devel spice-server-devel usbredir-devel

Since qemu 6.2 requires gcc>7.6? Install gcc 8 for building:

yum install devtoolset-8-gcc-c++
scl enable devtoolset-8 bash
./configure --target-list=x86_64-softmmu --enable-debug --disable-docs --disable-virglrenderer --prefix=/opt/local --enable-virtfs --enable-libusb --disable-debug-tcg --audio-drv-list=pa  --enable-spice --enable-usb-redir
make -j8
make install

Change from default qemu to /opt/local/bin/qemu-system-x86_64, then start the machine.
You may also need virsh or other tools:

yum install -y libvirt libvirt-python libguestfs-tools virt-install -y

Gen12GPUPassthrough

Ubuntu 22.04.2 desktop cdrom installation on Gen12 machine.

sudo apt update -y && sudo apt upgrade -y
sudo apt install -y openssh-server virt-manager qemu vim

Edit the grub and initramfs-tools, and vfio:

$ cat /etc/default/grub | grep CMDLINE_LINUX_DEFAULT
GRUB_CMDLINE_LINUX_DEFAULT="quiet  intel_iommu=on intel_iommu=pt kvm.ignore_msrs=1 video=efifb:off,vesafb:off"
$ cat /etc/initramfs-tools/modules
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
$  echo "options vfio-pci disable_vga=1" > /etc/modprobe.d/vfio.conf
$ sudo update-grub2 && sudo update-initramfs -u -k all
$ sudo reboot

Build ovmf:

$ cp /home/idv/xxxxxxxxx/VBT/Vbt.bin OvmfPkg/Vbt/Vbt.bin 
$ cp /home/idv/xxxxxxxxx/./IntelGopDriver/RELEASE_VS2015x86/X64/IntelGopDriver.efi OvmfPkg/IntelGop/IntelGopDriver.efi
$ pwd
/home/idv/Code/Intel_edk2/edk2_gen12
Build the ovmf(follow the guideline)

Install an ubuntu22.04 vm in host machine, with qxl/spice.

glmark2: score 1711

Install win11(shift+f10), use regedit for editing:

/images/2023_05_08_11_23_09_794x480.jpg

Fallback and continue install:

/images/2023_05_08_11_24_16_769x553.jpg

WorkingTipsONGen12GVTD

/images/2023_05_06_12_09_11_751x278.jpg

UEFI/i440fx:

/images/2023_05_06_12_09_53_770x388.jpg

Virtio Block:

/images/2023_05_06_12_10_16_723x433.jpg

4Core:

/images/2023_05_06_12_10_36_757x512.jpg

Configuration:

/images/2023_05_06_12_11_23_887x403.jpg

RunSystemctlWithoutRootPassword

创建一个sudoer规则文件:

$ echo -e "Cmnd_Alias USER_SERVICES = /usr/bin/systemctl start snmpd.service, /usr/bin/systemctl stop snmpd.service, /usr/bin/systemctl restart snmpd.service, /usr/bin/systemctl start p910nd.service, /usr/bin/systemctl stop p910nd.service, /usr/bin/systemctl restart p910nd.service\nctyun ALL=(ALL) NOPASSWD: USER_SERVICES" | sudo tee /etc/sudoers.d/ctyun

(另一种方法)也可以手动创建/etc/sudoers.d/ctyun文件后键入以下内容:

Cmnd_Alias USER_SERVICES = /usr/bin/systemctl start snmpd.service, /usr/bin/systemctl stop snmpd.service, /usr/bin/systemctl restart snmpd.service, /usr/bin/systemctl start p910nd.service, /usr/bin/systemctl stop p910nd.service, /usr/bin/systemctl restart p910nd.service
ctyun ALL=(ALL) NOPASSWD: USER_SERVICES

重启机器,或重新登陆桌面(注销后登陆), 验证:

sudo systemctl restart snmpd.service

IDVdGPUReleaseNote

Create Cubic environment

Get the latest ubuntu desktop installation image:

wget https://mirrors.ustc.edu.cn/ubuntu-releases/22.04.2/ubuntu-22.04.2-desktop-amd64.iso
mkdir ~/idv_dGPU_release

Choose the newly created directory:

/images/2023_04_21_09_36_41_582x193.jpg

Fill in descriptions:

/images/2023_04_21_09_37_35_932x603.jpg

Now we get the virtual environment terminal:

/images/2023_04_21_09_38_26_934x196.jpg

Customization

Change repository and update to latest:

root@cubic:~# cat /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/ubuntu jammy main restricted
deb http://mirrors.ustc.edu.cn/ubuntu jammy-updates main restricted
deb http://mirrors.ustc.edu.cn/ubuntu jammy universe
deb http://mirrors.ustc.edu.cn/ubuntu jammy-updates universe
deb http://mirrors.ustc.edu.cn/ubuntu jammy multiverse
deb http://mirrors.ustc.edu.cn/ubuntu jammy-updates multiverse
deb http://mirrors.ustc.edu.cn/ubuntu jammy-backports main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu jammy-security main restricted
deb http://mirrors.ustc.edu.cn/ubuntu jammy-security universe
deb http://mirrors.ustc.edu.cn/ubuntu jammy-security multiverse
root@cubic:~# apt install -y kubuntu-desktop virt-manager build-essential

Change default to sddm:

/images/2023_04_21_09_49_57_942x475.jpg

Verification

/images/2023_04_21_10_18_31_635x215.jpg

Display:

/images/2023_04_21_10_19_15_1286x433.jpg

VT-d && VT-x:

/images/2023_04_21_10_20_17_1345x495.jpg

Intel SGX:

/images/2023_04_21_10_20_42_1196x297.jpg

Install(Install Ubuntu):

/images/2023_04_21_10_46_06_890x763.jpg

Normal install:

/images/2023_04_21_10_46_33_1364x744.jpg

Use nvme ssd:

/images/2023_04_21_10_47_52_1140x596.jpg

Try模式进入后,停用:

/images/2023_04_21_11_00_21_1126x700.jpg

删除:

/images/2023_04_21_11_00_39_1112x752.jpg

应用:

/images/2023_04_21_11_00_54_927x598.jpg

安装:

/images/2023_04_21_11_01_12_439x289.jpg

现在可以选择并继续:

/images/2023_04_21_11_01_53_915x414.jpg

设置用户名/密码/自动登陆:

/images/2023_04_21_11_02_51_895x587.jpg

等待安装完成后,拔掉U盘后重新启动。

启动虚拟机

导文件:

# scp ./mac_hdd_ng.img rx560.qcow2 rx550_OVMF_VARS-1024x768.fd OVMF_CODE.fd test@192.168.1.123:~
# virsh dumpxml macOSrx550>aaaa.xml
# scp ./aaaa.xml test@192.168.1.123:~