diff options
author | Simon Rettberg | 2023-07-20 11:09:42 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-07-20 11:09:42 +0200 |
commit | 59c06daaf9abfec2fa258729dd3b22cb7c70a59c (patch) | |
tree | 1aba3c7d43827f766f133d1a13121eeae9734d4f /core/modules/qemu/data | |
parent | [qemu] java: Don't throw away viewer output on crash (diff) | |
download | mltk-59c06daaf9abfec2fa258729dd3b22cb7c70a59c.tar.gz mltk-59c06daaf9abfec2fa258729dd3b22cb7c70a59c.tar.xz mltk-59c06daaf9abfec2fa258729dd3b22cb7c70a59c.zip |
[qemu] Add workaround for weird qemu crash with edk2 on Alderlake
... at least one specific model with P and E cores ...
Diffstat (limited to 'core/modules/qemu/data')
-rwxr-xr-x | core/modules/qemu/data/usr/bin/qemu-system-x86_64.openslx | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/core/modules/qemu/data/usr/bin/qemu-system-x86_64.openslx b/core/modules/qemu/data/usr/bin/qemu-system-x86_64.openslx new file mode 100755 index 00000000..bc743f48 --- /dev/null +++ b/core/modules/qemu/data/usr/bin/qemu-system-x86_64.openslx @@ -0,0 +1,73 @@ +#!/bin/sh + +bin="${0%.openslx}" + +allflags="$( "$bin" -cpu help | sed -En '/^Recognized CPUID flags:/,/^$/s/ +/,+/gp' | tail -n+2 | tr -d '\n' )" + +replace_params () { + modelname= + model= + family= + stepping= + vendor= + for i; do + shift + case "$i" in + migratable=*) + continue + ;; + model=*) + model=1 + ;; + model-id=*) + modelname=1 + ;; + family=*) + family=1 + ;; + stepping=*) + stepping=1 + ;; + vendor=*) + vendor=1 + ;; + *) + ;; + esac + set -- "$@" "$i" + done + [ -z "$modelname" ] && set -- "$@" "model-id=$( awk '/^model name\s/ {print substr($0,index($0, ":")+2); exit}' /proc/cpuinfo )" + [ -z "$vendor" ] && set -- "$@" "vendor=$( awk '/^vendor_id\s/ {print substr($0,index($0, ":")+2); exit}' /proc/cpuinfo )" + [ -z "$model" ] && set -- "$@" "model=$( awk '$1$2 == "model:" {print $3; exit}' /proc/cpuinfo )" + [ -z "$family" ] && set -- "$@" "family=$( awk '$1$2$3 == "cpufamily:" {print $4; exit}' /proc/cpuinfo )" + [ -z "$stepping" ] && set -- "$@" "stepping=$( awk '$1$2 == "stepping:" {print $3; exit}' /proc/cpuinfo )" + printf "%s" "$*" +} + +i="$#" +while [ "$i" -gt 0 ]; do + case "$1" in + -cpu) + case "$2" in + host|max) + set -- "$@" -cpu "Cascadelake-Server$allflags" + : "$(( i -= 2 ))" + shift 2 + continue + ;; + host*|max*) + params="${2#*,}" + params="$( set -f ; IFS=, ; replace_params $params )" + set -- "$@" -cpu "Cascadelake-Server,$params$allflags" + : "$(( i -= 2 ))" + shift 2 + continue + ;; + esac + esac + set -- "$@" "$1" + : "$(( i -= 1 ))" + shift 1 +done + +exec "$bin" "$@" |