linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Unconditionally call x86 ops that are always implemented
@ 2019-08-01 16:46 Sean Christopherson
  2019-08-01 21:39 ` Krish Sadhukhan
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2019-08-01 16:46 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář; +Cc: kvm, linux-kernel

Remove two stale checks for non-NULL ops now that they're implemented by
both VMX and SVM.

Fixes: 74f169090b6f ("kvm/svm: Setup MCG_CAP on AMD properly")
Fixes: b31c114b82b2 ("KVM: X86: Provide a capability to disable PAUSE intercepts")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/x86.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 01e18caac825..2c25a19d436f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3506,8 +3506,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
 	for (bank = 0; bank < bank_num; bank++)
 		vcpu->arch.mce_banks[bank*4] = ~(u64)0;
 
-	if (kvm_x86_ops->setup_mce)
-		kvm_x86_ops->setup_mce(vcpu);
+	kvm_x86_ops->setup_mce(vcpu);
 out:
 	return r;
 }
@@ -9313,10 +9312,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm_page_track_init(kvm);
 	kvm_mmu_init_vm(kvm);
 
-	if (kvm_x86_ops->vm_init)
-		return kvm_x86_ops->vm_init(kvm);
-
-	return 0;
+	return kvm_x86_ops->vm_init(kvm);
 }
 
 static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: x86: Unconditionally call x86 ops that are always implemented
  2019-08-01 16:46 [PATCH] KVM: x86: Unconditionally call x86 ops that are always implemented Sean Christopherson
@ 2019-08-01 21:39 ` Krish Sadhukhan
  2019-08-01 21:42   ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: Krish Sadhukhan @ 2019-08-01 21:39 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Radim Krčmář
  Cc: kvm, linux-kernel



On 08/01/2019 09:46 AM, Sean Christopherson wrote:
> Remove two stale checks for non-NULL ops now that they're implemented by
> both VMX and SVM.
>
> Fixes: 74f169090b6f ("kvm/svm: Setup MCG_CAP on AMD properly")
> Fixes: b31c114b82b2 ("KVM: X86: Provide a capability to disable PAUSE intercepts")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>   arch/x86/kvm/x86.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 01e18caac825..2c25a19d436f 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3506,8 +3506,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
>   	for (bank = 0; bank < bank_num; bank++)
>   		vcpu->arch.mce_banks[bank*4] = ~(u64)0;
>   
> -	if (kvm_x86_ops->setup_mce)
> -		kvm_x86_ops->setup_mce(vcpu);
> +	kvm_x86_ops->setup_mce(vcpu);
>   out:
>   	return r;
>   }
> @@ -9313,10 +9312,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>   	kvm_page_track_init(kvm);
>   	kvm_mmu_init_vm(kvm);
>   
> -	if (kvm_x86_ops->vm_init)
> -		return kvm_x86_ops->vm_init(kvm);
> -
> -	return 0;
> +	return kvm_x86_ops->vm_init(kvm);
>   }
>   
>   static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)

The following two ops are also implemented by both VMX and SVM:

         update_cr8_intercept
         update_pi_irte

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: x86: Unconditionally call x86 ops that are always implemented
  2019-08-01 21:39 ` Krish Sadhukhan
@ 2019-08-01 21:42   ` Sean Christopherson
  2019-08-02 22:48     ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2019-08-01 21:42 UTC (permalink / raw)
  To: Krish Sadhukhan
  Cc: Paolo Bonzini, Radim Krčmář, kvm, linux-kernel

