aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c8
-rw-r--r--arch/arm/boot/dts/dra7.dtsi6
-rw-r--r--arch/arm/boot/dts/imx25.dtsi8
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts8
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts2
-rw-r--r--arch/arm/kernel/entry-header.S13
-rw-r--r--arch/arm/kernel/perf_event.c10
-rw-r--r--arch/arm/kernel/setup.c7
-rw-r--r--arch/arm/mach-mvebu/coherency.c7
-rw-r--r--arch/arm/mach-omap2/common.h1
-rw-r--r--arch/arm/mach-omap2/omap4-common.c32
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c1
-rw-r--r--arch/arm/mach-omap2/prcm-common.h1
-rw-r--r--arch/arm/mach-omap2/prm44xx.c5
-rw-r--r--arch/arm/mach-omap2/prm_common.c14
-rw-r--r--arch/arm/mach-omap2/twl-common.c7
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c9
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c9
-rw-r--r--arch/arm64/Makefile1
-rw-r--r--arch/arm64/boot/dts/Makefile2
-rw-r--r--arch/arm64/boot/dts/arm/juno.dts2
-rw-r--r--arch/arm64/mm/dump.c1
-rw-r--r--arch/avr32/kernel/module.c13
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c2
-rw-r--r--arch/cris/kernel/module.c2
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c2
-rw-r--r--arch/ia64/kernel/module.c6
-rw-r--r--arch/ia64/pci/pci.c48
-rw-r--r--arch/microblaze/pci/pci-common.c13
-rw-r--r--arch/mips/net/bpf_jit.c2
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c2
-rw-r--r--arch/mn10300/unit-asb2305/pci.c47
-rw-r--r--arch/nios2/kernel/module.c2
-rw-r--r--arch/nios2/kernel/signal.c2
-rw-r--r--arch/parisc/kernel/module.c6
-rw-r--r--arch/powerpc/kernel/pci-common.c12
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c2
-rw-r--r--arch/powerpc/platforms/powernv/setup.c2
-rw-r--r--arch/powerpc/xmon/xmon.c1
-rw-r--r--arch/s390/kernel/module.c10
-rw-r--r--arch/s390/net/bpf_jit.S28
-rw-r--r--arch/s390/net/bpf_jit_comp.c9
-rw-r--r--arch/sparc/kernel/pci.c5
-rw-r--r--arch/sparc/net/bpf_jit_comp.c4
-rw-r--r--arch/tile/kernel/module.c4
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/boot/compressed/Makefile2
-rw-r--r--arch/x86/boot/compressed/misc.c9
-rw-r--r--arch/x86/include/asm/acpi.h1
-rw-r--r--arch/x86/include/asm/desc.h20
-rw-r--r--arch/x86/include/asm/mmu_context.h20
-rw-r--r--arch/x86/kernel/acpi/boot.c26
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c1
-rw-r--r--arch/x86/kernel/ftrace.c2
-rw-r--r--arch/x86/kernel/irq.c2
-rw-r--r--arch/x86/kernel/tls.c25
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/kvm/emulate.c31
-rw-r--r--arch/x86/mm/init.c4
-rw-r--r--arch/x86/mm/mpx.c6
-rw-r--r--arch/x86/mm/pat.c7
-rw-r--r--arch/x86/pci/i386.c2
-rw-r--r--arch/x86/pci/xen.c49
-rw-r--r--arch/x86/tools/calc_run_size.pl39
-rw-r--r--arch/x86/tools/calc_run_size.sh42
68 files changed, 403 insertions, 287 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35cd6cde..98a1525fa164 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -285,8 +285,12 @@ pcibios_claim_one_bus(struct pci_bus *b)
285 if (r->parent || !r->start || !r->flags) 285 if (r->parent || !r->start || !r->flags)
286 continue; 286 continue;
287 if (pci_has_flag(PCI_PROBE_ONLY) || 287 if (pci_has_flag(PCI_PROBE_ONLY) ||
288 (r->flags & IORESOURCE_PCI_FIXED)) 288 (r->flags & IORESOURCE_PCI_FIXED)) {
289 pci_claim_resource(dev, i); 289 if (pci_claim_resource(dev, i) == 0)
290 continue;
291
292 pci_claim_bridge_resource(dev, i);
293 }
290 } 294 }
291 } 295 }
292 296
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 22771bc1643a..63f8b007bdc5 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1257,6 +1257,8 @@
1257 tx-fifo-resize; 1257 tx-fifo-resize;
1258 maximum-speed = "super-speed"; 1258 maximum-speed = "super-speed";
1259 dr_mode = "otg"; 1259 dr_mode = "otg";
1260 snps,dis_u3_susphy_quirk;
1261 snps,dis_u2_susphy_quirk;
1260 }; 1262 };
1261 }; 1263 };
1262 1264
@@ -1278,6 +1280,8 @@
1278 tx-fifo-resize; 1280 tx-fifo-resize;
1279 maximum-speed = "high-speed"; 1281 maximum-speed = "high-speed";
1280 dr_mode = "otg"; 1282 dr_mode = "otg";
1283 snps,dis_u3_susphy_quirk;
1284 snps,dis_u2_susphy_quirk;
1281 }; 1285 };
1282 }; 1286 };
1283 1287
@@ -1299,6 +1303,8 @@
1299 tx-fifo-resize; 1303 tx-fifo-resize;
1300 maximum-speed = "high-speed"; 1304 maximum-speed = "high-speed";
1301 dr_mode = "otg"; 1305 dr_mode = "otg";
1306 snps,dis_u3_susphy_quirk;
1307 snps,dis_u2_susphy_quirk;
1302 }; 1308 };
1303 }; 1309 };
1304 1310
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index d238676a9107..e4d3aecc4ed2 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -369,7 +369,7 @@
369 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 369 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
370 #pwm-cells = <2>; 370 #pwm-cells = <2>;
371 reg = <0x53fa0000 0x4000>; 371 reg = <0x53fa0000 0x4000>;
372 clocks = <&clks 106>, <&clks 36>; 372 clocks = <&clks 106>, <&clks 52>;
373 clock-names = "ipg", "per"; 373 clock-names = "ipg", "per";
374 interrupts = <36>; 374 interrupts = <36>;
375 }; 375 };
@@ -388,7 +388,7 @@
388 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 388 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
389 #pwm-cells = <2>; 389 #pwm-cells = <2>;
390 reg = <0x53fa8000 0x4000>; 390 reg = <0x53fa8000 0x4000>;
391 clocks = <&clks 107>, <&clks 36>; 391 clocks = <&clks 107>, <&clks 52>;
392 clock-names = "ipg", "per"; 392 clock-names = "ipg", "per";
393 interrupts = <41>; 393 interrupts = <41>;
394 }; 394 };
@@ -429,7 +429,7 @@
429 pwm4: pwm@53fc8000 { 429 pwm4: pwm@53fc8000 {
430 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 430 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
431 reg = <0x53fc8000 0x4000>; 431 reg = <0x53fc8000 0x4000>;
432 clocks = <&clks 108>, <&clks 36>; 432 clocks = <&clks 108>, <&clks 52>;
433 clock-names = "ipg", "per"; 433 clock-names = "ipg", "per";
434 interrupts = <42>; 434 interrupts = <42>;
435 }; 435 };
@@ -476,7 +476,7 @@
476 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 476 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
477 #pwm-cells = <2>; 477 #pwm-cells = <2>;
478 reg = <0x53fe0000 0x4000>; 478 reg = <0x53fe0000 0x4000>;
479 clocks = <&clks 105>, <&clks 36>; 479 clocks = <&clks 105>, <&clks 52>;
480 clock-names = "ipg", "per"; 480 clock-names = "ipg", "per";
481 interrupts = <26>; 481 interrupts = <26>;
482 }; 482 };
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index 8c1febd7e3f2..c108bb451337 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -166,12 +166,12 @@
166 #address-cells = <1>; 166 #address-cells = <1>;
167 #size-cells = <0>; 167 #size-cells = <0>;
168 168
169 ethphy1: ethernet-phy@0 { 169 ethphy1: ethernet-phy@1 {
170 reg = <0>; 170 reg = <1>;
171 }; 171 };
172 172
173 ethphy2: ethernet-phy@1 { 173 ethphy2: ethernet-phy@2 {
174 reg = <1>; 174 reg = <2>;
175 }; 175 };
176 }; 176 };
177}; 177};
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index ea282c7c0ca5..e2fed2712249 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -406,7 +406,7 @@
406 clock-frequency = <400000>; 406 clock-frequency = <400000>;
407 407
408 magnetometer@c { 408 magnetometer@c {
409 compatible = "ak,ak8975"; 409 compatible = "asahi-kasei,ak8975";
410 reg = <0xc>; 410 reg = <0xc>;
411 interrupt-parent = <&gpio>; 411 interrupt-parent = <&gpio>;
412 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>; 412 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 4176df721bf0..1a0045abead7 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -253,21 +253,22 @@
253 .endm 253 .endm
254 254
255 .macro restore_user_regs, fast = 0, offset = 0 255 .macro restore_user_regs, fast = 0, offset = 0
256 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr 256 mov r2, sp
257 ldr lr, [sp, #\offset + S_PC]! @ get pc 257 ldr r1, [r2, #\offset + S_PSR] @ get calling cpsr
258 ldr lr, [r2, #\offset + S_PC]! @ get pc
258 msr spsr_cxsf, r1 @ save in spsr_svc 259 msr spsr_cxsf, r1 @ save in spsr_svc
259#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) 260#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
260 @ We must avoid clrex due to Cortex-A15 erratum #830321 261 @ We must avoid clrex due to Cortex-A15 erratum #830321
261 strex r1, r2, [sp] @ clear the exclusive monitor 262 strex r1, r2, [r2] @ clear the exclusive monitor
262#endif 263#endif
263 .if \fast 264 .if \fast
264 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr 265 ldmdb r2, {r1 - lr}^ @ get calling r1 - lr
265 .else 266 .else
266 ldmdb sp, {r0 - lr}^ @ get calling r0 - lr 267 ldmdb r2, {r0 - lr}^ @ get calling r0 - lr
267 .endif 268 .endif
268 mov r0, r0 @ ARMv5T and earlier require a nop 269 mov r0, r0 @ ARMv5T and earlier require a nop
269 @ after ldm {}^ 270 @ after ldm {}^
270 add sp, sp, #S_FRAME_SIZE - S_PC 271 add sp, sp, #\offset + S_FRAME_SIZE
271 movs pc, lr @ return & move spsr_svc into cpsr 272 movs pc, lr @ return & move spsr_svc into cpsr
272 .endm 273 .endm
273 274
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index f7c65adaa428..557e128e4df0 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -116,8 +116,14 @@ int armpmu_event_set_period(struct perf_event *event)
116 ret = 1; 116 ret = 1;
117 } 117 }
118 118
119 if (left > (s64)armpmu->max_period) 119 /*
120 left = armpmu->max_period; 120 * Limit the maximum period to prevent the counter value
121 * from overtaking the one we are about to program. In
122 * effect we are reducing max_period to account for
123 * interrupt latency (and we are being very conservative).
124 */
125 if (left > (armpmu->max_period >> 1))
126 left = armpmu->max_period >> 1;
121 127
122 local64_set(&hwc->prev_count, (u64)-left); 128 local64_set(&hwc->prev_count, (u64)-left);
123 129
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 715ae19bc7c8..e55408e96559 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -657,10 +657,13 @@ int __init arm_add_memory(u64 start, u64 size)
657 657
658 /* 658 /*
659 * Ensure that start/size are aligned to a page boundary. 659 * Ensure that start/size are aligned to a page boundary.
660 * Size is appropriately rounded down, start is rounded up. 660 * Size is rounded down, start is rounded up.
661 */ 661 */
662 size -= start & ~PAGE_MASK;
663 aligned_start = PAGE_ALIGN(start); 662 aligned_start = PAGE_ALIGN(start);
663 if (aligned_start > start + size)
664 size = 0;
665 else
666 size -= aligned_start - start;
664 667
665#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT 668#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
666 if (aligned_start > ULONG_MAX) { 669 if (aligned_start > ULONG_MAX) {
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 3585cb394e9b..caa21e9b8cd9 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -246,9 +246,14 @@ static int coherency_type(void)
246 return type; 246 return type;
247} 247}
248 248
249/*
250 * As a precaution, we currently completely disable hardware I/O
251 * coherency, until enough testing is done with automatic I/O
252 * synchronization barriers to validate that it is a proper solution.
253 */
249int coherency_available(void) 254int coherency_available(void)
250{ 255{
251 return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; 256 return false;
252} 257}
253 258
254int __init coherency_init(void) 259int __init coherency_init(void)
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index db57741c9c8a..64e44d6d07c0 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -211,6 +211,7 @@ extern struct device *omap2_get_iva_device(void);
211extern struct device *omap2_get_l3_device(void); 211extern struct device *omap2_get_l3_device(void);
212extern struct device *omap4_get_dsp_device(void); 212extern struct device *omap4_get_dsp_device(void);
213 213
214unsigned int omap4_xlate_irq(unsigned int hwirq);
214void omap_gic_of_init(void); 215void omap_gic_of_init(void);
215 216
216#ifdef CONFIG_CACHE_L2X0 217#ifdef CONFIG_CACHE_L2X0
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index b7cb44abe49b..cc30e49a4cc2 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -256,6 +256,38 @@ static int __init omap4_sar_ram_init(void)
256} 256}
257omap_early_initcall(omap4_sar_ram_init); 257omap_early_initcall(omap4_sar_ram_init);
258 258
259static struct of_device_id gic_match[] = {
260 { .compatible = "arm,cortex-a9-gic", },
261 { .compatible = "arm,cortex-a15-gic", },
262 { },
263};
264
265static struct device_node *gic_node;
266
267unsigned int omap4_xlate_irq(unsigned int hwirq)
268{
269 struct of_phandle_args irq_data;
270 unsigned int irq;
271
272 if (!gic_node)
273 gic_node = of_find_matching_node(NULL, gic_match);
274
275 if (WARN_ON(!gic_node))
276 return hwirq;
277
278 irq_data.np = gic_node;
279 irq_data.args_count = 3;
280 irq_data.args[0] = 0;
281 irq_data.args[1] = hwirq - OMAP44XX_IRQ_GIC_START;
282 irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH;
283
284 irq = irq_create_of_mapping(&irq_data);
285 if (WARN_ON(!irq))
286 irq = hwirq;
287
288 return irq;
289}
290
259void __init omap_gic_of_init(void) 291void __init omap_gic_of_init(void)
260{ 292{
261 struct device_node *np; 293 struct device_node *np;
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cbb908dc5cf0..9025ffffd2dc 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3534,9 +3534,15 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
3534 3534
3535 mpu_irqs_cnt = _count_mpu_irqs(oh); 3535 mpu_irqs_cnt = _count_mpu_irqs(oh);
3536 for (i = 0; i < mpu_irqs_cnt; i++) { 3536 for (i = 0; i < mpu_irqs_cnt; i++) {
3537 unsigned int irq;
3538
3539 if (oh->xlate_irq)
3540 irq = oh->xlate_irq((oh->mpu_irqs + i)->irq);
3541 else
3542 irq = (oh->mpu_irqs + i)->irq;
3537 (res + r)->name = (oh->mpu_irqs + i)->name; 3543 (res + r)->name = (oh->mpu_irqs + i)->name;
3538 (res + r)->start = (oh->mpu_irqs + i)->irq; 3544 (res + r)->start = irq;
3539 (res + r)->end = (oh->mpu_irqs + i)->irq; 3545 (res + r)->end = irq;
3540 (res + r)->flags = IORESOURCE_IRQ; 3546 (res + r)->flags = IORESOURCE_IRQ;
3541 r++; 3547 r++;
3542 } 3548 }
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 35ca6efbec31..5b42fafcaf55 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -676,6 +676,7 @@ struct omap_hwmod {
676 spinlock_t _lock; 676 spinlock_t _lock;
677 struct list_head node; 677 struct list_head node;
678 struct omap_hwmod_ocp_if *_mpu_port; 678 struct omap_hwmod_ocp_if *_mpu_port;
679 unsigned int (*xlate_irq)(unsigned int);
679 u16 flags; 680 u16 flags;
680 u8 mpu_rt_idx; 681 u8 mpu_rt_idx;
681 u8 response_lat; 682 u8 response_lat;
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index c314b3c31117..f5e68a782025 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -479,6 +479,7 @@ static struct omap_hwmod omap44xx_dma_system_hwmod = {
479 .class = &omap44xx_dma_hwmod_class, 479 .class = &omap44xx_dma_hwmod_class,
480 .clkdm_name = "l3_dma_clkdm", 480 .clkdm_name = "l3_dma_clkdm",
481 .mpu_irqs = omap44xx_dma_system_irqs, 481 .mpu_irqs = omap44xx_dma_system_irqs,
482 .xlate_irq = omap4_xlate_irq,
482 .main_clk = "l3_div_ck", 483 .main_clk = "l3_div_ck",
483 .prcm = { 484 .prcm = {
484 .omap4 = { 485 .omap4 = {
@@ -640,6 +641,7 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
640 .class = &omap44xx_dispc_hwmod_class, 641 .class = &omap44xx_dispc_hwmod_class,
641 .clkdm_name = "l3_dss_clkdm", 642 .clkdm_name = "l3_dss_clkdm",
642 .mpu_irqs = omap44xx_dss_dispc_irqs, 643 .mpu_irqs = omap44xx_dss_dispc_irqs,
644 .xlate_irq = omap4_xlate_irq,
643 .sdma_reqs = omap44xx_dss_dispc_sdma_reqs, 645 .sdma_reqs = omap44xx_dss_dispc_sdma_reqs,
644 .main_clk = "dss_dss_clk", 646 .main_clk = "dss_dss_clk",
645 .prcm = { 647 .prcm = {
@@ -693,6 +695,7 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
693 .class = &omap44xx_dsi_hwmod_class, 695 .class = &omap44xx_dsi_hwmod_class,
694 .clkdm_name = "l3_dss_clkdm", 696 .clkdm_name = "l3_dss_clkdm",
695 .mpu_irqs = omap44xx_dss_dsi1_irqs, 697 .mpu_irqs = omap44xx_dss_dsi1_irqs,
698 .xlate_irq = omap4_xlate_irq,
696 .sdma_reqs = omap44xx_dss_dsi1_sdma_reqs, 699 .sdma_reqs = omap44xx_dss_dsi1_sdma_reqs,
697 .main_clk = "dss_dss_clk", 700 .main_clk = "dss_dss_clk",
698 .prcm = { 701 .prcm = {
@@ -726,6 +729,7 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
726 .class = &omap44xx_dsi_hwmod_class, 729 .class = &omap44xx_dsi_hwmod_class,
727 .clkdm_name = "l3_dss_clkdm", 730 .clkdm_name = "l3_dss_clkdm",
728 .mpu_irqs = omap44xx_dss_dsi2_irqs, 731 .mpu_irqs = omap44xx_dss_dsi2_irqs,
732 .xlate_irq = omap4_xlate_irq,
729 .sdma_reqs = omap44xx_dss_dsi2_sdma_reqs, 733 .sdma_reqs = omap44xx_dss_dsi2_sdma_reqs,
730 .main_clk = "dss_dss_clk", 734 .main_clk = "dss_dss_clk",
731 .prcm = { 735 .prcm = {
@@ -784,6 +788,7 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
784 */ 788 */
785 .flags = HWMOD_SWSUP_SIDLE, 789 .flags = HWMOD_SWSUP_SIDLE,
786 .mpu_irqs = omap44xx_dss_hdmi_irqs, 790 .mpu_irqs = omap44xx_dss_hdmi_irqs,
791 .xlate_irq = omap4_xlate_irq,
787 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, 792 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs,
788 .main_clk = "dss_48mhz_clk", 793 .main_clk = "dss_48mhz_clk",
789 .prcm = { 794 .prcm = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 3e9523084b2a..7c3fac035e93 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -288,6 +288,7 @@ static struct omap_hwmod omap54xx_dma_system_hwmod = {
288 .class = &omap54xx_dma_hwmod_class, 288 .class = &omap54xx_dma_hwmod_class,
289 .clkdm_name = "dma_clkdm", 289 .clkdm_name = "dma_clkdm",
290 .mpu_irqs = omap54xx_dma_system_irqs, 290 .mpu_irqs = omap54xx_dma_system_irqs,
291 .xlate_irq = omap4_xlate_irq,
291 .main_clk = "l3_iclk_div", 292 .main_clk = "l3_iclk_div",
292 .prcm = { 293 .prcm = {
293 .omap4 = { 294 .omap4 = {
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index a8e4b582c527..6163d66102a3 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -498,6 +498,7 @@ struct omap_prcm_irq_setup {
498 u8 nr_irqs; 498 u8 nr_irqs;
499 const struct omap_prcm_irq *irqs; 499 const struct omap_prcm_irq *irqs;
500 int irq; 500 int irq;
501 unsigned int (*xlate_irq)(unsigned int);
501 void (*read_pending_irqs)(unsigned long *events); 502 void (*read_pending_irqs)(unsigned long *events);
502 void (*ocp_barrier)(void); 503 void (*ocp_barrier)(void);
503 void (*save_and_clear_irqen)(u32 *saved_mask); 504 void (*save_and_clear_irqen)(u32 *saved_mask);
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index cc170fb81ff7..408c64efb807 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -49,6 +49,7 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
49 .irqs = omap4_prcm_irqs, 49 .irqs = omap4_prcm_irqs,
50 .nr_irqs = ARRAY_SIZE(omap4_prcm_irqs), 50 .nr_irqs = ARRAY_SIZE(omap4_prcm_irqs),
51 .irq = 11 + OMAP44XX_IRQ_GIC_START, 51 .irq = 11 + OMAP44XX_IRQ_GIC_START,
52 .xlate_irq = omap4_xlate_irq,
52 .read_pending_irqs = &omap44xx_prm_read_pending_irqs, 53 .read_pending_irqs = &omap44xx_prm_read_pending_irqs,
53 .ocp_barrier = &omap44xx_prm_ocp_barrier, 54 .ocp_barrier = &omap44xx_prm_ocp_barrier,
54 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen, 55 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen,
@@ -751,8 +752,10 @@ static int omap44xx_prm_late_init(void)
751 } 752 }
752 753
753 /* Once OMAP4 DT is filled as well */ 754 /* Once OMAP4 DT is filled as well */
754 if (irq_num >= 0) 755 if (irq_num >= 0) {
755 omap4_prcm_irq_setup.irq = irq_num; 756 omap4_prcm_irq_setup.irq = irq_num;
757 omap4_prcm_irq_setup.xlate_irq = NULL;
758 }
756 } 759 }
757 760
758 omap44xx_prm_enable_io_wakeup(); 761 omap44xx_prm_enable_io_wakeup();
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 779940cb6e56..dea2833ca627 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -187,6 +187,7 @@ int omap_prcm_event_to_irq(const char *name)
187 */ 187 */
188void omap_prcm_irq_cleanup(void) 188void omap_prcm_irq_cleanup(void)
189{ 189{
190 unsigned int irq;
190 int i; 191 int i;
191 192
192 if (!prcm_irq_setup) { 193 if (!prcm_irq_setup) {
@@ -211,7 +212,11 @@ void omap_prcm_irq_cleanup(void)
211 kfree(prcm_irq_setup->priority_mask); 212 kfree(prcm_irq_setup->priority_mask);
212 prcm_irq_setup->priority_mask = NULL; 213 prcm_irq_setup->priority_mask = NULL;
213 214
214 irq_set_chained_handler(prcm_irq_setup->irq, NULL); 215 if (prcm_irq_setup->xlate_irq)
216 irq = prcm_irq_setup->xlate_irq(prcm_irq_setup->irq);
217 else
218 irq = prcm_irq_setup->irq;
219 irq_set_chained_handler(irq, NULL);
215 220
216 if (prcm_irq_setup->base_irq > 0) 221 if (prcm_irq_setup->base_irq > 0)
217 irq_free_descs(prcm_irq_setup->base_irq, 222 irq_free_descs(prcm_irq_setup->base_irq,
@@ -259,6 +264,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
259 int offset, i; 264 int offset, i;
260 struct irq_chip_generic *gc; 265 struct irq_chip_generic *gc;
261 struct irq_chip_type *ct; 266 struct irq_chip_type *ct;
267 unsigned int irq;
262 268
263 if (!irq_setup) 269 if (!irq_setup)
264 return -EINVAL; 270 return -EINVAL;
@@ -298,7 +304,11 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
298 1 << (offset & 0x1f); 304 1 << (offset & 0x1f);
299 } 305 }
300 306
301 irq_set_chained_handler(irq_setup->irq, omap_prcm_irq_handler); 307 if (irq_setup->xlate_irq)
308 irq = irq_setup->xlate_irq(irq_setup->irq);
309 else
310 irq = irq_setup->irq;
311 irq_set_chained_handler(irq, omap_prcm_irq_handler);
302 312
303 irq_setup->base_irq = irq_alloc_descs(-1, 0, irq_setup->nr_regs * 32, 313 irq_setup->base_irq = irq_alloc_descs(-1, 0, irq_setup->nr_regs * 32,
304 0); 314 0);
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4457e731f7a4..292eca0e78ed 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -66,19 +66,24 @@ void __init omap_pmic_init(int bus, u32 clkrate,
66 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 66 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
67} 67}
68 68
69#ifdef CONFIG_ARCH_OMAP4
69void __init omap4_pmic_init(const char *pmic_type, 70void __init omap4_pmic_init(const char *pmic_type,
70 struct twl4030_platform_data *pmic_data, 71 struct twl4030_platform_data *pmic_data,
71 struct i2c_board_info *devices, int nr_devices) 72 struct i2c_board_info *devices, int nr_devices)
72{ 73{
73 /* PMIC part*/ 74 /* PMIC part*/
75 unsigned int irq;
76
74 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); 77 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
75 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT); 78 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
76 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data); 79 irq = omap4_xlate_irq(7 + OMAP44XX_IRQ_GIC_START);
80 omap_pmic_init(1, 400, pmic_type, irq, pmic_data);
77 81
78 /* Register additional devices on i2c1 bus if needed */ 82 /* Register additional devices on i2c1 bus if needed */
79 if (devices) 83 if (devices)
80 i2c_register_board_info(1, devices, nr_devices); 84 i2c_register_board_info(1, devices, nr_devices);
81} 85}
86#endif
82 87
83void __init omap_pmic_late_init(void) 88void __init omap_pmic_late_init(void)
84{ 89{
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 170bd146ba17..cef8895a9b82 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -576,11 +576,18 @@ void __init r8a7778_init_irq_extpin(int irlm)
576void __init r8a7778_init_irq_dt(void) 576void __init r8a7778_init_irq_dt(void)
577{ 577{
578 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000); 578 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000);
579#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
580 void __iomem *gic_dist_base = ioremap_nocache(0xfe438000, 0x1000);
581 void __iomem *gic_cpu_base = ioremap_nocache(0xfe430000, 0x1000);
582#endif
579 583
580 BUG_ON(!base); 584 BUG_ON(!base);
581 585
586#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
587 gic_init(0, 29, gic_dist_base, gic_cpu_base);
588#else
582 irqchip_init(); 589 irqchip_init();
583 590#endif
584 /* route all interrupts to ARM */ 591 /* route all interrupts to ARM */
585 __raw_writel(0x73ffffff, base + INT2NTSR0); 592 __raw_writel(0x73ffffff, base + INT2NTSR0);
586 __raw_writel(0xffffffff, base + INT2NTSR1); 593 __raw_writel(0xffffffff, base + INT2NTSR1);
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 6156d172cf31..27dceaf9e688 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -720,10 +720,17 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
720 720
721void __init r8a7779_init_irq_dt(void) 721void __init r8a7779_init_irq_dt(void)
722{ 722{
723#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
724 void __iomem *gic_dist_base = ioremap_nocache(0xf0001000, 0x1000);
725 void __iomem *gic_cpu_base = ioremap_nocache(0xf0000100, 0x1000);
726#endif
723 gic_arch_extn.irq_set_wake = r8a7779_set_wake; 727 gic_arch_extn.irq_set_wake = r8a7779_set_wake;
724 728
729#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
730 gic_init(0, 29, gic_dist_base, gic_cpu_base);
731#else
725 irqchip_init(); 732 irqchip_init();
726 733#endif
727 /* route all interrupts to ARM */ 734 /* route all interrupts to ARM */
728 __raw_writel(0xffffffff, INT2NTSR0); 735 __raw_writel(0xffffffff, INT2NTSR0);
729 __raw_writel(0x3fffffff, INT2NTSR1); 736 __raw_writel(0x3fffffff, INT2NTSR1);
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 1c43cec971b5..066688863920 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -85,6 +85,7 @@ vdso_install:
85# We use MRPROPER_FILES and CLEAN_FILES now 85# We use MRPROPER_FILES and CLEAN_FILES now
86archclean: 86archclean:
87 $(Q)$(MAKE) $(clean)=$(boot) 87 $(Q)$(MAKE) $(clean)=$(boot)
88 $(Q)$(MAKE) $(clean)=$(boot)/dts
88 89
89define archhelp 90define archhelp
90 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' 91 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 3b8d427c3985..c62b0f4d9ef6 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -3,6 +3,4 @@ dts-dirs += apm
3dts-dirs += arm 3dts-dirs += arm
4dts-dirs += cavium 4dts-dirs += cavium
5 5
6always := $(dtb-y)
7subdir-y := $(dts-dirs) 6subdir-y := $(dts-dirs)
8clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/arm/juno.dts b/arch/arm64/boot/dts/arm/juno.dts
index cb3073e4e7a8..d429129ecb3d 100644
--- a/arch/arm64/boot/dts/arm/juno.dts
+++ b/arch/arm64/boot/dts/arm/juno.dts
@@ -22,7 +22,7 @@
22 }; 22 };
23 23
24 chosen { 24 chosen {
25 stdout-path = &soc_uart0; 25 stdout-path = "serial0:115200n8";
26 }; 26 };
27 27
28 psci { 28 psci {
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index cf33f33333cc..d54dc9ac4b70 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -15,6 +15,7 @@
15 */ 15 */
16#include <linux/debugfs.h> 16#include <linux/debugfs.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/io.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/seq_file.h> 21#include <linux/seq_file.h>
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c
index 2c9412908024..164efa009e5b 100644
--- a/arch/avr32/kernel/module.c
+++ b/arch/avr32/kernel/module.c
@@ -19,12 +19,10 @@
19#include <linux/moduleloader.h> 19#include <linux/moduleloader.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21 21
22void module_free(struct module *mod, void *module_region) 22void module_arch_freeing_init(struct module *mod)
23{ 23{
24 vfree(mod->arch.syminfo); 24 vfree(mod->arch.syminfo);
25 mod->arch.syminfo = NULL; 25 mod->arch.syminfo = NULL;
26
27 vfree(module_region);
28} 26}
29 27
30static inline int check_rela(Elf32_Rela *rela, struct module *module, 28static inline int check_rela(Elf32_Rela *rela, struct module *module,
@@ -291,12 +289,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
291 289
292 return ret; 290 return ret;
293} 291}
294
295int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
296 struct module *module)
297{
298 vfree(module->arch.syminfo);
299 module->arch.syminfo = NULL;
300
301 return 0;
302}
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 08a313fc2241..f772068d9e79 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -604,7 +604,7 @@ static ssize_t __sync_serial_read(struct file *file,
604 struct timespec *ts) 604 struct timespec *ts)
605{ 605{
606 unsigned long flags; 606 unsigned long flags;
607 int dev = MINOR(file->f_dentry->d_inode->i_rdev); 607 int dev = MINOR(file_inode(file)->i_rdev);
608 int avail; 608 int avail;
609 struct sync_port *port; 609 struct sync_port *port;
610 unsigned char *start; 610 unsigned char *start;
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index 51123f985eb5..af04cb6b6dc9 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -36,7 +36,7 @@ void *module_alloc(unsigned long size)
36} 36}
37 37
38/* Free memory returned from module_alloc */ 38/* Free memory returned from module_alloc */
39void module_free(struct module *mod, void *module_region) 39void module_memfree(void *module_region)
40{ 40{
41 kfree(module_region); 41 kfree(module_region);
42} 42}
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index 67b1d1685759..0635bd6c2af3 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -94,7 +94,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
94 r = &dev->resource[idx]; 94 r = &dev->resource[idx];
95 if (!r->start) 95 if (!r->start)
96 continue; 96 continue;
97 pci_claim_resource(dev, idx); 97 pci_claim_bridge_resource(dev, idx);
98 } 98 }
99 } 99 }
100 pcibios_allocate_bus_resources(&bus->children); 100 pcibios_allocate_bus_resources(&bus->children);
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 24603be24c14..29754aae5177 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -305,14 +305,12 @@ plt_target (struct plt_entry *plt)
305#endif /* !USE_BRL */ 305#endif /* !USE_BRL */
306 306
307void 307void
308module_free (struct module *mod, void *module_region) 308module_arch_freeing_init (struct module *mod)
309{ 309{
310 if (mod && mod->arch.init_unw_table && 310 if (mod->arch.init_unw_table) {
311 module_region == mod->module_init) {
312 unw_remove_unwind_table(mod->arch.init_unw_table); 311 unw_remove_unwind_table(mod->arch.init_unw_table);
313 mod->arch.init_unw_table = NULL; 312 mod->arch.init_unw_table = NULL;
314 } 313 }
315 vfree(module_region);
316} 314}
317 315
318/* Have we already seen one of these relocations? */ 316/* Have we already seen one of these relocations? */
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582777cf..900cc93e5409 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -487,45 +487,39 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
487 return 0; 487 return 0;
488} 488}
489 489
490static int is_valid_resource(struct pci_dev *dev, int idx) 490void pcibios_fixup_device_resources(struct pci_dev *dev)
491{ 491{
492 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 492 int idx;
493 struct resource *devr = &dev->resource[idx], *busr;
494 493
495 if (!dev->bus) 494 if (!dev->bus)
496 return 0; 495 return;
497
498 pci_bus_for_each_resource(dev->bus, busr, i) {
499 if (!busr || ((busr->flags ^ devr->flags) & type_mask))
500 continue;
501 if ((devr->start) && (devr->start >= busr->start) &&
502 (devr->end <= busr->end))
503 return 1;
504 }
505 return 0;
506}
507 496
508static void pcibios_fixup_resources(struct pci_dev *dev, int start, int limit) 497 for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
509{ 498 struct resource *r = &dev->resource[idx];
510 int i;
511 499
512 for (i = start; i < limit; i++) { 500 if (!r->flags || r->parent || !r->start)
513 if (!dev->resource[i].flags)
514 continue; 501 continue;
515 if ((is_valid_resource(dev, i)))
516 pci_claim_resource(dev, i);
517 }
518}
519 502
520void pcibios_fixup_device_resources(struct pci_dev *dev) 503 pci_claim_resource(dev, idx);
521{ 504 }
522 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES);
523} 505}
524EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources); 506EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources);
525 507
526static void pcibios_fixup_bridge_resources(struct pci_dev *dev) 508static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
527{ 509{
528 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES); 510 int idx;
511
512 if (!dev->bus)
513 return;
514
515 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
516 struct resource *r = &dev->resource[idx];
517
518 if (!r->flags || r->parent || !r->start)
519 continue;
520
521 pci_claim_bridge_resource(dev, idx);
522 }
529} 523}
530 524
531/* 525/*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c0c033..48528fb81eff 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1026,6 +1026,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1026 pr, (pr && pr->name) ? pr->name : "nil"); 1026 pr, (pr && pr->name) ? pr->name : "nil");
1027 1027
1028 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1028 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1029 struct pci_dev *dev = bus->self;
1030
1029 if (request_resource(pr, res) == 0) 1031 if (request_resource(pr, res) == 0)
1030 continue; 1032 continue;
1031 /* 1033 /*
@@ -1035,6 +1037,12 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1035 */ 1037 */
1036 if (reparent_resources(pr, res) == 0) 1038 if (reparent_resources(pr, res) == 0)
1037 continue; 1039 continue;
1040
1041 if (dev && i < PCI_BRIDGE_RESOURCE_NUM &&
1042 pci_claim_bridge_resource(dev,
1043 i + PCI_BRIDGE_RESOURCES) == 0)
1044 continue;
1045
1038 } 1046 }
1039 pr_warn("PCI: Cannot allocate resource region "); 1047 pr_warn("PCI: Cannot allocate resource region ");
1040 pr_cont("%d of PCI bridge %d, will remap\n", i, bus->number); 1048 pr_cont("%d of PCI bridge %d, will remap\n", i, bus->number);
@@ -1227,7 +1235,10 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1227 (unsigned long long)r->end, 1235 (unsigned long long)r->end,
1228 (unsigned int)r->flags); 1236 (unsigned int)r->flags);
1229 1237
1230 pci_claim_resource(dev, i); 1238 if (pci_claim_resource(dev, i) == 0)
1239 continue;
1240
1241 pci_claim_bridge_resource(dev, i);
1231 } 1242 }
1232 } 1243 }
1233 1244
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 9fd6834a2172..5d6139390bf8 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -1388,7 +1388,7 @@ out:
1388void bpf_jit_free(struct bpf_prog *fp) 1388void bpf_jit_free(struct bpf_prog *fp)
1389{ 1389{
1390 if (fp->jited) 1390 if (fp->jited)
1391 module_free(NULL, fp->bpf_func); 1391 module_memfree(fp->bpf_func);
1392 1392
1393 bpf_prog_unlock_free(fp); 1393 bpf_prog_unlock_free(fp);
1394} 1394}
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index febb9cd83177..b5b036f64275 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -106,7 +106,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
106 if (!r->flags) 106 if (!r->flags)
107 continue; 107 continue;
108 if (!r->start || 108 if (!r->start ||
109 pci_claim_resource(dev, idx) < 0) { 109 pci_claim_bridge_resource(dev, idx) < 0) {
110 printk(KERN_ERR "PCI:" 110 printk(KERN_ERR "PCI:"
111 " Cannot allocate resource" 111 " Cannot allocate resource"
112 " region %d of bridge %s\n", 112 " region %d of bridge %s\n",
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f8c9c2..471ff398090c 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -281,42 +281,37 @@ static int __init pci_check_direct(void)
281 return -ENODEV; 281 return -ENODEV;
282} 282}
283 283
284static int is_valid_resource(struct pci_dev *dev, int idx) 284static void pcibios_fixup_device_resources(struct pci_dev *dev)
285{ 285{
286 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 286 int idx;
287 struct resource *devr = &dev->resource[idx], *busr;
288
289 if (dev->bus) {
290 pci_bus_for_each_resource(dev->bus, busr, i) {
291 if (!busr || (busr->flags ^ devr->flags) & type_mask)
292 continue;
293
294 if (devr->start &&
295 devr->start >= busr->start &&
296 devr->end <= busr->end)
297 return 1;
298 }
299 }
300 287
301 return 0; 288 if (!dev->bus)
289 return;
290
291 for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
292 struct resource *r = &dev->resource[idx];
293
294 if (!r->flags || r->parent || !r->start)
295 continue;
296
297 pci_claim_resource(dev, idx);
298 }
302} 299}
303 300
304static void pcibios_fixup_device_resources(struct pci_dev *dev) 301static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
305{ 302{
306 int limit, i; 303 int idx;
307 304
308 if (dev->bus->number != 0) 305 if (!dev->bus)
309 return; 306 return;
310 307
311 limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? 308 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
312 PCI_BRIDGE_RESOURCES : PCI_NUM_RESOURCES; 309 struct resource *r = &dev->resource[idx];
313 310
314 for (i = 0; i < limit; i++) { 311 if (!r->flags || r->parent || !r->start)
315 if (!dev->resource[i].flags)
316 continue; 312 continue;
317 313
318 if (is_valid_resource(dev, i)) 314 pci_claim_bridge_resource(dev, idx);
319 pci_claim_resource(dev, i);
320 } 315 }
321} 316}
322 317
@@ -330,7 +325,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
330 325
331 if (bus->self) { 326 if (bus->self) {
332 pci_read_bridge_bases(bus); 327 pci_read_bridge_bases(bus);
333 pcibios_fixup_device_resources(bus->self); 328 pcibios_fixup_bridge_resources(bus->self);
334 } 329 }
335 330
336 list_for_each_entry(dev, &bus->devices, bus_list) 331 list_for_each_entry(dev, &bus->devices, bus_list)
diff --git a/arch/nios2/kernel/module.c b/arch/nios2/kernel/module.c
index cc924a38f22a..e2e3f13f98d5 100644
--- a/arch/nios2/kernel/module.c
+++ b/arch/nios2/kernel/module.c
@@ -36,7 +36,7 @@ void *module_alloc(unsigned long size)
36} 36}
37 37
38/* Free memory returned from module_alloc */ 38/* Free memory returned from module_alloc */
39void module_free(struct module *mod, void *module_region) 39void module_memfree(void *module_region)
40{ 40{
41 kfree(module_region); 41 kfree(module_region);
42} 42}
diff --git a/arch/nios2/kernel/signal.c b/arch/nios2/kernel/signal.c
index f9d27883a714..2d0ea25be171 100644
--- a/arch/nios2/kernel/signal.c
+++ b/arch/nios2/kernel/signal.c
@@ -200,7 +200,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
200 200
201 /* Set up to return from userspace; jump to fixed address sigreturn 201 /* Set up to return from userspace; jump to fixed address sigreturn
202 trampoline on kuser page. */ 202 trampoline on kuser page. */
203 regs->ra = (unsigned long) (0x1040); 203 regs->ra = (unsigned long) (0x1044);
204 204
205 /* Set up registers for signal handler */ 205 /* Set up registers for signal handler */
206 regs->sp = (unsigned long) frame; 206 regs->sp = (unsigned long) frame;
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 50dfafc3f2c1..5822e8e200e6 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -298,14 +298,10 @@ static inline unsigned long count_stubs(const Elf_Rela *rela, unsigned long n)
298} 298}
299#endif 299#endif
300 300
301 301void module_arch_freeing_init(struct module *mod)
302/* Free memory returned from module_alloc */
303void module_free(struct module *mod, void *module_region)
304{ 302{
305 kfree(mod->arch.section); 303 kfree(mod->arch.section);
306 mod->arch.section = NULL; 304 mod->arch.section = NULL;
307
308 vfree(module_region);
309} 305}
310 306
311/* Additional bytes needed in front of individual sections */ 307/* Additional bytes needed in front of individual sections */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d35943..2a525c938158 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1184,6 +1184,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1184 pr, (pr && pr->name) ? pr->name : "nil"); 1184 pr, (pr && pr->name) ? pr->name : "nil");
1185 1185
1186 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1186 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1187 struct pci_dev *dev = bus->self;
1188
1187 if (request_resource(pr, res) == 0) 1189 if (request_resource(pr, res) == 0)
1188 continue; 1190 continue;
1189 /* 1191 /*
@@ -1193,6 +1195,11 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1193 */ 1195 */
1194 if (reparent_resources(pr, res) == 0) 1196 if (reparent_resources(pr, res) == 0)
1195 continue; 1197 continue;
1198
1199 if (dev && i < PCI_BRIDGE_RESOURCE_NUM &&
1200 pci_claim_bridge_resource(dev,
1201 i + PCI_BRIDGE_RESOURCES) == 0)
1202 continue;
1196 } 1203 }
1197 pr_warning("PCI: Cannot allocate resource region " 1204 pr_warning("PCI: Cannot allocate resource region "
1198 "%d of PCI bridge %d, will remap\n", i, bus->number); 1205 "%d of PCI bridge %d, will remap\n", i, bus->number);
@@ -1401,7 +1408,10 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1401 (unsigned long long)r->end, 1408 (unsigned long long)r->end,
1402 (unsigned int)r->flags); 1409 (unsigned int)r->flags);
1403 1410
1404 pci_claim_resource(dev, i); 1411 if (pci_claim_resource(dev, i) == 0)
1412 continue;
1413
1414 pci_claim_bridge_resource(dev, i);
1405 } 1415 }
1406 } 1416 }
1407 1417
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 1ca125b9c226..d1916b577f2c 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -699,7 +699,7 @@ out:
699void bpf_jit_free(struct bpf_prog *fp) 699void bpf_jit_free(struct bpf_prog *fp)
700{ 700{
701 if (fp->jited) 701 if (fp->jited)
702 module_free(NULL, fp->bpf_func); 702 module_memfree(fp->bpf_func);
703 703
704 bpf_prog_unlock_free(fp); 704 bpf_prog_unlock_free(fp);
705} 705}
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index b700a329c31d..d2de7d5d7574 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -304,7 +304,7 @@ int pnv_save_sprs_for_winkle(void)
304 * all cpus at boot. Get these reg values of current cpu and use the 304 * all cpus at boot. Get these reg values of current cpu and use the
305 * same accross all cpus. 305 * same accross all cpus.
306 */ 306 */
307 uint64_t lpcr_val = mfspr(SPRN_LPCR); 307 uint64_t lpcr_val = mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1;
308 uint64_t hid0_val = mfspr(SPRN_HID0); 308 uint64_t hid0_val = mfspr(SPRN_HID0);
309 uint64_t hid1_val = mfspr(SPRN_HID1); 309 uint64_t hid1_val = mfspr(SPRN_HID1);
310 uint64_t hid4_val = mfspr(SPRN_HID4); 310 uint64_t hid4_val = mfspr(SPRN_HID4);
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 5b150f0c5df9..13c6e200b24e 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -337,6 +337,7 @@ static inline void disable_surveillance(void)
337 args.token = rtas_token("set-indicator"); 337 args.token = rtas_token("set-indicator");
338 if (args.token == RTAS_UNKNOWN_SERVICE) 338 if (args.token == RTAS_UNKNOWN_SERVICE)
339 return; 339 return;
340 args.token = cpu_to_be32(args.token);
340 args.nargs = cpu_to_be32(3); 341 args.nargs = cpu_to_be32(3);
341 args.nret = cpu_to_be32(1); 342 args.nret = cpu_to_be32(1);
342 args.rets = &args.args[3]; 343 args.rets = &args.args[3];
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index b89b59158b95..409d152585be 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -55,14 +55,10 @@ void *module_alloc(unsigned long size)
55} 55}
56#endif 56#endif
57 57
58/* Free memory returned from module_alloc */ 58void module_arch_freeing_init(struct module *mod)
59void module_free(struct module *mod, void *module_region)
60{ 59{
61 if (mod) { 60 vfree(mod->arch.syminfo);
62 vfree(mod->arch.syminfo); 61 mod->arch.syminfo = NULL;
63 mod->arch.syminfo = NULL;
64 }
65 vfree(module_region);
66} 62}
67 63
68static void check_rela(Elf_Rela *rela, struct module *me) 64static void check_rela(Elf_Rela *rela, struct module *me)
diff --git a/arch/s390/net/bpf_jit.S b/arch/s390/net/bpf_jit.S
index 7e45d13816c1..ba44c9f55346 100644
--- a/arch/s390/net/bpf_jit.S
+++ b/arch/s390/net/bpf_jit.S
@@ -22,8 +22,8 @@
22 * skb_copy_bits takes 4 parameters: 22 * skb_copy_bits takes 4 parameters:
23 * %r2 = skb pointer 23 * %r2 = skb pointer
24 * %r3 = offset into skb data 24 * %r3 = offset into skb data
25 * %r4 = length to copy 25 * %r4 = pointer to temp buffer
26 * %r5 = pointer to temp buffer 26 * %r5 = length to copy
27 */ 27 */
28#define SKBDATA %r8 28#define SKBDATA %r8
29 29
@@ -44,8 +44,9 @@ ENTRY(sk_load_word)
44 44
45sk_load_word_slow: 45sk_load_word_slow:
46 lgr %r9,%r2 # save %r2 46 lgr %r9,%r2 # save %r2
47 lhi %r4,4 # 4 bytes 47 lgr %r3,%r1 # offset
48 la %r5,160(%r15) # pointer to temp buffer 48 la %r4,160(%r15) # pointer to temp buffer
49 lghi %r5,4 # 4 bytes
49 brasl %r14,skb_copy_bits # get data from skb 50 brasl %r14,skb_copy_bits # get data from skb
50 l %r5,160(%r15) # load result from temp buffer 51 l %r5,160(%r15) # load result from temp buffer
51 ltgr %r2,%r2 # set cc to (%r2 != 0) 52 ltgr %r2,%r2 # set cc to (%r2 != 0)
@@ -69,8 +70,9 @@ ENTRY(sk_load_half)
69 70
70sk_load_half_slow: 71sk_load_half_slow:
71 lgr %r9,%r2 # save %r2 72 lgr %r9,%r2 # save %r2
72 lhi %r4,2 # 2 bytes 73 lgr %r3,%r1 # offset
73 la %r5,162(%r15) # pointer to temp buffer 74 la %r4,162(%r15) # pointer to temp buffer
75 lghi %r5,2 # 2 bytes
74 brasl %r14,skb_copy_bits # get data from skb 76 brasl %r14,skb_copy_bits # get data from skb
75 xc 160(2,%r15),160(%r15) 77 xc 160(2,%r15),160(%r15)
76 l %r5,160(%r15) # load result from temp buffer 78 l %r5,160(%r15) # load result from temp buffer
@@ -95,8 +97,9 @@ ENTRY(sk_load_byte)
95 97
96sk_load_byte_slow: 98sk_load_byte_slow:
97 lgr %r9,%r2 # save %r2 99 lgr %r9,%r2 # save %r2
98 lhi %r4,1 # 1 bytes 100 lgr %r3,%r1 # offset
99 la %r5,163(%r15) # pointer to temp buffer 101 la %r4,163(%r15) # pointer to temp buffer
102 lghi %r5,1 # 1 byte
100 brasl %r14,skb_copy_bits # get data from skb 103 brasl %r14,skb_copy_bits # get data from skb
101 xc 160(3,%r15),160(%r15) 104 xc 160(3,%r15),160(%r15)
102 l %r5,160(%r15) # load result from temp buffer 105 l %r5,160(%r15) # load result from temp buffer
@@ -104,11 +107,11 @@ sk_load_byte_slow:
104 lgr %r2,%r9 # restore %r2 107 lgr %r2,%r9 # restore %r2
105 br %r8 108 br %r8
106 109
107 /* A = (*(u8 *)(skb->data+K) & 0xf) << 2 */ 110 /* X = (*(u8 *)(skb->data+K) & 0xf) << 2 */
108ENTRY(sk_load_byte_msh) 111ENTRY(sk_load_byte_msh)
109 llgfr %r1,%r3 # extend offset 112 llgfr %r1,%r3 # extend offset
110 clr %r11,%r3 # hlen < offset ? 113 clr %r11,%r3 # hlen < offset ?
111 jle sk_load_byte_slow 114 jle sk_load_byte_msh_slow
112 lhi %r12,0 115 lhi %r12,0
113 ic %r12,0(%r1,%r10) # get byte from skb 116 ic %r12,0(%r1,%r10) # get byte from skb
114 nill %r12,0x0f 117 nill %r12,0x0f
@@ -118,8 +121,9 @@ ENTRY(sk_load_byte_msh)
118 121
119sk_load_byte_msh_slow: 122sk_load_byte_msh_slow:
120 lgr %r9,%r2 # save %r2 123 lgr %r9,%r2 # save %r2
121 lhi %r4,2 # 2 bytes 124 lgr %r3,%r1 # offset
122 la %r5,162(%r15) # pointer to temp buffer 125 la %r4,163(%r15) # pointer to temp buffer
126 lghi %r5,1 # 1 byte
123 brasl %r14,skb_copy_bits # get data from skb 127 brasl %r14,skb_copy_bits # get data from skb
124 xc 160(3,%r15),160(%r15) 128 xc 160(3,%r15),160(%r15)
125 l %r12,160(%r15) # load result from temp buffer 129 l %r12,160(%r15) # load result from temp buffer
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 524496d47ef5..bbd1981cc150 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -448,15 +448,12 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
448 mask = 0x800000; /* je */ 448 mask = 0x800000; /* je */
449kbranch: /* Emit compare if the branch targets are different */ 449kbranch: /* Emit compare if the branch targets are different */
450 if (filter->jt != filter->jf) { 450 if (filter->jt != filter->jf) {
451 if (K <= 16383) 451 if (test_facility(21))
452 /* chi %r5,<K> */
453 EMIT4_IMM(0xa75e0000, K);
454 else if (test_facility(21))
455 /* clfi %r5,<K> */ 452 /* clfi %r5,<K> */
456 EMIT6_IMM(0xc25f0000, K); 453 EMIT6_IMM(0xc25f0000, K);
457 else 454 else
458 /* c %r5,<d(K)>(%r13) */ 455 /* cl %r5,<d(K)>(%r13) */
459 EMIT4_DISP(0x5950d000, EMIT_CONST(K)); 456 EMIT4_DISP(0x5550d000, EMIT_CONST(K));
460 } 457 }
461branch: if (filter->jt == filter->jf) { 458branch: if (filter->jt == filter->jf) {
462 if (filter->jt == 0) 459 if (filter->jt == 0)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f49478..9ce5afe167ff 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -639,7 +639,10 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
639 (unsigned long long)r->end, 639 (unsigned long long)r->end,
640 (unsigned int)r->flags); 640 (unsigned int)r->flags);
641 641
642 pci_claim_resource(dev, i); 642 if (pci_claim_resource(dev, i) == 0)
643 continue;
644
645 pci_claim_bridge_resource(dev, i);
643 } 646 }
644 } 647 }
645 648
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index f33e7c7a3bf7..7931eeeb649a 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -776,7 +776,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
776 if (unlikely(proglen + ilen > oldproglen)) { 776 if (unlikely(proglen + ilen > oldproglen)) {
777 pr_err("bpb_jit_compile fatal error\n"); 777 pr_err("bpb_jit_compile fatal error\n");
778 kfree(addrs); 778 kfree(addrs);
779 module_free(NULL, image); 779 module_memfree(image);
780 return; 780 return;
781 } 781 }
782 memcpy(image + proglen, temp, ilen); 782 memcpy(image + proglen, temp, ilen);
@@ -822,7 +822,7 @@ out:
822void bpf_jit_free(struct bpf_prog *fp) 822void bpf_jit_free(struct bpf_prog *fp)
823{ 823{
824 if (fp->jited) 824 if (fp->jited)
825 module_free(NULL, fp->bpf_func); 825 module_memfree(fp->bpf_func);
826 826
827 bpf_prog_unlock_free(fp); 827 bpf_prog_unlock_free(fp);
828} 828}
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c
index 96447c9160a0..2305084c9b93 100644
--- a/arch/tile/kernel/module.c
+++ b/arch/tile/kernel/module.c
@@ -74,7 +74,7 @@ error:
74 74
75 75
76/* Free memory returned from module_alloc */ 76/* Free memory returned from module_alloc */
77void module_free(struct module *mod, void *module_region) 77void module_memfree(void *module_region)
78{ 78{
79 vfree(module_region); 79 vfree(module_region);
80 80
@@ -83,7 +83,7 @@ void module_free(struct module *mod, void *module_region)
83 0, 0, 0, NULL, NULL, 0); 83 0, 0, 0, NULL, NULL, 0);
84 84
85 /* 85 /*
86 * FIXME: If module_region == mod->module_init, trim exception 86 * FIXME: Add module_arch_freeing_init to trim exception
87 * table entries. 87 * table entries.
88 */ 88 */
89} 89}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ba397bde7948..0dc9d0144a27 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -857,7 +857,7 @@ source "kernel/Kconfig.preempt"
857 857
858config X86_UP_APIC 858config X86_UP_APIC
859 bool "Local APIC support on uniprocessors" 859 bool "Local APIC support on uniprocessors"
860 depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI 860 depends on X86_32 && !SMP && !X86_32_NON_STANDARD
861 ---help--- 861 ---help---
862 A local APIC (Advanced Programmable Interrupt Controller) is an 862 A local APIC (Advanced Programmable Interrupt Controller) is an
863 integrated interrupt controller in the CPU. If you have a single-CPU 863 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -868,6 +868,10 @@ config X86_UP_APIC
868 performance counters), and the NMI watchdog which detects hard 868 performance counters), and the NMI watchdog which detects hard
869 lockups. 869 lockups.
870 870
871config X86_UP_APIC_MSI
872 def_bool y
873 select X86_UP_APIC if X86_32 && !SMP && !X86_32_NON_STANDARD && PCI_MSI
874
871config X86_UP_IOAPIC 875config X86_UP_IOAPIC
872 bool "IO-APIC support on uniprocessors" 876 bool "IO-APIC support on uniprocessors"
873 depends on X86_UP_APIC 877 depends on X86_UP_APIC
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index d999398928bc..ad754b4411f7 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -90,7 +90,7 @@ suffix-$(CONFIG_KERNEL_LZO) := lzo
90suffix-$(CONFIG_KERNEL_LZ4) := lz4 90suffix-$(CONFIG_KERNEL_LZ4) := lz4
91 91
92RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \ 92RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \
93 perl $(srctree)/arch/x86/tools/calc_run_size.pl) 93 $(CONFIG_SHELL) $(srctree)/arch/x86/tools/calc_run_size.sh)
94quiet_cmd_mkpiggy = MKPIGGY $@ 94quiet_cmd_mkpiggy = MKPIGGY $@
95 cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) 95 cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
96 96
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index dcc1c536cc21..a950864a64da 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -373,6 +373,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
373 unsigned long output_len, 373 unsigned long output_len,
374 unsigned long run_size) 374 unsigned long run_size)
375{ 375{
376 unsigned char *output_orig = output;
377
376 real_mode = rmode; 378 real_mode = rmode;
377 379
378 sanitize_boot_params(real_mode); 380 sanitize_boot_params(real_mode);
@@ -421,7 +423,12 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
421 debug_putstr("\nDecompressing Linux... "); 423 debug_putstr("\nDecompressing Linux... ");
422 decompress(input_data, input_len, NULL, NULL, output, NULL, error); 424 decompress(input_data, input_len, NULL, NULL, output, NULL, error);
423 parse_elf(output); 425 parse_elf(output);
424 handle_relocations(output, output_len); 426 /*
427 * 32-bit always performs relocations. 64-bit relocations are only
428 * needed if kASLR has chosen a different load address.
429 */
430 if (!IS_ENABLED(CONFIG_X86_64) || output != output_orig)
431 handle_relocations(output, output_len);
425 debug_putstr("done.\nBooting the kernel.\n"); 432 debug_putstr("done.\nBooting the kernel.\n");
426 return output; 433 return output;
427} 434}
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 0ab4f9fd2687..3a45668f6dc3 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -50,6 +50,7 @@ void acpi_pic_sci_set_trigger(unsigned int, u16);
50 50
51extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi, 51extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
52 int trigger, int polarity); 52 int trigger, int polarity);
53extern void (*__acpi_unregister_gsi)(u32 gsi);
53 54
54static inline void disable_acpi(void) 55static inline void disable_acpi(void)
55{ 56{
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 50d033a8947d..a94b82e8f156 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -251,7 +251,8 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
251 gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]; 251 gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i];
252} 252}
253 253
254#define _LDT_empty(info) \ 254/* This intentionally ignores lm, since 32-bit apps don't have that field. */
255#define LDT_empty(info) \
255 ((info)->base_addr == 0 && \ 256 ((info)->base_addr == 0 && \
256 (info)->limit == 0 && \ 257 (info)->limit == 0 && \
257 (info)->contents == 0 && \ 258 (info)->contents == 0 && \
@@ -261,11 +262,18 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
261 (info)->seg_not_present == 1 && \ 262 (info)->seg_not_present == 1 && \
262 (info)->useable == 0) 263 (info)->useable == 0)
263 264
264#ifdef CONFIG_X86_64 265/* Lots of programs expect an all-zero user_desc to mean "no segment at all". */
265#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0)) 266static inline bool LDT_zero(const struct user_desc *info)
266#else 267{
267#define LDT_empty(info) (_LDT_empty(info)) 268 return (info->base_addr == 0 &&
268#endif 269 info->limit == 0 &&
270 info->contents == 0 &&
271 info->read_exec_only == 0 &&
272 info->seg_32bit == 0 &&
273 info->limit_in_pages == 0 &&
274 info->seg_not_present == 0 &&
275 info->useable == 0);
276}
269 277
270static inline void clear_LDT(void) 278static inline void clear_LDT(void)
271{ 279{
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 40269a2bf6f9..4b75d591eb5e 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -130,7 +130,25 @@ static inline void arch_bprm_mm_init(struct mm_struct *mm,
130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma, 130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
131 unsigned long start, unsigned long end) 131 unsigned long start, unsigned long end)
132{ 132{
133 mpx_notify_unmap(mm, vma, start, end); 133 /*
134 * mpx_notify_unmap() goes and reads a rarely-hot
135 * cacheline in the mm_struct. That can be expensive
136 * enough to be seen in profiles.
137 *
138 * The mpx_notify_unmap() call and its contents have been
139 * observed to affect munmap() performance on hardware
140 * where MPX is not present.
141 *
142 * The unlikely() optimizes for the fast case: no MPX
143 * in the CPU, or no MPX use in the process. Even if
144 * we get this wrong (in the unlikely event that MPX
145 * is widely enabled on some system) the overhead of
146 * MPX itself (reading bounds tables) is expected to
147 * overwhelm the overhead of getting this unlikely()
148 * consistently wrong.
149 */
150 if (unlikely(cpu_feature_enabled(X86_FEATURE_MPX)))
151 mpx_notify_unmap(mm, vma, start, end);
134} 152}
135 153
136#endif /* _ASM_X86_MMU_CONTEXT_H */ 154#endif /* _ASM_X86_MMU_CONTEXT_H */
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index d1626364a28a..b9e30daa0881 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -611,20 +611,20 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
611 611
612int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) 612int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
613{ 613{
614 int irq; 614 int rc, irq, trigger, polarity;
615 615
616 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { 616 rc = acpi_get_override_irq(gsi, &trigger, &polarity);
617 *irqp = gsi; 617 if (rc == 0) {
618 } else { 618 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
619 mutex_lock(&acpi_ioapic_lock); 619 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
620 irq = mp_map_gsi_to_irq(gsi, 620 irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
621 IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); 621 if (irq >= 0) {
622 mutex_unlock(&acpi_ioapic_lock); 622 *irqp = irq;
623 if (irq < 0) 623 return 0;
624 return -1; 624 }
625 *irqp = irq;
626 } 625 }
627 return 0; 626
627 return -1;
628} 628}
629EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); 629EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
630 630
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index a450373e8e91..939155ffdece 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -107,6 +107,7 @@ static struct clocksource hyperv_cs = {
107 .rating = 400, /* use this when running on Hyperv*/ 107 .rating = 400, /* use this when running on Hyperv*/
108 .read = read_hv_clock, 108 .read = read_hv_clock,
109 .mask = CLOCKSOURCE_MASK(64), 109 .mask = CLOCKSOURCE_MASK(64),
110 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
110}; 111};
111 112
112static void __init ms_hyperv_init_platform(void) 113static void __init ms_hyperv_init_platform(void)
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 2142376dc8c6..8b7b0a51e742 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -674,7 +674,7 @@ static inline void *alloc_tramp(unsigned long size)
674} 674}
675static inline void tramp_free(void *tramp) 675static inline void tramp_free(void *tramp)
676{ 676{
677 module_free(NULL, tramp); 677 module_memfree(tramp);
678} 678}
679#else 679#else
680/* Trampolines can only be created if modules are supported */ 680/* Trampolines can only be created if modules are supported */
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 6307a0f0cf17..705ef8d48e2d 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -127,7 +127,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
127 seq_puts(p, " Machine check polls\n"); 127 seq_puts(p, " Machine check polls\n");
128#endif 128#endif
129#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN) 129#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
130 seq_printf(p, "%*s: ", prec, "THR"); 130 seq_printf(p, "%*s: ", prec, "HYP");
131 for_each_online_cpu(j) 131 for_each_online_cpu(j)
132 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count); 132 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count);
133 seq_puts(p, " Hypervisor callback interrupts\n"); 133 seq_puts(p, " Hypervisor callback interrupts\n");
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 4e942f31b1a7..7fc5e843f247 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -29,7 +29,28 @@ static int get_free_idx(void)
29 29
30static bool tls_desc_okay(const struct user_desc *info) 30static bool tls_desc_okay(const struct user_desc *info)
31{ 31{
32 if (LDT_empty(info)) 32 /*
33 * For historical reasons (i.e. no one ever documented how any
34 * of the segmentation APIs work), user programs can and do
35 * assume that a struct user_desc that's all zeros except for
36 * entry_number means "no segment at all". This never actually
37 * worked. In fact, up to Linux 3.19, a struct user_desc like
38 * this would create a 16-bit read-write segment with base and
39 * limit both equal to zero.
40 *
41 * That was close enough to "no segment at all" until we
42 * hardened this function to disallow 16-bit TLS segments. Fix
43 * it up by interpreting these zeroed segments the way that they
44 * were almost certainly intended to be interpreted.
45 *
46 * The correct way to ask for "no segment at all" is to specify
47 * a user_desc that satisfies LDT_empty. To keep everything
48 * working, we accept both.
49 *
50 * Note that there's a similar kludge in modify_ldt -- look at
51 * the distinction between modes 1 and 0x11.
52 */
53 if (LDT_empty(info) || LDT_zero(info))
33 return true; 54 return true;
34 55
35 /* 56 /*
@@ -71,7 +92,7 @@ static void set_tls_desc(struct task_struct *p, int idx,
71 cpu = get_cpu(); 92 cpu = get_cpu();
72 93
73 while (n-- > 0) { 94 while (n-- > 0) {
74 if (LDT_empty(info)) 95 if (LDT_empty(info) || LDT_zero(info))
75 desc->a = desc->b = 0; 96 desc->a = desc->b = 0;
76 else 97 else
77 fill_ldt(desc, info); 98 fill_ldt(desc, info);
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index b7e50bba3bbb..505449700e0c 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -617,7 +617,7 @@ static unsigned long quick_pit_calibrate(void)
617 goto success; 617 goto success;
618 } 618 }
619 } 619 }
620 pr_err("Fast TSC calibration failed\n"); 620 pr_info("Fast TSC calibration failed\n");
621 return 0; 621 return 0;
622 622
623success: 623success:
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 169b09d76ddd..de12c1d379f1 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2348,7 +2348,7 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2348 * Not recognized on AMD in compat mode (but is recognized in legacy 2348 * Not recognized on AMD in compat mode (but is recognized in legacy
2349 * mode). 2349 * mode).
2350 */ 2350 */
2351 if ((ctxt->mode == X86EMUL_MODE_PROT32) && (efer & EFER_LMA) 2351 if ((ctxt->mode != X86EMUL_MODE_PROT64) && (efer & EFER_LMA)
2352 && !vendor_intel(ctxt)) 2352 && !vendor_intel(ctxt))
2353 return emulate_ud(ctxt); 2353 return emulate_ud(ctxt);
2354 2354
@@ -2359,25 +2359,13 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2359 setup_syscalls_segments(ctxt, &cs, &ss); 2359 setup_syscalls_segments(ctxt, &cs, &ss);
2360 2360
2361 ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); 2361 ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data);
2362 switch (ctxt->mode) { 2362 if ((msr_data & 0xfffc) == 0x0)
2363 case X86EMUL_MODE_PROT32: 2363 return emulate_gp(ctxt, 0);
2364 if ((msr_data & 0xfffc) == 0x0)
2365 return emulate_gp(ctxt, 0);
2366 break;
2367 case X86EMUL_MODE_PROT64:
2368 if (msr_data == 0x0)
2369 return emulate_gp(ctxt, 0);
2370 break;
2371 default:
2372 break;
2373 }
2374 2364
2375 ctxt->eflags &= ~(EFLG_VM | EFLG_IF); 2365 ctxt->eflags &= ~(EFLG_VM | EFLG_IF);
2376 cs_sel = (u16)msr_data; 2366 cs_sel = (u16)msr_data & ~SELECTOR_RPL_MASK;
2377 cs_sel &= ~SELECTOR_RPL_MASK;
2378 ss_sel = cs_sel + 8; 2367 ss_sel = cs_sel + 8;
2379 ss_sel &= ~SELECTOR_RPL_MASK; 2368 if (efer & EFER_LMA) {
2380 if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) {
2381 cs.d = 0; 2369 cs.d = 0;
2382 cs.l = 1; 2370 cs.l = 1;
2383 } 2371 }
@@ -2386,10 +2374,11 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2386 ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); 2374 ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS);
2387 2375
2388 ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data); 2376 ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data);
2389 ctxt->_eip = msr_data; 2377 ctxt->_eip = (efer & EFER_LMA) ? msr_data : (u32)msr_data;
2390 2378
2391 ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); 2379 ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data);
2392 *reg_write(ctxt, VCPU_REGS_RSP) = msr_data; 2380 *reg_write(ctxt, VCPU_REGS_RSP) = (efer & EFER_LMA) ? msr_data :
2381 (u32)msr_data;
2393 2382
2394 return X86EMUL_CONTINUE; 2383 return X86EMUL_CONTINUE;
2395} 2384}
@@ -3791,8 +3780,8 @@ static const struct opcode group5[] = {
3791}; 3780};
3792 3781
3793static const struct opcode group6[] = { 3782static const struct opcode group6[] = {
3794 DI(Prot, sldt), 3783 DI(Prot | DstMem, sldt),
3795 DI(Prot, str), 3784 DI(Prot | DstMem, str),
3796 II(Prot | Priv | SrcMem16, em_lldt, lldt), 3785 II(Prot | Priv | SrcMem16, em_lldt, lldt),
3797 II(Prot | Priv | SrcMem16, em_ltr, ltr), 3786 II(Prot | Priv | SrcMem16, em_ltr, ltr),
3798 N, N, N, N, 3787 N, N, N, N,
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 08a7d313538a..079c3b6a3ff1 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -43,7 +43,7 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
43 [_PAGE_CACHE_MODE_WT] = _PAGE_PCD, 43 [_PAGE_CACHE_MODE_WT] = _PAGE_PCD,
44 [_PAGE_CACHE_MODE_WP] = _PAGE_PCD, 44 [_PAGE_CACHE_MODE_WP] = _PAGE_PCD,
45}; 45};
46EXPORT_SYMBOL_GPL(__cachemode2pte_tbl); 46EXPORT_SYMBOL(__cachemode2pte_tbl);
47uint8_t __pte2cachemode_tbl[8] = { 47uint8_t __pte2cachemode_tbl[8] = {
48 [__pte2cm_idx(0)] = _PAGE_CACHE_MODE_WB, 48 [__pte2cm_idx(0)] = _PAGE_CACHE_MODE_WB,
49 [__pte2cm_idx(_PAGE_PWT)] = _PAGE_CACHE_MODE_WC, 49 [__pte2cm_idx(_PAGE_PWT)] = _PAGE_CACHE_MODE_WC,
@@ -54,7 +54,7 @@ uint8_t __pte2cachemode_tbl[8] = {
54 [__pte2cm_idx(_PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS, 54 [__pte2cm_idx(_PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
55 [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC, 55 [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
56}; 56};
57EXPORT_SYMBOL_GPL(__pte2cachemode_tbl); 57EXPORT_SYMBOL(__pte2cachemode_tbl);
58 58
59static unsigned long __initdata pgt_buf_start; 59static unsigned long __initdata pgt_buf_start;
60static unsigned long __initdata pgt_buf_end; 60static unsigned long __initdata pgt_buf_end;
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
index 67ebf5751222..c439ec478216 100644
--- a/arch/x86/mm/mpx.c
+++ b/arch/x86/mm/mpx.c
@@ -349,6 +349,12 @@ static __user void *task_get_bounds_dir(struct task_struct *tsk)
349 return MPX_INVALID_BOUNDS_DIR; 349 return MPX_INVALID_BOUNDS_DIR;
350 350
351 /* 351 /*
352 * 32-bit binaries on 64-bit kernels are currently
353 * unsupported.
354 */
355 if (IS_ENABLED(CONFIG_X86_64) && test_thread_flag(TIF_IA32))
356 return MPX_INVALID_BOUNDS_DIR;
357 /*
352 * The bounds directory pointer is stored in a register 358 * The bounds directory pointer is stored in a register
353 * only accessible if we first do an xsave. 359 * only accessible if we first do an xsave.
354 */ 360 */
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index edf299c8ff6c..7ac68698406c 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -234,8 +234,13 @@ void pat_init(void)
234 PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC); 234 PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC);
235 235
236 /* Boot CPU check */ 236 /* Boot CPU check */
237 if (!boot_pat_state) 237 if (!boot_pat_state) {
238 rdmsrl(MSR_IA32_CR_PAT, boot_pat_state); 238 rdmsrl(MSR_IA32_CR_PAT, boot_pat_state);
239 if (!boot_pat_state) {
240 pat_disable("PAT read returns always zero, disabled.");
241 return;
242 }
243 }
239 244
240 wrmsrl(MSR_IA32_CR_PAT, pat); 245 wrmsrl(MSR_IA32_CR_PAT, pat);
241 246
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 9b18ef315a55..349c0d32cc0b 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -216,7 +216,7 @@ static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
216 continue; 216 continue;
217 if (r->parent) /* Already allocated */ 217 if (r->parent) /* Already allocated */
218 continue; 218 continue;
219 if (!r->start || pci_claim_resource(dev, idx) < 0) { 219 if (!r->start || pci_claim_bridge_resource(dev, idx) < 0) {
220 /* 220 /*
221 * Something is wrong with the region. 221 * Something is wrong with the region.
222 * Invalidate the resource to prevent 222 * Invalidate the resource to prevent
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index c489ef2c1a39..9098d880c476 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -458,6 +458,7 @@ int __init pci_xen_hvm_init(void)
458 * just how GSIs get registered. 458 * just how GSIs get registered.
459 */ 459 */
460 __acpi_register_gsi = acpi_register_gsi_xen_hvm; 460 __acpi_register_gsi = acpi_register_gsi_xen_hvm;
461 __acpi_unregister_gsi = NULL;
461#endif 462#endif
462 463
463#ifdef CONFIG_PCI_MSI 464#ifdef CONFIG_PCI_MSI
@@ -471,52 +472,6 @@ int __init pci_xen_hvm_init(void)
471} 472}
472 473
473#ifdef CONFIG_XEN_DOM0 474#ifdef CONFIG_XEN_DOM0
474static __init void xen_setup_acpi_sci(void)
475{
476 int rc;
477 int trigger, polarity;
478 int gsi = acpi_sci_override_gsi;
479 int irq = -1;
480 int gsi_override = -1;
481
482 if (!gsi)
483 return;
484
485 rc = acpi_get_override_irq(gsi, &trigger, &polarity);
486 if (rc) {
487 printk(KERN_WARNING "xen: acpi_get_override_irq failed for acpi"
488 " sci, rc=%d\n", rc);
489 return;
490 }
491 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
492 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
493
494 printk(KERN_INFO "xen: sci override: global_irq=%d trigger=%d "
495 "polarity=%d\n", gsi, trigger, polarity);
496
497 /* Before we bind the GSI to a Linux IRQ, check whether
498 * we need to override it with bus_irq (IRQ) value. Usually for
499 * IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so:
500 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
501 * but there are oddballs where the IRQ != GSI:
502 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level)
503 * which ends up being: gsi_to_irq[9] == 20
504 * (which is what acpi_gsi_to_irq ends up calling when starting the
505 * the ACPI interpreter and keels over since IRQ 9 has not been
506 * setup as we had setup IRQ 20 for it).
507 */
508 if (acpi_gsi_to_irq(gsi, &irq) == 0) {
509 /* Use the provided value if it's valid. */
510 if (irq >= 0)
511 gsi_override = irq;
512 }
513
514 gsi = xen_register_gsi(gsi, gsi_override, trigger, polarity);
515 printk(KERN_INFO "xen: acpi sci %d\n", gsi);
516
517 return;
518}
519
520int __init pci_xen_initial_domain(void) 475int __init pci_xen_initial_domain(void)
521{ 476{
522 int irq; 477 int irq;
@@ -527,8 +482,8 @@ int __init pci_xen_initial_domain(void)
527 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs; 482 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
528 pci_msi_ignore_mask = 1; 483 pci_msi_ignore_mask = 1;
529#endif 484#endif
530 xen_setup_acpi_sci();
531 __acpi_register_gsi = acpi_register_gsi_xen; 485 __acpi_register_gsi = acpi_register_gsi_xen;
486 __acpi_unregister_gsi = NULL;
532 /* Pre-allocate legacy irqs */ 487 /* Pre-allocate legacy irqs */
533 for (irq = 0; irq < nr_legacy_irqs(); irq++) { 488 for (irq = 0; irq < nr_legacy_irqs(); irq++) {
534 int trigger, polarity; 489 int trigger, polarity;
diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl
deleted file mode 100644
index 23210baade2d..000000000000
--- a/arch/x86/tools/calc_run_size.pl
+++ /dev/null
@@ -1,39 +0,0 @@
1#!/usr/bin/perl
2#
3# Calculate the amount of space needed to run the kernel, including room for
4# the .bss and .brk sections.
5#
6# Usage:
7# objdump -h a.out | perl calc_run_size.pl
8use strict;
9
10my $mem_size = 0;
11my $file_offset = 0;
12
13my $sections=" *[0-9]+ \.(?:bss|brk) +";
14while (<>) {
15 if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) {
16 my $size = hex($1);
17 my $offset = hex($2);
18 $mem_size += $size;
19 if ($file_offset == 0) {
20 $file_offset = $offset;
21 } elsif ($file_offset != $offset) {
22 # BFD linker shows the same file offset in ELF.
23 # Gold linker shows them as consecutive.
24 next if ($file_offset + $mem_size == $offset + $size);
25
26 printf STDERR "file_offset: 0x%lx\n", $file_offset;
27 printf STDERR "mem_size: 0x%lx\n", $mem_size;
28 printf STDERR "offset: 0x%lx\n", $offset;
29 printf STDERR "size: 0x%lx\n", $size;
30
31 die ".bss and .brk are non-contiguous\n";
32 }
33 }
34}
35
36if ($file_offset == 0) {
37 die "Never found .bss or .brk file offset\n";
38}
39printf("%d\n", $mem_size + $file_offset);
diff --git a/arch/x86/tools/calc_run_size.sh b/arch/x86/tools/calc_run_size.sh
new file mode 100644
index 000000000000..1a4c17bb3910
--- /dev/null
+++ b/arch/x86/tools/calc_run_size.sh
@@ -0,0 +1,42 @@
1#!/bin/sh
2#
3# Calculate the amount of space needed to run the kernel, including room for
4# the .bss and .brk sections.
5#
6# Usage:
7# objdump -h a.out | sh calc_run_size.sh
8
9NUM='\([0-9a-fA-F]*[ \t]*\)'
10OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"$NUM$NUM$NUM$NUM"'.*/\1\4/p')
11if [ -z "$OUT" ] ; then
12 echo "Never found .bss or .brk file offset" >&2
13 exit 1
14fi
15
16OUT=$(echo ${OUT# })
17sizeA=$(printf "%d" 0x${OUT%% *})
18OUT=${OUT#* }
19offsetA=$(printf "%d" 0x${OUT%% *})
20OUT=${OUT#* }
21sizeB=$(printf "%d" 0x${OUT%% *})
22OUT=${OUT#* }
23offsetB=$(printf "%d" 0x${OUT%% *})
24
25run_size=$(( $offsetA + $sizeA + $sizeB ))
26
27# BFD linker shows the same file offset in ELF.
28if [ "$offsetA" -ne "$offsetB" ] ; then
29 # Gold linker shows them as consecutive.
30 endB=$(( $offsetB + $sizeB ))
31 if [ "$endB" != "$run_size" ] ; then
32 printf "sizeA: 0x%x\n" $sizeA >&2
33 printf "offsetA: 0x%x\n" $offsetA >&2
34 printf "sizeB: 0x%x\n" $sizeB >&2
35 printf "offsetB: 0x%x\n" $offsetB >&2
36 echo ".bss and .brk are non-contiguous" >&2
37 exit 1
38 fi
39fi
40
41printf "%d\n" $run_size
42exit 0