#endif
u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
- {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
+ {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID };
EXPORT_SYMBOL(x86_acpiid_to_apicid);
/* --------------------------------------------------------------------------
mp_register_lapic_address(acpi_lapic_addr);
+ BUILD_BUG_ON(MAX_APICS != MAX_LOCAL_APIC);
count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
MAX_APICS);
x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic,
{
unsigned int acpiid, apicid;
- if ((apicid = x86_cpu_to_apicid[cpu]) == 0xff)
- return 0xff;
+ if ((apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID)
+ return INVALID_ACPIID;
for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++)
if (x86_acpiid_to_apicid[acpiid] == apicid)
return acpiid;
- return 0xff;
+ return INVALID_ACPIID;
}
u32 apic_id;
apic_id = x86_acpiid_to_apicid[acpi_id];
- if ( apic_id == 0xff )
+ if ( apic_id == BAD_APICID )
return -1;
for ( i = 0; i < NR_CPUS; i++ )
struct cpuinfo_x86 cpu_data[NR_CPUS];
-u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = -1U };
+u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
+ { [0 ... NR_CPUS-1] = BAD_APICID };
static void map_cpu_to_logical_apicid(void);
return -EBUSY;
/* Detect if the cpu has been added before */
- if ( x86_acpiid_to_apicid[acpi_id] != 0xff )
+ if ( x86_acpiid_to_apicid[acpi_id] != BAD_APICID )
{
cpu = (x86_acpiid_to_apicid[acpi_id] != apic_id)
? -EINVAL : -EEXIST;
{
dprintk(XENLOG_WARNING,
"Setup node failed for pxm %x\n", pxm);
- x86_acpiid_to_apicid[acpi_id] = 0xff;
+ x86_acpiid_to_apicid[acpi_id] = BAD_APICID;
mp_unregister_lapic(apic_id, cpu);
cpu = node;
goto out;
#endif /* CONFIG_ACPI_SLEEP */
-#define MAX_MADT_ENTRIES 256
+#define MAX_MADT_ENTRIES MAX(256, 2 * NR_CPUS)
extern u32 x86_acpiid_to_apicid[];
-#define MAX_LOCAL_APIC 256
+#define MAX_LOCAL_APIC MAX(256, 4 * NR_CPUS)
+
+#define INVALID_ACPIID (-1U)
extern u32 pmtmr_ioport;
extern void srat_detect_node(int cpu);
extern void setup_node_bootmem(int nodeid, u64 start, u64 end);
-extern unsigned char apicid_to_node[256];
+extern unsigned char apicid_to_node[];
#ifdef CONFIG_NUMA
extern void __init init_cpu_to_node(void);
/*
* Get the physical ID information for a pinned vcpu's underlying physical
* processor. The physical ID informmation is architecture-specific.
- * On x86: id[31:0]=apic_id, id[63:32]=acpi_id, and all values 0xff and
- * greater are reserved.
+ * On x86: id[31:0]=apic_id, id[63:32]=acpi_id.
* This command returns -EINVAL if it is not a valid operation for this VCPU.
*/
#define VCPUOP_get_physid 12 /* arg == vcpu_get_physid_t */
};
typedef struct vcpu_get_physid vcpu_get_physid_t;
DEFINE_XEN_GUEST_HANDLE(vcpu_get_physid_t);
-#define xen_vcpu_physid_to_x86_apicid(physid) \
- ((((uint32_t)(physid)) >= 0xff) ? 0xff : ((uint8_t)(physid)))
-#define xen_vcpu_physid_to_x86_acpiid(physid) \
- ((((uint32_t)((physid)>>32)) >= 0xff) ? 0xff : ((uint8_t)((physid)>>32)))
+#define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid))
+#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32))
/*
* Register a memory location to get a secondary copy of the vcpu time