diff options
-rw-r--r-- | arch/x86/include/asm/apic.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/irq_remapping.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 49 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/probe_64.c | 2 | ||||
-rw-r--r-- | include/linux/dmar.h | 2 |
7 files changed, 21 insertions, 48 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index fbdd65446c7a..3738438a91f5 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -107,8 +107,7 @@ extern u32 native_safe_apic_wait_icr_idle(void); | |||
107 | extern void native_apic_icr_write(u32 low, u32 id); | 107 | extern void native_apic_icr_write(u32 low, u32 id); |
108 | extern u64 native_apic_icr_read(void); | 108 | extern u64 native_apic_icr_read(void); |
109 | 109 | ||
110 | #define EIM_8BIT_APIC_ID 0 | 110 | extern int x2apic_mode; |
111 | #define EIM_32BIT_APIC_ID 1 | ||
112 | 111 | ||
113 | #ifdef CONFIG_X86_X2APIC | 112 | #ifdef CONFIG_X86_X2APIC |
114 | /* | 113 | /* |
@@ -166,7 +165,7 @@ static inline u64 native_x2apic_icr_read(void) | |||
166 | return val; | 165 | return val; |
167 | } | 166 | } |
168 | 167 | ||
169 | extern int x2apic, x2apic_phys; | 168 | extern int x2apic_phys; |
170 | extern void check_x2apic(void); | 169 | extern void check_x2apic(void); |
171 | extern void enable_x2apic(void); | 170 | extern void enable_x2apic(void); |
172 | extern void x2apic_icr_write(u32 low, u32 id); | 171 | extern void x2apic_icr_write(u32 low, u32 id); |
@@ -182,6 +181,8 @@ static inline int x2apic_enabled(void) | |||
182 | return 1; | 181 | return 1; |
183 | return 0; | 182 | return 0; |
184 | } | 183 | } |
184 | |||
185 | #define x2apic_supported() (cpu_has_x2apic) | ||
185 | #else | 186 | #else |
186 | static inline void check_x2apic(void) | 187 | static inline void check_x2apic(void) |
187 | { | 188 | { |
@@ -194,9 +195,8 @@ static inline int x2apic_enabled(void) | |||
194 | return 0; | 195 | return 0; |
195 | } | 196 | } |
196 | 197 | ||
197 | #define x2apic 0 | ||
198 | #define x2apic_preenabled 0 | 198 | #define x2apic_preenabled 0 |
199 | 199 | #define x2apic_supported() 0 | |
200 | #endif | 200 | #endif |
201 | 201 | ||
202 | extern void enable_IR_x2apic(void); | 202 | extern void enable_IR_x2apic(void); |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 9d826e436010..34eaa37f7ad4 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -161,7 +161,6 @@ extern int io_apic_set_pci_routing(int ioapic, int pin, int irq, | |||
161 | extern int (*ioapic_renumber_irq)(int ioapic, int irq); | 161 | extern int (*ioapic_renumber_irq)(int ioapic, int irq); |
162 | extern void ioapic_init_mappings(void); | 162 | extern void ioapic_init_mappings(void); |
163 | 163 | ||
164 | #ifdef CONFIG_X86_64 | ||
165 | extern struct IO_APIC_route_entry **alloc_ioapic_entries(void); | 164 | extern struct IO_APIC_route_entry **alloc_ioapic_entries(void); |
166 | extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries); | 165 | extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries); |
167 | extern int save_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); | 166 | extern int save_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); |
@@ -169,7 +168,6 @@ extern void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); | |||
169 | extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); | 168 | extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); |
170 | extern void reinit_intr_remapped_IO_APIC(int intr_remapping, | 169 | extern void reinit_intr_remapped_IO_APIC(int intr_remapping, |
171 | struct IO_APIC_route_entry **ioapic_entries); | 170 | struct IO_APIC_route_entry **ioapic_entries); |
172 | #endif | ||
173 | 171 | ||
174 | extern void probe_nr_irqs_gsi(void); | 172 | extern void probe_nr_irqs_gsi(void); |
175 | 173 | ||
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h index 0396760fccb8..f275e2244505 100644 --- a/arch/x86/include/asm/irq_remapping.h +++ b/arch/x86/include/asm/irq_remapping.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _ASM_X86_IRQ_REMAPPING_H | 1 | #ifndef _ASM_X86_IRQ_REMAPPING_H |
2 | #define _ASM_X86_IRQ_REMAPPING_H | 2 | #define _ASM_X86_IRQ_REMAPPING_H |
3 | 3 | ||
4 | #define IRTE_DEST(dest) ((x2apic) ? dest : dest << 8) | 4 | #define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) |
5 | 5 | ||
6 | #endif /* _ASM_X86_IRQ_REMAPPING_H */ | 6 | #endif /* _ASM_X86_IRQ_REMAPPING_H */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 7b41a32339e0..2b30e520dce3 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -134,8 +134,8 @@ static __init int setup_apicpmtimer(char *s) | |||
134 | __setup("apicpmtimer", setup_apicpmtimer); | 134 | __setup("apicpmtimer", setup_apicpmtimer); |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | int x2apic_mode; | ||
137 | #ifdef CONFIG_X86_X2APIC | 138 | #ifdef CONFIG_X86_X2APIC |
138 | int x2apic; | ||
139 | /* x2apic enabled before OS handover */ | 139 | /* x2apic enabled before OS handover */ |
140 | static int x2apic_preenabled; | 140 | static int x2apic_preenabled; |
141 | static int disable_x2apic; | 141 | static int disable_x2apic; |
@@ -858,7 +858,7 @@ void clear_local_APIC(void) | |||
858 | u32 v; | 858 | u32 v; |
859 | 859 | ||
860 | /* APIC hasn't been mapped yet */ | 860 | /* APIC hasn't been mapped yet */ |
861 | if (!x2apic && !apic_phys) | 861 | if (!x2apic_mode && !apic_phys) |
862 | return; | 862 | return; |
863 | 863 | ||
864 | maxlvt = lapic_get_maxlvt(); | 864 | maxlvt = lapic_get_maxlvt(); |
@@ -1330,7 +1330,7 @@ void check_x2apic(void) | |||
1330 | { | 1330 | { |
1331 | if (x2apic_enabled()) { | 1331 | if (x2apic_enabled()) { |
1332 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); | 1332 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); |
1333 | x2apic_preenabled = x2apic = 1; | 1333 | x2apic_preenabled = x2apic_mode = 1; |
1334 | } | 1334 | } |
1335 | } | 1335 | } |
1336 | 1336 | ||
@@ -1338,7 +1338,7 @@ void enable_x2apic(void) | |||
1338 | { | 1338 | { |
1339 | int msr, msr2; | 1339 | int msr, msr2; |
1340 | 1340 | ||
1341 | if (!x2apic) | 1341 | if (!x2apic_mode) |
1342 | return; | 1342 | return; |
1343 | 1343 | ||
1344 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | 1344 | rdmsr(MSR_IA32_APICBASE, msr, msr2); |
@@ -1390,25 +1390,17 @@ void __init enable_IR_x2apic(void) | |||
1390 | mask_IO_APIC_setup(ioapic_entries); | 1390 | mask_IO_APIC_setup(ioapic_entries); |
1391 | mask_8259A(); | 1391 | mask_8259A(); |
1392 | 1392 | ||
1393 | #ifdef CONFIG_X86_X2APIC | 1393 | ret = enable_intr_remapping(x2apic_supported()); |
1394 | if (cpu_has_x2apic) | ||
1395 | ret = enable_intr_remapping(EIM_32BIT_APIC_ID); | ||
1396 | else | ||
1397 | #endif | ||
1398 | ret = enable_intr_remapping(EIM_8BIT_APIC_ID); | ||
1399 | |||
1400 | if (ret) | 1394 | if (ret) |
1401 | goto end_restore; | 1395 | goto end_restore; |
1402 | 1396 | ||
1403 | pr_info("Enabled Interrupt-remapping\n"); | 1397 | pr_info("Enabled Interrupt-remapping\n"); |
1404 | 1398 | ||
1405 | #ifdef CONFIG_X86_X2APIC | 1399 | if (x2apic_supported() && !x2apic_mode) { |
1406 | if (cpu_has_x2apic && !x2apic) { | 1400 | x2apic_mode = 1; |
1407 | x2apic = 1; | ||
1408 | enable_x2apic(); | 1401 | enable_x2apic(); |
1409 | pr_info("Enabled x2apic\n"); | 1402 | pr_info("Enabled x2apic\n"); |
1410 | } | 1403 | } |
1411 | #endif | ||
1412 | 1404 | ||
1413 | end_restore: | 1405 | end_restore: |
1414 | if (ret) | 1406 | if (ret) |
@@ -1576,7 +1568,7 @@ void __init early_init_lapic_mapping(void) | |||
1576 | */ | 1568 | */ |
1577 | void __init init_apic_mappings(void) | 1569 | void __init init_apic_mappings(void) |
1578 | { | 1570 | { |
1579 | if (x2apic) { | 1571 | if (x2apic_mode) { |
1580 | boot_cpu_physical_apicid = read_apic_id(); | 1572 | boot_cpu_physical_apicid = read_apic_id(); |
1581 | return; | 1573 | return; |
1582 | } | 1574 | } |
@@ -2010,10 +2002,10 @@ static int lapic_suspend(struct sys_device *dev, pm_message_t state) | |||
2010 | 2002 | ||
2011 | local_irq_save(flags); | 2003 | local_irq_save(flags); |
2012 | disable_local_APIC(); | 2004 | disable_local_APIC(); |
2013 | #ifdef CONFIG_INTR_REMAP | 2005 | |
2014 | if (intr_remapping_enabled) | 2006 | if (intr_remapping_enabled) |
2015 | disable_intr_remapping(); | 2007 | disable_intr_remapping(); |
2016 | #endif | 2008 | |
2017 | local_irq_restore(flags); | 2009 | local_irq_restore(flags); |
2018 | return 0; | 2010 | return 0; |
2019 | } | 2011 | } |
@@ -2023,8 +2015,6 @@ static int lapic_resume(struct sys_device *dev) | |||
2023 | unsigned int l, h; | 2015 | unsigned int l, h; |
2024 | unsigned long flags; | 2016 | unsigned long flags; |
2025 | int maxlvt; | 2017 | int maxlvt; |
2026 | |||
2027 | #ifdef CONFIG_INTR_REMAP | ||
2028 | int ret; | 2018 | int ret; |
2029 | struct IO_APIC_route_entry **ioapic_entries = NULL; | 2019 | struct IO_APIC_route_entry **ioapic_entries = NULL; |
2030 | 2020 | ||
@@ -2050,17 +2040,8 @@ static int lapic_resume(struct sys_device *dev) | |||
2050 | mask_8259A(); | 2040 | mask_8259A(); |
2051 | } | 2041 | } |
2052 | 2042 | ||
2053 | if (x2apic) | 2043 | if (x2apic_mode) |
2054 | enable_x2apic(); | 2044 | enable_x2apic(); |
2055 | #else | ||
2056 | if (!apic_pm_state.active) | ||
2057 | return 0; | ||
2058 | |||
2059 | local_irq_save(flags); | ||
2060 | if (x2apic) | ||
2061 | enable_x2apic(); | ||
2062 | #endif | ||
2063 | |||
2064 | else { | 2045 | else { |
2065 | /* | 2046 | /* |
2066 | * Make sure the APICBASE points to the right address | 2047 | * Make sure the APICBASE points to the right address |
@@ -2098,18 +2079,12 @@ static int lapic_resume(struct sys_device *dev) | |||
2098 | apic_write(APIC_ESR, 0); | 2079 | apic_write(APIC_ESR, 0); |
2099 | apic_read(APIC_ESR); | 2080 | apic_read(APIC_ESR); |
2100 | 2081 | ||
2101 | #ifdef CONFIG_INTR_REMAP | ||
2102 | if (intr_remapping_enabled) { | 2082 | if (intr_remapping_enabled) { |
2103 | if (x2apic) | 2083 | reenable_intr_remapping(x2apic_mode); |
2104 | reenable_intr_remapping(EIM_32BIT_APIC_ID); | ||
2105 | else | ||
2106 | reenable_intr_remapping(EIM_8BIT_APIC_ID); | ||
2107 | |||
2108 | unmask_8259A(); | 2084 | unmask_8259A(); |
2109 | restore_IO_APIC_setup(ioapic_entries); | 2085 | restore_IO_APIC_setup(ioapic_entries); |
2110 | free_ioapic_entries(ioapic_entries); | 2086 | free_ioapic_entries(ioapic_entries); |
2111 | } | 2087 | } |
2112 | #endif | ||
2113 | 2088 | ||
2114 | local_irq_restore(flags); | 2089 | local_irq_restore(flags); |
2115 | 2090 | ||
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index ea22a86e3cda..3a45d2ec9740 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -736,7 +736,6 @@ static int __init ioapic_pirq_setup(char *str) | |||
736 | __setup("pirq=", ioapic_pirq_setup); | 736 | __setup("pirq=", ioapic_pirq_setup); |
737 | #endif /* CONFIG_X86_32 */ | 737 | #endif /* CONFIG_X86_32 */ |
738 | 738 | ||
739 | #ifdef CONFIG_INTR_REMAP | ||
740 | struct IO_APIC_route_entry **alloc_ioapic_entries(void) | 739 | struct IO_APIC_route_entry **alloc_ioapic_entries(void) |
741 | { | 740 | { |
742 | int apic; | 741 | int apic; |
@@ -857,7 +856,6 @@ void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries) | |||
857 | 856 | ||
858 | kfree(ioapic_entries); | 857 | kfree(ioapic_entries); |
859 | } | 858 | } |
860 | #endif | ||
861 | 859 | ||
862 | /* | 860 | /* |
863 | * Find the IRQ entry number of a certain pin. | 861 | * Find the IRQ entry number of a certain pin. |
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index 1783652bb0e5..bc3e880f9b82 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -50,7 +50,7 @@ static struct apic *apic_probe[] __initdata = { | |||
50 | void __init default_setup_apic_routing(void) | 50 | void __init default_setup_apic_routing(void) |
51 | { | 51 | { |
52 | #ifdef CONFIG_X86_X2APIC | 52 | #ifdef CONFIG_X86_X2APIC |
53 | if (x2apic && (apic != &apic_x2apic_phys && | 53 | if (x2apic_mode && (apic != &apic_x2apic_phys && |
54 | #ifdef CONFIG_X86_UV | 54 | #ifdef CONFIG_X86_UV |
55 | apic != &apic_x2apic_uv_x && | 55 | apic != &apic_x2apic_uv_x && |
56 | #endif | 56 | #endif |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 06f592a7f73c..10ff5c498824 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -158,6 +158,8 @@ static inline struct intel_iommu *map_ioapic_to_ir(int apic) | |||
158 | } | 158 | } |
159 | #define irq_remapped(irq) (0) | 159 | #define irq_remapped(irq) (0) |
160 | #define enable_intr_remapping(mode) (-1) | 160 | #define enable_intr_remapping(mode) (-1) |
161 | #define disable_intr_remapping() (0) | ||
162 | #define reenable_intr_remapping(mode) (0) | ||
161 | #define intr_remapping_enabled (0) | 163 | #define intr_remapping_enabled (0) |
162 | #endif | 164 | #endif |
163 | 165 | ||