2023-07-19 00:05:04

by Sean Christopherson

[permalink] [raw]
Subject: [RFC PATCH v11 04/29] KVM: PPC: Drop dead code related to KVM_ARCH_WANT_MMU_NOTIFIER

Signed-off-by: Sean Christopherson <[email protected]>
---
arch/powerpc/kvm/powerpc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 7197c8256668..5cf9e5e3112a 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -634,10 +634,11 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_SYNC_MMU:
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
r = hv_enabled;
-#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)
- r = 1;
#else
- r = 0;
+#ifndef KVM_ARCH_WANT_MMU_NOTIFIER
+ BUILD_BUG();
+#endif
+ r = 1;
#endif
break;
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
--
2.41.0.255.g8b1d071c50-goog



2023-07-19 17:50:57

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [RFC PATCH v11 04/29] KVM: PPC: Drop dead code related to KVM_ARCH_WANT_MMU_NOTIFIER

On 7/19/23 01:44, Sean Christopherson wrote:
> Signed-off-by: Sean Christopherson<[email protected]>
> ---
> arch/powerpc/kvm/powerpc.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 7197c8256668..5cf9e5e3112a 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -634,10 +634,11 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_SYNC_MMU:
> #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
> r = hv_enabled;

This could actually be unnecessarily conservative. Even book3s_pr.c
knows how to do unmap and set_spte, so it should be able to support
KVM_CAP_SYNC_MMU. Alex, Nick, do you remember any of this? This would
mean moving KVM_CAP_SYNC_MMU to virt/kvm/kvm_main.c, which is nice.

Paolo

> -#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)
> - r = 1;
> #else
> - r = 0;
> +#ifndef KVM_ARCH_WANT_MMU_NOTIFIER
> + BUILD_BUG();
> +#endif
> + r = 1;
> #endif
> break;
> #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE