diff options
| author | Brijesh Singh <brijesh.singh@amd.com> | 2020-05-24 07:14:11 -0500 |
|---|---|---|
| committer | Brijesh Singh <brijesh.singh@amd.com> | 2020-05-24 07:14:11 -0500 |
| commit | cd68fbefd9c9470539cf5656074906b3baeca63c (patch) | |
| tree | babbd696343964675dc905a9bbae758fcf1ed732 | |
| parent | f50f628deebbb0b6f5ec64fe5f4d7137f83e3f5b (diff) | |
| download | cachepc-amdsev-cd68fbefd9c9470539cf5656074906b3baeca63c.tar.gz cachepc-amdsev-cd68fbefd9c9470539cf5656074906b3baeca63c.zip | |
fix SEV policy calculation and remove thp change from grub
| -rwxr-xr-x | install.sh | 19 | ||||
| -rwxr-xr-x | launch-qemu.sh | 5 |
2 files changed, 5 insertions, 19 deletions
@@ -1,6 +1,6 @@ #!/bin/bash -. /etc/os-release +[ -e /etc/os-release ] && . /etc/os-release # This will install all the dependent packages for qemu and ovmf to run if [ "$ID_LIKE" = "debian" ]; then @@ -15,23 +15,6 @@ else rpm -ivh linux/kernel-*.rpm fi -# update grub.cfg to disable THP -if ! grep "transparent_hugepage=never" /etc/default/grub >/dev/null; then - orig_cmdline="`grep GRUB_CMDLINE_LINUX /etc/default/grub | cut -f2- -d=`" - cmdline="${orig_cmdline::-1}" - cmdline="${cmdline:1}" - cmdline="${cmdline} transparent_hugepage=never" - - sed -i "/GRUB_CMDLINE_LINUX/c\GRUB_CMDLINE_LINUX=\"${cmdline}\"" /etc/default/grub - - if [ "$ID_LIKE" = "debian" ]; then - update-grub2 - else - grub2-mkconfig - fi -fi - -# cp kvm.conf /etc/modprobe.d/ echo diff --git a/launch-qemu.sh b/launch-qemu.sh index db13e7f..43cec9b 100755 --- a/launch-qemu.sh +++ b/launch-qemu.sh @@ -220,12 +220,15 @@ if [ ${SEV} = "1" ]; then [ "${ALLOW_DEBUG}" = "1" ] && POLICY=$((POLICY & ~0x01)) [ "${SEV_ES}" = "1" ] && POLICY=$((POLICY | 0x04)) SEV_POLICY=$(printf ",policy=%#x" $POLICY) - SEV_POLICY=",policy=0xB0000" fi if [ "${SEV_SNP}" = 1 ]; then SEV_GUEST_SNP=",snp=yes" + POLICY=$((0x30000)) + SEV_POLICY=$(printf ",policy=%#x" $POLICY) + [ "${ALLOW_DEBUG}" = "1" ] && POLICY=$((POLICY | 0x80000)) + # check if THP is disable cat /sys/kernel/mm/transparent_hugepage/enabled | grep -w "\[never\]" if [ $? -ne 0 ]; then |
