qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 1/2] Move KVM init to arch_init.c, compile vl.c


From: Blue Swirl
Subject: [Qemu-devel] Re: [PATCH 1/2] Move KVM init to arch_init.c, compile vl.c once
Date: Fri, 2 Apr 2010 17:20:38 +0300

On 4/1/10, Paolo Bonzini <address@hidden> wrote:
> On 04/01/2010 10:07 PM, Blue Swirl wrote:
>
> > Remove dependency of vl.c to KVM, then we can partially revert
> > b33612d03540fda7fa67485f1c20395beb7a2bf0.
> >
>
>  This is ugly...
>
>  Michael Tsirkin said in commit ca821806:
>
>   Comment on kvm usage: rather than require users to do if(kvm_enabled())
>   and/or ifdefs, this patch adds an API that, internally, is defined to
>   stub function on non-kvm build, and checks kvm_enabled for non-kvm
>   run.
>
>   While rest of qemu code still uses if (kvm_enabled()), I think this
>   approach is cleaner, and we should convert rest of code to it
>   long term.
>
>  Maybe we can start doing this for kvm_init?

I see now. Yes, this would be better approach, I think this is also
what Anthony proposed.

> > +void enable_kvm(void)
> > +{
> > +    kvm_allowed = 1;
> > +}
> >
>
>  If you're adding this, this conditional from vl.c
>
>   if (!(kvm_available())) {
>      printf("Option %s not supported for this target\n", popt->name);
>      exit(1);
>   }
>
>  belongs in arch_init.c too, like in do_smbios_option and
> do_acpitable_option.
>
>  Alternatively, with the approach I gave above, you can test in
> kvm_maybe_init if kvm_init returns -ENOSYS, and print the error above
> instead of "failed to initialize KVM".

Also kvm_allowed could be set in kvm-all.c.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]