Re: [RFC PATCH 5/7] [hyper-v] hyper-v helper functions

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

 



On Sun, 2011-10-09 at 21:01 +0200, Alon Levy wrote:
> On Sun, Oct 09, 2011 at 08:52:53PM +0200, Vadim Rozenfeld wrote:
> > ---
> >  hyperv.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
> >  hyperv.h |    7 +++++++
> >  2 files changed, 51 insertions(+), 0 deletions(-)
> > 
> > diff --git a/hyperv.c b/hyperv.c
> > index a17f879..57915b9 100644
> > --- a/hyperv.c
> > +++ b/hyperv.c
> > @@ -3,6 +3,10 @@
> >  #include "qemu-option.h"
> >  #include "qemu-config.h"
> >  
> > +static int hyperv_apic;
> > +static int hyperv_wd;
> > +static int hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
> > +
> >  void hyperv_init(void)
> >  {
> >      QemuOpts *opts = QTAILQ_FIRST(&qemu_hyperv_opts.head);
> > @@ -10,6 +14,46 @@ void hyperv_init(void)
> >      if (!opts) {
> >          return;
> >      }
> > +
> > +    hyperv_spinlock_attempts = qemu_opt_get_number(opts, "spinlock", 
> > +                                                   HYPERV_SPINLOCK_NEVER_RETRY
> > +                                                  );
> > +    hyperv_wd = qemu_opt_get_bool(opts, "wd", 0);
> > +    hyperv_apic = qemu_opt_get_bool(opts, "vapic", 0);
> > +
> > +}
> > +
> > +int hyperv_enabled(void)
> > +{
> > +    return hyperv_hypercall_available() | hyperv_relaxed_timing();
> Shouldn't this be a logical or?
Sure, thanks.
> 
> > +}
> > +
> > +int hyperv_hypercall_available(void)
> > +{
> > +    if (hyperv_apic ||
> > +        (hyperv_spinlock_attempts != HYPERV_SPINLOCK_NEVER_RETRY)) {
> > +      return 1;
> > +    }
> > +    return 0;
> > +}
> > +
> > +int hyperv_relaxed_timing(void)
> > +{
> > +    return !hyperv_wd;
> > +}
> > +
> > +int hyperv_apic_recommended(void)
> > +{
> > +#ifdef KVM_CAP_IRQCHIP
> > +    return hyperv_apic;
> > +#else
> > +    return 0;
> > +#endif
> > +}
> > +
> > +int hyperv_spinlock_retries(void)
> > +{
> > +    return hyperv_spinlock_attempts;
> >  }
> >  
> >  static void hyperv_initialize(void)
> > diff --git a/hyperv.h b/hyperv.h
> > index eaf974a..27d2e6e 100644
> > --- a/hyperv.h
> > +++ b/hyperv.h
> > @@ -6,7 +6,14 @@
> >  
> >  #include <asm/hyperv.h>
> >  
> > +#define HYPERV_SPINLOCK_NEVER_RETRY             0xFFFFFFFF
> > +
> >  void hyperv_init(void);
> > +int hyperv_enabled(void);
> > +int hyperv_hypercall_available(void);
> > +int hyperv_relaxed_timing(void);
> > +int hyperv_apic_recommended(void);
> > +int hyperv_spinlock_retries(void);
> >  
> >  #endif /* QEMU_HW_HYPERV_H */
> >  
> > -- 
> > 1.7.4.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux