ACK: [PATCH] cpu: virt: fix the assumption that fwts_cpu_readmsr returns 0 = FWTS_OK

ivanhu ivan.hu at canonical.com
Mon Jul 25 06:04:23 UTC 2016



On 2016年07月15日 23:39, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/cpu/virt/virt_svm.c | 2 +-
>  src/cpu/virt/virt_vmx.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/cpu/virt/virt_svm.c b/src/cpu/virt/virt_svm.c
> index 7843428..a81877f 100644
> --- a/src/cpu/virt/virt_svm.c
> +++ b/src/cpu/virt/virt_svm.c
> @@ -59,7 +59,7 @@ static int vt_locked_by_bios(void)
>  	if (!can_lock_with_msr())
>  		return 0;
>
> -	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr))
> +	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr) != FWTS_OK)
>  		return -1;
>
>  	return ((msr & 0x1000) == 0x1000); /* SVM capable but locked by bios*/
> diff --git a/src/cpu/virt/virt_vmx.c b/src/cpu/virt/virt_vmx.c
> index 58b952f..29612f5 100644
> --- a/src/cpu/virt/virt_vmx.c
> +++ b/src/cpu/virt/virt_vmx.c
> @@ -59,7 +59,7 @@ static int vt_locked_by_bios(void)
>  {
>  	uint64_t msr;
>
> -	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr))
> +	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr) != FWTS_OK)
>  		return -1;
>
>  	return (msr & 5) == 1; /* VT capable but locked by bios*/
>

Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list