blob: 94eb8572d6056945cc3ebdca0a70da89dcc45396 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#include <xen/config.h>
#include <xen/irq.h>
#include <xen/sched.h>
#include <asm/current.h>
#include <asm/smp.h>
#include <asm/hardirq.h>
#include <mach_apic.h>
const cpumask_t *target_cpus_all(void)
{
return &cpu_online_map;
}
/*
* LOGICAL FLAT DELIVERY MODE (multicast via bitmask to <= 8 logical APIC IDs).
*/
void init_apic_ldr_flat(void)
{
unsigned long val;
apic_write_around(APIC_DFR, APIC_DFR_FLAT);
val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
val |= SET_xAPIC_LOGICAL_ID(1UL << smp_processor_id());
apic_write_around(APIC_LDR, val);
}
void __init clustered_apic_check_flat(void)
{
printk("Enabling APIC mode: Flat. Using %d I/O APICs\n", nr_ioapics);
}
const cpumask_t *vector_allocation_cpumask_flat(int cpu)
{
return &cpu_online_map;
}
unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask)
{
return cpumask_bits(cpumask)[0]&0xFF;
}
/*
* PHYSICAL DELIVERY MODE (unicast to physical APIC IDs).
*/
void init_apic_ldr_phys(void)
{
unsigned long val;
apic_write_around(APIC_DFR, APIC_DFR_FLAT);
/* A dummy logical ID should be fine. We only deliver in phys mode. */
val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
apic_write_around(APIC_LDR, val);
}
void __init clustered_apic_check_phys(void)
{
printk("Enabling APIC mode: Phys. Using %d I/O APICs\n", nr_ioapics);
}
const cpumask_t *vector_allocation_cpumask_phys(int cpu)
{
return cpumask_of(cpu);
}
unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask)
{
/* As we are using single CPU as destination, pick only one CPU here */
return cpu_physical_id(cpumask_any(cpumask));
}
|