Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312414
b: refs/heads/master
c: 0b8255e
h: refs/heads/master
v: v3
  • Loading branch information
Suresh Siddha authored and Ingo Molnar committed Jun 6, 2012
1 parent c8e2d85 commit 25b32f0
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 332afa656e76458ee9cf0f0d123016a0658539e4
refs/heads/master: 0b8255e660a0c229ebfe8f9fde12a8d4d34c50e0
9 changes: 0 additions & 9 deletions trunk/arch/x86/include/asm/x2apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ static int x2apic_apic_id_registered(void)
return 1;
}

/*
* 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)
{
Expand Down
56 changes: 39 additions & 17 deletions trunk/arch/x86/kernel/apic/x2apic_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,47 @@ static void x2apic_send_IPI_all(int vector)

static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
{
/*
* We're using fixed IRQ delivery, can only return one logical APIC ID.
* May as well be the first.
*/
int cpu = cpumask_first(cpumask);
u32 dest = 0;
int i;

if ((unsigned)cpu < nr_cpu_ids)
return per_cpu(x86_cpu_to_logical_apicid, cpu);
else
if (cpu > nr_cpu_ids)
return BAD_APICID;

for_each_cpu_and(i, cpumask, per_cpu(cpus_in_cluster, cpu))
dest |= per_cpu(x86_cpu_to_logical_apicid, i);

return dest;
}

static unsigned int
x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
const struct cpumask *andmask)
{
int cpu;
u32 dest = 0;
u16 cluster;
int i;

/*
* We're using fixed IRQ delivery, can only return one logical APIC ID.
* May as well be the first.
*/
for_each_cpu_and(cpu, cpumask, andmask) {
if (cpumask_test_cpu(cpu, cpu_online_mask))
break;
for_each_cpu_and(i, cpumask, andmask) {
if (!cpumask_test_cpu(i, cpu_online_mask))
continue;
dest = per_cpu(x86_cpu_to_logical_apicid, i);
cluster = x2apic_cluster(i);
break;
}

return per_cpu(x86_cpu_to_logical_apicid, cpu);
if (!dest)
return BAD_APICID;

for_each_cpu_and(i, cpumask, andmask) {
if (!cpumask_test_cpu(i, cpu_online_mask))
continue;
if (cluster != x2apic_cluster(i))
continue;
dest |= per_cpu(x86_cpu_to_logical_apicid, i);
}

return dest;
}

static void init_x2apic_ldr(void)
Expand Down Expand Up @@ -208,6 +221,15 @@ static int x2apic_cluster_probe(void)
return 0;
}

/*
* Each x2apic cluster is an allocation domain.
*/
static void cluster_vector_allocation_domain(int cpu, struct cpumask *retmask)
{
cpumask_clear(retmask);
cpumask_copy(retmask, per_cpu(cpus_in_cluster, cpu));
}

static struct apic apic_x2apic_cluster = {

.name = "cluster x2apic",
Expand All @@ -225,7 +247,7 @@ static struct apic apic_x2apic_cluster = {
.check_apicid_used = NULL,
.check_apicid_present = NULL,

.vector_allocation_domain = x2apic_vector_allocation_domain,
.vector_allocation_domain = cluster_vector_allocation_domain,
.init_apic_ldr = init_x2apic_ldr,

.ioapic_phys_id_map = NULL,
Expand Down
9 changes: 9 additions & 0 deletions trunk/arch/x86/kernel/apic/x2apic_phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ static int x2apic_phys_probe(void)
return apic == &apic_x2apic_phys;
}

/*
* 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 struct apic apic_x2apic_phys = {

.name = "physical x2apic",
Expand Down

0 comments on commit 25b32f0

Please sign in to comment.