[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 12/12] pc: Generate APIC IDs according to CPU topo
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [RFC 12/12] pc: Generate APIC IDs according to CPU topology |
Date: |
Thu, 10 Jan 2013 21:55:55 -0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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 address@hidden
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
> --
> Regards,
> Igor
--
Eduardo
- [Qemu-devel] [RFC 01/12] kvm: add KVM_FEATURE_CLOCKSOURCE_STABLE_BIT fake #define, (continued)
- [Qemu-devel] [RFC 01/12] kvm: add KVM_FEATURE_CLOCKSOURCE_STABLE_BIT fake #define, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 05/12] target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 08/12] cpus.h: Make constant smp_cores/smp_threads available on *-user, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 03/12] pc: Reverse pc_init_pci() compatibility logic, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 06/12] fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init(), Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 09/12] pc: Set fw_cfg data based on APIC ID calculation, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 12/12] pc: Generate APIC IDs according to CPU topology, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 04/12] kvm: Create kvm_arch_vcpu_id() function, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 07/12] target-i386/cpu: Introduce apic_id_for_cpu() function, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 10/12] tests: Support target-specific unit tests, Eduardo Habkost, 2013/01/09
- [Qemu-devel] [RFC 02/12] target-i386: Don't set any KVM flag by default if KVM is disabled, Eduardo Habkost, 2013/01/09