diff mbox

[1/4] kvm: Simplify invtsc check

Message ID 1482866480-26208-2-git-send-email-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eduardo Habkost Dec. 27, 2016, 7:21 p.m. UTC
Instead of searching the table we have just built, we can check
the env->features field directly.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marcelo Tosatti Dec. 29, 2016, 6:57 p.m. UTC | #1
On Tue, Dec 27, 2016 at 05:21:17PM -0200, Eduardo Habkost wrote:
> Instead of searching the table we have just built, we can check
> the env->features field directly.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target/i386/kvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 10a9cd8..a26290f 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -962,8 +962,8 @@ int kvm_arch_init_vcpu(CPUState *cs)
>          has_msr_mcg_ext_ctl = has_msr_feature_control = true;
>      }
>  
> -    c = cpuid_find_entry(&cpuid_data.cpuid, 0x80000007, 0);
> -    if (c && (c->edx & 1<<8) && invtsc_mig_blocker == NULL) {
> +    if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> +        invtsc_mig_blocker == NULL) {
>          /* for migration */
>          error_setg(&invtsc_mig_blocker,
>                     "State blocked by non-migratable CPU device"
> -- 
> 2.7.4


Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 10a9cd8..a26290f 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -962,8 +962,8 @@  int kvm_arch_init_vcpu(CPUState *cs)
         has_msr_mcg_ext_ctl = has_msr_feature_control = true;
     }
 
-    c = cpuid_find_entry(&cpuid_data.cpuid, 0x80000007, 0);
-    if (c && (c->edx & 1<<8) && invtsc_mig_blocker == NULL) {
+    if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
+        invtsc_mig_blocker == NULL) {
         /* for migration */
         error_setg(&invtsc_mig_blocker,
                    "State blocked by non-migratable CPU device"