diff options
Diffstat (limited to 'arch/x86/kernel/genx2apic_phys.c')
| -rw-r--r-- | arch/x86/kernel/genx2apic_phys.c | 125 |
1 files changed, 77 insertions, 48 deletions
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c index 21bcc0e098b..5cbae8aa040 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/genx2apic_phys.c | |||
| @@ -55,8 +55,8 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | |||
| 55 | 55 | ||
| 56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | 56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) |
| 57 | { | 57 | { |
| 58 | unsigned long flags; | ||
| 59 | unsigned long query_cpu; | 58 | unsigned long query_cpu; |
| 59 | unsigned long flags; | ||
| 60 | 60 | ||
| 61 | local_irq_save(flags); | 61 | local_irq_save(flags); |
| 62 | for_each_cpu(query_cpu, mask) { | 62 | for_each_cpu(query_cpu, mask) { |
| @@ -66,12 +66,12 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | |||
| 66 | local_irq_restore(flags); | 66 | local_irq_restore(flags); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, | 69 | static void |
| 70 | int vector) | 70 | x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) |
| 71 | { | 71 | { |
| 72 | unsigned long flags; | ||
| 73 | unsigned long query_cpu; | ||
| 74 | unsigned long this_cpu = smp_processor_id(); | 72 | unsigned long this_cpu = smp_processor_id(); |
| 73 | unsigned long query_cpu; | ||
| 74 | unsigned long flags; | ||
| 75 | 75 | ||
| 76 | local_irq_save(flags); | 76 | local_irq_save(flags); |
| 77 | for_each_cpu(query_cpu, mask) { | 77 | for_each_cpu(query_cpu, mask) { |
| @@ -85,16 +85,17 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, | |||
| 85 | 85 | ||
| 86 | static void x2apic_send_IPI_allbutself(int vector) | 86 | static void x2apic_send_IPI_allbutself(int vector) |
| 87 | { | 87 | { |
| 88 | unsigned long flags; | ||
| 89 | unsigned long query_cpu; | ||
| 90 | unsigned long this_cpu = smp_processor_id(); | 88 | unsigned long this_cpu = smp_processor_id(); |
| 89 | unsigned long query_cpu; | ||
| 90 | unsigned long flags; | ||
| 91 | 91 | ||
| 92 | local_irq_save(flags); | 92 | local_irq_save(flags); |
| 93 | for_each_online_cpu(query_cpu) | 93 | for_each_online_cpu(query_cpu) { |
| 94 | if (query_cpu != this_cpu) | 94 | if (query_cpu == this_cpu) |
| 95 | __x2apic_send_IPI_dest( | 95 | continue; |
| 96 | per_cpu(x86_cpu_to_apicid, query_cpu), | 96 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), |
| 97 | vector, APIC_DEST_PHYSICAL); | 97 | vector, APIC_DEST_PHYSICAL); |
| 98 | } | ||
| 98 | local_irq_restore(flags); | 99 | local_irq_restore(flags); |
| 99 | } | 100 | } |
| 100 | 101 | ||
| @@ -110,21 +111,21 @@ static int x2apic_apic_id_registered(void) | |||
| 110 | 111 | ||
| 111 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) | 112 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) |
| 112 | { | 113 | { |
| 113 | int cpu; | ||
| 114 | |||
| 115 | /* | 114 | /* |
| 116 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 115 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
| 117 | * May as well be the first. | 116 | * May as well be the first. |
| 118 | */ | 117 | */ |
| 119 | cpu = cpumask_first(cpumask); | 118 | int cpu = cpumask_first(cpumask); |
| 119 | |||
| 120 | if ((unsigned)cpu < nr_cpu_ids) | 120 | if ((unsigned)cpu < nr_cpu_ids) |
| 121 | return per_cpu(x86_cpu_to_apicid, cpu); | 121 | return per_cpu(x86_cpu_to_apicid, cpu); |
| 122 | else | 122 | else |
| 123 | return BAD_APICID; | 123 | return BAD_APICID; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 126 | static unsigned int |
| 127 | const struct cpumask *andmask) | 127 | x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
| 128 | const struct cpumask *andmask) | ||
| 128 | { | 129 | { |
| 129 | int cpu; | 130 | int cpu; |
| 130 | 131 | ||
| @@ -132,31 +133,28 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
| 132 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 133 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
| 133 | * May as well be the first. | 134 | * May as well be the first. |
| 134 | */ | 135 | */ |
| 135 | for_each_cpu_and(cpu, cpumask, andmask) | 136 | for_each_cpu_and(cpu, cpumask, andmask) { |
| 136 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 137 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
| 137 | break; | 138 | break; |
| 139 | } | ||
| 140 | |||
| 138 | if (cpu < nr_cpu_ids) | 141 | if (cpu < nr_cpu_ids) |
| 139 | return per_cpu(x86_cpu_to_apicid, cpu); | 142 | return per_cpu(x86_cpu_to_apicid, cpu); |
| 143 | |||
| 140 | return BAD_APICID; | 144 | return BAD_APICID; |
| 141 | } | 145 | } |
| 142 | 146 | ||
| 143 | static unsigned int get_apic_id(unsigned long x) | 147 | static unsigned int x2apic_phys_get_apic_id(unsigned long x) |
| 144 | { | 148 | { |
| 145 | unsigned int id; | 149 | return x; |
| 146 | |||
| 147 | id = x; | ||
| 148 | return id; | ||
| 149 | } | 150 | } |
| 150 | 151 | ||
| 151 | static unsigned long set_apic_id(unsigned int id) | 152 | static unsigned long set_apic_id(unsigned int id) |
| 152 | { | 153 | { |
| 153 | unsigned long x; | 154 | return id; |
| 154 | |||
| 155 | x = id; | ||
| 156 | return x; | ||
| 157 | } | 155 | } |
| 158 | 156 | ||
| 159 | static unsigned int phys_pkg_id(int index_msb) | 157 | static int x2apic_phys_pkg_id(int initial_apicid, int index_msb) |
| 160 | { | 158 | { |
| 161 | return current_cpu_data.initial_apicid >> index_msb; | 159 | return current_cpu_data.initial_apicid >> index_msb; |
| 162 | } | 160 | } |
| @@ -168,27 +166,58 @@ static void x2apic_send_IPI_self(int vector) | |||
| 168 | 166 | ||
| 169 | static void init_x2apic_ldr(void) | 167 | static void init_x2apic_ldr(void) |
| 170 | { | 168 | { |
| 171 | return; | ||
| 172 | } | 169 | } |
| 173 | 170 | ||
| 174 | struct genapic apic_x2apic_phys = { | 171 | struct genapic apic_x2apic_phys = { |
| 175 | .name = "physical x2apic", | 172 | |
| 176 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | 173 | .name = "physical x2apic", |
| 177 | .int_delivery_mode = dest_Fixed, | 174 | .probe = NULL, |
| 178 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 175 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, |
| 179 | .target_cpus = x2apic_target_cpus, | 176 | .apic_id_registered = x2apic_apic_id_registered, |
| 180 | .vector_allocation_domain = x2apic_vector_allocation_domain, | 177 | |
| 181 | .apic_id_registered = x2apic_apic_id_registered, | 178 | .irq_delivery_mode = dest_Fixed, |
| 182 | .init_apic_ldr = init_x2apic_ldr, | 179 | .irq_dest_mode = 0, /* physical */ |
| 183 | .send_IPI_all = x2apic_send_IPI_all, | 180 | |
| 184 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | 181 | .target_cpus = x2apic_target_cpus, |
| 185 | .send_IPI_mask = x2apic_send_IPI_mask, | 182 | .disable_esr = 0, |
| 186 | .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, | 183 | .dest_logical = 0, |
| 187 | .send_IPI_self = x2apic_send_IPI_self, | 184 | .check_apicid_used = NULL, |
| 188 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | 185 | .check_apicid_present = NULL, |
| 189 | .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and, | 186 | |
| 190 | .phys_pkg_id = phys_pkg_id, | 187 | .vector_allocation_domain = x2apic_vector_allocation_domain, |
| 191 | .get_apic_id = get_apic_id, | 188 | .init_apic_ldr = init_x2apic_ldr, |
| 192 | .set_apic_id = set_apic_id, | 189 | |
| 193 | .apic_id_mask = (0xFFFFFFFFu), | 190 | .ioapic_phys_id_map = NULL, |
| 191 | .setup_apic_routing = NULL, | ||
| 192 | .multi_timer_check = NULL, | ||
| 193 | .apicid_to_node = NULL, | ||
| 194 | .cpu_to_logical_apicid = NULL, | ||
| 195 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
| 196 | .apicid_to_cpu_present = NULL, | ||
| 197 | .setup_portio_remap = NULL, | ||
| 198 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
| 199 | .enable_apic_mode = NULL, | ||
| 200 | .phys_pkg_id = x2apic_phys_pkg_id, | ||
| 201 | .mps_oem_check = NULL, | ||
| 202 | |||
| 203 | .get_apic_id = x2apic_phys_get_apic_id, | ||
| 204 | .set_apic_id = set_apic_id, | ||
| 205 | .apic_id_mask = 0xFFFFFFFFu, | ||
| 206 | |||
| 207 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
| 208 | .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and, | ||
| 209 | |||
| 210 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
| 211 | .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, | ||
| 212 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
| 213 | .send_IPI_all = x2apic_send_IPI_all, | ||
| 214 | .send_IPI_self = x2apic_send_IPI_self, | ||
| 215 | |||
| 216 | .wakeup_cpu = NULL, | ||
| 217 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
| 218 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
| 219 | .wait_for_init_deassert = NULL, | ||
| 220 | .smp_callin_clear_local_apic = NULL, | ||
| 221 | .store_NMI_vector = NULL, | ||
| 222 | .inquire_remote_apic = NULL, | ||
| 194 | }; | 223 | }; |
