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