lkml.org 
[lkml]   [2020]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] KVM: Pass kvm_init()'s opaque param to additional arch funcs
On Wed, 29 Jan 2020 16:10:19 -0800
Sean Christopherson <sean.j.christopherson@intel.com> wrote:

> Pass @opaque to kvm_arch_hardware_setup() and
> kvm_arch_check_processor_compat() to allow architecture specific code to
> reference @opaque without having to stash it away in a temporary global
> variable. This will enable x86 to separate its vendor specific callback
> ops, which are passed via @opaque, into "init" and "runtime" ops without
> having to stash away the "init" ops.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> arch/mips/kvm/mips.c | 4 ++--
> arch/powerpc/kvm/powerpc.c | 4 ++--
> arch/s390/kvm/kvm-s390.c | 4 ++--
> arch/x86/kvm/x86.c | 4 ++--
> include/linux/kvm_host.h | 4 ++--
> virt/kvm/arm/arm.c | 4 ++--
> virt/kvm/kvm_main.c | 18 ++++++++++++++----
> 7 files changed, 26 insertions(+), 16 deletions(-)

> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index eb3709d55139..5ad252defa54 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -4345,14 +4345,22 @@ struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void)
> return &kvm_running_vcpu;
> }
>
> -static void check_processor_compat(void *rtn)
> +struct kvm_cpu_compat_check {
> + void *opaque;
> + int *ret;
> +};
> +
> +static void check_processor_compat(void *data)
> {
> - *(int *)rtn = kvm_arch_check_processor_compat();
> + struct kvm_cpu_compat_check *c = data;
> +
> + *c->ret = kvm_arch_check_processor_compat(c->opaque);
> }

This function also looks better now :)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Tested-by: Cornelia Huck <cohuck@redhat.com> #s390

\
 
 \ /
  Last update: 2020-01-31 13:06    [W:0.116 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site