diff --git a/csv/confidential-containers/pkg/hymgr b/csv/confidential-containers/pkg/hymgr new file mode 100755 index 0000000000000000000000000000000000000000..80ba11430b807706cf8bf506747db4066d177c70 Binary files /dev/null and b/csv/confidential-containers/pkg/hymgr differ diff --git a/csv/confidential-containers/scripts/setup_dcu_passthrough.sh b/csv/confidential-containers/scripts/setup_dcu_passthrough.sh index 20d87482857cdf14fc62a94bdbcacf4df21b45da..4f5e039c49bb9b177cac24cda19e13843cd02935 100755 --- a/csv/confidential-containers/scripts/setup_dcu_passthrough.sh +++ b/csv/confidential-containers/scripts/setup_dcu_passthrough.sh @@ -11,6 +11,10 @@ set -o pipefail readonly script_name="$(basename "${BASH_SOURCE[0]}")" readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly PKG_DIR="${script_dir}/../pkg" + +readonly DTK_URL="https://download.sourcefind.cn:65024/directlink/1/DTK-24.04.1/Ubuntu20.04.1/DTK-24.04.1-Ubuntu20.04.1-x86_64.tar.gz" +readonly RCOK_URL="https://download.sourcefind.cn:65024/directlink/6/latest%E9%A9%B1%E5%8A%A8/previous_package/rock-5.7.1-6.2.18-V1.1.2.aio.run" readonly hygon_vendor_id="0x1d94" @@ -147,10 +151,30 @@ EOF } install_dcu_toolkit() { - # DTK is too big to put it in iso. - [ ! -f DTK-22.04.2.tar.gz ] && wget -O DTK-22.04.2.tar.gz "https://cancon.hpccube.com:65024/directlink/1/DTK-22.04.2/Ubuntu20.04.1/DTK-22.04.2-ubuntu20.04.1-b56941.tar.gz" - tar xvf DTK-22.04.2.tar.gz -C /opt/ - echo 'export HSA_USERPTR_FOR_PAGED_MEM=0'>>/opt/dtk-22.04.2/env.sh + # 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. + # 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 +} + +# To make guest image as small as possible, +# install hyhal on host, then mount it to guest. +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 + + # 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 + + cp -v ${PKG_DIR}/hymgr /opt/hyhal/bin/ } main() { @@ -161,6 +185,7 @@ main() { install_vfio_device_plugin install_dcu_toolkit + install_dcu_hyhal OK "Environment is set up, enjoy!" }