* [PATCH v2] KVM: x86: Unconditionally call x86 ops that are always implemented
@ 2019-08-02 22:06 Sean Christopherson
2019-08-02 22:48 ` Krish Sadhukhan
0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2019-08-02 22:06 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: kvm, linux-kernel, Krish Sadhukhan
Remove a few stale checks for non-NULL ops now that the ops in question
are implemented by both VMX and SVM.
Note, this is **not** stable material, the Fixes tags are there purely
to show when a particular op was first supported 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")
Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt")
Cc: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
v2: Give update_pi_iret the same treatment [Krish].
arch/x86/kvm/x86.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 01e18caac825..e7c993f0cbed 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)
@@ -9992,7 +9988,7 @@ EXPORT_SYMBOL_GPL(kvm_arch_has_noncoherent_dma);
bool kvm_arch_has_irq_bypass(void)
{
- return kvm_x86_ops->update_pi_irte != NULL;
+ return true;
}
int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
@@ -10032,9 +10028,6 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq,
uint32_t guest_irq, bool set)
{
- if (!kvm_x86_ops->update_pi_irte)
- return -EINVAL;
-
return kvm_x86_ops->update_pi_irte(kvm, host_irq, guest_irq, set);
}
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: x86: Unconditionally call x86 ops that are always implemented
2019-08-02 22:06 [PATCH v2] KVM: x86: Unconditionally call x86 ops that are always implemented Sean Christopherson
@ 2019-08-02 22:48 ` Krish Sadhukhan
2019-08-02 22:59 ` Sean Christopherson
0 siblings, 1 reply; 3+ messages in thread
From: Krish Sadhukhan @ 2019-08-02 22:48 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini, Radim Krčmář
Cc: kvm, linux-kernel
On 08/02/2019 03:06 PM, Sean Christopherson wrote:
> Remove a few stale checks for non-NULL ops now that the ops in question
> are implemented by both VMX and SVM.
>
> Note, this is **not** stable material, the Fixes tags are there purely
> to show when a particular op was first supported 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")
> Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt")
> Cc: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>
> v2: Give update_pi_iret the same treatment [Krish].
>
> arch/x86/kvm/x86.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 01e18caac825..e7c993f0cbed 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)
> @@ -9992,7 +9988,7 @@ EXPORT_SYMBOL_GPL(kvm_arch_has_noncoherent_dma);
>
> bool kvm_arch_has_irq_bypass(void)
Now that this is returning true always and that this is called only in
kvm_irqfd_assign(), this can perhaps be removed altogether ?
> {
> - return kvm_x86_ops->update_pi_irte != NULL;
> + return true;
> }
>
> int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
> @@ -10032,9 +10028,6 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
> int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq,
> uint32_t guest_irq, bool set)
> {
> - if (!kvm_x86_ops->update_pi_irte)
> - return -EINVAL;
> -
> return kvm_x86_ops->update_pi_irte(kvm, host_irq, guest_irq, set);
> }
>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: x86: Unconditionally call x86 ops that are always implemented
2019-08-02 22:48 ` Krish Sadhukhan
@ 2019-08-02 22:59 ` Sean Christopherson
0 siblings, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2019-08-02 22:59 UTC (permalink / raw)
To: Krish Sadhukhan
Cc: Paolo Bonzini, Radim Krčmář, kvm, linux-kernel
On Fri, Aug 02, 2019 at 03:48:27PM -0700, Krish Sadhukhan wrote:
>
> On 08/02/2019 03:06 PM, Sean Christopherson wrote:
> >Remove a few stale checks for non-NULL ops now that the ops in question
> >are implemented by both VMX and SVM.
> >
> >Note, this is **not** stable material, the Fixes tags are there purely
> >to show when a particular op was first supported 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")
> >Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt")
> >Cc: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> >Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> >---
> >
> >v2: Give update_pi_iret the same treatment [Krish].
> >
> > arch/x86/kvm/x86.c | 13 +++----------
> > 1 file changed, 3 insertions(+), 10 deletions(-)
> >
> >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >index 01e18caac825..e7c993f0cbed 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)
> >@@ -9992,7 +9988,7 @@ EXPORT_SYMBOL_GPL(kvm_arch_has_noncoherent_dma);
> > bool kvm_arch_has_irq_bypass(void)
>
> Now that this is returning true always and that this is called only in
> kvm_irqfd_assign(), this can perhaps be removed altogether ?
No go, PowerPC has a conditional implementation.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-02 22:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 22:06 [PATCH v2] KVM: x86: Unconditionally call x86 ops that are always implemented Sean Christopherson
2019-08-02 22:48 ` Krish Sadhukhan
2019-08-02 22:59 ` 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).