From 5a7a7083f5cfc97353804f33d595bff3669be7dc Mon Sep 17 00:00:00 2001 From: Yadong Qi Date: Thu, 28 Jul 2022 14:12:37 +0800 Subject: [PATCH 01/56] Bump version to 0.7.1 Bump version to 0.7.1 Tracked-On: OAM-103537 Signed-off-by: Yadong Qi --- debian/changelog | 6 ++++++ src/vm_manager.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8b8dc4d..166306e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vm-manager (0.7.1) stable; urgency=medium + + * Bump version to 0.7.1 + + -- Qi, Yadong Thu, 28 Jul 2022 14:10:52 +0800 + vm-manager (0.6.1) stable; urgency=medium * Bum version to 0.6.1 diff --git a/src/vm_manager.c b/src/vm_manager.c index 9410f04..c187dfc 100644 --- a/src/vm_manager.c +++ b/src/vm_manager.c @@ -20,7 +20,7 @@ #include "vm_manager.h" #define VERSION_MAJOR 0 -#define VERSION_MINOR 6 +#define VERSION_MINOR 7 #define VERSION_MICRO 1 #define VERSION xstr(VERSION_MAJOR)"."xstr(VERSION_MINOR)"."xstr(VERSION_MICRO) From 97333a5a48f35055457ea18042fa9002f3f3b010 Mon Sep 17 00:00:00 2001 From: shivasku82 Date: Thu, 21 Jul 2022 10:27:44 +0530 Subject: [PATCH 02/56] get latest host camera service during setup host , host camera service source will be download, build and install. point setup host to latest host camera service. Tracked-On: OAM-102938 Signed-off-by: shivasku82 --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index d9943d7..6ba4465 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -110,7 +110,7 @@ function install_host_service() { cd host_camera git clone https://github.com/projectceladon/host-camera-server.git cd host-camera-server - git checkout b715695dc2e47eaf2a7d275093419394efe0a7c3 + git checkout 915388bd22d1582d44fb22dc647bd46a6ab675bc mkdir build cd build cmake .. From 586a3f01dd0508ad3a6235f2fa6f2d344a3e42b0 Mon Sep 17 00:00:00 2001 From: "Chen, Gang G" Date: Tue, 19 Jul 2022 05:05:03 +0800 Subject: [PATCH 03/56] support celadon ISO image flashing in start_flash_usb.sh script Tracked-On: OAM-103810 Signed-off-by: Chen, Gang G --- scripts/start_flash_usb.sh | 47 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/scripts/start_flash_usb.sh b/scripts/start_flash_usb.sh index df2f88d..eb13016 100755 --- a/scripts/start_flash_usb.sh +++ b/scripts/start_flash_usb.sh @@ -7,7 +7,7 @@ WORK_DIR=$PWD -[ $# -lt 1 ] && echo "Usage: $0 caas-flashfiles-eng-.zip" && exit -1 +[ $# -lt 1 ] && echo "Usage: $0 [caas-flashfiles-.zip] [caas-flashfile-.iso] [caas-flashfile-.iso.zip]" && exit -1 if [ -f android.qcow2 ] then @@ -41,25 +41,34 @@ else qemu-img create -f qcow2 android.qcow2 32G fi -[ -d "./flashfiles_decompress" ] && rm -rf "./flashfiles_decompress" -mkdir ./flashfiles_decompress -unzip $1 -d ./flashfiles_decompress +decompress=flashfiles_decompress +zip_file=$(file $1 | grep -i "Zip archive data") +if [[ $zip_file != "" ]]; then + rm -rf "$decompress" && mkdir $decompress + unzip $1 -d $decompress -G_size=$((1<<32)) -for i in `ls ./flashfiles_decompress`;do - if [ -f "./flashfiles_decompress/"$i ] && [ "`grep $i ./flashfiles_decompress/installer.cmd`" ]; then - size=$(stat -c %s "./flashfiles_decompress/"$i) - if [[ $size -gt $G_size ]]; then - echo "Split $i due to its size bigger than 4G\n" - split --bytes=$((G_size-1)) --numeric-suffixes "./flashfiles_decompress/"$i "./flashfiles_decompress/"$i.part - rm "./flashfiles_decompress/"$i - fi - fi -done + if [[ -f $decompress/boot.img ]]; then + G_size=$((1<<32)) + for i in `ls $decompress`; do + size=$(stat -c %s "$decompress/"$i) + if [[ $size -gt $G_size ]]; then + echo "Split $i due to its size bigger than 4G" + split --bytes=$((G_size-1)) --numeric-suffixes "$decompress/"$i "$decompress/"$i.part + rm "$decompress/"$i + fi + done -dd if=/dev/zero of=./flash.vfat bs=63M count=160 -mkfs.vfat ./flash.vfat -mcopy -i flash.vfat flashfiles_decompress/* :: + dd if=/dev/zero of=./flash.vfat bs=63M count=160 + mkfs.vfat ./flash.vfat + mcopy -i flash.vfat $decompress/* :: + + virt_disk=flash.vfat + else + virt_disk=$decompress/`ls $decompress` + fi +else + virt_disk=$1 +fi if [ "$support_dedicated_data" = true ] then @@ -90,7 +99,7 @@ qemu-system-x86_64 \ -chardev socket,id=charserial0,path=./kernel-console,server=on,wait=off \ -device isa-serial,chardev=charserial0,id=serial0 \ -device qemu-xhci,id=xhci,addr=0x5 \ - -drive file=./flash.vfat,id=udisk1,format=raw,if=none \ + -drive file=$virt_disk,id=udisk1,format=raw,if=none \ -device usb-storage,drive=udisk1,bus=xhci.0 \ -device virtio-scsi-pci,id=scsi0,addr=0x8 \ -drive file=./android.qcow2,if=none,format=qcow2,id=scsidisk1 \ From a1c6ff4de4e5b252cb4afa0870664e734c345017 Mon Sep 17 00:00:00 2001 From: Yadong Qi Date: Fri, 16 Sep 2022 09:38:48 +0800 Subject: [PATCH 04/56] Install fixed version for S/stable Install fixed version for S/stable Tracked-On: OAM-103950 Signed-off-by: Yadong Qi --- scripts/setup_host.sh | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 6ba4465..bc6fe05 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -218,15 +218,14 @@ function ubu_build_ovmf_gvt(){ } function install_vm_manager_deb(){ - #Try to download from latest release/tag local os_ver=$(lsb_release -rs) - local vm_repo="https://github.com/projectceladon/vm_manager/" - local rtag=$(git ls-remote -t --refs ${vm_repo} | cut --delimiter='/' --fields=3 | tr '-' '~' | sort --version-sort | tail --lines=1) + local vm_repo="https://github.com/projectceladon/vm_manager" + local rtag="v0.7.1" local rdeb=vm-manager_${rtag}_ubuntu-${os_ver}.deb [ -f ${rdeb} ] && rm -f ${rdeb} - local rurl=https://github.com/projectceladon/vm_manager/releases/latest/download/${rdeb} + local rurl=${vm_repo}/releases/download/${rtag}/${rdeb} if wget ${rurl} ; then sudo dpkg -i ${rdeb} || return -1 @@ -236,24 +235,13 @@ function install_vm_manager_deb(){ fi } -function install_vm_manager_src() { - #Try to build from source code - sudo apt-get install --yes make gcc - git clone https://github.com/projectceladon/vm_manager.git || return -1 - cd vm_manager/ - make || return -1 - sudo make install || return -1 - cd - - rm -rf vm_manager/ -} - function install_vm_manager() { sudo apt-get update sudo apt-get install --yes libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev wget lsb-release git - install_vm_manager_deb || install_vm_manager_src + install_vm_manager_deb if [ "$?" -ne 0 ]; then echo "Failed to install vm-manager!" - echo "Please download and install mannually from: https://github.com/projectceladon/vm_manager/releases/latest" + echo "Please download and install mannually from: https://github.com/projectceladon/vm_manager/releases/" fi } From 772c6a46188dd3e7da8a7813a713b2355357ad7b Mon Sep 17 00:00:00 2001 From: iViggyPrabhu Date: Sun, 16 Oct 2022 09:52:39 +0530 Subject: [PATCH 05/56] Modified qemu download to be in QEMU_CACHE_DIR so that it can be reused Tracked-On: OAM-104266 Signed-off-by: tprabhu --- scripts/setup_host.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index bc6fe05..24ce316 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -10,6 +10,10 @@ set -eE #--------- Global variable ------------------- reboot_required=0 QEMU_REL="qemu-6.0.0" + +#Directory to keep versions of qemu which can be reused instead of downloading again +QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" + CIV_WORK_DIR=$(pwd) CIV_GOP_DIR=$CIV_WORK_DIR/GOP_PKG CIV_VERTICAl_DIR=$CIV_WORK_DIR/vertical_patches/host @@ -140,9 +144,17 @@ function ubu_install_qemu_gvt(){ sudo apt install -y git libfdt-dev libpixman-1-dev libssl-dev vim socat libsdl2-dev libspice-server-dev autoconf libtool xtightvncviewer tightvncserver x11vnc uuid-runtime uuid uml-utilities bridge-utils python-dev liblzma-dev libc6-dev libegl1-mesa-dev libepoxy-dev libdrm-dev libgbm-dev libaio-dev libusb-1.0-0-dev libgtk-3-dev bison libcap-dev libattr1-dev flex libvirglrenderer-dev build-essential gettext libegl-mesa0 libegl-dev libglvnd-dev libgl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libegl1 gcc g++ pkg-config libpulse-dev libgl1-mesa-dri sudo apt install -y ninja-build libcap-ng-dev - [ ! -f $CIV_WORK_DIR/$QEMU_REL.tar.xz ] && wget https://download.qemu.org/$QEMU_REL.tar.xz -P $CIV_WORK_DIR + #Create QEMU_CACHE_DIR if it doesnt exists + mkdir -p $QEMU_CACHE_DIR + + #Download QEMU_REL.tar.xz if it doesnt exist in QEMU_CACHE_DIR + [ ! -f $QEMU_CACHE_DIR/$QEMU_REL.tar.xz ] && check_qemu_network && wget https://download.qemu.org/$QEMU_REL.tar.xz -P $QEMU_CACHE_DIR + + [ -d $CIV_WORK_DIR/$QEMU_REL ] && rm -rf $CIV_WORK_DIR/$QEMU_REL - tar -xf $CIV_WORK_DIR/$QEMU_REL.tar.xz + + #Directly untar into the CIV_WORK_DIR + tar -xf $QEMU_CACHE_DIR/$QEMU_REL.tar.xz -C $CIV_WORK_DIR cd $CIV_WORK_DIR/$QEMU_REL/ @@ -318,6 +330,17 @@ function check_os() { } function check_network(){ + #Check if you are able to access external website without actually downloading it + wget --timeout=3 --tries=1 -q --spider https://github.com + if [ $? -ne 0 ]; then + echo "access https://github.com failed!" + echo "please make sure network is working" + return -1 + fi +} + +#Check Connection specifically with qemu network only if QEMU_REL.tar.xz needs to be downloaded as it doesnt exist in QEMU_CACHE_DIR +function check_qemu_network(){ wget --timeout=3 --tries=1 https://download.qemu.org/ -q -O /dev/null if [ $? -ne 0 ]; then echo "access https://download.qemu.org failed!" From 46c0a28bae5233224f6bf8e64efdab5a309d9120 Mon Sep 17 00:00:00 2001 From: blackdobb Date: Wed, 7 Dec 2022 14:48:28 +0800 Subject: [PATCH 06/56] Fix disk full error during flashing Tracked-On: OAM-105154 Signed-off-by: blackdobb --- src/guest/flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guest/flash.c b/src/guest/flash.c index e1874eb..bc53f4c 100644 --- a/src/guest/flash.c +++ b/src/guest/flash.c @@ -110,7 +110,7 @@ static int create_vusb(GKeyFile *gkf) } snprintf(cmd, MAX_CMDLINE_LEN, "dd if=/dev/zero of="VUSB_FLASH_DISK" bs=%ld count=%ld", - DD_BS, (total_images_size + DD_BS - 1)/DD_BS); + DD_BS, (total_images_size + DD_BS + 2 GIGABYTE - 1)/DD_BS); printf("%s\n", cmd); if (system(cmd)) return -1; From 99cb652e9a98b9ed295c51fe292998a5d171e550 Mon Sep 17 00:00:00 2001 From: Yadong Qi Date: Thu, 8 Dec 2022 15:33:44 +0800 Subject: [PATCH 07/56] Bump version to 0.7.2 Bump version to 0.7.2 Tracked-On: OAM-105154 Signed-off-by: Yadong Qi --- debian/changelog | 6 ++++++ src/vm_manager.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 166306e..25f1583 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vm-manager (0.7.2) stable; urgency=medium + + * Bump version to 0.7.2 + + -- Qi, Yadong Thu, 08 Dec 2022 15:30:36 +0800 + vm-manager (0.7.1) stable; urgency=medium * Bump version to 0.7.1 diff --git a/src/vm_manager.c b/src/vm_manager.c index c187dfc..6f22fea 100644 --- a/src/vm_manager.c +++ b/src/vm_manager.c @@ -21,7 +21,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_MICRO 1 +#define VERSION_MICRO 2 #define VERSION xstr(VERSION_MAJOR)"."xstr(VERSION_MINOR)"."xstr(VERSION_MICRO) From c653876beab3d714fd7cc338a9210c507319899e Mon Sep 17 00:00:00 2001 From: Yadong Qi Date: Thu, 8 Dec 2022 15:44:57 +0800 Subject: [PATCH 08/56] Update vm-manager to v0.7.2 for s/stable Include fixes Tracked-On: OAM-105240 Signed-off-by: Yadong Qi --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 24ce316..30773da 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -232,7 +232,7 @@ function ubu_build_ovmf_gvt(){ function install_vm_manager_deb(){ local os_ver=$(lsb_release -rs) local vm_repo="https://github.com/projectceladon/vm_manager" - local rtag="v0.7.1" + local rtag="v0.7.2" local rdeb=vm-manager_${rtag}_ubuntu-${os_ver}.deb [ -f ${rdeb} ] && rm -f ${rdeb} From 0d67cef3ce9eb73dd3622bbd01a6335ae20999a6 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Mon, 26 Sep 2022 14:57:02 +0530 Subject: [PATCH 09/56] Pass host graphics SRIOV info to guest. Add file in aaf folder to enable guest to know if host supports SRIOV. Tracked-On: OAM-105472 Signed-off-by: Suresh, Prashanth AAF_GPU_TYPE_GVTD) + if (sub > AAF_GPU_TYPE_SRIOV) return -1; aaf_config_array[AAF_CONFIG_GPU_TYPE] = gpu_type[sub]; break; diff --git a/src/guest/start.c b/src/guest/start.c index 2f05c19..a6000ab 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -1036,7 +1036,7 @@ int start_guest(char *name) } else if (strcmp(val, VGPU_OPTS_SRIOV_STR) == 0) { if (setup_sriov(gkf, &p, &size)) return -1; - set_aaf_option(AAF_CONFIG_GPU_TYPE, AAF_GPU_TYPE_VIRTIO); + set_aaf_option(AAF_CONFIG_GPU_TYPE, AAF_GPU_TYPE_SRIOV); } else { g_warning("Invalid Graphics config\n"); return -1; diff --git a/src/include/guest/aaf.h b/src/include/guest/aaf.h index 4a49dd7..f00510f 100644 --- a/src/include/guest/aaf.h +++ b/src/include/guest/aaf.h @@ -28,7 +28,8 @@ enum { enum { AAF_GPU_TYPE_VIRTIO = 0, AAF_GPU_TYPE_GVTG, - AAF_GPU_TYPE_GVTD + AAF_GPU_TYPE_GVTD, + AAF_GPU_TYPE_SRIOV }; int set_aaf_path(const char *bin_path); From 3f9cbe0eec08c41a95e665eef71c1a41982de896 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Thu, 21 Jul 2022 11:38:20 +0530 Subject: [PATCH 10/56] Remove limitation for total number of VF Removed limitation of 4 for total number of VF Tracked-On: OAM-102949 Signed-off-by: Suresh, Prashanth --- src/guest/start.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/guest/start.c b/src/guest/start.c index a6000ab..df5550c 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -404,8 +404,6 @@ static int set_available_vf(void) } close(fd); total_vfs = strtoul(buf, NULL, 10); - /* Limit total VFs to conserve memory */ - total_vfs = total_vfs > 4 ? 4 : total_vfs; memset(buf, 0, sizeof(buf)); snprintf(buf, sizeof(buf), "%d", total_vfs); From dfc8ba63274dc9a2f4a73fe5f68040849a314d75 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Fri, 29 Jul 2022 14:09:06 +0530 Subject: [PATCH 11/56] Improve logic to enable VFs Changes: - added logic to check and enable VFs only when necessary Tracked-On: OAM-102949 Signed-off-by: Suresh, Prashanth --- src/guest/start.c | 99 ++++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 39 deletions(-) diff --git a/src/guest/start.c b/src/guest/start.c index df5550c..80950fa 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -373,7 +373,7 @@ static int setup_hugepages(GKeyFile *gkf) static int set_available_vf(void) { int fd = 0; - int total_vfs = 0; + int total_vfs = 0, numvfs = 0; int dev_id = 0; ssize_t n = 0; char buf[64] = { 0 }; @@ -405,57 +405,78 @@ static int set_available_vf(void) close(fd); total_vfs = strtoul(buf, NULL, 10); - memset(buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "%d", total_vfs); - - if (write_to_file(INTEL_GPU_DEV_PATH"/sriov_drivers_autoprobe", "0")) { - fprintf(stderr, "Unable to de-probe sriov drivers"); + if (total_vfs == 0) { + fprintf(stderr, "Error: total number of supported VFs is 0"); return -1; } - if (write_to_file("/sys/class/drm/card0/device/sriov_numvfs", buf)) { - fprintf(stderr, "Unable to de-probe sriov drivers"); - return -1; - } + fd = open("/sys/class/drm/card0/device/sriov_numvfs", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "open /sys/class/drm/card0/device/sriov_numvfs, errno=%d\n", errno); + return 0; + } - if (write_to_file(INTEL_GPU_DEV_PATH"/sriov_drivers_autoprobe", "1")) { - fprintf(stderr, "Unable to auto-probe sriov drivers"); - return -1; - } + n = read(fd, buf, sizeof(buf)); + if (n == -1) { + fprintf(stderr, "read /sys/class/drm/card0/device//sriov_numvfs failed, errno=%d\n", errno); + close(fd); + return 0; + } + close(fd); + numvfs = strtoul(buf, NULL, 10); - /* Get device ID */ - fd = open(INTEL_GPU_DEV_PATH"/device", O_RDONLY); - if (fd == -1) { - fprintf(stderr, "open %s failed, errno=%d\n", INTEL_GPU_DEV_PATH"/device", errno); - return -1; - } + if (numvfs < total_vfs) { + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), "%d", total_vfs); - n = read(fd, buf, sizeof(buf)); - if (n == -1) { - fprintf(stderr, "read %s failed, errno=%d\n", INTEL_GPU_DEV_PATH"/device", errno); - close(fd); - return -1; - } - close(fd); - dev_id = strtol(buf, NULL, 16); + if (write_to_file(INTEL_GPU_DEV_PATH"/sriov_drivers_autoprobe", "0")) { + fprintf(stderr, "Unable to de-probe sriov drivers"); + return -1; + } + + if (write_to_file("/sys/class/drm/card0/device/sriov_numvfs", buf)) { + fprintf(stderr, "Unable to de-probe sriov drivers"); + return -1; + } + if (write_to_file(INTEL_GPU_DEV_PATH"/sriov_drivers_autoprobe", "1")) { + fprintf(stderr, "Unable to auto-probe sriov drivers"); + return -1; + } - memset(buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "8086 %x", dev_id); + /* Get device ID */ + fd = open(INTEL_GPU_DEV_PATH"/device", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "open %s failed, errno=%d\n", INTEL_GPU_DEV_PATH"/device", errno); + return -1; + } - /* Create new vfio id for GPU */ - ret = write_to_file(PCI_DRIVER_PATH"vfio-pci/new_id", buf); - if (ret == EEXIST) { - if (write_to_file("/sys/bus/pci/drivers/vfio-pci/remove_id", buf)) { - fprintf(stderr, "Cannot remove original GPU vfio id\n"); + n = read(fd, buf, sizeof(buf)); + if (n == -1) { + fprintf(stderr, "read %s failed, errno=%d\n", INTEL_GPU_DEV_PATH"/device", errno); + close(fd); return -1; } - if (write_to_file(PCI_DRIVER_PATH"vfio-pci/new_id", buf)) { - fprintf(stderr, "Cannot add new GPU vfio id\n"); + close(fd); + dev_id = strtol(buf, NULL, 16); + + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), "8086 %x", dev_id); + + /* Create new vfio id for GPU */ + ret = write_to_file(PCI_DRIVER_PATH"vfio-pci/new_id", buf); + if (ret == EEXIST) { + if (write_to_file("/sys/bus/pci/drivers/vfio-pci/remove_id", buf)) { + fprintf(stderr, "Cannot remove original GPU vfio id\n"); + return -1; + } + if (write_to_file(PCI_DRIVER_PATH"vfio-pci/new_id", buf)) { + fprintf(stderr, "Cannot add new GPU vfio id\n"); + return -1; + } + } else if (ret != 0) { return -1; } - } else if (ret != 0) { - return -1; } for (i = 1; i < total_vfs; i++) { From df14e4e3ded9eec866f05f83b356bc45f99ed256 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Fri, 29 Jul 2022 15:18:02 +0530 Subject: [PATCH 12/56] Configure VF time settings Change: - added configuration of VF time settings before launching guest Tracked-On: OAM-102949 Signed-off-by: Suresh, Prashanth --- src/guest/start.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/guest/start.c b/src/guest/start.c index 80950fa..94dcf11 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -377,6 +377,7 @@ static int set_available_vf(void) int dev_id = 0; ssize_t n = 0; char buf[64] = { 0 }; + char timeout_file[64] = { 0 }; int i; int ret = 0; @@ -479,7 +480,7 @@ static int set_available_vf(void) } } - for (i = 1; i < total_vfs; i++) { + for (i = 1; i < numvfs; i++) { memset(buf, 0, sizeof(buf)); snprintf(buf, sizeof(buf), "/sys/bus/pci/devices/0000:00:02.%d/enable", i); fd = open(buf, O_RDONLY); @@ -497,6 +498,13 @@ static int set_available_vf(void) } close(fd); if (strtol(buf, NULL, 10) == 0) { + //Configure timeout values + snprintf(timeout_file, sizeof(timeout_file), "/sys/class/drm/card0/iov/vf%d/gt/preempt_timeout_us", i); + snprintf(buf, sizeof(buf), "%d", 50000); + write_to_file(timeout_file, buf); + snprintf(timeout_file, sizeof(timeout_file), "/sys/class/drm/card0/iov/vf%d/gt/exec_quantum_ms", i); + snprintf(buf, sizeof(buf), "%d", 25); + write_to_file(timeout_file, buf); return i; } } From 77a6672ec4e60d430ed3c52331cf210fde020643 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Tue, 8 Nov 2022 12:03:39 +0530 Subject: [PATCH 13/56] Add power control qmp socket for Android 12 Add qmp socket for CiV guest VM that required by suspend/hibernate power control feature. Signed-off-by: Suresh, Prashanth --- src/guest/start.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/guest/start.c b/src/guest/start.c index 94dcf11..910189a 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -63,6 +63,8 @@ static int get_uid() { #define PT_LEN 16 static char *pci_pt_record[PT_MAX] = { 0 }; static int pci_count = 0; +static int MAX_NUM_GUEST = 7; +static char qmp_pwr_socket[MAX_PATH] = { 0 }; static int create_vgpu(GKeyFile *gkf) { @@ -579,6 +581,13 @@ static void cleanup_passthrough(void) { } } +static void cleanup_pwr_ctrl() { + //cleanup qmp power control socket on exit + if(access(qmp_pwr_socket, F_OK) == 0) { + remove(qmp_pwr_socket); + } +} + static int check_soundcard_on_host(){ int ret = system("cat /proc/asound/cards | grep sof"); return ret; @@ -597,6 +606,7 @@ static void cleanup(int num, int removed_sof_tgl_snd_module) cleanup_child_proc(); cleanup_rpmb(); cleanup_passthrough(); + cleanup_pwr_ctrl(); if(removed_sof_tgl_snd_module) insert_sof_tgl_snd_module(); @@ -883,6 +893,25 @@ static void strip_duplicate(gchar *val, const gchar *inner_cmd) g_free(to_split); } +static void set_pwr_ctrl(char * qmp_cmd) { + for(int avail = 0; avail < MAX_NUM_GUEST; avail++) { + char *num; + asprintf(&num, "%d", avail); + strcpy(qmp_pwr_socket, "/tmp/qmp-pwr-socket-"); + if (strlen(num) < (sizeof(qmp_pwr_socket) - strlen(qmp_pwr_socket))) { + strncat(qmp_pwr_socket, num, (sizeof(qmp_pwr_socket) - strlen(num) -1)); + } + if(access(qmp_pwr_socket, F_OK) != 0) { + snprintf(qmp_cmd, MAX_CMDLINE_LEN, " -qmp unix:%s,%s", qmp_pwr_socket, "server,nowait"); + break; + } + } + if (strcmp(qmp_cmd, "") == 0) { + printf("E: No power control socket available"); + exit(1); + } +} + int start_guest(char *name) { int ret = 0; @@ -933,6 +962,11 @@ int start_guest(char *name) cx = snprintf(p, size, " -qmp unix:%s/.%s"CIV_GUEST_QMP_SUFFIX",server,nowait", civ_config_path, qname); p += cx; size -= cx; + char qmp_sock[MAX_CMDLINE_LEN] = { 0 }; + set_pwr_ctrl(qmp_sock); + cx = snprintf(p, size, "%s", qmp_sock); + p += cx; size -= cx; + val = g_key_file_get_string(gkf, g->name, g->key[GLOB_VSOCK_CID], NULL); if (val) { cx = snprintf(p, size, " -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=%s,bus=pcie.0,addr=0x4", val); From 201c03f3bf02d1ddb7f7f089bfc8e00ab9a74b43 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Wed, 16 Nov 2022 21:45:41 +0530 Subject: [PATCH 14/56] Fix Android first launch failure with VM manager Replace sriov_numvfs with sriov_totalvfs while checking condition. Signed-off-by: Suresh, Prashanth --- src/guest/start.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/guest/start.c b/src/guest/start.c index 910189a..b1e93c7 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -482,6 +482,21 @@ static int set_available_vf(void) } } + fd = open("/sys/class/drm/card0/device/sriov_numvfs", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "open /sys/class/drm/card0/device/sriov_numvfs, errno=%d\n", errno); + return 0; + } + + n = read(fd, buf, sizeof(buf)); + if (n == -1) { + fprintf(stderr, "read /sys/class/drm/card0/device//sriov_numvfs failed, errno=%d\n", errno); + close(fd); + return 0; + } + close(fd); + numvfs = strtoul(buf, NULL, 10); + for (i = 1; i < numvfs; i++) { memset(buf, 0, sizeof(buf)); snprintf(buf, sizeof(buf), "/sys/bus/pci/devices/0000:00:02.%d/enable", i); From b1a7a4a31d5f4650526c48a95fd5e545dfad91a6 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Thu, 17 Nov 2022 15:37:19 +0530 Subject: [PATCH 15/56] Fix logic for enabling VFs in vm-manager Enable VFs only on checking the number of available VFs. Tracked-On: OAM-105472 Signed-off-by: Suresh, Prashanth --- src/guest/start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guest/start.c b/src/guest/start.c index b1e93c7..25e1207 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -428,7 +428,7 @@ static int set_available_vf(void) close(fd); numvfs = strtoul(buf, NULL, 10); - if (numvfs < total_vfs) { + if (numvfs == 0) { memset(buf, 0, sizeof(buf)); snprintf(buf, sizeof(buf), "%d", total_vfs); From e683028692fb596b14be216df208d57e2c674f86 Mon Sep 17 00:00:00 2001 From: tprabhu Date: Mon, 5 Aug 2024 16:45:41 +0530 Subject: [PATCH 16/56] Updated CI workflow --- .github/workflows/ci.yaml | 68 +++++++++++++++ .github/workflows/ci.yml | 39 --------- .github/workflows/codeql-analysis.yml | 57 ------------ .github/workflows/publish_review_event.yaml | 96 +++++++++++++++++++++ .github/workflows/release.yml | 51 ----------- .github/workflows/store_review_event.yaml | 18 ++++ 6 files changed, 182 insertions(+), 147 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/publish_review_event.yaml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/store_review_event.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..7909260 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,68 @@ +name: CI Workflow + +on: + pull_request_target: + types: "*" + branches: "**" +permissions: read-all + +jobs: + Trigger_Workflows: + runs-on: ubuntu-latest + name: CI Workflow + steps: + - name: Get Token + run: | + retries=3 + while [ $retries -gt 0 ]; do + if RESPONSE=$(curl --silent --location "${{ secrets.CLIENT_TOKEN_URL }}" \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --data-urlencode "client_id=${{ secrets.CLIENT_ID }}" \ + --data-urlencode "client_secret=${{ secrets.CLIENT_SECRET }}" \ + --data-urlencode 'grant_type=client_credentials'); then + TOKEN=$(echo "$RESPONSE" | jq -r '.access_token') + if [ -n "$TOKEN" ]; then + echo "TOKEN=$TOKEN" >> $GITHUB_ENV + break + else + echo "Error: Failed to parse access token from response" + fi + else + echo "Error: Request to get token failed" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to retrieve access token after multiple retries" + exit 1 + fi + + + + - name: Trigger Build with Event + if: success() + env: + TOKEN: ${{ env.TOKEN }} + run: | + EVENT_DATA='${{ toJSON(github.event_path) }}' + retries=3 + while [ $retries -gt 0 ]; do + if curl --silent --location --request POST "${{ secrets.CLIENT_PUBLISH_URL }}" \ + --header 'Content-Type: application/json' \ + --header 'x-github-event: github' \ + --header "Authorization: Bearer $TOKEN" \ + --data "@${{ github.event_path }}"; then + break + else + echo "Error: Failed to trigger build" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to trigger build after multiple retries" + exit 1 + fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f859409..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: VM Manager CI - -on: [push, pull_request] - -jobs: - build_ubuntu_gcc: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-18.04, ubuntu-20.04] - - steps: - - uses: actions/checkout@v2 - with: - path: vm-manager - - - name: setup - run: | - sudo apt-get --quiet update --yes - sudo apt-get --quiet install --yes make libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev devscripts build-essential lintian debhelper - - - name: build - run: | - cd vm-manager/ - debuild -b -uc -us --lintian-opts --profile debian - - - name: artifacts - uses: actions/upload-artifact@v2 - with: - name: vm-manager.${{ matrix.os }}.${{ github.run_id }}.${{ github.sha }} - path: | - debian/ - *.deb - *.ddeb - *.build - *.buildinfo - *.changes diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index f3d8788..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: "CodeQL" - -on: - push: - pull_request: - schedule: - - cron: '0 0 * * 0' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - queries: security-extended,security-and-quality - - # Install dependencies - - run: | - sudo apt-get --quiet update --yes - sudo apt-get --quiet install --yes make libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev devscripts build-essential lintian debhelper - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - #- run: | - # sudo apt-get --quiet update --yes - # sudo apt-get --quiet install --yes make libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev devscripts build-essential lintian debhelper - # make - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/publish_review_event.yaml b/.github/workflows/publish_review_event.yaml new file mode 100644 index 0000000..8175520 --- /dev/null +++ b/.github/workflows/publish_review_event.yaml @@ -0,0 +1,96 @@ +name: Publish Review Event + +on: + workflow_run: + workflows: ["Store_Review_Event"] + types: + - completed +permissions: read-all + +jobs: + fetch_and_process: + runs-on: ubuntu-latest + steps: + - name: 'Download artifact' + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "eventjson" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/eventjson.zip`, Buffer.from(download.data)); + + - name: 'Unzip artifact' + run: | + ls + unzip eventjson.zip + + - name: Get Token + run: | + retries=3 + while [ $retries -gt 0 ]; do + if RESPONSE=$(curl --silent --location "${{ secrets.CLIENT_TOKEN_URL }}" \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --data-urlencode "client_id=${{ secrets.CLIENT_ID }}" \ + --data-urlencode "client_secret=${{ secrets.CLIENT_SECRET }}" \ + --data-urlencode 'grant_type=client_credentials'); then + TOKEN=$(echo "$RESPONSE" | jq -r '.access_token') + if [ -n "$TOKEN" ]; then + echo "TOKEN=$TOKEN" >> $GITHUB_ENV + break + else + echo "Error: Failed to parse access token from response" + fi + else + echo "Error: Request to get token failed" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to retrieve access token after multiple retries" + exit 1 + fi + + + + - name: Trigger Build with Event + if: success() + env: + TOKEN: ${{ env.TOKEN }} + run: | + + EVENT_DATA=$(cat event.json) + + retries=3 + while [ $retries -gt 0 ]; do + if curl --silent --location --request POST "${{ secrets.CLIENT_PUBLISH_URL }}" \ + --header 'Content-Type: application/json' \ + --header 'x-github-event: github' \ + --header "Authorization: Bearer $TOKEN" \ + --data "$EVENT_DATA"; then + break + else + echo "Error: Failed to trigger build" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to trigger build after multiple retries" + exit 1 + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fa11ee4..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: VM Manager Release - -on: - release: - types: [published, edited] - -jobs: - build_ubuntu_gcc: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-18.04, ubuntu-20.04] - - steps: - - uses: actions/checkout@v2 - with: - path: vm-manager - - - name: setup - run: | - sudo apt-get --quiet update --yes - sudo apt-get --quiet install --yes make libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev devscripts build-essential lintian debhelper - - - name: Set release version - run: echo "REL_VER=${GITHUB_REF##*/}" >> $GITHUB_ENV - - - name: build - run: | - cd vm-manager/ - debuild -b -uc -us --lintian-opts --profile debian - cp $(realpath ../*.deb) vm-manager_${{ env.REL_VER }}_${{ matrix.os }}.deb - - - name: artifacts - uses: actions/upload-artifact@v2 - with: - name: vm-manager.${{ matrix.os }}.${{ github.run_id }}.${{ github.sha }} - path: | - vm-manager/debian/ - *.deb - *.ddeb - *.build - *.buildinfo - *.changes - - - name: Upload release assets - uses: softprops/action-gh-release@v1 - with: - files: | - vm-manager/vm-manager_${{ env.REL_VER }}_${{ matrix.os }}.deb diff --git a/.github/workflows/store_review_event.yaml b/.github/workflows/store_review_event.yaml new file mode 100644 index 0000000..703b240 --- /dev/null +++ b/.github/workflows/store_review_event.yaml @@ -0,0 +1,18 @@ +name: Store_Review_Event + +on: + pull_request_review: + types: "**" +permissions: read-all + +jobs: + Store_Review_Event: + runs-on: ubuntu-latest + name: Store Review Event + steps: + - name: Upload event JSON as artifact + uses: actions/upload-artifact@v4 + with: + name: eventjson + path: "${{ github.event_path }}" + retention-days: 7 \ No newline at end of file From b4c9b21626f06e52cf9d7a8e4e98886f38a3b7bb Mon Sep 17 00:00:00 2001 From: Ratnesh Kumar Rai Date: Mon, 30 May 2022 14:54:27 +0530 Subject: [PATCH 17/56] Enable Remote Inferencing in CIV Setup host environment for remote inferencing Tracked-On: OAM-102337 Signed-off-by: Ratnesh Kumar Rai Signed-off-by: nitishat Signed-off-by: akodanka --- scripts/setup_host.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 6e1872b..49c5dd1 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -320,6 +320,11 @@ function ubu_update_fw(){ reboot_required=1 } +function setup_remote_infer() { + $CIV_WORK_DIR/scripts/setup_rinfer_host.sh + reboot_required=1 +} + function check_os() { local version=`cat /proc/version` @@ -597,6 +602,7 @@ function show_help() { printf "\t-h show this help message\n" printf "\t-u specify Host OS's UI, support \"headless\" and \"GUI\" eg. \"-u headless\" or \"-u GUI\"\n" printf "\t--auto-start auto start CiV guest when Host boot up.\n" + printf "\t-i enable remote inferencing\n" } function parse_arg() { @@ -626,6 +632,10 @@ function parse_arg() { start_thermal_daemon || return -1 ;; + -i) + setup_remote_infer || return -1 + ;; + --auto-start) install_auto_start_service "$2" || return -1 shift From 2a45b40d1ac5cd96b46f13b0bd5df03c44abfdd2 Mon Sep 17 00:00:00 2001 From: "Kothapeta, BikshapathiX" Date: Thu, 14 Jul 2022 09:03:47 +0530 Subject: [PATCH 18/56] Revert OAM-102765 because of conflicts Revert "point host camera service to latest fix" This reverts commit 2a3b25bfca1b7b14314fdc158f759641a61f1890. Signed-off-by: Kothapeta, BikshapathiX --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 49c5dd1..b073469 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -114,7 +114,7 @@ function install_host_service() { cd host_camera git clone https://github.com/projectceladon/host-camera-server.git cd host-camera-server - git checkout 915388bd22d1582d44fb22dc647bd46a6ab675bc + git checkout ba2707587e8f3ad03714d5e3ed47844e83cde7c0 mkdir build cd build cmake .. From a91810ddbbb0c6ac1205501587f00857fd335b6c Mon Sep 17 00:00:00 2001 From: "Kothapeta, BikshapathiX" Date: Thu, 14 Jul 2022 09:05:51 +0530 Subject: [PATCH 19/56] Revert of OAM-102361 because of conflicts Revert "start host camera service from vm-manager" This reverts commit e639ed807bf1429fd0fdc56b5e9601e23054867d. --- sample/guest01.ini | 1 - scripts/setup_host.sh | 103 -------------------------------------- src/guest/guest.c | 2 +- src/guest/start.c | 11 +--- src/include/guest/guest.h | 1 - 5 files changed, 2 insertions(+), 116 deletions(-) diff --git a/sample/guest01.ini b/sample/guest01.ini index e6dcc29..0542a20 100644 --- a/sample/guest01.ini +++ b/sample/guest01.ini @@ -78,7 +78,6 @@ passthrough_pci=0000:00:14.0, [mediation] #battery_med=/home/gvt/caas/scripts/batsys #thermal_med=/home/gvt/caas/scripts/thermsys -#camera_med=y [guest_control] #time_keep=/home/gvt/caas/scripts/guest_time_keeping.sh diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index b073469..f3e864b 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -25,106 +25,6 @@ function error() { echo "$BASH_SOURCE Failed at line($line): $cmd" } - -function install_virtualcamera_service() { - service_file=virtualcamera.service - touch $service_file - cat /dev/null > $service_file - - echo "[Unit]" > $service_file - echo -e "Description=Virtual Camera Auto Start\n" >> $service_file - echo -e "After=default.target\n" >> $service_file - echo "[Service]" >> $service_file - echo -e "ExecStartPre=/usr/sbin/modprobe v4l2loopback devices=2 video_nr=6,7 card_label=\"VCam0\",\"VCam1\" exclusive_caps=1,1\n" >> $service_file - echo -e "ExecStart=/usr/bin/IntelCameraService -i /dev/video0 -o /dev/video6 -o /dev/video7 -w 1920 -h 1080 -f MJPG\n" >> $service_file - echo -e "SuccessExitStatus=255\n" >> $service_file - echo -e "Restart=always\n" >> $service_file - echo -e "RestartSec=10\n" >> $service_file - echo "[Install]" >> $service_file - echo -e "WantedBy=default.target\n" >> $service_file - - cat $service_file - sudo mv $service_file /etc/systemd/system/ - sudo systemctl enable virtualcamera.service - sudo systemctl restart virtualcamera.service -} - -function install_virtual_camera() { - KERNELRELEASE=`uname -r` - KERNEL_DIR=/lib/modules/${KERNELRELEASE}/kernel/drivers/media/v4l2-core/ - CURRENT_DIR=`pwd` - - sudo -E apt install linux-headers-`uname -r` - - echo "Clean environment..." - if [ -x v4l2loopback ]; then - rm -rf v4l2loopback - fi - IS_SERVICE_RUNNING=`ps -fe | grep IntelCameraService | grep -v "grep" | wc -l` - if [ $IS_SERVICE_RUNNING == 1 ]; then - echo "Stop running IntelCameraService" - sudo systemctl stop virtualcamera.service - fi - IS_V4L2LOOPBACK_EXIST=`lsmod | grep "v4l2loopback" | wc -l` - if [ $IS_V4L2LOOPBACK_EXIST != 0 ]; then - echo "rmmod v4l2loopback..." - sudo rmmod v4l2loopback - fi - - echo "Install v4l2loopback driver..." - git clone https://github.com/umlaeute/v4l2loopback.git - cd v4l2loopback - git checkout 81b8df79107d1fbf392fdcbaa051bd227a9c94c1 - - git apply ../scripts/cam_sharing/0001-Netlink-sync.patch - make - - echo "cp " ${DRIVER} ${KERNEL_DIR}/v4l2loopback.ko - if [ -f ${KERNEL_DIR}/v4l2loopback.ko ]; then - echo "Backup original v4l2loopback.ko" - mv ${KERNEL_DIR}/v4l2loopback.ko ${KERNEL_DIR}/v4l2loopback.ko.orig - fi - sudo cp v4l2loopback.ko ${KERNEL_DIR} - depmod - cd .. - if [ -x v4l2loopback ]; then - rm -rf v4l2loopback - fi - - echo "Install IntelCameraService in /usr/bin/ ..." - sudo chmod 777 scripts/cam_sharing/IntelCameraService - sudo cp ./scripts/cam_sharing/IntelCameraService /usr/bin/ - - echo "Install virtualcamera.service in /lib/systemd/system/ ..." - install_virtualcamera_service - - echo "Complete virtual camera installation." - -} - -function install_host_service() { - sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev libavdevice-dev -y - sudo apt-get install ffmpeg -y - sudo apt-get install build-essential clang -y - - sudo apt install git - - sudo apt-get install --yes cmake - mkdir -p host_camera - cd host_camera - git clone https://github.com/projectceladon/host-camera-server.git - cd host-camera-server - git checkout ba2707587e8f3ad03714d5e3ed47844e83cde7c0 - mkdir build - cd build - cmake .. - cmake --build . - sudo cp source/libvhal-client.so* /usr/lib - sudo cp host_camera_service/stream /usr/local/bin/ - cd ../../.. - sudo rm -rf host_camera -} - function ubu_changes_require(){ echo "Please make sure your apt is working" echo "If you run the installation first time, reboot is required" @@ -671,9 +571,6 @@ check_network check_kernel_version ubu_changes_require -install_host_service -install_virtual_camera - ubu_install_qemu_gvt ubu_build_ovmf_gvt ubu_enable_host_gvt diff --git a/src/guest/guest.c b/src/guest/guest.c index 4d2bcf4..2cc8e68 100644 --- a/src/guest/guest.c +++ b/src/guest/guest.c @@ -32,7 +32,7 @@ keyfile_group_t g_group[] = { { "vtpm", { "bin_path", "data_dir", NULL } }, { "rpmb", { "bin_path", "data_dir", NULL } }, { "passthrough", { "passthrough_pci", NULL}}, - { "mediation", { "battery_med", "thermal_med", "camera_med",NULL }}, + { "mediation", { "battery_med", "thermal_med", NULL }}, { "aaf", { "path", "support_suspend", "audio_type", NULL } }, { "guest_control", { "time_keep", "pm_control", NULL }}, { "extra", { "cmd", "service", NULL } }, diff --git a/src/guest/start.c b/src/guest/start.c index 25e1207..df1e9e4 100644 --- a/src/guest/start.c +++ b/src/guest/start.c @@ -813,10 +813,6 @@ static int run_thermal_mediation_daemon(char *path) { return execute_cmd(path, NULL, 0, 1); } -static int run_camera_mediation_daemon(char *path) { - return execute_cmd(path, NULL, 0, 1); -} - static int run_guest_timekeep(char *path, char *p, size_t size, char *pipe_name) { int cx = 0; const char *pipe = pipe_name ? pipe_name : "qmp-time-keep-pipe"; @@ -1233,11 +1229,6 @@ int start_guest(char *name) if (val != NULL && (strcmp("", val) != 0)) run_thermal_mediation_daemon(val); - val = g_key_file_get_string(gkf, g->name, g->key[CAMERA_MED], NULL); - if (val != NULL && (strcasecmp("y", val) == 0)) { - run_camera_mediation_daemon("/usr/local/bin/stream"); - } - /* run guest pm */ g = &g_group[GROUP_GUEST_SERVICE]; @@ -1287,7 +1278,7 @@ int start_guest(char *name) cx = snprintf(p, size, "%s", fixed_cmd); p += cx; size -= cx; - run_vtpm_daemon(); + run_vtpm_daemon(); cleanup_rpmb(); run_rpmb_daemon(); diff --git a/src/include/guest/guest.h b/src/include/guest/guest.h index 0165d9a..a943296 100644 --- a/src/include/guest/guest.h +++ b/src/include/guest/guest.h @@ -197,7 +197,6 @@ enum { /* Sub key of group mediation */ BATTERY_MED = 0, THERMAL_MED, - CAMERA_MED, /* Sub key of group aaf */ AAF_PATH = 0, From 43a8d6ff4aa779749afea44ad440d25d3c3acb22 Mon Sep 17 00:00:00 2001 From: vdanix Date: Mon, 3 Oct 2022 15:20:03 +0530 Subject: [PATCH 20/56] Revert "Install fixed version for S/stable" This reverts commit 69804c712e5a7a957cd52fa4aa762ed3b3e6a42d. --- scripts/setup_host.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index f3e864b..04b93ac 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -130,14 +130,15 @@ function ubu_build_ovmf_gvt(){ } function install_vm_manager_deb(){ + #Try to download from latest release/tag local os_ver=$(lsb_release -rs) - local vm_repo="https://github.com/projectceladon/vm_manager" - local rtag="v0.7.2" + local vm_repo="https://github.com/projectceladon/vm_manager/" + local rtag=$(git ls-remote -t --refs ${vm_repo} | cut --delimiter='/' --fields=3 | tr '-' '~' | sort --version-sort | tail --lines=1) local rdeb=vm-manager_${rtag}_ubuntu-${os_ver}.deb [ -f ${rdeb} ] && rm -f ${rdeb} - local rurl=${vm_repo}/releases/download/${rtag}/${rdeb} + local rurl=https://github.com/projectceladon/vm_manager/releases/latest/download/${rdeb} if wget ${rurl} ; then sudo dpkg -i ${rdeb} || return -1 @@ -147,13 +148,24 @@ function install_vm_manager_deb(){ fi } +function install_vm_manager_src() { + #Try to build from source code + sudo apt-get install --yes make gcc + git clone https://github.com/projectceladon/vm_manager.git || return -1 + cd vm_manager/ + make || return -1 + sudo make install || return -1 + cd - + rm -rf vm_manager/ +} + function install_vm_manager() { sudo apt-get update sudo apt-get install --yes libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev wget lsb-release git - install_vm_manager_deb + install_vm_manager_deb || install_vm_manager_src if [ "$?" -ne 0 ]; then echo "Failed to install vm-manager!" - echo "Please download and install mannually from: https://github.com/projectceladon/vm_manager/releases/" + echo "Please download and install mannually from: https://github.com/projectceladon/vm_manager/releases/latest" fi } From 71e65b9997857b0ad80e19a00231b209d91a1a41 Mon Sep 17 00:00:00 2001 From: vdanix Date: Mon, 3 Oct 2022 15:20:48 +0530 Subject: [PATCH 21/56] Revert "support celadon ISO image flashing in start_flash_usb.sh script" This reverts commit f5a5f05a0a30ed137585d2163b763179c0587c6b. --- scripts/start_flash_usb.sh | 47 +++++++++++++++----------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/scripts/start_flash_usb.sh b/scripts/start_flash_usb.sh index eb13016..df2f88d 100755 --- a/scripts/start_flash_usb.sh +++ b/scripts/start_flash_usb.sh @@ -7,7 +7,7 @@ WORK_DIR=$PWD -[ $# -lt 1 ] && echo "Usage: $0 [caas-flashfiles-.zip] [caas-flashfile-.iso] [caas-flashfile-.iso.zip]" && exit -1 +[ $# -lt 1 ] && echo "Usage: $0 caas-flashfiles-eng-.zip" && exit -1 if [ -f android.qcow2 ] then @@ -41,34 +41,25 @@ else qemu-img create -f qcow2 android.qcow2 32G fi -decompress=flashfiles_decompress -zip_file=$(file $1 | grep -i "Zip archive data") -if [[ $zip_file != "" ]]; then - rm -rf "$decompress" && mkdir $decompress - unzip $1 -d $decompress +[ -d "./flashfiles_decompress" ] && rm -rf "./flashfiles_decompress" +mkdir ./flashfiles_decompress +unzip $1 -d ./flashfiles_decompress - if [[ -f $decompress/boot.img ]]; then - G_size=$((1<<32)) - for i in `ls $decompress`; do - size=$(stat -c %s "$decompress/"$i) - if [[ $size -gt $G_size ]]; then - echo "Split $i due to its size bigger than 4G" - split --bytes=$((G_size-1)) --numeric-suffixes "$decompress/"$i "$decompress/"$i.part - rm "$decompress/"$i - fi - done - - dd if=/dev/zero of=./flash.vfat bs=63M count=160 - mkfs.vfat ./flash.vfat - mcopy -i flash.vfat $decompress/* :: - - virt_disk=flash.vfat - else - virt_disk=$decompress/`ls $decompress` +G_size=$((1<<32)) +for i in `ls ./flashfiles_decompress`;do + if [ -f "./flashfiles_decompress/"$i ] && [ "`grep $i ./flashfiles_decompress/installer.cmd`" ]; then + size=$(stat -c %s "./flashfiles_decompress/"$i) + if [[ $size -gt $G_size ]]; then + echo "Split $i due to its size bigger than 4G\n" + split --bytes=$((G_size-1)) --numeric-suffixes "./flashfiles_decompress/"$i "./flashfiles_decompress/"$i.part + rm "./flashfiles_decompress/"$i + fi fi -else - virt_disk=$1 -fi +done + +dd if=/dev/zero of=./flash.vfat bs=63M count=160 +mkfs.vfat ./flash.vfat +mcopy -i flash.vfat flashfiles_decompress/* :: if [ "$support_dedicated_data" = true ] then @@ -99,7 +90,7 @@ qemu-system-x86_64 \ -chardev socket,id=charserial0,path=./kernel-console,server=on,wait=off \ -device isa-serial,chardev=charserial0,id=serial0 \ -device qemu-xhci,id=xhci,addr=0x5 \ - -drive file=$virt_disk,id=udisk1,format=raw,if=none \ + -drive file=./flash.vfat,id=udisk1,format=raw,if=none \ -device usb-storage,drive=udisk1,bus=xhci.0 \ -device virtio-scsi-pci,id=scsi0,addr=0x8 \ -drive file=./android.qcow2,if=none,format=qcow2,id=scsidisk1 \ From ccdc805b0a9afd9007a2be08d59af7cedb3af5d9 Mon Sep 17 00:00:00 2001 From: Kishan Mochi Date: Tue, 8 Mar 2022 13:06:23 +0530 Subject: [PATCH 22/56] Port SRIOV graphics and media installation for host Changes: - added function to install components for SRIOV - ported SRIOV installation script - improved grub update logic - removed old mesa installation patch --- scripts/setup_host.sh | 62 +++++++++-- scripts/sriov_setup_host.sh | 214 ++++++++++++++++++++++++++++++++++++ 2 files changed, 264 insertions(+), 12 deletions(-) create mode 100644 scripts/sriov_setup_host.sh diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 04b93ac..6e0d212 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -38,6 +38,43 @@ function ubu_changes_require(){ sudo apt install -y libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev } +function ubu_install_sriov(){ + # Switch to Xorg for Ubuntu 21.04 + if [[ $(lsb_release -rs) == "21.04" ]]; then + sed -i "s/\#WaylandEnable=false/WaylandEnable=false/g" /etc/gdm3/custom.conf + fi + + sudo apt install -y net-tools openssh-server git make autoconf libtool meson vim v4l-utils pkg-config libpciaccess-dev cmake \ + python3-pip python3.10 llvm-12-dev libelf-dev bison flex wayland-protocols libwayland-dev libwayland-egl-backend-dev \ + libx11-dev libxext-dev libxdamage-dev libx11-xcb-dev libxcb-glx0-dev libxcb-dri2-0-dev libxcb-dri3-dev \ + libxcb-present-dev libxshmfence-dev libxxf86vm-dev libxrandr-dev libkmod-dev libprocps-dev libdw-dev libpixman-1-dev \ + libcairo2-dev libudev-dev libgudev-1.0-0 gtk-doc-tools sshfs mesa-utils xutils-dev libunwind-dev libxml2-dev doxygen \ + xmlto cmake libpciaccess-dev graphviz libjpeg-dev libwebp-dev libsystemd-dev libdbus-glib-1-dev libpam0g-dev \ + freerdp2-dev libxkbcommon-dev libinput-dev libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0-dev \ + libxcb-composite0-dev libxcursor-dev liblcms2-dev libpango1.0-dev libglfw3-dev libxcb-composite0-dev libxcursor-dev \ + libgtk-3-dev libsdl2-dev virtinst virt-viewer virt-manager libspice-server-dev libusb-dev libxfont-dev libxkbfile-dev \ + libepoxy-dev rpm libncurses5-dev libncursesw5-dev liblz4-tool git-lfs uuid mtools python3-usb python3-pyudev \ + libjson-c-dev libfdt-dev socat bridge-utils uml-utilities python-dev libcap-ng-dev libusb-1.0-0-dev nasm acpidump \ + iasl libseccomp-dev libtasn1-6-dev libgnutls28-dev expect gawk + sudo apt install -y python3-mako + + # Clean up any existing folders + function del_existing_folder() { + if [ -d "$1" ]; then + echo "Deleting existing folder $1" + rm -fr $1 + fi + } + del_existing_folder $CIV_WORK_DIR/media + del_existing_folder $CIV_WORK_DIR/gstreamer + del_existing_folder $CIV_WORK_DIR/graphics + del_existing_folder $CIV_WORK_DIR/neo + + # Start setup + source $CIV_WORK_DIR/scripts/sriov_setup_host.sh + +} + function ubu_install_qemu_gvt(){ sudo apt purge -y "^qemu" sudo apt autoremove -y @@ -170,12 +207,15 @@ function install_vm_manager() { } function ubu_enable_host_gvt(){ - if [[ ! `cat /etc/default/grub` =~ "i915.enable_gvt=1 intel_iommu=on i915.force_probe=*" ]]; then + if [[ ! `cat /etc/default/grub` =~ "i915.enable_gvt=1" ]]; then read -p "The grub entry in '/etc/default/grub' will be updated for enabling GVT-g and GVT-d, do you want to continue? [Y/n]" res if [ x$res = xn ]; then - exit 0 + return + fi + if [[ ! `cat /etc/default/grub` =~ "intel_iommu=on i915.force_probe=*" ]]; then + sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"intel_iommu=on i915.force_probe=* /g" /etc/default/grub fi - sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"i915.enable_gvt=1 intel_iommu=on i915.force_probe=*/g" /etc/default/grub + sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"i915.enable_gvt=1 /g" /etc/default/grub update-grub echo -e "\nkvmgt\nvfio-iommu-type1\nvfio-mdev\n" >> /etc/initramfs-tools/modules @@ -186,24 +226,21 @@ function ubu_enable_host_gvt(){ } function ubu_enable_host_sriov(){ - if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc=0x7" ]]; then + if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc=0x7 udmabuf.list_limit=8192" ]]; then read -p "The grub entry in '/etc/default/grub' will be updated for enabling SRIOV, do you want to continue? [Y/n]" res if [ x$res = xn ]; then - exit 0 + return + fi + if [[ ! `cat /etc/default/grub` =~ "intel_iommu=on i915.force_probe=*" ]]; then + sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"intel_iommu=on i915.force_probe=* /g" /etc/default/grub fi - sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"i915.enable_guc=0x7 udmabuf.list_limit=8192 /g" /etc/default/grub + sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"i915.enable_guc=0x7 udmabuf.list_limit=8192 /g" /etc/default/grub update-grub echo -e "\nkvmgt\nvfio-iommu-type1\nvfio-mdev\n" >> /etc/initramfs-tools/modules update-initramfs -u -k all - # Switch to Xorg for Ubuntu 21.04 - if [[ $(lsb_release -rs) == "21.04" ]]; then - sed -i "s/\#WaylandEnable=false/WaylandEnable=false/g" /etc/gdm3/custom.conf - fi - reboot_required=1 - fi } @@ -583,6 +620,7 @@ check_network check_kernel_version ubu_changes_require +ubu_install_sriov ubu_install_qemu_gvt ubu_build_ovmf_gvt ubu_enable_host_gvt diff --git a/scripts/sriov_setup_host.sh b/scripts/sriov_setup_host.sh new file mode 100644 index 0000000..8be0eaa --- /dev/null +++ b/scripts/sriov_setup_host.sh @@ -0,0 +1,214 @@ +#!/bin/bash +RED='\033[0;31m' +NC='\033[0m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' + +export PrefixPath=/usr +export LibPath=/usr/lib/x86_64-linux-gnu +export nproc=20 +export WrkDir=`pwd` + +function check_build_error(){ + if [ $? -ne 0 ]; then + echo -e "${RED}$1: Build Error ${NC}" + exit -1 + else + echo -e "${GREEN}$1: Build Success${NC}" + fi +} + +git config --global advice.detachedHead false +#media +echo "export LIBVA_DRIVER_NAME=iHD" | sudo tee -a /etc/environment +echo "export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" | sudo tee -a /etc/environment +echo "export GIT_SSL_NO_VERIFY=true" | sudo tee -a /etc/environment +source /etc/environment + +git lfs install --skip-smudge +git clone https://gitlab.freedesktop.org/mesa/drm.git media/libdrm +cd media/libdrm +git checkout refs/tags/libdrm-2.4.107 +meson build/ --prefix=$PrefixPath --libdir=$LibPath +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/intel/libva.git media/libva +cd media/libva +git checkout refs/tags/2.13.0 +meson build/ --prefix=$PrefixPath --libdir=$LibPath +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/intel/libva-utils.git media/libva-utils +cd media/libva-utils +git checkout refs/tags/2.13.0 +meson build/ --prefix=$PrefixPath --libdir=$LibPath +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/intel/gmmlib.git media/gmmlib +cd media/gmmlib +git checkout refs/tags/intel-gmmlib-21.3.3 +mkdir build && cd build +cmake -DCMAKE_INSTALL_PREFIX=$PrefixPath ../ +make -j "$(nproc)" +check_build_error +sudo make install +cd $WrkDir + + +git clone https://github.com/intel/media-driver.git media/media-driver +cd media/media-driver +git checkout refs/tags/intel-media-21.3.5 +git apply $CIV_WORK_DIR/vertical_patches/host/media/media-driver/*.patch + +mkdir build_media && cd build_media +cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath +make -j "$(nproc)" +check_build_error +sudo make install +cd $WrkDir +# Create igfx_user_feature.txt +echo "[KEY]" | sudo tee -a /etc/igfx_user_feature.txt +echo " 0x00000001" | sudo tee -a /etc/igfx_user_feature.txt +echo " UFKEY_INTERNAL\LibVa" | sudo tee -a /etc/igfx_user_feature.txt +echo " [VALUE]" | sudo tee -a /etc/igfx_user_feature.txt +echo " Disable MMC" | sudo tee -a /etc/igfx_user_feature.txt +echo " 4" | sudo tee -a /etc/igfx_user_feature.txt +echo " 1" | sudo tee -a /etc/igfx_user_feature.txt +echo " [VALUE]" | sudo tee -a /etc/igfx_user_feature.txt +echo " Enable HCP Scalability Decode" | sudo tee -a /etc/igfx_user_feature.txt +echo " 4" | sudo tee -a /etc/igfx_user_feature.txt +echo " 0" | sudo tee -a /etc/igfx_user_feature.txt +echo "[KEY]" | sudo tee -a /etc/igfx_user_feature.txt +echo " 0x00000002" | sudo tee -a /etc/igfx_user_feature.txt +echo " UFKEY_INTERNAL\Report" | sudo tee -a /etc/igfx_user_feature.txt + + +#onevpl-gpu +git clone https://github.com/oneapi-src/oneVPL-intel-gpu.git media/oneVPL-gpu +cd media/oneVPL-gpu +git checkout refs/tags/intel-onevpl-21.3.4 +git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL-gpu/*.patch + +mkdir build && cd build +cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath +make -j "$(nproc)" +check_build_error +sudo make install +cd $WrkDir + +#onevpl +git clone https://github.com/oneapi-src/oneVPL.git media/oneVPL +cd media/oneVPL +git checkout refs/tags/v2021.6.0 +git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL/*.patch +mkdir build && cd build +cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath +make -j "$(nproc)" +check_build_error +sudo make install +cd $WrkDir + + +#gstreamer +git clone https://github.com/GStreamer/gstreamer.git gstreamer/gstreamer +cd gstreamer/gstreamer +git checkout b4ca58df7624b005a33e182a511904d7cceea890 +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/GStreamer/gst-plugins-base.git gstreamer/gst-plugins-base +cd gstreamer/gst-plugins-base +git checkout ce937bcb21412d7b3539a2da0509cc96260562f8 +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/GStreamer/gst-plugins-good.git gstreamer/gst-plugins-good +cd gstreamer/gst-plugins-good +git checkout 20bbeb5e37666c53c254c7b08470ad8a00d97630 +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/GStreamer/gst-plugins-bad.git gstreamer/gst-plugins-bad +cd gstreamer/gst-plugins-bad +git checkout ca8068c6d793d7aaa6f2e2cc6324fdedfe2f33fa +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/GStreamer/gst-plugins-ugly.git gstreamer/gst-plugins-ugly +cd gstreamer/gst-plugins-ugly +git checkout 499d3cd726a4ca9cbbdd4b4fe9ccdca78ef538ba +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/GStreamer/gstreamer-vaapi.git gstreamer/gstreamer-vaapi +cd gstreamer/gstreamer-vaapi +git checkout c3ddb29cb2860374f9efbed495af7b0eead08312 +git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gstreamer-vaapi/*.patch +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +git clone https://github.com/GStreamer/gst-rtsp-server.git gstreamer/gst-rtsp-server +cd gstreamer/gst-rtsp-server +git checkout 0b037e35e7ed3259ca05be748c382bc40e2cdd91 +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir + + +#mesa +git clone https://gitlab.freedesktop.org/mesa/mesa.git graphics/mesa +cd graphics/mesa +git checkout 0e0633ca49425dbc869521cede6a82d2d91c8042 +git apply $CIV_WORK_DIR/vertical_patches/host/graphics/mesa/*.patch +meson build/ --prefix=$PrefixPath -Dgallium-drivers="swrast,iris,kmsro" -Dvulkan-drivers=intel -Ddri-drivers=i965 +ninja -C build && sudo ninja -C build install +check_build_error +cd $WrkDir +# Create mesa_driver.sh +echo "is_vf=\`dmesg | grep \"SR-IOV VF\"\`" | sudo tee -a /etc/profile.d/mesa_driver.sh +echo "if [[ \$is_vf =~ \"VF\" ]]; then" | sudo tee -a /etc/profile.d/mesa_driver.sh +echo " export MESA_LOADER_DRIVER_OVERRIDE=pl111" | sudo tee -a /etc/profile.d/mesa_driver.sh +echo "else" | sudo tee -a /etc/profile.d/mesa_driver.sh +echo " export MESA_LOADER_DRIVER_OVERRIDE=iris" | sudo tee -a /etc/profile.d/mesa_driver.sh +echo "fi" | sudo tee -a /etc/profile.d/mesa_driver.sh + + +#OpenCL +mkdir neo +cd neo +wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-gmmlib-devel_21.3.3_amd64.deb +wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-gmmlib_21.3.3_amd64.deb +wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9389/intel-igc-core_1.0.9389_amd64.deb +wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9389/intel-igc-opencl_1.0.9389_amd64.deb +wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-opencl-icd_21.47.21710_amd64.deb +wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-level-zero-gpu_1.2.21710_amd64.deb +sudo dpkg -i *.deb +cd $WrkDir From f58053ce07278d96ad898edfc6327f90f575bd27 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Tue, 8 Mar 2022 12:13:49 +0800 Subject: [PATCH 23/56] Update SRIOV graphics and media installation for host Changes: - updated to dev_gen12_ww10 branch - updated libdrm from 2.4.107 to 2.4.110 - updated libva from 2.13.0 to 2.14.0 - updated gmmlib from 21.3.3 to 22.0.3 - updated mesa from 21.3.5 to 21.1.1 - updated onevpl-gpu from 21.3.4 to 22.2.0 - updated onevpl from v2021.6.0 to w2022.0.3 - added patches for gstreamer plugins --- scripts/sriov_setup_host.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/sriov_setup_host.sh b/scripts/sriov_setup_host.sh index 8be0eaa..97d2a77 100644 --- a/scripts/sriov_setup_host.sh +++ b/scripts/sriov_setup_host.sh @@ -28,7 +28,8 @@ source /etc/environment git lfs install --skip-smudge git clone https://gitlab.freedesktop.org/mesa/drm.git media/libdrm cd media/libdrm -git checkout refs/tags/libdrm-2.4.107 +git checkout refs/tags/libdrm-2.4.110 +git apply $CIV_WORK_DIR/vertical_patches/host/libdrm/*.patch meson build/ --prefix=$PrefixPath --libdir=$LibPath ninja -C build && sudo ninja -C build install check_build_error @@ -37,7 +38,7 @@ cd $WrkDir git clone https://github.com/intel/libva.git media/libva cd media/libva -git checkout refs/tags/2.13.0 +git checkout refs/tags/2.14.0 meson build/ --prefix=$PrefixPath --libdir=$LibPath ninja -C build && sudo ninja -C build install check_build_error @@ -46,7 +47,7 @@ cd $WrkDir git clone https://github.com/intel/libva-utils.git media/libva-utils cd media/libva-utils -git checkout refs/tags/2.13.0 +git checkout refs/tags/2.14.0 meson build/ --prefix=$PrefixPath --libdir=$LibPath ninja -C build && sudo ninja -C build install check_build_error @@ -55,7 +56,8 @@ cd $WrkDir git clone https://github.com/intel/gmmlib.git media/gmmlib cd media/gmmlib -git checkout refs/tags/intel-gmmlib-21.3.3 +git checkout refs/tags/intel-gmmlib-22.0.3 +git apply $CIV_WORK_DIR/vertical_patches/host/gmmlib/*.patch mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$PrefixPath ../ make -j "$(nproc)" @@ -66,9 +68,8 @@ cd $WrkDir git clone https://github.com/intel/media-driver.git media/media-driver cd media/media-driver -git checkout refs/tags/intel-media-21.3.5 +git checkout refs/tags/intel-media-22.1.1 git apply $CIV_WORK_DIR/vertical_patches/host/media/media-driver/*.patch - mkdir build_media && cd build_media cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath make -j "$(nproc)" @@ -95,7 +96,7 @@ echo " UFKEY_INTERNAL\Report" | sudo tee -a /etc/igfx_user_fe #onevpl-gpu git clone https://github.com/oneapi-src/oneVPL-intel-gpu.git media/oneVPL-gpu cd media/oneVPL-gpu -git checkout refs/tags/intel-onevpl-21.3.4 +git checkout refs/tags/intel-onevpl-22.2.0 git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL-gpu/*.patch mkdir build && cd build @@ -108,7 +109,7 @@ cd $WrkDir #onevpl git clone https://github.com/oneapi-src/oneVPL.git media/oneVPL cd media/oneVPL -git checkout refs/tags/v2021.6.0 +git checkout refs/tags/v2022.0.3 git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL/*.patch mkdir build && cd build cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath @@ -131,6 +132,7 @@ cd $WrkDir git clone https://github.com/GStreamer/gst-plugins-base.git gstreamer/gst-plugins-base cd gstreamer/gst-plugins-base git checkout ce937bcb21412d7b3539a2da0509cc96260562f8 +git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gst-plugins-base/*.patch meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled ninja -C build && sudo ninja -C build install check_build_error @@ -140,6 +142,7 @@ cd $WrkDir git clone https://github.com/GStreamer/gst-plugins-good.git gstreamer/gst-plugins-good cd gstreamer/gst-plugins-good git checkout 20bbeb5e37666c53c254c7b08470ad8a00d97630 +git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gst-plugins-good/*.patch meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled ninja -C build && sudo ninja -C build install check_build_error @@ -149,7 +152,8 @@ cd $WrkDir git clone https://github.com/GStreamer/gst-plugins-bad.git gstreamer/gst-plugins-bad cd gstreamer/gst-plugins-bad git checkout ca8068c6d793d7aaa6f2e2cc6324fdedfe2f33fa -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled +git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gst-plugins-bad/*.patch +meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -Dmsdk=disabled -Dmfx_api=oneVPL ninja -C build && sudo ninja -C build install check_build_error cd $WrkDir @@ -194,7 +198,7 @@ check_build_error cd $WrkDir # Create mesa_driver.sh echo "is_vf=\`dmesg | grep \"SR-IOV VF\"\`" | sudo tee -a /etc/profile.d/mesa_driver.sh -echo "if [[ \$is_vf =~ \"VF\" ]]; then" | sudo tee -a /etc/profile.d/mesa_driver.sh +echo "if [[ \$is_vf =~ \"VF\" ]]; then" | sudo tee -a /etc/profile.d/mesa_driver.sh echo " export MESA_LOADER_DRIVER_OVERRIDE=pl111" | sudo tee -a /etc/profile.d/mesa_driver.sh echo "else" | sudo tee -a /etc/profile.d/mesa_driver.sh echo " export MESA_LOADER_DRIVER_OVERRIDE=iris" | sudo tee -a /etc/profile.d/mesa_driver.sh @@ -204,7 +208,6 @@ echo "fi" | sudo tee -a /etc/profile.d #OpenCL mkdir neo cd neo -wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-gmmlib-devel_21.3.3_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-gmmlib_21.3.3_amd64.deb wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9389/intel-igc-core_1.0.9389_amd64.deb wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9389/intel-igc-opencl_1.0.9389_amd64.deb From f8f0cbfb2bac2e84d480599a107b8ec71d0565db Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Wed, 30 Mar 2022 15:07:48 +0800 Subject: [PATCH 24/56] Change the recipe to follow MR1 recipe instead oe-core As for opencl, we used the latest version available to make sure similarity for mediastack Signed-off-by: Mazlan, Hazwan Arif --- scripts/sriov_setup_host.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/sriov_setup_host.sh b/scripts/sriov_setup_host.sh index 97d2a77..a324b7c 100644 --- a/scripts/sriov_setup_host.sh +++ b/scripts/sriov_setup_host.sh @@ -28,7 +28,7 @@ source /etc/environment git lfs install --skip-smudge git clone https://gitlab.freedesktop.org/mesa/drm.git media/libdrm cd media/libdrm -git checkout refs/tags/libdrm-2.4.110 +git checkout refs/tags/libdrm-2.4.107 git apply $CIV_WORK_DIR/vertical_patches/host/libdrm/*.patch meson build/ --prefix=$PrefixPath --libdir=$LibPath ninja -C build && sudo ninja -C build install @@ -38,7 +38,7 @@ cd $WrkDir git clone https://github.com/intel/libva.git media/libva cd media/libva -git checkout refs/tags/2.14.0 +git checkout refs/tags/2.13.0 meson build/ --prefix=$PrefixPath --libdir=$LibPath ninja -C build && sudo ninja -C build install check_build_error @@ -47,7 +47,7 @@ cd $WrkDir git clone https://github.com/intel/libva-utils.git media/libva-utils cd media/libva-utils -git checkout refs/tags/2.14.0 +git checkout refs/tags/2.13.0 meson build/ --prefix=$PrefixPath --libdir=$LibPath ninja -C build && sudo ninja -C build install check_build_error @@ -56,7 +56,7 @@ cd $WrkDir git clone https://github.com/intel/gmmlib.git media/gmmlib cd media/gmmlib -git checkout refs/tags/intel-gmmlib-22.0.3 +git checkout refs/tags/intel-gmmlib-22.0.1 git apply $CIV_WORK_DIR/vertical_patches/host/gmmlib/*.patch mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$PrefixPath ../ @@ -96,7 +96,7 @@ echo " UFKEY_INTERNAL\Report" | sudo tee -a /etc/igfx_user_fe #onevpl-gpu git clone https://github.com/oneapi-src/oneVPL-intel-gpu.git media/oneVPL-gpu cd media/oneVPL-gpu -git checkout refs/tags/intel-onevpl-22.2.0 +git checkout refs/tags/intel-onevpl-22.1.0 git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL-gpu/*.patch mkdir build && cd build @@ -208,10 +208,10 @@ echo "fi" | sudo tee -a /etc/profile.d #OpenCL mkdir neo cd neo -wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-gmmlib_21.3.3_amd64.deb -wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9389/intel-igc-core_1.0.9389_amd64.deb -wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9389/intel-igc-opencl_1.0.9389_amd64.deb -wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-opencl-icd_21.47.21710_amd64.deb -wget https://github.com/intel/compute-runtime/releases/download/21.47.21710/intel-level-zero-gpu_1.2.21710_amd64.deb +wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-gmmlib_22.0.2_amd64.deb +wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-core_1.0.10409_amd64.deb +wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-opencl_1.0.10409_amd64.deb +wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-opencl-icd_22.10.22597_amd64.deb +wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-level-zero-gpu_1.3.22597_amd64.deb sudo dpkg -i *.deb cd $WrkDir From 415ccfd514d2fe4471a520500872f5b5f63abfa2 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Thu, 31 Mar 2022 15:54:59 +0800 Subject: [PATCH 25/56] Fix OpenCL update error Change: - added installation of dependent package - added copyright license --- scripts/sriov_setup_host.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/sriov_setup_host.sh b/scripts/sriov_setup_host.sh index a324b7c..1bed779 100644 --- a/scripts/sriov_setup_host.sh +++ b/scripts/sriov_setup_host.sh @@ -1,4 +1,10 @@ #!/bin/bash + +# Copyright (c) 2022 Intel Corporation. +# All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + RED='\033[0;31m' NC='\033[0m' GREEN='\033[0;32m' @@ -213,5 +219,6 @@ wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0. wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-opencl_1.0.10409_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-opencl-icd_22.10.22597_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-level-zero-gpu_1.3.22597_amd64.deb +sudo apt install ocl-icd-libopencl1 sudo dpkg -i *.deb cd $WrkDir From fc0f890bdd0251ec5ecfe08579e031fd126a23da Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Fri, 27 May 2022 15:14:17 +0530 Subject: [PATCH 26/56] Enable independent SRIOV host setup from CIV setup Changes: - removed SRIOV-related setup functions - added additional patching of qemu from SRIOV folder - added prerequisite check for successfully completed SRIOV setup Tracked-On: Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 86 ++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 58 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 6e0d212..51072ba 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -38,43 +38,6 @@ function ubu_changes_require(){ sudo apt install -y libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev } -function ubu_install_sriov(){ - # Switch to Xorg for Ubuntu 21.04 - if [[ $(lsb_release -rs) == "21.04" ]]; then - sed -i "s/\#WaylandEnable=false/WaylandEnable=false/g" /etc/gdm3/custom.conf - fi - - sudo apt install -y net-tools openssh-server git make autoconf libtool meson vim v4l-utils pkg-config libpciaccess-dev cmake \ - python3-pip python3.10 llvm-12-dev libelf-dev bison flex wayland-protocols libwayland-dev libwayland-egl-backend-dev \ - libx11-dev libxext-dev libxdamage-dev libx11-xcb-dev libxcb-glx0-dev libxcb-dri2-0-dev libxcb-dri3-dev \ - libxcb-present-dev libxshmfence-dev libxxf86vm-dev libxrandr-dev libkmod-dev libprocps-dev libdw-dev libpixman-1-dev \ - libcairo2-dev libudev-dev libgudev-1.0-0 gtk-doc-tools sshfs mesa-utils xutils-dev libunwind-dev libxml2-dev doxygen \ - xmlto cmake libpciaccess-dev graphviz libjpeg-dev libwebp-dev libsystemd-dev libdbus-glib-1-dev libpam0g-dev \ - freerdp2-dev libxkbcommon-dev libinput-dev libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0-dev \ - libxcb-composite0-dev libxcursor-dev liblcms2-dev libpango1.0-dev libglfw3-dev libxcb-composite0-dev libxcursor-dev \ - libgtk-3-dev libsdl2-dev virtinst virt-viewer virt-manager libspice-server-dev libusb-dev libxfont-dev libxkbfile-dev \ - libepoxy-dev rpm libncurses5-dev libncursesw5-dev liblz4-tool git-lfs uuid mtools python3-usb python3-pyudev \ - libjson-c-dev libfdt-dev socat bridge-utils uml-utilities python-dev libcap-ng-dev libusb-1.0-0-dev nasm acpidump \ - iasl libseccomp-dev libtasn1-6-dev libgnutls28-dev expect gawk - sudo apt install -y python3-mako - - # Clean up any existing folders - function del_existing_folder() { - if [ -d "$1" ]; then - echo "Deleting existing folder $1" - rm -fr $1 - fi - } - del_existing_folder $CIV_WORK_DIR/media - del_existing_folder $CIV_WORK_DIR/gstreamer - del_existing_folder $CIV_WORK_DIR/graphics - del_existing_folder $CIV_WORK_DIR/neo - - # Start setup - source $CIV_WORK_DIR/scripts/sriov_setup_host.sh - -} - function ubu_install_qemu_gvt(){ sudo apt purge -y "^qemu" sudo apt autoremove -y @@ -107,6 +70,14 @@ function ubu_install_qemu_gvt(){ for i in $CIV_GOP_DIR/qemu/*.patch; do patch -p1 < $i; done fi + sriov_qemu_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/*.patch 2> /dev/null | wc -l) + if [ "$sriov_qemu_patch_num" != "0" ]; then + for i in $CIV_WORK_DIR/sriov_patches/qemu/*.patch; do + echo "applying qemu patch $i" + patch -p1 < $i + done + fi + vertical_qemu_patch_num=$(ls $CIV_VERTICAl_DIR/qemu/*.patch 2> /dev/null | wc -l) if [ "$vertical_qemu_patch_num" != "0" ]; then for i in $CIV_VERTICAl_DIR/qemu/*.patch; do @@ -225,25 +196,6 @@ function ubu_enable_host_gvt(){ fi } -function ubu_enable_host_sriov(){ - if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc=0x7 udmabuf.list_limit=8192" ]]; then - read -p "The grub entry in '/etc/default/grub' will be updated for enabling SRIOV, do you want to continue? [Y/n]" res - if [ x$res = xn ]; then - return - fi - if [[ ! `cat /etc/default/grub` =~ "intel_iommu=on i915.force_probe=*" ]]; then - sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"intel_iommu=on i915.force_probe=* /g" /etc/default/grub - fi - sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"i915.enable_guc=0x7 udmabuf.list_limit=8192 /g" /etc/default/grub - update-grub - - echo -e "\nkvmgt\nvfio-iommu-type1\nvfio-mdev\n" >> /etc/initramfs-tools/modules - update-initramfs -u -k all - - reboot_required=1 - fi -} - function ubu_update_fw(){ FW_REL="linux-firmware-20220310" GUC_REL="70.0.3" @@ -314,6 +266,25 @@ function check_kernel_version() { fi } +function check_sriov_setup() { + input="$CIV_WORK_DIR/sriov_setup_ubuntu.log" + sriov_setup_success=0 + + if [ -f "$input" ]; then + while read -r line + do + if [[ $line == "Success" ]]; then + sriov_setup_success=1 + fi + done < "$input" + fi + + if [ $sriov_setup_success == 0 ]; then + echo "E: Please ensure SRIOV has been setup successfully first" + exit + fi +} + function ask_reboot(){ if [ $reboot_required -eq 1 ];then read -p "Reboot is required, do you want to reboot it NOW? [y/N]" res @@ -618,13 +589,12 @@ parse_arg "$@" check_os check_network check_kernel_version +check_sriov_setup ubu_changes_require -ubu_install_sriov ubu_install_qemu_gvt ubu_build_ovmf_gvt ubu_enable_host_gvt -ubu_enable_host_sriov ubu_update_fw install_vm_manager From eae755e424d5a099f2e3ce23a2f9426a646b0435 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Thu, 19 May 2022 14:49:28 +0800 Subject: [PATCH 27/56] Remove redundant script to setup SRIOV on host Change: - deleted sriov_setup_host.sh --- scripts/sriov_setup_host.sh | 224 ------------------------------------ 1 file changed, 224 deletions(-) delete mode 100644 scripts/sriov_setup_host.sh diff --git a/scripts/sriov_setup_host.sh b/scripts/sriov_setup_host.sh deleted file mode 100644 index 1bed779..0000000 --- a/scripts/sriov_setup_host.sh +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2022 Intel Corporation. -# All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 - -RED='\033[0;31m' -NC='\033[0m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' - -export PrefixPath=/usr -export LibPath=/usr/lib/x86_64-linux-gnu -export nproc=20 -export WrkDir=`pwd` - -function check_build_error(){ - if [ $? -ne 0 ]; then - echo -e "${RED}$1: Build Error ${NC}" - exit -1 - else - echo -e "${GREEN}$1: Build Success${NC}" - fi -} - -git config --global advice.detachedHead false -#media -echo "export LIBVA_DRIVER_NAME=iHD" | sudo tee -a /etc/environment -echo "export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" | sudo tee -a /etc/environment -echo "export GIT_SSL_NO_VERIFY=true" | sudo tee -a /etc/environment -source /etc/environment - -git lfs install --skip-smudge -git clone https://gitlab.freedesktop.org/mesa/drm.git media/libdrm -cd media/libdrm -git checkout refs/tags/libdrm-2.4.107 -git apply $CIV_WORK_DIR/vertical_patches/host/libdrm/*.patch -meson build/ --prefix=$PrefixPath --libdir=$LibPath -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/intel/libva.git media/libva -cd media/libva -git checkout refs/tags/2.13.0 -meson build/ --prefix=$PrefixPath --libdir=$LibPath -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/intel/libva-utils.git media/libva-utils -cd media/libva-utils -git checkout refs/tags/2.13.0 -meson build/ --prefix=$PrefixPath --libdir=$LibPath -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/intel/gmmlib.git media/gmmlib -cd media/gmmlib -git checkout refs/tags/intel-gmmlib-22.0.1 -git apply $CIV_WORK_DIR/vertical_patches/host/gmmlib/*.patch -mkdir build && cd build -cmake -DCMAKE_INSTALL_PREFIX=$PrefixPath ../ -make -j "$(nproc)" -check_build_error -sudo make install -cd $WrkDir - - -git clone https://github.com/intel/media-driver.git media/media-driver -cd media/media-driver -git checkout refs/tags/intel-media-22.1.1 -git apply $CIV_WORK_DIR/vertical_patches/host/media/media-driver/*.patch -mkdir build_media && cd build_media -cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath -make -j "$(nproc)" -check_build_error -sudo make install -cd $WrkDir -# Create igfx_user_feature.txt -echo "[KEY]" | sudo tee -a /etc/igfx_user_feature.txt -echo " 0x00000001" | sudo tee -a /etc/igfx_user_feature.txt -echo " UFKEY_INTERNAL\LibVa" | sudo tee -a /etc/igfx_user_feature.txt -echo " [VALUE]" | sudo tee -a /etc/igfx_user_feature.txt -echo " Disable MMC" | sudo tee -a /etc/igfx_user_feature.txt -echo " 4" | sudo tee -a /etc/igfx_user_feature.txt -echo " 1" | sudo tee -a /etc/igfx_user_feature.txt -echo " [VALUE]" | sudo tee -a /etc/igfx_user_feature.txt -echo " Enable HCP Scalability Decode" | sudo tee -a /etc/igfx_user_feature.txt -echo " 4" | sudo tee -a /etc/igfx_user_feature.txt -echo " 0" | sudo tee -a /etc/igfx_user_feature.txt -echo "[KEY]" | sudo tee -a /etc/igfx_user_feature.txt -echo " 0x00000002" | sudo tee -a /etc/igfx_user_feature.txt -echo " UFKEY_INTERNAL\Report" | sudo tee -a /etc/igfx_user_feature.txt - - -#onevpl-gpu -git clone https://github.com/oneapi-src/oneVPL-intel-gpu.git media/oneVPL-gpu -cd media/oneVPL-gpu -git checkout refs/tags/intel-onevpl-22.1.0 -git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL-gpu/*.patch - -mkdir build && cd build -cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath -make -j "$(nproc)" -check_build_error -sudo make install -cd $WrkDir - -#onevpl -git clone https://github.com/oneapi-src/oneVPL.git media/oneVPL -cd media/oneVPL -git checkout refs/tags/v2022.0.3 -git apply $CIV_WORK_DIR/vertical_patches/host/media/oneVPL/*.patch -mkdir build && cd build -cmake ../ -DCMAKE_INSTALL_PREFIX=$PrefixPath -make -j "$(nproc)" -check_build_error -sudo make install -cd $WrkDir - - -#gstreamer -git clone https://github.com/GStreamer/gstreamer.git gstreamer/gstreamer -cd gstreamer/gstreamer -git checkout b4ca58df7624b005a33e182a511904d7cceea890 -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/GStreamer/gst-plugins-base.git gstreamer/gst-plugins-base -cd gstreamer/gst-plugins-base -git checkout ce937bcb21412d7b3539a2da0509cc96260562f8 -git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gst-plugins-base/*.patch -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/GStreamer/gst-plugins-good.git gstreamer/gst-plugins-good -cd gstreamer/gst-plugins-good -git checkout 20bbeb5e37666c53c254c7b08470ad8a00d97630 -git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gst-plugins-good/*.patch -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/GStreamer/gst-plugins-bad.git gstreamer/gst-plugins-bad -cd gstreamer/gst-plugins-bad -git checkout ca8068c6d793d7aaa6f2e2cc6324fdedfe2f33fa -git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gst-plugins-bad/*.patch -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -Dmsdk=disabled -Dmfx_api=oneVPL -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/GStreamer/gst-plugins-ugly.git gstreamer/gst-plugins-ugly -cd gstreamer/gst-plugins-ugly -git checkout 499d3cd726a4ca9cbbdd4b4fe9ccdca78ef538ba -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/GStreamer/gstreamer-vaapi.git gstreamer/gstreamer-vaapi -cd gstreamer/gstreamer-vaapi -git checkout c3ddb29cb2860374f9efbed495af7b0eead08312 -git apply $CIV_WORK_DIR/vertical_patches/host/gstreamer/gstreamer-vaapi/*.patch -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -git clone https://github.com/GStreamer/gst-rtsp-server.git gstreamer/gst-rtsp-server -cd gstreamer/gst-rtsp-server -git checkout 0b037e35e7ed3259ca05be748c382bc40e2cdd91 -meson build --prefix=$PrefixPath --libdir=$LibPath -Dgtk_doc=disabled -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir - - -#mesa -git clone https://gitlab.freedesktop.org/mesa/mesa.git graphics/mesa -cd graphics/mesa -git checkout 0e0633ca49425dbc869521cede6a82d2d91c8042 -git apply $CIV_WORK_DIR/vertical_patches/host/graphics/mesa/*.patch -meson build/ --prefix=$PrefixPath -Dgallium-drivers="swrast,iris,kmsro" -Dvulkan-drivers=intel -Ddri-drivers=i965 -ninja -C build && sudo ninja -C build install -check_build_error -cd $WrkDir -# Create mesa_driver.sh -echo "is_vf=\`dmesg | grep \"SR-IOV VF\"\`" | sudo tee -a /etc/profile.d/mesa_driver.sh -echo "if [[ \$is_vf =~ \"VF\" ]]; then" | sudo tee -a /etc/profile.d/mesa_driver.sh -echo " export MESA_LOADER_DRIVER_OVERRIDE=pl111" | sudo tee -a /etc/profile.d/mesa_driver.sh -echo "else" | sudo tee -a /etc/profile.d/mesa_driver.sh -echo " export MESA_LOADER_DRIVER_OVERRIDE=iris" | sudo tee -a /etc/profile.d/mesa_driver.sh -echo "fi" | sudo tee -a /etc/profile.d/mesa_driver.sh - - -#OpenCL -mkdir neo -cd neo -wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-gmmlib_22.0.2_amd64.deb -wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-core_1.0.10409_amd64.deb -wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-opencl_1.0.10409_amd64.deb -wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-opencl-icd_22.10.22597_amd64.deb -wget https://github.com/intel/compute-runtime/releases/download/22.10.22597/intel-level-zero-gpu_1.3.22597_amd64.deb -sudo apt install ocl-icd-libopencl1 -sudo dpkg -i *.deb -cd $WrkDir From d57e10ba73200acaddf0a80b42336a7234c44ecb Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Thu, 30 Jun 2022 13:20:41 +0530 Subject: [PATCH 28/56] Update setup for Ubuntu 22.04 Changes: - removed installation of obsolete python-dev package - replaced swtpm and libtpms installation with default ubuntu packages - added update of apparmor profile for swtpm - added dpkg installation of missing libssl package Tracked-On: Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 55 ++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 51072ba..0bbec00 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -41,7 +41,7 @@ function ubu_changes_require(){ function ubu_install_qemu_gvt(){ sudo apt purge -y "^qemu" sudo apt autoremove -y - sudo apt install -y git libfdt-dev libpixman-1-dev libssl-dev vim socat libsdl2-dev libspice-server-dev autoconf libtool xtightvncviewer tightvncserver x11vnc uuid-runtime uuid uml-utilities bridge-utils python-dev liblzma-dev libc6-dev libegl1-mesa-dev libepoxy-dev libdrm-dev libgbm-dev libaio-dev libusb-1.0-0-dev libgtk-3-dev bison libcap-dev libattr1-dev flex libvirglrenderer-dev build-essential gettext libegl-mesa0 libegl-dev libglvnd-dev libgl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libegl1 gcc g++ pkg-config libpulse-dev libgl1-mesa-dri + sudo apt install -y git libfdt-dev libpixman-1-dev libssl-dev vim socat libsdl2-dev libspice-server-dev autoconf libtool xtightvncviewer tightvncserver x11vnc uuid-runtime uuid uml-utilities bridge-utils liblzma-dev libc6-dev libegl1-mesa-dev libepoxy-dev libdrm-dev libgbm-dev libaio-dev libusb-1.0-0-dev libgtk-3-dev bison libcap-dev libattr1-dev flex libvirglrenderer-dev build-essential gettext libegl-mesa0 libegl-dev libglvnd-dev libgl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libegl1 gcc g++ pkg-config libpulse-dev libgl1-mesa-dri sudo apt install -y ninja-build libcap-ng-dev #Create QEMU_CACHE_DIR if it doesnt exists @@ -403,33 +403,33 @@ function setup_sof() { } function ubu_install_swtpm() { - TPMS_VER=v0.9.0 - TPMS_LIB=libtpms-0.9.0 - SWTPM_VER=v0.7.0 - SWTPM=swtpm-0.7.0 - - #install libtpms - apt-get -y install automake autoconf gawk - [ ! -f $TPMS_VER.tar.gz ] && wget https://github.com/stefanberger/libtpms/archive/$TPMS_VER.tar.gz -P $CIV_WORK_DIR - [ -d $CIV_WORK_DIR/$TPMS_LIB ] && rm -rf $CIV_WORK_DIR/$TPMS_LIB - tar zxvf $CIV_WORK_DIR/$TPMS_VER.tar.gz - cd $CIV_WORK_DIR/$TPMS_LIB - ./autogen.sh --with-tpm2 --with-openssl --prefix=/usr - make -j24 - make -j24 check - make install - cd - + #install libtpms and swtpm + sudo apt-get -y install libtpms-dev swtpm + + #update apparmor profile usr.bin.swtpm + sed -i "s/#include /include /g" /etc/apparmor.d/usr.bin.swtpm + sed -i "s/#include /include /g" /etc/apparmor.d/usr.bin.swtpm + sed -i "s/#include /include \n include /g" /etc/apparmor.d/usr.bin.swtpm + sed -i "s/#include /include /g" /etc/apparmor.d/usr.bin.swtpm + + #update local apparmor profile usr.bin.swtpm + local_swtpm_profile=("owner /home/**/vtpm0/.lock wk," + "owner /home/**/vtpm0/swtpm-sock w," + "owner /home/**/vtpm0/TMP2-00.permall rw," + "owner /home/**/vtpm0/tpm2-00.permall rw,") + + for rule in "${local_swtpm_profile[@]}"; do + if [[ ! `cat /etc/apparmor.d/local/usr.bin.swtpm` =~ "$rule" ]]; then + echo -e "$rule" | sudo tee -a /etc/apparmor.d/local/usr.bin.swtpm + fi + done + reboot_required=1 +} - #install swtpm - apt-get -y install net-tools libseccomp-dev libtasn1-6-dev libgnutls28-dev expect libjson-glib-dev - [ ! -f $SWTPM_VER.tar.gz ] && wget https://github.com/stefanberger/swtpm/archive/$SWTPM_VER.tar.gz -P $CIV_WORK_DIR - [ -d $CIV_WORK_DIR/$SWTPM ] && rm -rf $CIV_WORK_DIR/$SWTPM - tar zxvf $CIV_WORK_DIR/$SWTPM_VER.tar.gz - cd $CIV_WORK_DIR/$SWTPM - ./autogen.sh --with-openssl --prefix=/usr - make -j24 - make install - cd - +function ubu_install_libssl() { + wget -N http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb + sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb + rm libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb } function ubu_update_bt_fw() { @@ -602,6 +602,7 @@ create_aaf_dir prepare_required_scripts ubu_install_swtpm +ubu_install_libssl ubu_update_bt_fw set_sleep_inhibitor From 1f7ad169b65e57a6dbca9befd699bc8b3dd23f14 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Fri, 24 Jun 2022 13:03:44 +0800 Subject: [PATCH 29/56] Use apt repository to install libssl Change: - switched installation of libssl1.1 to use focal apt repository --- scripts/setup_host.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 0bbec00..50723ae 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -427,9 +427,9 @@ function ubu_install_swtpm() { } function ubu_install_libssl() { - wget -N http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb - sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb - rm libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb + sudo add-apt-repository -y 'deb http://security.ubuntu.com/ubuntu focal-security main' + sudo apt-get -y install libssl1.1 + sudo add-apt-repository -y --remove 'deb http://security.ubuntu.com/ubuntu focal-security main' } function ubu_update_bt_fw() { From eb350938199fd583d422e6d03c778ffa0d0abfc8 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Tue, 12 Jul 2022 09:33:22 +0530 Subject: [PATCH 30/56] Add config ini as part of package. Add ini file as part of config and update paths. Tracked-On: Signed-off-by: Suresh, Prashanth --- scripts/setup_civ_ini.sh | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/setup_host.sh | 5 +++++ 2 files changed, 49 insertions(+) create mode 100755 scripts/setup_civ_ini.sh diff --git a/scripts/setup_civ_ini.sh b/scripts/setup_civ_ini.sh new file mode 100755 index 0000000..aab7697 --- /dev/null +++ b/scripts/setup_civ_ini.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Copyright (c) 2022 Intel Corporation. +# All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +set -eE +CIV_WORK_DIR=$(pwd) +USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6) + +function setup_civ_ini() { + filename=$(ls caas-flashfiles*) + sed -i "/^\[global\]$/,/^\[/ s#^name.*#name=civ-sriov#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[global\]$/,/^\[/ s#^flashfiles.*#flashfiles=$CIV_WORK_DIR\/$filename#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[firmware\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR\/OVMF.fd#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[disk\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR\/android.qcow2#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[graphics\]$/,/^\[/ s#^type.*#type=SRIOV#" $USER_HOME/.intel/.civ/civ-sriov.ini + + sed -i "/^\[graphics\]$/,/^\[/ s/^gvtg_version.*/#gvtg_version=/" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[graphics\]$/,/^\[/ s/^vgpu_uuid.*/#vgpu_uuid=/" $USER_HOME/.intel/.civ/civ-sriov.ini + + sed -i "/^\[net\]$/,/^\[/ s/^model.*/#model=/" $USER_HOME/.intel/.civ/civ-sriov.ini + + sed -i "/^\[vtpm\]$/,/^\[/ s#^data_dir.*#data_dir=$CIV_WORK_DIR\/vtpm0#" $USER_HOME/.intel/.civ/civ-sriov.ini + + sed -i "/^\[rpmb\]$/,/^\[/ s#^bin_path.*#bin_path=$CIV_WORK_DIR\/scripts\/rpmb_dev#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[rpmb\]$/,/^\[/ s#^data_dir.*#data_dir=$CIV_WORK_DIR#" $USER_HOME/.intel/.civ/civ-sriov.ini + + sed -i "/^\[aaf\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR/scripts/aaf#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[aaf\]$/,/^\[/ s#^support_suspend.*#support_suspend=disable#" $USER_HOME/.intel/.civ/civ-sriov.ini + + sed -i "/^\[passthrough\]$/,/^\[/ s/^passthrough_pci/#passthrough_pci/" $USER_HOME/.intel/.civ/civ-sriov.ini +} + +function copy_civ_ini() { + mkdir -p $USER_HOME/.intel/.civ/ + cp $CIV_WORK_DIR/scripts/civ-1.ini $USER_HOME/.intel/.civ/civ-sriov.ini + chmod 0666 $USER_HOME/.intel/.civ/civ-sriov.ini +} + +copy_civ_ini +setup_civ_ini + diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 50723ae..dd31456 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -575,6 +575,10 @@ function parse_arg() { done } +function setup_civ_ini() { + $CIV_WORK_DIR/scripts/setup_civ_ini.sh +} + function create_aaf_dir() { mkdir -p $CIV_WORK_DIR/scripts/aaf } @@ -599,6 +603,7 @@ ubu_update_fw install_vm_manager create_aaf_dir +setup_civ_ini prepare_required_scripts ubu_install_swtpm From 108e57d55cfe05841575a87234e05a0ee7576700 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Fri, 19 Aug 2022 17:35:56 +0800 Subject: [PATCH 31/56] Improve apparmor swtpm profile update Change: - updated host setup to load apparmor profile without reboot Change-Id: Ibb19ad436e6b7f96d0370aed2cb8d5ee471a7f51 --- scripts/setup_host.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index dd31456..6c3f9e3 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -423,7 +423,9 @@ function ubu_install_swtpm() { echo -e "$rule" | sudo tee -a /etc/apparmor.d/local/usr.bin.swtpm fi done - reboot_required=1 + #load profile + sudo apparmor_parser -r /etc/apparmor.d/usr.bin.swtpm + } function ubu_install_libssl() { From 1dd3b3573d1494adb1560a4a9a4ff3c2d25703cc Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Mon, 22 Aug 2022 14:44:41 +0800 Subject: [PATCH 32/56] Update logic to add GVT-d grub cmdline Change: - updated logic to add GVT-d grub cmdline only for non-SRIOV case Change-Id: Ia9c7b92580086a43863244133f517dc067280985 --- scripts/setup_host.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 6c3f9e3..b9677a6 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -178,7 +178,9 @@ function install_vm_manager() { } function ubu_enable_host_gvt(){ - if [[ ! `cat /etc/default/grub` =~ "i915.enable_gvt=1" ]]; then + + if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc=0x7 udmabuf.list_limit=8192" ]] && + [[ ! `cat /etc/default/grub` =~ "i915.enable_gvt=1" ]]; then read -p "The grub entry in '/etc/default/grub' will be updated for enabling GVT-g and GVT-d, do you want to continue? [Y/n]" res if [ x$res = xn ]; then return From d44d64b90157f4acf11365a1e15c2d59fe73e3ba Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Thu, 1 Sep 2022 10:18:53 +0530 Subject: [PATCH 33/56] Add v0.7.1 tag for VM-manager Add tag for VM manager so there is not issue later with incompatible versions. Tracked-On: OAM-103724 Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index b9677a6..2c0108a 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -17,6 +17,7 @@ QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" CIV_WORK_DIR=$(pwd) CIV_GOP_DIR=$CIV_WORK_DIR/GOP_PKG CIV_VERTICAl_DIR=$CIV_WORK_DIR/vertical_patches/host +VM_MANAGER_VERSION=v0.7.1 #--------- Functions ------------------- function error() { @@ -159,7 +160,11 @@ function install_vm_manager_deb(){ function install_vm_manager_src() { #Try to build from source code sudo apt-get install --yes make gcc - git clone https://github.com/projectceladon/vm_manager.git || return -1 + if [ ! -z $VM_MANAGER_VERSION ]; then + git clone -b $VM_MANAGER_VERSION --single-branch https://github.com/projectceladon/vm_manager.git + else + git clone https://github.com/projectceladon/vm_manager.git || return -1 + fi cd vm_manager/ make || return -1 sudo make install || return -1 @@ -170,7 +175,7 @@ function install_vm_manager_src() { function install_vm_manager() { sudo apt-get update sudo apt-get install --yes libglib2.0-dev libncurses-dev libuuid1 uuid-dev libjson-c-dev wget lsb-release git - install_vm_manager_deb || install_vm_manager_src + install_vm_manager_src if [ "$?" -ne 0 ]; then echo "Failed to install vm-manager!" echo "Please download and install mannually from: https://github.com/projectceladon/vm_manager/releases/latest" From abde379a9f3f241a749464676e93c767f2a26a63 Mon Sep 17 00:00:00 2001 From: HeYue Date: Mon, 11 Jul 2022 13:58:50 +0800 Subject: [PATCH 34/56] Upgrade the qemu to 7.0 Tracked-On: OAM-102812 Signed-off-by: HeYue Change-Id: I3ecd76dacffc6e6cd778085c9f156546852e4d91 --- scripts/setup_host.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 2c0108a..8a11f27 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -9,7 +9,7 @@ set -eE #--------- Global variable ------------------- reboot_required=0 -QEMU_REL="qemu-6.0.0" +QEMU_REL="qemu-7.0.0" #Directory to keep versions of qemu which can be reused instead of downloading again QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" @@ -108,8 +108,12 @@ function ubu_install_qemu_gvt(){ } function ubu_build_ovmf_gvt(){ + [ -d $CIV_WORK_DIR/edk2 ] && rm -rf $CIV_WORK_DIR/edk2 + sudo apt install -y uuid-dev nasm acpidump iasl - cd $CIV_WORK_DIR/$QEMU_REL/roms/edk2 + git clone https://github.com/tianocore/edk2.git + cd $CIV_WORK_DIR/edk2 + git checkout -b stable202111 edk2-stable202111 patch -p1 < $CIV_WORK_DIR/patches/ovmf/0001-OvmfPkg-add-IgdAssignmentDxe.patch if [ -d $CIV_GOP_DIR ]; then @@ -125,10 +129,12 @@ function ubu_build_ovmf_gvt(){ done fi + git submodule update --init + source ./edksetup.sh make -C BaseTools/ build -b DEBUG -t GCC5 -a X64 -p OvmfPkg/OvmfPkgX64.dsc -D NETWORK_IP4_ENABLE -D NETWORK_ENABLE -D SECURE_BOOT_ENABLE -D TPM_ENABLE - cp Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd ../../../OVMF.fd + cp Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd ../OVMF.fd if [ -d $CIV_GOP_DIR ]; then local gpu_device_id=$(cat /sys/bus/pci/devices/0000:00:02.0/device) From 78eda319b7b3a9b1377e8989fb7df5ef90ce374e Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Thu, 15 Sep 2022 12:51:08 +0800 Subject: [PATCH 35/56] Update host setup to QEMU 7.1 Change: - updated setup_host.sh to install QEMU 7.1 - ensured submodules are updated before patching Change-Id: I0ec881407b9f8ff1ea99858c8887caacf057db94 --- scripts/setup_host.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 8a11f27..52faf6e 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -9,7 +9,7 @@ set -eE #--------- Global variable ------------------- reboot_required=0 -QEMU_REL="qemu-7.0.0" +QEMU_REL="qemu-7.1.0" #Directory to keep versions of qemu which can be reused instead of downloading again QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" @@ -114,6 +114,7 @@ function ubu_build_ovmf_gvt(){ git clone https://github.com/tianocore/edk2.git cd $CIV_WORK_DIR/edk2 git checkout -b stable202111 edk2-stable202111 + git submodule update --init patch -p1 < $CIV_WORK_DIR/patches/ovmf/0001-OvmfPkg-add-IgdAssignmentDxe.patch if [ -d $CIV_GOP_DIR ]; then @@ -129,8 +130,6 @@ function ubu_build_ovmf_gvt(){ done fi - git submodule update --init - source ./edksetup.sh make -C BaseTools/ build -b DEBUG -t GCC5 -a X64 -p OvmfPkg/OvmfPkgX64.dsc -D NETWORK_IP4_ENABLE -D NETWORK_ENABLE -D SECURE_BOOT_ENABLE -D TPM_ENABLE From 15cf00dc421526f387db2a5499457dee798ed154 Mon Sep 17 00:00:00 2001 From: vdanix Date: Tue, 4 Oct 2022 13:40:22 +0530 Subject: [PATCH 36/56] From Horizontal changes taken in start_flash_usb.sh From Master commit "support celadon ISO image flashing in start_flash_usb.sh script" Tracked-On: OAM-104141 Signed-off-by: vdanix --- scripts/start_flash_usb.sh | 47 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/scripts/start_flash_usb.sh b/scripts/start_flash_usb.sh index df2f88d..eb13016 100755 --- a/scripts/start_flash_usb.sh +++ b/scripts/start_flash_usb.sh @@ -7,7 +7,7 @@ WORK_DIR=$PWD -[ $# -lt 1 ] && echo "Usage: $0 caas-flashfiles-eng-.zip" && exit -1 +[ $# -lt 1 ] && echo "Usage: $0 [caas-flashfiles-.zip] [caas-flashfile-.iso] [caas-flashfile-.iso.zip]" && exit -1 if [ -f android.qcow2 ] then @@ -41,25 +41,34 @@ else qemu-img create -f qcow2 android.qcow2 32G fi -[ -d "./flashfiles_decompress" ] && rm -rf "./flashfiles_decompress" -mkdir ./flashfiles_decompress -unzip $1 -d ./flashfiles_decompress +decompress=flashfiles_decompress +zip_file=$(file $1 | grep -i "Zip archive data") +if [[ $zip_file != "" ]]; then + rm -rf "$decompress" && mkdir $decompress + unzip $1 -d $decompress -G_size=$((1<<32)) -for i in `ls ./flashfiles_decompress`;do - if [ -f "./flashfiles_decompress/"$i ] && [ "`grep $i ./flashfiles_decompress/installer.cmd`" ]; then - size=$(stat -c %s "./flashfiles_decompress/"$i) - if [[ $size -gt $G_size ]]; then - echo "Split $i due to its size bigger than 4G\n" - split --bytes=$((G_size-1)) --numeric-suffixes "./flashfiles_decompress/"$i "./flashfiles_decompress/"$i.part - rm "./flashfiles_decompress/"$i - fi - fi -done + if [[ -f $decompress/boot.img ]]; then + G_size=$((1<<32)) + for i in `ls $decompress`; do + size=$(stat -c %s "$decompress/"$i) + if [[ $size -gt $G_size ]]; then + echo "Split $i due to its size bigger than 4G" + split --bytes=$((G_size-1)) --numeric-suffixes "$decompress/"$i "$decompress/"$i.part + rm "$decompress/"$i + fi + done -dd if=/dev/zero of=./flash.vfat bs=63M count=160 -mkfs.vfat ./flash.vfat -mcopy -i flash.vfat flashfiles_decompress/* :: + dd if=/dev/zero of=./flash.vfat bs=63M count=160 + mkfs.vfat ./flash.vfat + mcopy -i flash.vfat $decompress/* :: + + virt_disk=flash.vfat + else + virt_disk=$decompress/`ls $decompress` + fi +else + virt_disk=$1 +fi if [ "$support_dedicated_data" = true ] then @@ -90,7 +99,7 @@ qemu-system-x86_64 \ -chardev socket,id=charserial0,path=./kernel-console,server=on,wait=off \ -device isa-serial,chardev=charserial0,id=serial0 \ -device qemu-xhci,id=xhci,addr=0x5 \ - -drive file=./flash.vfat,id=udisk1,format=raw,if=none \ + -drive file=$virt_disk,id=udisk1,format=raw,if=none \ -device usb-storage,drive=udisk1,bus=xhci.0 \ -device virtio-scsi-pci,id=scsi0,addr=0x8 \ -drive file=./android.qcow2,if=none,format=qcow2,id=scsidisk1 \ From 180f2746a2870f707315d2ac4c741273cd6ca442 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Wed, 14 Dec 2022 09:55:53 +0800 Subject: [PATCH 37/56] Fix logic to display gvt prompt Changes: - improved string matching to handle both hex and decimal - retained only SRIOV setting in string match Change-Id: I126d013b250d847ea80ed5788cd8a28c950a2409 --- scripts/setup_host.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 52faf6e..64f2f70 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -189,8 +189,9 @@ function install_vm_manager() { function ubu_enable_host_gvt(){ - if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc=0x7 udmabuf.list_limit=8192" ]] && + if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc="(0x)?0*"7" ]] && [[ ! `cat /etc/default/grub` =~ "i915.enable_gvt=1" ]]; then + read -p "The grub entry in '/etc/default/grub' will be updated for enabling GVT-g and GVT-d, do you want to continue? [Y/n]" res if [ x$res = xn ]; then return From 39c845dc9bbd03a9316f02d7e9f6e8d0c1357cb1 Mon Sep 17 00:00:00 2001 From: Basil Chew Date: Mon, 30 Jan 2023 11:09:23 +0800 Subject: [PATCH 38/56] Update SRIOV QEMU patching Changes: - added patching for SRIOV QEMU CVE patches - updated SRIOV QEMU patch path Change-Id: Iae178053579f93b9a15c034e37946ef78481c9a4 --- scripts/setup_host.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 64f2f70..be389c8 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -71,9 +71,17 @@ function ubu_install_qemu_gvt(){ for i in $CIV_GOP_DIR/qemu/*.patch; do patch -p1 < $i; done fi - sriov_qemu_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/*.patch 2> /dev/null | wc -l) + sriov_qemu_cve_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/cve/*.patch 2> /dev/null | wc -l) + if [ "$sriov_qemu_cve_patch_num" != "0" ]; then + for i in $CIV_WORK_DIR/sriov_patches/qemu/cve/*.patch; do + echo "applying qemu patch $i" + patch -p1 < $i + done + fi + + sriov_qemu_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/qemu/*.patch 2> /dev/null | wc -l) if [ "$sriov_qemu_patch_num" != "0" ]; then - for i in $CIV_WORK_DIR/sriov_patches/qemu/*.patch; do + for i in $CIV_WORK_DIR/sriov_patches/qemu/qemu/*.patch; do echo "applying qemu patch $i" patch -p1 < $i done From f457dbb7d704211c36a3571bdfcc098725f7dbc8 Mon Sep 17 00:00:00 2001 From: vdanix Date: Tue, 7 Feb 2023 13:26:22 +0530 Subject: [PATCH 39/56] Remove user prompts from host setup Changes: - removed prompt to update QEMU - removed prompt to update grub - removed prompt for reboot Tracked-On: OAM-105716 Signed-off-by: vdanix --- scripts/setup_host.sh | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index be389c8..3a29e0d 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -29,10 +29,6 @@ function error() { function ubu_changes_require(){ echo "Please make sure your apt is working" echo "If you run the installation first time, reboot is required" - read -p "QEMU version will be replaced (it could be recovered by 'apt purge ^qemu, apt install qemu'), do you want to continue? [Y/n]" res - if [ x$res = xn ]; then - return 1 - fi sudo apt install -y wget mtools ovmf dmidecode python3-usb python3-pyudev pulseaudio jq # Install libs for vm-manager @@ -200,10 +196,6 @@ function ubu_enable_host_gvt(){ if [[ ! `cat /etc/default/grub` =~ "i915.enable_guc="(0x)?0*"7" ]] && [[ ! `cat /etc/default/grub` =~ "i915.enable_gvt=1" ]]; then - read -p "The grub entry in '/etc/default/grub' will be updated for enabling GVT-g and GVT-d, do you want to continue? [Y/n]" res - if [ x$res = xn ]; then - return - fi if [[ ! `cat /etc/default/grub` =~ "intel_iommu=on i915.force_probe=*" ]]; then sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"intel_iommu=on i915.force_probe=* /g" /etc/default/grub fi @@ -308,12 +300,7 @@ function check_sriov_setup() { function ask_reboot(){ if [ $reboot_required -eq 1 ];then - read -p "Reboot is required, do you want to reboot it NOW? [y/N]" res - if [ x$res = xy ]; then - reboot - else - echo "Please reboot system later to take effect" - fi + echo "Please reboot system to take effect" fi } From 3906ecea7dc59fdadba8cfb55b6f14b069f5d2c3 Mon Sep 17 00:00:00 2001 From: vdanix Date: Wed, 1 Mar 2023 13:32:06 +0530 Subject: [PATCH 40/56] VM_MANAGER_VERSION change to celadon/s/mr0/stable in setup_host.sh Fix for s/w to h/w codec in vertical build. Tracked-On: OAM-106631 --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 3a29e0d..e338cb6 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -17,7 +17,7 @@ QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" CIV_WORK_DIR=$(pwd) CIV_GOP_DIR=$CIV_WORK_DIR/GOP_PKG CIV_VERTICAl_DIR=$CIV_WORK_DIR/vertical_patches/host -VM_MANAGER_VERSION=v0.7.1 +VM_MANAGER_VERSION=celadon/s/mr0/stable #--------- Functions ------------------- function error() { From 18305ded45b5415a19e1c59085399e93eb41d4c2 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Mon, 13 Mar 2023 16:17:27 +0530 Subject: [PATCH 41/56] Skip QEMU installation for RPL-P during host setup. --bsp to be passed as an argument when running on RPL-P. Eg. sudo -E ./scripts/setup_host.sh --bsp Tracked-On: OAM-106817 Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index e338cb6..cc697a8 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -10,6 +10,7 @@ set -eE #--------- Global variable ------------------- reboot_required=0 QEMU_REL="qemu-7.1.0" +skip_install_qemu=false #Directory to keep versions of qemu which can be reused instead of downloading again QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" @@ -36,6 +37,10 @@ function ubu_changes_require(){ } function ubu_install_qemu_gvt(){ + if [ $skip_install_qemu = true ]; then + echo "Skip ubu_install_qemu_gvt" + return + fi sudo apt purge -y "^qemu" sudo apt autoremove -y sudo apt install -y git libfdt-dev libpixman-1-dev libssl-dev vim socat libsdl2-dev libspice-server-dev autoconf libtool xtightvncviewer tightvncserver x11vnc uuid-runtime uuid uml-utilities bridge-utils liblzma-dev libc6-dev libegl1-mesa-dev libepoxy-dev libdrm-dev libgbm-dev libaio-dev libusb-1.0-0-dev libgtk-3-dev bison libcap-dev libattr1-dev flex libvirglrenderer-dev build-essential gettext libegl-mesa0 libegl-dev libglvnd-dev libgl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libegl1 gcc g++ pkg-config libpulse-dev libgl1-mesa-dri @@ -571,6 +576,10 @@ function parse_arg() { shift ;; + --bsp) + skip_install_qemu=true + ;; + -?*) echo "Error: Invalid option $1" show_help From 9a7ab9adc89135532813c936ffb983259afa44cb Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Wed, 5 Apr 2023 14:19:14 +0530 Subject: [PATCH 42/56] Add parameters to config ini to support HPD feature. Add display related featured for HPD support on Android. Tracked-On: --- sample/guest01.ini | 7 +++++++ scripts/setup_host.sh | 1 + 2 files changed, 8 insertions(+) diff --git a/sample/guest01.ini b/sample/guest01.ini index 0542a20..4ea3b73 100644 --- a/sample/guest01.ini +++ b/sample/guest01.ini @@ -71,6 +71,13 @@ support_suspend=enable #making audio passthrough for guest. In all other cases use "legacy-hda" only. audio_type=legacy-hda +#"show_fps" should be set to "on" if FPS is to be displayed. It can be set to "off" +#if not required. +[display] +#connectors.0= +#connectors.1= +#show_fps= + [passthrough] #specified the PCI id here if you want to passthrough it to guest, seperate them with comma passthrough_pci=0000:00:14.0, diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index cc697a8..3df928e 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -180,6 +180,7 @@ function install_vm_manager_src() { git clone https://github.com/projectceladon/vm_manager.git || return -1 fi cd vm_manager/ + git apply $CIV_WORK_DIR/vertical_patches/host/vm-manager/*.patch make || return -1 sudo make install || return -1 cd - From 7e4a3fa9945c3febdac12610fd4cc4a40fc7039e Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Fri, 28 Apr 2023 22:02:00 +0530 Subject: [PATCH 43/56] Move vm-manager to v1.2.3. Upgrade vm-manager to latest release. Tracked-On: --- sample/guest01.ini | 4 ++-- scripts/setup_host.sh | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sample/guest01.ini b/sample/guest01.ini index 4ea3b73..225402a 100644 --- a/sample/guest01.ini +++ b/sample/guest01.ini @@ -74,8 +74,8 @@ audio_type=legacy-hda #"show_fps" should be set to "on" if FPS is to be displayed. It can be set to "off" #if not required. [display] -#connectors.0= -#connectors.1= +#connectors_0= +#connectors_1= #show_fps= [passthrough] diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 3df928e..0c1e0a1 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -18,7 +18,7 @@ QEMU_CACHE_DIR="$HOME/.cache/civ/qemu" CIV_WORK_DIR=$(pwd) CIV_GOP_DIR=$CIV_WORK_DIR/GOP_PKG CIV_VERTICAl_DIR=$CIV_WORK_DIR/vertical_patches/host -VM_MANAGER_VERSION=celadon/s/mr0/stable +VM_MANAGER_VERSION=v1.2.3 #--------- Functions ------------------- function error() { @@ -179,11 +179,14 @@ function install_vm_manager_src() { else git clone https://github.com/projectceladon/vm_manager.git || return -1 fi + sudo apt install -y cmake cd vm_manager/ git apply $CIV_WORK_DIR/vertical_patches/host/vm-manager/*.patch - make || return -1 - sudo make install || return -1 - cd - + mkdir build && cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + cmake --build . --config Release + cp src/vm-manager /usr/bin/ + cd $CIV_WORK_DIR rm -rf vm_manager/ } From ab3713a7ec520aa4016bcf8848644457bc4f2598 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Thu, 1 Jun 2023 19:31:04 +0530 Subject: [PATCH 44/56] Add parameter to disable host input. Tracked-On: Signed-off-by: Suresh, Prashanth --- sample/guest01.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/sample/guest01.ini b/sample/guest01.ini index 225402a..d2c687d 100644 --- a/sample/guest01.ini +++ b/sample/guest01.ini @@ -77,6 +77,7 @@ audio_type=legacy-hda #connectors_0= #connectors_1= #show_fps= +#disable_host_input=no [passthrough] #specified the PCI id here if you want to passthrough it to guest, seperate them with comma From 243e7cc03446b0a766082c759114c52be58122cd Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Wed, 28 Jun 2023 12:11:34 +0530 Subject: [PATCH 45/56] Multi Android VM support Tracked-On: OAM-110639 Signed-off-by: Suresh, Prashanth --- scripts/setup_civ_ini.sh | 47 ++++++++++-- scripts/setup_host.sh | 51 +++++++++++-- scripts/setup_multi_civ_vm.sh | 137 ++++++++++++++++++++++++++++++++++ scripts/start_flash_usb.sh | 22 +++++- 4 files changed, 239 insertions(+), 18 deletions(-) create mode 100755 scripts/setup_multi_civ_vm.sh diff --git a/scripts/setup_civ_ini.sh b/scripts/setup_civ_ini.sh index aab7697..2701194 100755 --- a/scripts/setup_civ_ini.sh +++ b/scripts/setup_civ_ini.sh @@ -8,29 +8,38 @@ set -eE CIV_WORK_DIR=$(pwd) USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6) +VSOCK_ID=3 +VM_NAME=Android-CIV +ADB_PORT=5555 +FASTBOOT_PORT=5554 function setup_civ_ini() { filename=$(ls caas-flashfiles*) - sed -i "/^\[global\]$/,/^\[/ s#^name.*#name=civ-sriov#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[global\]$/,/^\[/ s#^name.*#name=$VM_NAME#" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[global\]$/,/^\[/ s#^flashfiles.*#flashfiles=$CIV_WORK_DIR\/$filename#" $USER_HOME/.intel/.civ/civ-sriov.ini - sed -i "/^\[firmware\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR\/OVMF.fd#" $USER_HOME/.intel/.civ/civ-sriov.ini - sed -i "/^\[disk\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR\/android.qcow2#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[global\]$/,/^\[/ s#^vsock_cid.*#vsock_cid=$VSOCK_ID#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[firmware\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR\/$VM_NAME\/OVMF.fd#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[disk\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR\/$VM_NAME\/android.qcow2#" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[graphics\]$/,/^\[/ s#^type.*#type=SRIOV#" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[graphics\]$/,/^\[/ s/^gvtg_version.*/#gvtg_version=/" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[graphics\]$/,/^\[/ s/^vgpu_uuid.*/#vgpu_uuid=/" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[net\]$/,/^\[/ s/^model.*/#model=/" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[net\]$/,/^\[/ s/^adb_port.*/adb_port=$ADB_PORT/" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[net\]$/,/^\[/ s/^fastboot_port.*/fastboot_port=$((ADB_PORT+1))/" $USER_HOME/.intel/.civ/civ-sriov.ini - sed -i "/^\[vtpm\]$/,/^\[/ s#^data_dir.*#data_dir=$CIV_WORK_DIR\/vtpm0#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[vtpm\]$/,/^\[/ s#^data_dir.*#data_dir=$CIV_WORK_DIR\/$VM_NAME\/vtpm0#" $USER_HOME/.intel/.civ/civ-sriov.ini - sed -i "/^\[rpmb\]$/,/^\[/ s#^bin_path.*#bin_path=$CIV_WORK_DIR\/scripts\/rpmb_dev#" $USER_HOME/.intel/.civ/civ-sriov.ini - sed -i "/^\[rpmb\]$/,/^\[/ s#^data_dir.*#data_dir=$CIV_WORK_DIR#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[rpmb\]$/,/^\[/ s#^bin_path.*#bin_path=$CIV_WORK_DIR\/$VM_NAME\/scripts\/rpmb_dev#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[rpmb\]$/,/^\[/ s#^data_dir.*#data_dir=$CIV_WORK_DIR\/$VM_NAME#" $USER_HOME/.intel/.civ/civ-sriov.ini - sed -i "/^\[aaf\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR/scripts/aaf#" $USER_HOME/.intel/.civ/civ-sriov.ini + sed -i "/^\[aaf\]$/,/^\[/ s#^path.*#path=$CIV_WORK_DIR/$VM_NAME/scripts/aaf#" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[aaf\]$/,/^\[/ s#^support_suspend.*#support_suspend=disable#" $USER_HOME/.intel/.civ/civ-sriov.ini sed -i "/^\[passthrough\]$/,/^\[/ s/^passthrough_pci/#passthrough_pci/" $USER_HOME/.intel/.civ/civ-sriov.ini + + mv $USER_HOME/.intel/.civ/civ-sriov.ini $USER_HOME/.intel/.civ/$VM_NAME.ini } function copy_civ_ini() { @@ -39,6 +48,30 @@ function copy_civ_ini() { chmod 0666 $USER_HOME/.intel/.civ/civ-sriov.ini } +function read_args() { + while [[ $# -gt 0 ]]; do + case $1 in + -v) + VSOCK_ID=$2 + shift + ;; + + -p) + ADB_PORT=$2 + shift + ;; + + -n) + VM_NAME=$2 + shift + ;; + esac + shift + done +} + +read_args "$@" + copy_civ_ini setup_civ_ini diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 0c1e0a1..60bb206 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -19,6 +19,10 @@ CIV_WORK_DIR=$(pwd) CIV_GOP_DIR=$CIV_WORK_DIR/GOP_PKG CIV_VERTICAl_DIR=$CIV_WORK_DIR/vertical_patches/host VM_MANAGER_VERSION=v1.2.3 +VSOCK_ID=3 +VM_NAME=Android-CIV1 +ADB_PORT=5555 +USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6) #--------- Functions ------------------- function error() { @@ -567,6 +571,11 @@ function parse_arg() { shift ;; + -n) + VM_NAME=$2 + shift + ;; + -t) start_thermal_daemon || return -1 ;; @@ -599,13 +608,40 @@ function parse_arg() { } function setup_civ_ini() { - $CIV_WORK_DIR/scripts/setup_civ_ini.sh + $CIV_WORK_DIR/scripts/setup_civ_ini.sh -v $1 -p $2 -n $3 +} + +function create_vm_dir() { + if [ -d $CIV_WORK_DIR/$VM_NAME ] + then + echo "Folder with name $VM_NAME already present. Delete and create new folder? Please enter yes/no" + read input + if [ $input = "yes" ]; then + rm -rf $CIV_DIR/$VM_NAME + else + exit + fi + fi + echo "Creating Dir: $CIV_WORK_DIR/$VM_NAME" + mkdir $CIV_WORK_DIR/$VM_NAME } -function create_aaf_dir() { - mkdir -p $CIV_WORK_DIR/scripts/aaf -} +function copy_files_for_vm() { + echo "Copying file: $CIV_WORK_DIR/$VM_NAME" + mkdir -p $CIV_WORK_DIR/$VM_NAME/scripts/aaf + req_files=("$CIV_WORK_DIR/OVMF.fd" + "$CIV_WORK_DIR/scripts/rpmb_dev") + for file in ${req_files[@]}; do + if [ ! -f $file ]; then + echo "Error: $file file is missing" + exit -1 + fi + done + + cp $CIV_WORK_DIR/OVMF.fd $CIV_WORK_DIR/$VM_NAME/ + cp $CIV_WORK_DIR/scripts/rpmb_dev $CIV_WORK_DIR/$VM_NAME/scripts/ +} #------------- main processes ------------- @@ -623,10 +659,11 @@ ubu_install_qemu_gvt ubu_build_ovmf_gvt ubu_enable_host_gvt ubu_update_fw - install_vm_manager -create_aaf_dir -setup_civ_ini + +create_vm_dir +setup_civ_ini $VSOCK_ID $ADB_PORT $VM_NAME +copy_files_for_vm prepare_required_scripts ubu_install_swtpm diff --git a/scripts/setup_multi_civ_vm.sh b/scripts/setup_multi_civ_vm.sh new file mode 100755 index 0000000..3b5b14e --- /dev/null +++ b/scripts/setup_multi_civ_vm.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +# Copyright (c) 2023 Intel Corporation. +# All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +set -eE + +#--------- Global variable ------------------- +CIV_DIR=$(pwd) +USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6) +VM_NAME=Android-CIV +NUMBER_OF_VM=1 +ADB_PORT=5555 +INITIAL_VM_NUM=1 +SETUP_HOST_DONE=false + +function copy_files_for_vm_flashing() { + mkdir -p $CIV_DIR/$3/scripts/aaf + + req_files=("$CIV_DIR/OVMF.fd" + "$CIV_DIR/scripts/rpmb_dev") + for file in ${req_files[@]}; do + if [ ! -f $file ]; then + echo "Error: $file file is missing" + exit -1 + fi + done + + cp $CIV_DIR/OVMF.fd $CIV_DIR/$3/ + cp $CIV_DIR/scripts/rpmb_dev $CIV_DIR/$3/scripts/ +} + +function create_vm_dirs() { + mkdir $CIV_DIR/$3 + $CIV_DIR/scripts/setup_civ_ini.sh -v $1 -p $2 -n $3 +} + + +function create_vms() { + create_vm_dirs $1 $2 $3 + copy_files_for_vm_flashing $1 $2 $3 +} + +function setup_files() { + echo "Creating setup for VMs" + if [ -d $USER_HOME/.intel/.civ ] + then + SETUP_HOST_DONE=true + fi + + new_dir=$CIV_DIR/$VM_NAME + if [ -n "$(ls -d ${new_dir}? 2> /dev/null )" ]; then + dir_arr=$(ls -d ${new_dir}?) + directories=( $dir_arr ) + last_vm=${directories[-1]} + final_vm_name="${last_vm##*/}" + last_character=${final_vm_name: -1} + last_character=$((last_character+1)) + INITIAL_VM_NUM=$last_character + fi + + for (( i=$INITIAL_VM_NUM; i<$NUMBER_OF_VM+$INITIAL_VM_NUM; i++ )) + do + if [ $SETUP_HOST_DONE = false ]; then + echo "Error: Please ensure setup_host.sh has been run successfully first" + exit -1 + else + create_vms $((i+2)) $((ADB_PORT+((i-1)*2))) ${VM_NAME}${i} + fi + done +} + +function copy_files_for_vm() { + if [ -f "$CIV_DIR/$VM_NAME$INITIAL_VM_NUM/android.qcow2" ]; then + cp $CIV_DIR/$VM_NAME$INITIAL_VM_NUM/android.qcow2 $CIV_DIR/$VM_NAME$1 + else + echo "android.qcow2 missing. Please run setup_host.sh, start_flash_usb.sh and try again" + exit + fi + + if [ -d "$CIV_DIR/$VM_NAME$INITIAL_VM_NUM/vtpm0" ]; then + cp -r $CIV_DIR/$VM_NAME$INITIAL_VM_NUM/vtpm0 $CIV_DIR/$VM_NAME$1 + else + echo "vtpm0 missing. Please run setup_host.sh, start_flash_usb.sh and try again" + exit + fi +} + +function flash_vms() { + echo "Flashing VMs" + if [ -f caas-flashfiles-*.zip ]; then + ./scripts/start_flash_usb.sh caas-flashfiles-*.zip --display-off -n $VM_NAME$INITIAL_VM_NUM + else + echo "flashfiles missing. Please download and unzip the package correctly." + exit -1 + fi + + for (( i=$INITIAL_VM_NUM+1; i<$NUMBER_OF_VM+$INITIAL_VM_NUM; i++ )) + do + copy_files_for_vm $i + echo "Flashed ${VM_NAME}${i}" + done +} + +function show_help() { + printf "Creates CIV guests under folder Android-CIVx, where x is the guest number.\n" + printf "Usage: \n" + printf "$(basename "$0") [-c] \n" + printf "Options:\n" + printf "\t-h show this help message\n" + printf "\t-c specify number of Android guests to be newly created. Default is 1.\n" +} + +function parse_args() { + while [[ $# -gt 0 ]]; do + case $1 in + -c) + NUMBER_OF_VM=$2 + shift + ;; + + -h|-\?|--help) + show_help + exit + ;; + + esac + shift + done +} + +parse_args "$@" +setup_files +flash_vms +echo "Done: \"$(realpath $0) $@\"" diff --git a/scripts/start_flash_usb.sh b/scripts/start_flash_usb.sh index eb13016..a4e851f 100755 --- a/scripts/start_flash_usb.sh +++ b/scripts/start_flash_usb.sh @@ -5,7 +5,21 @@ # # SPDX-License-Identifier: Apache-2.0 -WORK_DIR=$PWD +WORK_DIR=$PWD/Android-CIV1 + +function parse_args() { + while [[ $# -gt 0 ]]; do + case $1 in + -n) + WORK_DIR=$PWD/$2 + shift + ;; + esac + shift + done +} + +parse_args "$@" [ $# -lt 1 ] && echo "Usage: $0 [caas-flashfiles-.zip] [caas-flashfile-.iso] [caas-flashfile-.iso.zip]" && exit -1 @@ -36,9 +50,9 @@ done if [ "$support_dedicated_data" = true ] then - qemu-img create -f qcow2 android.qcow2 8500M + qemu-img create -f qcow2 $WORK_DIR/android.qcow2 8500M else - qemu-img create -f qcow2 android.qcow2 32G + qemu-img create -f qcow2 $WORK_DIR/android.qcow2 32G fi decompress=flashfiles_decompress @@ -102,7 +116,7 @@ qemu-system-x86_64 \ -drive file=$virt_disk,id=udisk1,format=raw,if=none \ -device usb-storage,drive=udisk1,bus=xhci.0 \ -device virtio-scsi-pci,id=scsi0,addr=0x8 \ - -drive file=./android.qcow2,if=none,format=qcow2,id=scsidisk1 \ + -drive file=$WORK_DIR/android.qcow2,if=none,format=qcow2,id=scsidisk1 \ -device scsi-hd,drive=scsidisk1,bus=scsi0.0 \ -drive file=$ovmf_file,format=raw,if=pflash \ -no-reboot \ From 1be6bbaf47f465b5923c6220714583765aad11d0 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Sun, 23 Jul 2023 23:08:16 +0530 Subject: [PATCH 46/56] Upgrade QEMU to 8.0.0 Tracked-On: OAM-111335 Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 60bb206..d64b309 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -9,7 +9,7 @@ set -eE #--------- Global variable ------------------- reboot_required=0 -QEMU_REL="qemu-7.1.0" +QEMU_REL="qemu-8.0.0" skip_install_qemu=false #Directory to keep versions of qemu which can be reused instead of downloading again From 7039e4c5f751c45009b3fcb4e87f457507416d0a Mon Sep 17 00:00:00 2001 From: "Kothapeta, BikshapathiX" Date: Thu, 17 Aug 2023 19:36:33 +0530 Subject: [PATCH 47/56] Fix TPM error failure fix for NVIndex failure Multi Android VM support TPM error failure fix for NVIndex failure Tracked-On: OAM-111783 Signed-off-by: Kothapeta, BikshapathiX --- scripts/start_flash_usb.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/start_flash_usb.sh b/scripts/start_flash_usb.sh index a4e851f..7e78ab7 100755 --- a/scripts/start_flash_usb.sh +++ b/scripts/start_flash_usb.sh @@ -126,4 +126,14 @@ qemu-system-x86_64 \ -tpmdev emulator,id=tpm0,chardev=chrtpm \ -device tpm-crb,tpmdev=tpm0 \ +if [ -f $WORK_DIR/../OVMF.fd ] ; then + if [ "$(md5sum $WORK_DIR/../OVMF.fd|awk '{print $1}')" != "$(md5sum $WORK_DIR/OVMF.fd|awk '{print $1}')" ]; then + cp $WORK_DIR/../OVMF.fd $WORK_DIR/ + else + echo "CheckSum matches skipping" + fi +else + echo "Error OVMF.fd file is missing" +fi + echo "Flashing is completed" From 8c1517d224719543d960954030bfa5467ee6fa21 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Wed, 13 Sep 2023 15:30:04 +0530 Subject: [PATCH 48/56] Fix pip3 version error. Pick pip version and set sleep inhibitor service. Tracked-On: OAM-112216 Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index d64b309..cd8166f 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -512,22 +512,24 @@ function ubu_update_wifi_fw(){ function set_sleep_inhibitor() { sudo apt-get -y install python3-pip sudo pip3 install -U sleep-inhibitor - sudo sed -i 's/\/usr\/bin\/%p/\/usr\/local\/bin\/%p/' /usr/local/share/sleep-inhibitor/sleep-inhibitor.service + + pythonversion="$(pip3 --version | grep -Po '^.*\(\K[^\)]*' | grep -Po '^.*\ \K[^\\n]*')" + sudo sed -i 's/\/usr\/bin\/%p/\/usr\/local\/bin\/%p/' /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/sleep-inhibitor.service #Download the plugin if not already sudo echo "#! /bin/sh if adb get-state 1>/dev/null 2>&1 then state=\$(adb shell dumpsys power | grep -oE 'WAKE_LOCK') - if echo \"\$state\" | grep 'WAKE_LOCK'; then + if echo \"\$state\" | grep 'WAKE_LOCK'; then exit 254 else exit 0 fi else exit 0 -fi" > /usr/local/share/sleep-inhibitor/plugins/is-wakelock-active - sudo chmod a+x /usr/local/share/sleep-inhibitor/plugins/is-wakelock-active - sudo cp /usr/local/share/sleep-inhibitor/sleep-inhibitor.conf /etc/. +fi" > /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/plugins/is-wakelock-active + sudo chmod a+x /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/plugins/is-wakelock-active + sudo cp /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/sleep-inhibitor.conf /etc/. sudo echo "plugins: #Inhibit sleep if wakelock is held - path: is-wakelock-active @@ -535,7 +537,7 @@ fi" > /usr/local/share/sleep-inhibitor/plugins/is-wakelock-active what: sleep period: 0.01" > /etc/sleep-inhibitor.conf sudo sed -i 's/#*HandleSuspendKey=\w*/HandleSuspendKey=suspend/' /etc/systemd/logind.conf - sudo cp /usr/local/share/sleep-inhibitor/sleep-inhibitor.service /etc/systemd/system/. + sudo cp /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/sleep-inhibitor.service /etc/systemd/system/. reboot_required=1 } From 41f28386435f68d3178edff1b73d1b3a519caa11 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Thu, 14 Sep 2023 10:07:49 +0530 Subject: [PATCH 49/56] Fix setup_host re-run issues - Fix bugs in vm-manager installation - Handle Android-CIV folder creation failure Tracked-On: OAM-112228 Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index cd8166f..dfa8cf8 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -177,6 +177,10 @@ function install_vm_manager_deb(){ function install_vm_manager_src() { #Try to build from source code + if [ -d $CIV_WORK_DIR/vm_manager ] + then + rm -rf $CIV_WORK_DIR/vm_manager + fi sudo apt-get install --yes make gcc if [ ! -z $VM_MANAGER_VERSION ]; then git clone -b $VM_MANAGER_VERSION --single-branch https://github.com/projectceladon/vm_manager.git @@ -619,7 +623,7 @@ function create_vm_dir() { echo "Folder with name $VM_NAME already present. Delete and create new folder? Please enter yes/no" read input if [ $input = "yes" ]; then - rm -rf $CIV_DIR/$VM_NAME + rm -rf $CIV_WORK_DIR/$VM_NAME else exit fi From f1cebb5f286c4fa6e20971fc00505ddf622f1328 Mon Sep 17 00:00:00 2001 From: "Suresh, Prashanth" Date: Wed, 27 Sep 2023 19:18:41 +0530 Subject: [PATCH 50/56] Remove firmware update as it is part of kernel. Firmware update is not necessary as GuC, HuC and DMC are part of host kernel. Tracked-On: OAM-112288 Signed-off-by: Suresh, Prashanth --- scripts/setup_host.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index dfa8cf8..f675266 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -664,7 +664,6 @@ ubu_changes_require ubu_install_qemu_gvt ubu_build_ovmf_gvt ubu_enable_host_gvt -ubu_update_fw install_vm_manager create_vm_dir From 6f4df7aa7720b15b2f56a33b4032f4b45d9c6ebc Mon Sep 17 00:00:00 2001 From: celadon Date: Thu, 15 Feb 2024 12:05:06 +0000 Subject: [PATCH 51/56] Revert "Update SRIOV QEMU patching" This reverts commit e8bade5aab76029c0cd69c20915da3940050d0ee. Tracked-On: OAM-115627 Signed-off-by: vdanix --- scripts/setup_host.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index f675266..ac8d820 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -76,17 +76,9 @@ function ubu_install_qemu_gvt(){ for i in $CIV_GOP_DIR/qemu/*.patch; do patch -p1 < $i; done fi - sriov_qemu_cve_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/cve/*.patch 2> /dev/null | wc -l) - if [ "$sriov_qemu_cve_patch_num" != "0" ]; then - for i in $CIV_WORK_DIR/sriov_patches/qemu/cve/*.patch; do - echo "applying qemu patch $i" - patch -p1 < $i - done - fi - - sriov_qemu_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/qemu/*.patch 2> /dev/null | wc -l) + sriov_qemu_patch_num=$(ls $CIV_WORK_DIR/sriov_patches/qemu/*.patch 2> /dev/null | wc -l) if [ "$sriov_qemu_patch_num" != "0" ]; then - for i in $CIV_WORK_DIR/sriov_patches/qemu/qemu/*.patch; do + for i in $CIV_WORK_DIR/sriov_patches/qemu/*.patch; do echo "applying qemu patch $i" patch -p1 < $i done From c7cbeb585a202c32cdc9be10752fe36bdb3b2911 Mon Sep 17 00:00:00 2001 From: Prashanth Suresh Date: Wed, 27 Mar 2024 13:49:33 +0000 Subject: [PATCH 52/56] Upgrade QEMU to 8.2.1 Upgrade QEMU version to 8.2.1 --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index ac8d820..ea3c1d2 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -9,7 +9,7 @@ set -eE #--------- Global variable ------------------- reboot_required=0 -QEMU_REL="qemu-8.0.0" +QEMU_REL="qemu-8.2.1" skip_install_qemu=false #Directory to keep versions of qemu which can be reused instead of downloading again From 1db473660a1b9f02aa4e670689cbb0613d06c16d Mon Sep 17 00:00:00 2001 From: Prashanth Suresh Date: Mon, 8 Apr 2024 06:57:58 +0000 Subject: [PATCH 53/56] Enable support for HW Spcie Enable HW Spice support for Android through vm-manager --- sample/guest01.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sample/guest01.ini b/sample/guest01.ini index d2c687d..afd9c14 100644 --- a/sample/guest01.ini +++ b/sample/guest01.ini @@ -79,6 +79,12 @@ audio_type=legacy-hda #show_fps= #disable_host_input=no +#Set hw_spice=true to view VM over HW Spice. false by default. Please add IP address and +#port for Spice display to work +#hw_spice=true +#ip_addr=10.49.4.30 +#port=3001 + [passthrough] #specified the PCI id here if you want to passthrough it to guest, seperate them with comma passthrough_pci=0000:00:14.0, From c7ae9413c7428e504f730ff87fb44c0c8fd61879 Mon Sep 17 00:00:00 2001 From: Basanagouda Nagappa Koppad Date: Thu, 19 Sep 2024 12:59:24 +0000 Subject: [PATCH 54/56] Fix vm-manager build error, pip3 install failure FTXUI component build error fixed in cmake Fixed pip3 install failure with pipx Tracked-On: OAM-125176 Signed-off-by: Basanagouda Nagappa Koppad --- scripts/setup_host.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index ea3c1d2..4e5b74f 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -153,7 +153,7 @@ function install_vm_manager_deb(){ local os_ver=$(lsb_release -rs) local vm_repo="https://github.com/projectceladon/vm_manager/" local rtag=$(git ls-remote -t --refs ${vm_repo} | cut --delimiter='/' --fields=3 | tr '-' '~' | sort --version-sort | tail --lines=1) - local rdeb=vm-manager_${rtag}_ubuntu-${os_ver}.deb + local rdeb=vm-manager_${rtag}.deb [ -f ${rdeb} ] && rm -f ${rdeb} @@ -507,10 +507,12 @@ function ubu_update_wifi_fw(){ function set_sleep_inhibitor() { sudo apt-get -y install python3-pip - sudo pip3 install -U sleep-inhibitor + sudo apt install -y pipx + pipx ensurepath + sudo pipx install sleep-inhibitor pythonversion="$(pip3 --version | grep -Po '^.*\(\K[^\)]*' | grep -Po '^.*\ \K[^\\n]*')" - sudo sed -i 's/\/usr\/bin\/%p/\/usr\/local\/bin\/%p/' /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/sleep-inhibitor.service + sudo sed -i 's/\/usr\/bin\/%p/\/usr\/local\/bin\/%p/' /root/.local/share/pipx/venvs/sleep-inhibitor/lib/python$pythonversion/site-packages/sleep_inhibitor/sleep-inhibitor.service #Download the plugin if not already sudo echo "#! /bin/sh if adb get-state 1>/dev/null 2>&1 @@ -523,9 +525,9 @@ then fi else exit 0 -fi" > /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/plugins/is-wakelock-active - sudo chmod a+x /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/plugins/is-wakelock-active - sudo cp /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/sleep-inhibitor.conf /etc/. +fi" > /root/.local/share/pipx/venvs/sleep-inhibitor/lib/python$pythonversion/site-packages/sleep_inhibitor/plugins/is-wakelock-active + sudo chmod a+x /root/.local/share/pipx/venvs/sleep-inhibitor/lib/python$pythonversion/site-packages/sleep_inhibitor/plugins/is-wakelock-active + sudo cp /root/.local/share/pipx/venvs/sleep-inhibitor/lib/python$pythonversion/site-packages/sleep_inhibitor/sleep-inhibitor.conf /etc/. sudo echo "plugins: #Inhibit sleep if wakelock is held - path: is-wakelock-active @@ -533,7 +535,7 @@ fi" > /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/plugins/ what: sleep period: 0.01" > /etc/sleep-inhibitor.conf sudo sed -i 's/#*HandleSuspendKey=\w*/HandleSuspendKey=suspend/' /etc/systemd/logind.conf - sudo cp /usr/local/lib/python$pythonversion/dist-packages/sleep_inhibitor/sleep-inhibitor.service /etc/systemd/system/. + sudo cp /root/.local/share/pipx/venvs/sleep-inhibitor/lib/python$pythonversion/site-packages/sleep_inhibitor/sleep-inhibitor.service /etc/systemd/system/. reboot_required=1 } From b5c2927370d23815ac5b56d6a17efe7a4ec95b3d Mon Sep 17 00:00:00 2001 From: celadon Date: Thu, 24 Oct 2024 10:16:44 +0000 Subject: [PATCH 55/56] Add HW Spice and HW cursor support to Android. Add HW Spice support to Android which cane be enabled via ini file. Add configurable render_sync parameter in VM-manager Add configurable HW cursor parameter in VM-manager --- sample/guest01.ini | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sample/guest01.ini b/sample/guest01.ini index afd9c14..700d8d9 100644 --- a/sample/guest01.ini +++ b/sample/guest01.ini @@ -78,11 +78,12 @@ audio_type=legacy-hda #connectors_1= #show_fps= #disable_host_input=no +hw_cursor=true +render_sync=true -#Set hw_spice=true to view VM over HW Spice. false by default. Please add IP address and -#port for Spice display to work -#hw_spice=true -#ip_addr=10.49.4.30 +#Set spice=HW to view VM over HW Spice and SW to view VM over SW Spice. +#Add port for Spice display to work +#spice=SW #port=3001 [passthrough] From e96f97d78ae0b64a99479e8217890755f8ed44f7 Mon Sep 17 00:00:00 2001 From: "Kothapeta, BikshapathiX" Date: Wed, 15 Jan 2025 12:26:42 +0000 Subject: [PATCH 56/56] Upgrede Qemu from 8.2.1 ti 9.1.0 Qemu Upgrade Tracked-On: OAM-129499 Signed-off-by: Kothapeta, BikshapathiX --- scripts/setup_host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 4e5b74f..f10a321 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -9,7 +9,7 @@ set -eE #--------- Global variable ------------------- reboot_required=0 -QEMU_REL="qemu-8.2.1" +QEMU_REL="qemu-9.1.0" skip_install_qemu=false #Directory to keep versions of qemu which can be reused instead of downloading again