|
@@ -8,8 +8,7 @@
|
|
#include <linux/cpu.h>
|
|
#include <linux/cpu.h>
|
|
|
|
|
|
#include <asm/smp.h>
|
|
#include <asm/smp.h>
|
|
-#include <asm/apic.h>
|
|
|
|
-#include <asm/ipi.h>
|
|
|
|
|
|
+#include <asm/x2apic.h>
|
|
|
|
|
|
static DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid);
|
|
static DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid);
|
|
static DEFINE_PER_CPU(cpumask_var_t, cpus_in_cluster);
|
|
static DEFINE_PER_CPU(cpumask_var_t, cpus_in_cluster);
|
|
@@ -20,37 +19,6 @@ static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
|
|
return x2apic_enabled();
|
|
return x2apic_enabled();
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * need to use more than cpu 0, because we need more vectors when
|
|
|
|
- * MSI-X are used.
|
|
|
|
- */
|
|
|
|
-static const struct cpumask *x2apic_target_cpus(void)
|
|
|
|
-{
|
|
|
|
- return cpu_online_mask;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * for now each logical cpu is in its own vector allocation domain.
|
|
|
|
- */
|
|
|
|
-static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask)
|
|
|
|
-{
|
|
|
|
- cpumask_clear(retmask);
|
|
|
|
- cpumask_set_cpu(cpu, retmask);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void
|
|
|
|
- __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest)
|
|
|
|
-{
|
|
|
|
- unsigned long cfg;
|
|
|
|
-
|
|
|
|
- cfg = __prepare_ICR(0, vector, dest);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * send the IPI.
|
|
|
|
- */
|
|
|
|
- native_x2apic_icr_write(cfg, apicid);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static inline u32 x2apic_cluster(int cpu)
|
|
static inline u32 x2apic_cluster(int cpu)
|
|
{
|
|
{
|
|
return per_cpu(x86_cpu_to_logical_apicid, cpu) >> 16;
|
|
return per_cpu(x86_cpu_to_logical_apicid, cpu) >> 16;
|
|
@@ -128,11 +96,6 @@ static void x2apic_send_IPI_all(int vector)
|
|
__x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
|
|
__x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
|
|
}
|
|
}
|
|
|
|
|
|
-static int x2apic_apic_id_registered(void)
|
|
|
|
-{
|
|
|
|
- return 1;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
|
|
static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
|
|
{
|
|
{
|
|
/*
|
|
/*
|
|
@@ -165,32 +128,6 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
|
return per_cpu(x86_cpu_to_logical_apicid, cpu);
|
|
return per_cpu(x86_cpu_to_logical_apicid, cpu);
|
|
}
|
|
}
|
|
|
|
|
|
-static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x)
|
|
|
|
-{
|
|
|
|
- unsigned int id;
|
|
|
|
-
|
|
|
|
- id = x;
|
|
|
|
- return id;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static unsigned long set_apic_id(unsigned int id)
|
|
|
|
-{
|
|
|
|
- unsigned long x;
|
|
|
|
-
|
|
|
|
- x = id;
|
|
|
|
- return x;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int x2apic_cluster_phys_pkg_id(int initial_apicid, int index_msb)
|
|
|
|
-{
|
|
|
|
- return initial_apicid >> index_msb;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void x2apic_send_IPI_self(int vector)
|
|
|
|
-{
|
|
|
|
- apic_write(APIC_SELF_IPI, vector);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void init_x2apic_ldr(void)
|
|
static void init_x2apic_ldr(void)
|
|
{
|
|
{
|
|
unsigned int this_cpu = smp_processor_id();
|
|
unsigned int this_cpu = smp_processor_id();
|
|
@@ -298,11 +235,11 @@ struct apic apic_x2apic_cluster = {
|
|
.setup_portio_remap = NULL,
|
|
.setup_portio_remap = NULL,
|
|
.check_phys_apicid_present = default_check_phys_apicid_present,
|
|
.check_phys_apicid_present = default_check_phys_apicid_present,
|
|
.enable_apic_mode = NULL,
|
|
.enable_apic_mode = NULL,
|
|
- .phys_pkg_id = x2apic_cluster_phys_pkg_id,
|
|
|
|
|
|
+ .phys_pkg_id = x2apic_phys_pkg_id,
|
|
.mps_oem_check = NULL,
|
|
.mps_oem_check = NULL,
|
|
|
|
|
|
- .get_apic_id = x2apic_cluster_phys_get_apic_id,
|
|
|
|
- .set_apic_id = set_apic_id,
|
|
|
|
|
|
+ .get_apic_id = x2apic_get_apic_id,
|
|
|
|
+ .set_apic_id = x2apic_set_apic_id,
|
|
.apic_id_mask = 0xFFFFFFFFu,
|
|
.apic_id_mask = 0xFFFFFFFFu,
|
|
|
|
|
|
.cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
|
|
.cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
|