On Thu, Aug 01, 2019 at 02:39:38PM -0700, Krish Sadhukhan wrote:
> 
> 
> On 08/01/2019 09:46 AM, Sean Christopherson wrote:
> >Remove two stale checks for non-NULL ops now that they're implemented by
> >both VMX and SVM.
> >
> >Fixes: 74f169090b6f ("kvm/svm: Setup MCG_CAP on AMD properly")
> >Fixes: b31c114b82b2 ("KVM: X86: Provide a capability to disable PAUSE intercepts")
> >Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> >---
> >  arch/x86/kvm/x86.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> >
> >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >index 01e18caac825..2c25a19d436f 100644
> >--- a/arch/x86/kvm/x86.c
> >+++ b/arch/x86/kvm/x86.c
> >@@ -3506,8 +3506,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
> >  	for (bank = 0; bank < bank_num; bank++)
> >  		vcpu->arch.mce_banks[bank*4] = ~(u64)0;
> >-	if (kvm_x86_ops->setup_mce)
> >-		kvm_x86_ops->setup_mce(vcpu);
> >+	kvm_x86_ops->setup_mce(vcpu);
> >  out:
> >  	return r;
> >  }
> >@@ -9313,10 +9312,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
> >  	kvm_page_track_init(kvm);
> >  	kvm_mmu_init_vm(kvm);
> >-	if (kvm_x86_ops->vm_init)
> >-		return kvm_x86_ops->vm_init(kvm);
> >-
> >-	return 0;
> >+	return kvm_x86_ops->vm_init(kvm);
> >  }
> >  static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
> 
> The following two ops are also implemented by both VMX and SVM:
> 
>         update_cr8_intercept
>         update_pi_irte

Drat, I didn't think to grep for !kvm_x86_ops.  I'll spin a v2.  Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: x86: Unconditionally call x86 ops that are always implemented
  2019-08-01 21:42   ` Sean Christopherson
@ 2019-08-02 22:48     ` Sean Christopherson
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2019-08-02 22:48 UTC (permalink / raw)
  To: Krish Sadhukhan
  Cc: Paolo Bonzini, Radim Krčmář, kvm, linux-kernel

On Thu, Aug 01, 2019 at 02:42:07PM -0700, Sean Christopherson wrote:
> On Thu, Aug 01, 2019 at 02:39:38PM -0700, Krish Sadhukhan wrote:
> > 
> > 
> > On 08/01/2019 09:46 AM, Sean Christopherson wrote:
> > >Remove two stale checks for non-NULL ops now that they're implemented by
> > >both VMX and SVM.
> > >
> > >Fixes: 74f169090b6f ("kvm/svm: Setup MCG_CAP on AMD properly")
> > >Fixes: b31c114b82b2 ("KVM: X86: Provide a capability to disable PAUSE intercepts")
> > >Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > >---
> > >  arch/x86/kvm/x86.c | 8 ++------
> > >  1 file changed, 2 insertions(+), 6 deletions(-)
> > >
> > >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > >index 01e18caac825..2c25a19d436f 100644
> > >--- a/arch/x86/kvm/x86.c
> > >+++ b/arch/x86/kvm/x86.c
> > >@@ -3506,8 +3506,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
> > >  	for (bank = 0; bank < bank_num; bank++)
> > >  		vcpu->arch.mce_banks[bank*4] = ~(u64)0;
> > >-	if (kvm_x86_ops->setup_mce)
> > >-		kvm_x86_ops->setup_mce(vcpu);
> > >+	kvm_x86_ops->setup_mce(vcpu);
> > >  out:
> > >  	return r;
> > >  }
> > >@@ -9313,10 +9312,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
> > >  	kvm_page_track_init(kvm);
> > >  	kvm_mmu_init_vm(kvm);
> > >-	if (kvm_x86_ops->vm_init)
> > >-		return kvm_x86_ops->vm_init(kvm);
> > >-
> > >-	return 0;
> > >+	return kvm_x86_ops->vm_init(kvm);
> > >  }
> > >  static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
> > 
> > The following two ops are also implemented by both VMX and SVM:
> > 
> >         update_cr8_intercept
> >         update_pi_irte
> 
> Drat, I didn't think to grep for !kvm_x86_ops.  I'll spin a v2.  Thanks!

Ah, but update_cr8_intercept is zapped by VMX if hardware doesn't support
the TPR shadow.

P.S. I meant to send this before posting v2, but I got distracted...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-02 22:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 16:46 [PATCH] KVM: x86: Unconditionally call x86 ops that are always implemented Sean Christopherson
2019-08-01 21:39 ` Krish Sadhukhan
2019-08-01 21:42   ` Sean Christopherson
2019-08-02 22:48     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).