qubes-hcl-report: SLAT detection: improve log parsing

This commit is contained in:
HW42 2016-09-02 03:17:11 +02:00
parent a4db742077
commit 3e668a62e2

View File

@ -22,6 +22,8 @@ VERSION=2.5
COPY2VM="dom0" COPY2VM="dom0"
SUPPORT_FILES=0 SUPPORT_FILES=0
XL_DMESG_PREFIX_REGEX='^(XEN) \(\[[^]]*\] \)\?'
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@ -101,7 +103,7 @@ XEN_EXTRA=`cat $TEMP_DIR/xl-info |grep xen_extra |cut -d: -f2 |tr -d ' '`
QUBES=`cat $TEMP_DIR/qubes-release |cut -d '(' -f2 |cut -d ')' -f1` QUBES=`cat $TEMP_DIR/qubes-release |cut -d '(' -f2 |cut -d ')' -f1`
XL_VTX=`cat $TEMP_DIR/xl-info |grep xen_caps | grep hvm` XL_VTX=`cat $TEMP_DIR/xl-info |grep xen_caps | grep hvm`
XL_VTD=`cat $TEMP_DIR/xl-info |grep virt_caps |grep hvm_directio` XL_VTD=`cat $TEMP_DIR/xl-info |grep virt_caps |grep hvm_directio`
XL_HAP=`cat $TEMP_DIR/xl-dmesg |grep 'HVM: Hardware Assisted Paging (HAP) detected'` XL_HAP=`cat $TEMP_DIR/xl-dmesg |grep "$XL_DMESG_PREFIX_REGEX"'HVM: Hardware Assisted Paging (HAP) detected\( but disabled\)\?$'`
PCRS=`find /sys/devices/ -name pcrs` PCRS=`find /sys/devices/ -name pcrs`
FILENAME="Qubes-HCL-${BRAND//[^[:alnum:]]/_}-${PRODUCT//[^[:alnum:]]/_}-$DATE" FILENAME="Qubes-HCL-${BRAND//[^[:alnum:]]/_}-${PRODUCT//[^[:alnum:]]/_}-$DATE"
@ -130,8 +132,13 @@ fi
if [ -n "$XL_HAP" ]; then if [ -n "$XL_HAP" ]; then
HAP="yes" HAP="yes"
HAP_VERBOSE="Yes"
if [[ "$XL_HAP" =~ "disabled" ]]; then
HAP_VERBOSE="Yes (disabled)"
fi
else else
HAP="no" HAP="no"
HAP_VERBOSE="No"
fi fi
if [[ $PCRS ]] if [[ $PCRS ]]
@ -159,7 +166,7 @@ echo -e "Net:\n$NET\n"
echo -e "SCSI:\n$SCSI\n" echo -e "SCSI:\n$SCSI\n"
echo -e "HVM:\t\t$VTX" echo -e "HVM:\t\t$VTX"
echo -e "I/O MMU:\t$VTD" echo -e "I/O MMU:\t$VTD"
echo -e "HAP/SLAT:\t${HAP^}" echo -e "HAP/SLAT:\t$HAP_VERBOSE"
echo -e "TPM:\t\t$TPM" echo -e "TPM:\t\t$TPM"
echo echo