Re: [PATCH v4 39/46] KVM: PPC: Book3S HV: Remove virt mode checks from real mode handlers
On 3/23/21 2:02 AM, Nicholas Piggin wrote: > Now that the P7/8 path no longer supports radix, real-mode handlers > do not need to deal with being called in virt mode. > > This change effectively reverts commit acde25726bc6 ("KVM: PPC: Book3S > HV: Add radix checks in real-mode hypercall handlers"). > > It removes a few more real-mode tests in rm hcall handlers, which also > allows the indirect ops for the xive module to be removed from the > built-in xics rm handlers. > > kvmppc_h_random is renamed to kvmppc_rm_h_random to be a bit more > descriptive of its function. > > Cc: Cédric Le Goater > Signed-off-by: Nicholas Piggin Reviewed-by: Cédric Le Goater > --- > arch/powerpc/include/asm/kvm_ppc.h | 10 +-- > arch/powerpc/kvm/book3s.c | 11 +-- > arch/powerpc/kvm/book3s_64_vio_hv.c | 12 > arch/powerpc/kvm/book3s_hv_builtin.c| 91 ++--- > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- > arch/powerpc/kvm/book3s_xive.c | 18 - > arch/powerpc/kvm/book3s_xive.h | 7 -- > arch/powerpc/kvm/book3s_xive_native.c | 10 --- > 8 files changed, 23 insertions(+), 138 deletions(-) > > diff --git a/arch/powerpc/include/asm/kvm_ppc.h > b/arch/powerpc/include/asm/kvm_ppc.h > index db6646c2ade2..5dfb3f167f2c 100644 > --- a/arch/powerpc/include/asm/kvm_ppc.h > +++ b/arch/powerpc/include/asm/kvm_ppc.h > @@ -659,8 +659,6 @@ extern int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, > u32 *server, > u32 *priority); > extern int kvmppc_xive_int_on(struct kvm *kvm, u32 irq); > extern int kvmppc_xive_int_off(struct kvm *kvm, u32 irq); > -extern void kvmppc_xive_init_module(void); > -extern void kvmppc_xive_exit_module(void); > > extern int kvmppc_xive_connect_vcpu(struct kvm_device *dev, > struct kvm_vcpu *vcpu, u32 cpu); > @@ -686,8 +684,6 @@ static inline int kvmppc_xive_enabled(struct kvm_vcpu > *vcpu) > extern int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, > struct kvm_vcpu *vcpu, u32 cpu); > extern void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu); > -extern void kvmppc_xive_native_init_module(void); > -extern void kvmppc_xive_native_exit_module(void); > extern int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, >union kvmppc_one_reg *val); > extern int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu, > @@ -701,8 +697,6 @@ static inline int kvmppc_xive_get_xive(struct kvm *kvm, > u32 irq, u32 *server, > u32 *priority) { return -1; } > static inline int kvmppc_xive_int_on(struct kvm *kvm, u32 irq) { return -1; } > static inline int kvmppc_xive_int_off(struct kvm *kvm, u32 irq) { return -1; > } > -static inline void kvmppc_xive_init_module(void) { } > -static inline void kvmppc_xive_exit_module(void) { } > > static inline int kvmppc_xive_connect_vcpu(struct kvm_device *dev, > struct kvm_vcpu *vcpu, u32 cpu) { > return -EBUSY; } > @@ -725,8 +719,6 @@ static inline int kvmppc_xive_enabled(struct kvm_vcpu > *vcpu) > static inline int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, > struct kvm_vcpu *vcpu, u32 cpu) { return -EBUSY; } > static inline void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu) { } > -static inline void kvmppc_xive_native_init_module(void) { } > -static inline void kvmppc_xive_native_exit_module(void) { } > static inline int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, > union kvmppc_one_reg *val) > { return 0; } > @@ -762,7 +754,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, > unsigned long tce_value, unsigned long npages); > long int kvmppc_rm_h_confer(struct kvm_vcpu *vcpu, int target, > unsigned int yield_count); > -long kvmppc_h_random(struct kvm_vcpu *vcpu); > +long kvmppc_rm_h_random(struct kvm_vcpu *vcpu); > void kvmhv_commence_exit(int trap); > void kvmppc_realmode_machine_check(struct kvm_vcpu *vcpu); > void kvmppc_subcore_enter_guest(void); > diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c > index 44bf567b6589..1888aedfd410 100644 > --- a/arch/powerpc/kvm/book3s.c > +++ b/arch/powerpc/kvm/book3s.c > @@ -1046,13 +1046,10 @@ static int kvmppc_book3s_init(void) > #ifdef CONFIG_KVM_XICS > #ifdef CONFIG_KVM_XIVE > if (xics_on_xive()) { > - kvmppc_xive_init_module(); > kvm_register_device_ops(&kvm_xive_ops, KVM_DEV_TYPE_XICS); > - if (kvmppc_xive_native_supported()) { > - kvmppc_xive_native_init_module(); > + if (kvmppc_xive_native_supported()) > kvm_register_device_ops(&kvm_xive_native_ops, > KVM_DEV_TYPE_XIVE); > - } > } else
[PATCH v4 39/46] KVM: PPC: Book3S HV: Remove virt mode checks from real mode handlers
Now that the P7/8 path no longer supports radix, real-mode handlers do not need to deal with being called in virt mode. This change effectively reverts commit acde25726bc6 ("KVM: PPC: Book3S HV: Add radix checks in real-mode hypercall handlers"). It removes a few more real-mode tests in rm hcall handlers, which also allows the indirect ops for the xive module to be removed from the built-in xics rm handlers. kvmppc_h_random is renamed to kvmppc_rm_h_random to be a bit more descriptive of its function. Cc: Cédric Le Goater Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_ppc.h | 10 +-- arch/powerpc/kvm/book3s.c | 11 +-- arch/powerpc/kvm/book3s_64_vio_hv.c | 12 arch/powerpc/kvm/book3s_hv_builtin.c| 91 ++--- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- arch/powerpc/kvm/book3s_xive.c | 18 - arch/powerpc/kvm/book3s_xive.h | 7 -- arch/powerpc/kvm/book3s_xive_native.c | 10 --- 8 files changed, 23 insertions(+), 138 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index db6646c2ade2..5dfb3f167f2c 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -659,8 +659,6 @@ extern int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, u32 *priority); extern int kvmppc_xive_int_on(struct kvm *kvm, u32 irq); extern int kvmppc_xive_int_off(struct kvm *kvm, u32 irq); -extern void kvmppc_xive_init_module(void); -extern void kvmppc_xive_exit_module(void); extern int kvmppc_xive_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, u32 cpu); @@ -686,8 +684,6 @@ static inline int kvmppc_xive_enabled(struct kvm_vcpu *vcpu) extern int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, u32 cpu); extern void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu); -extern void kvmppc_xive_native_init_module(void); -extern void kvmppc_xive_native_exit_module(void); extern int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, union kvmppc_one_reg *val); extern int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu, @@ -701,8 +697,6 @@ static inline int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, u32 *priority) { return -1; } static inline int kvmppc_xive_int_on(struct kvm *kvm, u32 irq) { return -1; } static inline int kvmppc_xive_int_off(struct kvm *kvm, u32 irq) { return -1; } -static inline void kvmppc_xive_init_module(void) { } -static inline void kvmppc_xive_exit_module(void) { } static inline int kvmppc_xive_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, u32 cpu) { return -EBUSY; } @@ -725,8 +719,6 @@ static inline int kvmppc_xive_enabled(struct kvm_vcpu *vcpu) static inline int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, u32 cpu) { return -EBUSY; } static inline void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu) { } -static inline void kvmppc_xive_native_init_module(void) { } -static inline void kvmppc_xive_native_exit_module(void) { } static inline int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, union kvmppc_one_reg *val) { return 0; } @@ -762,7 +754,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, unsigned long tce_value, unsigned long npages); long int kvmppc_rm_h_confer(struct kvm_vcpu *vcpu, int target, unsigned int yield_count); -long kvmppc_h_random(struct kvm_vcpu *vcpu); +long kvmppc_rm_h_random(struct kvm_vcpu *vcpu); void kvmhv_commence_exit(int trap); void kvmppc_realmode_machine_check(struct kvm_vcpu *vcpu); void kvmppc_subcore_enter_guest(void); diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 44bf567b6589..1888aedfd410 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c @@ -1046,13 +1046,10 @@ static int kvmppc_book3s_init(void) #ifdef CONFIG_KVM_XICS #ifdef CONFIG_KVM_XIVE if (xics_on_xive()) { - kvmppc_xive_init_module(); kvm_register_device_ops(&kvm_xive_ops, KVM_DEV_TYPE_XICS); - if (kvmppc_xive_native_supported()) { - kvmppc_xive_native_init_module(); + if (kvmppc_xive_native_supported()) kvm_register_device_ops(&kvm_xive_native_ops, KVM_DEV_TYPE_XIVE); - } } else #endif kvm_register_device_ops(&kvm_xics_ops, KVM_DEV_TYPE_XICS); @@ -1062,12 +1059,6 @@ static int kvmppc_book3s_init(void) static void kvmppc_book3s_exit(void) { -#ifdef CONFIG_KVM_XICS - if (xics_on_xive()) {