From d07972be0e28e15d038dc2d23e193de8eb1c863d Mon Sep 17 00:00:00 2001 From: dsh Date: Fri, 16 May 2025 10:45:56 +0800 Subject: [PATCH] Update DCU Driver to rock-5.7.1-6.2.31-V1.6.3 --- .../scripts/setup_dcu_passthrough.sh | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/csv/confidential-containers/scripts/setup_dcu_passthrough.sh b/csv/confidential-containers/scripts/setup_dcu_passthrough.sh index 3dede0f..ba5923f 100755 --- a/csv/confidential-containers/scripts/setup_dcu_passthrough.sh +++ b/csv/confidential-containers/scripts/setup_dcu_passthrough.sh @@ -96,7 +96,7 @@ metadata: namespace: kube-system data: config.yml: | - - resourceName: dcu/a100 + - resourceName: dcu/k100 vendorId: ${vendor_id} deviceId: ['${device_id}'] --- @@ -121,7 +121,7 @@ spec: operator: Exists containers: - name: vfio-device-plugin - image: docker.io/pawsonfang/vfio-device-plugin + image: haigon.cn/test/vfio-device-plugin securityContext: allowPrivilegeEscalation: false capabilities: @@ -152,34 +152,46 @@ EOF } install_dcu_toolkit() { + DTK="DTK-24.04.3-Ubuntu20.04.1-x86_64.tar.gz" # DTK is too big to put it in ISO. - # Download DTK-24.04.1 from https://cancon.hpccube.com:65024/1/main/DTK-24.04.1. + # Download DTK-24.04.3 from https://cancon.hpccube.com:65024/1/main/DTK-24.04.3 # User should find the correct DTK release for your OS. # Here is a example for ubuntu 20.04.1 - [ ! -f DTK-24.04.1.tar.gz ] && wget -O DTK-24.04.1.tar.gz $DTK_URL - tar xvf DTK-24.04.1.tar.gz -C /opt/ - echo 'export HSA_USERPTR_FOR_PAGED_MEM=0' >> /opt/dtk-24.04.1/env.sh - echo 'hy-virtual -enable-encrypted' >> /opt/dtk-24.04.1/env.sh + if [ ! -f $DTK ]; then + /opt/hygon/tools/sftp download /hygon-devkit/4.0/2025-01-01/csv/confidential-containers/pkg/$DTK $DTK + fi + + echo "Extract $DTK to /opt" + tar zxf $DTK -C /opt/ + echo 'hy-virtual -enable-encrypted' >> /opt/dtk-24.04.3/env.sh } # To make guest image as small as possible, -# install hyhal on host, then mount it to guest. +# install hyhal on host, then mount it to container. install_dcu_hyhal() { - [ ! -f rock.aio.run ] && wget -O rock.aio.run $RCOK_URL - chmod +x rock.aio.run - ./rock.aio.run -u 0 -r 0 + ROCK=rock-5.7.1-6.2.31-V1.6.3.aio.run + read -p "Note: Install $ROCK on host, do you want to continue? (y/n)" yn + case "$yn" in + [yY]|[yY][eE][sS]) + install="yes" + ;; + [nN]|[nN][oO]) + exit 1 + ;; + *) + echo "Invalid input. Please enter y or n" + exit 1 + ;; + esac + + if [ ! -f $ROCK ]; then + /opt/hygon/tools/sftp download /hygon-devkit/4.0/2025-01-01/csv/confidential-containers/pkg/$ROCK $ROCK + fi + chmod +x $ROCK + ./$ROCK -u 0 -r 0 # Disable hymgr on host so that DCU dirver will not be loaded. systemctl disable hymgr - - # replace hymgr with a new one - [[ -d /opt/hyhal && ! -f /opt/hyhal/bin/hymgr-kata.bkp ]] && cp -v /opt/hyhal/bin/hymgr /opt/hyhal/bin/hymgr-kata.bkp - - if [ ! -f ${PKG_DIR}/hymgr ]; then - /opt/hygon/tools/sftp download /hygon-devkit/4.0/2025-01-01/csv/confidential-containers/pkg/hymgr ${PKG_DIR}/hymgr - fi - - cp -v ${PKG_DIR}/hymgr /opt/hyhal/bin/ } main() { -- Gitee