Re: [RFC 12/12] pc: Generate APIC IDs according to CPU topology

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

 



On Fri, Jan 11, 2013 at 12:36:35AM +0100, Igor Mammedov wrote:
[...]
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index 33787dc..f34192c 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> > @@ -23,6 +23,8 @@
> >  
> >  #include "cpu.h"
> >  #include "sysemu/kvm.h"
> > +#include "sysemu/cpus.h"
> > +#include "topology.h"
> >  
> >  #include "qemu/option.h"
> >  #include "qemu/config-file.h"
> > @@ -2192,6 +2194,14 @@ void x86_cpu_realize(Object *obj, Error **errp)
> >      cpu_reset(CPU(cpu));
> >  }
> >  
> > +/* Enables contiguous-apic-ID mode, for compatibility */
> > +static bool compat_apic_id_mode;
> > +
> > +void enable_compat_apic_id_mode(void)
> > +{
> > +    compat_apic_id_mode = true;
> > +}
> > +
> >  /* Calculates initial APIC ID for a specific CPU index
> >   *
> >   * Currently we need to be able to calculate the APIC ID from the CPU index
> > @@ -2201,10 +2211,20 @@ void x86_cpu_realize(Object *obj, Error **errp)
> >   */
> >  uint32_t apic_id_for_cpu(unsigned int cpu_index)
> if you move ^^^ to board, there won't be need in [8/12]

True. The previous version I had (apic-id-topology-using-apic-id-prop
branch) didn't need it. But I just wanted to avoid touching the CPU
creation code by now.

BTW, *-user doesn't have a board but does have an APIC ID (because
*-user has CPUID and CPUID exposes the APIC ID). This would mean we
would need APIC ID calculation code present in two separated places
(which I would like to avoid).


> >  {
> > -    /* right now APIC ID == CPU index. this will eventually change to use
> > -     * the CPU topology configuration properly
> > -     */
> > -    return cpu_index;
> > +    uint32_t correct_id;
> > +    static bool warned;
> > +
> > +    correct_id = topo_apicid_for_cpu(smp_cores, smp_threads, cpu_index);
> > +    if (compat_apic_id_mode) {
> > +        if (cpu_index != correct_id && !warned) {
> > +            error_report("APIC IDs set in compatibility mode, "
> > +                         "CPU topology won't match the configuration");
> > +            warned = true;
> > +        }
> > +        return cpu_index;
> > +    } else {
> > +        return correct_id;
> > +    }
> >  }
> >  
> >  static void x86_cpu_initfn(Object *obj)
> > diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> > index dbd9899..d9a9e8f 100644
> > --- a/target-i386/cpu.h
> > +++ b/target-i386/cpu.h
> > @@ -1239,5 +1239,6 @@ void disable_kvm_pv_eoi(void);
> >  const char *get_register_name_32(unsigned int reg);
> >  
> >  uint32_t apic_id_for_cpu(unsigned int cpu_index);
> > +void enable_compat_apic_id_mode(void);
> >  
> >  #endif /* CPU_I386_H */
> > -- 
> > 1.7.11.7
> > 
> > --
> > 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
> 
> 
> -- 
> Regards,
>   Igor

-- 
Eduardo
--
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