aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS9
-rw-r--r--arch/arm/boot/dts/bcm28155-ap.dts4
-rw-r--r--arch/arm/boot/dts/qcom-msm8660-surf.dts11
-rw-r--r--arch/arm/boot/dts/qcom-msm8960-cdp.dts18
-rw-r--r--arch/arm/boot/dts/qcom-msm8974.dtsi24
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi8
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi20
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts4
-rw-r--r--arch/arm/boot/dts/zynq-zc706.dts4
-rw-r--r--arch/arm/boot/dts/zynq-zed.dts4
-rw-r--r--arch/arm/configs/keystone_defconfig1
-rw-r--r--arch/arm/configs/msm_defconfig4
-rw-r--r--arch/arm/configs/multi_v7_defconfig154
-rw-r--r--arch/arm/configs/tegra_defconfig11
-rw-r--r--arch/arm/mach-hisi/Kconfig1
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c6
-rw-r--r--arch/arm/mach-iop32x/em7210.c32
-rw-r--r--arch/arm/mach-keystone/Kconfig1
-rw-r--r--arch/arm/mach-kirkwood/pm.c4
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.c2
-rw-r--r--arch/arm/mach-omap2/common.h7
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c26
-rw-r--r--arch/arm/mach-omap2/io.c1
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c3
-rw-r--r--arch/arm/mach-omap2/omap-smp.c6
-rw-r--r--arch/arm/mach-omap2/omap4-common.c6
-rw-r--r--arch/arm/mach-omap2/pm44xx.c15
-rw-r--r--arch/arm/plat-orion/irq.c47
-rw-r--r--drivers/bus/arm-cci.c2
-rw-r--r--drivers/clocksource/bcm_kona_timer.c14
-rw-r--r--drivers/irqchip/irq-armada-370-xp.c4
-rw-r--r--include/linux/slab.h8
-rw-r--r--mm/slab.c2
-rw-r--r--mm/slub.c56
-rw-r--r--tools/power/x86/turbostat/.gitignore1
-rw-r--r--tools/power/x86/turbostat/Makefile2
-rw-r--r--tools/power/x86/turbostat/turbostat.c441
37 files changed, 679 insertions, 284 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index dc2fd2298090..b2cf5cfb4d29 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -868,14 +868,7 @@ F: arch/arm/mach-prima2/
868F: drivers/clk/clk-prima2.c 868F: drivers/clk/clk-prima2.c
869F: drivers/clocksource/timer-prima2.c 869F: drivers/clocksource/timer-prima2.c
870F: drivers/clocksource/timer-marco.c 870F: drivers/clocksource/timer-marco.c
871F: drivers/dma/sirf-dma.c 871N: [^a-z]sirf
872F: drivers/i2c/busses/i2c-sirf.c
873F: drivers/input/misc/sirfsoc-onkey.c
874F: drivers/irqchip/irq-sirfsoc.c
875F: drivers/mmc/host/sdhci-sirf.c
876F: drivers/pinctrl/sirf/
877F: drivers/rtc/rtc-sirfsoc.c
878F: drivers/spi/spi-sirf.c
879 872
880ARM/EBSA110 MACHINE SUPPORT 873ARM/EBSA110 MACHINE SUPPORT
881M: Russell King <linux@arm.linux.org.uk> 874M: Russell King <linux@arm.linux.org.uk>
diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts
index c7fa9fbb999c..5ff2382a49e4 100644
--- a/arch/arm/boot/dts/bcm28155-ap.dts
+++ b/arch/arm/boot/dts/bcm28155-ap.dts
@@ -13,6 +13,8 @@
13 13
14/dts-v1/; 14/dts-v1/;
15 15
16#include <dt-bindings/gpio/gpio.h>
17
16#include "bcm11351.dtsi" 18#include "bcm11351.dtsi"
17 19
18/ { 20/ {
@@ -60,7 +62,7 @@
60 62
61 sdio4: sdio@3f1b0000 { 63 sdio4: sdio@3f1b0000 {
62 max-frequency = <48000000>; 64 max-frequency = <48000000>;
63 cd-gpios = <&gpio 14 0>; 65 cd-gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
64 status = "okay"; 66 status = "okay";
65 }; 67 };
66 68
diff --git a/arch/arm/boot/dts/qcom-msm8660-surf.dts b/arch/arm/boot/dts/qcom-msm8660-surf.dts
index 1187185cf25b..68a72f5507b9 100644
--- a/arch/arm/boot/dts/qcom-msm8660-surf.dts
+++ b/arch/arm/boot/dts/qcom-msm8660-surf.dts
@@ -2,6 +2,8 @@
2 2
3/include/ "skeleton.dtsi" 3/include/ "skeleton.dtsi"
4 4
5#include <dt-bindings/clock/qcom,gcc-msm8660.h>
6
5/ { 7/ {
6 model = "Qualcomm MSM8660 SURF"; 8 model = "Qualcomm MSM8660 SURF";
7 compatible = "qcom,msm8660-surf", "qcom,msm8660"; 9 compatible = "qcom,msm8660-surf", "qcom,msm8660";
@@ -37,11 +39,20 @@
37 #interrupt-cells = <2>; 39 #interrupt-cells = <2>;
38 }; 40 };
39 41
42 gcc: clock-controller@900000 {
43 compatible = "qcom,gcc-msm8660";
44 #clock-cells = <1>;
45 #reset-cells = <1>;
46 reg = <0x900000 0x4000>;
47 };
48
40 serial@19c40000 { 49 serial@19c40000 {
41 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; 50 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
42 reg = <0x19c40000 0x1000>, 51 reg = <0x19c40000 0x1000>,
43 <0x19c00000 0x1000>; 52 <0x19c00000 0x1000>;
44 interrupts = <0 195 0x0>; 53 interrupts = <0 195 0x0>;
54 clocks = <&gcc GSBI12_UART_CLK>, <&gcc GSBI12_H_CLK>;
55 clock-names = "core", "iface";
45 }; 56 };
46 57
47 qcom,ssbi@500000 { 58 qcom,ssbi@500000 {
diff --git a/arch/arm/boot/dts/qcom-msm8960-cdp.dts b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
index 6ccbac77931e..7c30de4fa302 100644
--- a/arch/arm/boot/dts/qcom-msm8960-cdp.dts
+++ b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
@@ -2,6 +2,8 @@
2 2
3/include/ "skeleton.dtsi" 3/include/ "skeleton.dtsi"
4 4
5#include <dt-bindings/clock/qcom,gcc-msm8960.h>
6
5/ { 7/ {
6 model = "Qualcomm MSM8960 CDP"; 8 model = "Qualcomm MSM8960 CDP";
7 compatible = "qcom,msm8960-cdp", "qcom,msm8960"; 9 compatible = "qcom,msm8960-cdp", "qcom,msm8960";
@@ -37,11 +39,27 @@
37 reg = <0x800000 0x4000>; 39 reg = <0x800000 0x4000>;
38 }; 40 };
39 41
42 gcc: clock-controller@900000 {
43 compatible = "qcom,gcc-msm8960";
44 #clock-cells = <1>;
45 #reset-cells = <1>;
46 reg = <0x900000 0x4000>;
47 };
48
49 clock-controller@4000000 {
50 compatible = "qcom,mmcc-msm8960";
51 reg = <0x4000000 0x1000>;
52 #clock-cells = <1>;
53 #reset-cells = <1>;
54 };
55
40 serial@16440000 { 56 serial@16440000 {
41 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; 57 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
42 reg = <0x16440000 0x1000>, 58 reg = <0x16440000 0x1000>,
43 <0x16400000 0x1000>; 59 <0x16400000 0x1000>;
44 interrupts = <0 154 0x0>; 60 interrupts = <0 154 0x0>;
61 clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>;
62 clock-names = "core", "iface";
45 }; 63 };
46 64
47 qcom,ssbi@500000 { 65 qcom,ssbi@500000 {
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
index 6ac94967d2d3..9e5dadb101eb 100644
--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -2,6 +2,8 @@
2 2
3#include "skeleton.dtsi" 3#include "skeleton.dtsi"
4 4
5#include <dt-bindings/clock/qcom,gcc-msm8974.h>
6
5/ { 7/ {
6 model = "Qualcomm MSM8974"; 8 model = "Qualcomm MSM8974";
7 compatible = "qcom,msm8974"; 9 compatible = "qcom,msm8974";
@@ -93,5 +95,27 @@
93 compatible = "qcom,pshold"; 95 compatible = "qcom,pshold";
94 reg = <0xfc4ab000 0x4>; 96 reg = <0xfc4ab000 0x4>;
95 }; 97 };
98
99 gcc: clock-controller@fc400000 {
100 compatible = "qcom,gcc-msm8974";
101 #clock-cells = <1>;
102 #reset-cells = <1>;
103 reg = <0xfc400000 0x4000>;
104 };
105
106 mmcc: clock-controller@fd8c0000 {
107 compatible = "qcom,mmcc-msm8974";
108 #clock-cells = <1>;
109 #reset-cells = <1>;
110 reg = <0xfd8c0000 0x6000>;
111 };
112
113 serial@f991e000 {
114 compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
115 reg = <0xf991e000 0x1000>;
116 interrupts = <0 108 0x0>;
117 clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
118 clock-names = "core", "iface";
119 };
96 }; 120 };
97}; 121};
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index f48487c2a970..71b1251f79c7 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -197,7 +197,7 @@
197 reg = <0 0xe6508000 0 0x40>; 197 reg = <0 0xe6508000 0 0x40>;
198 interrupt-parent = <&gic>; 198 interrupt-parent = <&gic>;
199 interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>; 199 interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
200 clocks = <&mstp3_clks R8A7790_CLK_I2C0>; 200 clocks = <&mstp9_clks R8A7790_CLK_I2C0>;
201 status = "disabled"; 201 status = "disabled";
202 }; 202 };
203 203
@@ -208,7 +208,7 @@
208 reg = <0 0xe6518000 0 0x40>; 208 reg = <0 0xe6518000 0 0x40>;
209 interrupt-parent = <&gic>; 209 interrupt-parent = <&gic>;
210 interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>; 210 interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
211 clocks = <&mstp3_clks R8A7790_CLK_I2C1>; 211 clocks = <&mstp9_clks R8A7790_CLK_I2C1>;
212 status = "disabled"; 212 status = "disabled";
213 }; 213 };
214 214
@@ -219,7 +219,7 @@
219 reg = <0 0xe6530000 0 0x40>; 219 reg = <0 0xe6530000 0 0x40>;
220 interrupt-parent = <&gic>; 220 interrupt-parent = <&gic>;
221 interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>; 221 interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
222 clocks = <&mstp3_clks R8A7790_CLK_I2C2>; 222 clocks = <&mstp9_clks R8A7790_CLK_I2C2>;
223 status = "disabled"; 223 status = "disabled";
224 }; 224 };
225 225
@@ -230,7 +230,7 @@
230 reg = <0 0xe6540000 0 0x40>; 230 reg = <0 0xe6540000 0 0x40>;
231 interrupt-parent = <&gic>; 231 interrupt-parent = <&gic>;
232 interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>; 232 interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
233 clocks = <&mstp3_clks R8A7790_CLK_I2C3>; 233 clocks = <&mstp9_clks R8A7790_CLK_I2C3>;
234 status = "disabled"; 234 status = "disabled";
235 }; 235 };
236 236
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 5d7681be0580..8b67b19392ec 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -102,6 +102,26 @@
102 clock-names = "pclk", "hclk", "tx_clk"; 102 clock-names = "pclk", "hclk", "tx_clk";
103 }; 103 };
104 104
105 sdhci0: ps7-sdhci@e0100000 {
106 compatible = "arasan,sdhci-8.9a";
107 status = "disabled";
108 clock-names = "clk_xin", "clk_ahb";
109 clocks = <&clkc 21>, <&clkc 32>;
110 interrupt-parent = <&intc>;
111 interrupts = <0 24 4>;
112 reg = <0xe0100000 0x1000>;
113 } ;
114
115 sdhci1: ps7-sdhci@e0101000 {
116 compatible = "arasan,sdhci-8.9a";
117 status = "disabled";
118 clock-names = "clk_xin", "clk_ahb";
119 clocks = <&clkc 22>, <&clkc 33>;
120 interrupt-parent = <&intc>;
121 interrupts = <0 47 4>;
122 reg = <0xe0101000 0x1000>;
123 } ;
124
105 slcr: slcr@f8000000 { 125 slcr: slcr@f8000000 {
106 compatible = "xlnx,zynq-slcr"; 126 compatible = "xlnx,zynq-slcr";
107 reg = <0xF8000000 0x1000>; 127 reg = <0xF8000000 0x1000>;
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 34d680a46b7e..c913f77a21eb 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -34,6 +34,10 @@
34 phy-mode = "rgmii"; 34 phy-mode = "rgmii";
35}; 35};
36 36
37&sdhci0 {
38 status = "okay";
39};
40
37&uart1 { 41&uart1 {
38 status = "okay"; 42 status = "okay";
39}; 43};
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
index b2835d5fc09a..88f62c50382e 100644
--- a/arch/arm/boot/dts/zynq-zc706.dts
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -35,6 +35,10 @@
35 phy-mode = "rgmii"; 35 phy-mode = "rgmii";
36}; 36};
37 37
38&sdhci0 {
39 status = "okay";
40};
41
38&uart1 { 42&uart1 {
39 status = "okay"; 43 status = "okay";
40}; 44};
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
index 2eda06889dfc..82d7ef1a9a9c 100644
--- a/arch/arm/boot/dts/zynq-zed.dts
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -35,6 +35,10 @@
35 phy-mode = "rgmii"; 35 phy-mode = "rgmii";
36}; 36};
37 37
38&sdhci0 {
39 status = "okay";
40};
41
38&uart1 { 42&uart1 {
39 status = "okay"; 43 status = "okay";
40}; 44};
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig
index a0182447d133..4582e160feab 100644
--- a/arch/arm/configs/keystone_defconfig
+++ b/arch/arm/configs/keystone_defconfig
@@ -142,6 +142,7 @@ CONFIG_USB_DWC3_DEBUG=y
142CONFIG_USB_DWC3_VERBOSE=y 142CONFIG_USB_DWC3_VERBOSE=y
143CONFIG_KEYSTONE_USB_PHY=y 143CONFIG_KEYSTONE_USB_PHY=y
144CONFIG_DMADEVICES=y 144CONFIG_DMADEVICES=y
145CONFIG_TI_EDMA=y
145CONFIG_COMMON_CLK_DEBUG=y 146CONFIG_COMMON_CLK_DEBUG=y
146CONFIG_MEMORY=y 147CONFIG_MEMORY=y
147CONFIG_EXT4_FS=y 148CONFIG_EXT4_FS=y
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index 0219c65cefd5..c5858b9eb516 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -114,6 +114,10 @@ CONFIG_USB_GADGET_VBUS_DRAW=500
114CONFIG_NEW_LEDS=y 114CONFIG_NEW_LEDS=y
115CONFIG_RTC_CLASS=y 115CONFIG_RTC_CLASS=y
116CONFIG_STAGING=y 116CONFIG_STAGING=y
117CONFIG_COMMON_CLK_QCOM=y
118CONFIG_MSM_GCC_8660=y
119CONFIG_MSM_MMCC_8960=y
120CONFIG_MSM_MMCC_8974=y
117CONFIG_MSM_IOMMU=y 121CONFIG_MSM_IOMMU=y
118CONFIG_EXT2_FS=y 122CONFIG_EXT2_FS=y
119CONFIG_EXT2_FS_XATTR=y 123CONFIG_EXT2_FS_XATTR=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 687e4e811b2a..845bc745706b 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -1,7 +1,12 @@
1CONFIG_SYSVIPC=y
1CONFIG_IRQ_DOMAIN_DEBUG=y 2CONFIG_IRQ_DOMAIN_DEBUG=y
2CONFIG_NO_HZ=y 3CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 4CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y
7CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y
9CONFIG_PARTITION_ADVANCED=y
5CONFIG_ARCH_MVEBU=y 10CONFIG_ARCH_MVEBU=y
6CONFIG_MACH_ARMADA_370=y 11CONFIG_MACH_ARMADA_370=y
7CONFIG_MACH_ARMADA_XP=y 12CONFIG_MACH_ARMADA_XP=y
@@ -38,7 +43,7 @@ CONFIG_ARCH_TEGRA=y
38CONFIG_ARCH_TEGRA_2x_SOC=y 43CONFIG_ARCH_TEGRA_2x_SOC=y
39CONFIG_ARCH_TEGRA_3x_SOC=y 44CONFIG_ARCH_TEGRA_3x_SOC=y
40CONFIG_ARCH_TEGRA_114_SOC=y 45CONFIG_ARCH_TEGRA_114_SOC=y
41CONFIG_TEGRA_PCI=y 46CONFIG_ARCH_TEGRA_124_SOC=y
42CONFIG_TEGRA_EMC_SCALING_ENABLE=y 47CONFIG_TEGRA_EMC_SCALING_ENABLE=y
43CONFIG_ARCH_U8500=y 48CONFIG_ARCH_U8500=y
44CONFIG_MACH_HREFV60=y 49CONFIG_MACH_HREFV60=y
@@ -49,19 +54,55 @@ CONFIG_ARCH_VEXPRESS_CA9X4=y
49CONFIG_ARCH_VIRT=y 54CONFIG_ARCH_VIRT=y
50CONFIG_ARCH_WM8850=y 55CONFIG_ARCH_WM8850=y
51CONFIG_ARCH_ZYNQ=y 56CONFIG_ARCH_ZYNQ=y
57CONFIG_TRUSTED_FOUNDATIONS=y
58CONFIG_PCI=y
59CONFIG_PCI_MSI=y
60CONFIG_PCI_MVEBU=y
61CONFIG_PCI_TEGRA=y
52CONFIG_SMP=y 62CONFIG_SMP=y
53CONFIG_HIGHPTE=y 63CONFIG_HIGHPTE=y
64CONFIG_CMA=y
54CONFIG_ARM_APPENDED_DTB=y 65CONFIG_ARM_APPENDED_DTB=y
55CONFIG_ARM_ATAG_DTB_COMPAT=y 66CONFIG_ARM_ATAG_DTB_COMPAT=y
67CONFIG_KEXEC=y
68CONFIG_CPU_FREQ=y
69CONFIG_CPU_FREQ_STAT_DETAILS=y
70CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
71CONFIG_CPU_IDLE=y
56CONFIG_NET=y 72CONFIG_NET=y
73CONFIG_PACKET=y
57CONFIG_UNIX=y 74CONFIG_UNIX=y
58CONFIG_INET=y 75CONFIG_INET=y
59CONFIG_IP_PNP=y 76CONFIG_IP_PNP=y
60CONFIG_IP_PNP_DHCP=y 77CONFIG_IP_PNP_DHCP=y
78CONFIG_IP_PNP_BOOTP=y
79CONFIG_IP_PNP_RARP=y
80CONFIG_IPV6_ROUTER_PREF=y
81CONFIG_IPV6_OPTIMISTIC_DAD=y
82CONFIG_INET6_AH=m
83CONFIG_INET6_ESP=m
84CONFIG_INET6_IPCOMP=m
85CONFIG_IPV6_MIP6=m
86CONFIG_IPV6_TUNNEL=m
87CONFIG_IPV6_MULTIPLE_TABLES=y
88CONFIG_CFG80211=m
89CONFIG_MAC80211=m
90CONFIG_RFKILL=y
91CONFIG_RFKILL_INPUT=y
92CONFIG_RFKILL_GPIO=y
61CONFIG_DEVTMPFS=y 93CONFIG_DEVTMPFS=y
62CONFIG_DEVTMPFS_MOUNT=y 94CONFIG_DEVTMPFS_MOUNT=y
95CONFIG_DMA_CMA=y
63CONFIG_OMAP_OCP2SCP=y 96CONFIG_OMAP_OCP2SCP=y
97CONFIG_MTD=y
98CONFIG_MTD_M25P80=y
99CONFIG_BLK_DEV_LOOP=y
100CONFIG_ICS932S401=y
101CONFIG_APDS9802ALS=y
102CONFIG_ISL29003=y
64CONFIG_BLK_DEV_SD=y 103CONFIG_BLK_DEV_SD=y
104CONFIG_BLK_DEV_SR=y
105CONFIG_SCSI_MULTI_LUN=y
65CONFIG_ATA=y 106CONFIG_ATA=y
66CONFIG_SATA_AHCI_PLATFORM=y 107CONFIG_SATA_AHCI_PLATFORM=y
67CONFIG_SATA_HIGHBANK=y 108CONFIG_SATA_HIGHBANK=y
@@ -69,13 +110,30 @@ CONFIG_SATA_MV=y
69CONFIG_NETDEVICES=y 110CONFIG_NETDEVICES=y
70CONFIG_SUN4I_EMAC=y 111CONFIG_SUN4I_EMAC=y
71CONFIG_NET_CALXEDA_XGMAC=y 112CONFIG_NET_CALXEDA_XGMAC=y
113CONFIG_MVNETA=y
72CONFIG_KS8851=y 114CONFIG_KS8851=y
115CONFIG_R8169=y
73CONFIG_SMSC911X=y 116CONFIG_SMSC911X=y
74CONFIG_STMMAC_ETH=y 117CONFIG_STMMAC_ETH=y
75CONFIG_ICPLUS_PHY=y
76CONFIG_MDIO_SUN4I=y
77CONFIG_TI_CPSW=y 118CONFIG_TI_CPSW=y
119CONFIG_AT803X_PHY=y
120CONFIG_MARVELL_PHY=y
121CONFIG_ICPLUS_PHY=y
122CONFIG_USB_PEGASUS=y
123CONFIG_USB_USBNET=y
124CONFIG_USB_NET_SMSC75XX=y
125CONFIG_USB_NET_SMSC95XX=y
126CONFIG_BRCMFMAC=m
127CONFIG_RT2X00=m
128CONFIG_RT2800USB=m
129CONFIG_INPUT_EVDEV=y
130CONFIG_KEYBOARD_GPIO=y
131CONFIG_KEYBOARD_TEGRA=y
78CONFIG_KEYBOARD_SPEAR=y 132CONFIG_KEYBOARD_SPEAR=y
133CONFIG_KEYBOARD_CROS_EC=y
134CONFIG_MOUSE_PS2_ELANTECH=y
135CONFIG_INPUT_MISC=y
136CONFIG_INPUT_MPU3050=y
79CONFIG_SERIO_AMBAKMI=y 137CONFIG_SERIO_AMBAKMI=y
80CONFIG_SERIAL_8250=y 138CONFIG_SERIAL_8250=y
81CONFIG_SERIAL_8250_CONSOLE=y 139CONFIG_SERIAL_8250_CONSOLE=y
@@ -98,30 +156,81 @@ CONFIG_SERIAL_FSL_LPUART=y
98CONFIG_SERIAL_FSL_LPUART_CONSOLE=y 156CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
99CONFIG_SERIAL_ST_ASC=y 157CONFIG_SERIAL_ST_ASC=y
100CONFIG_SERIAL_ST_ASC_CONSOLE=y 158CONFIG_SERIAL_ST_ASC_CONSOLE=y
159CONFIG_I2C_CHARDEV=y
160CONFIG_I2C_MUX=y
161CONFIG_I2C_MUX_PINCTRL=y
101CONFIG_I2C_DESIGNWARE_PLATFORM=y 162CONFIG_I2C_DESIGNWARE_PLATFORM=y
163CONFIG_I2C_MV64XXX=y
102CONFIG_I2C_SIRF=y 164CONFIG_I2C_SIRF=y
103CONFIG_I2C_TEGRA=y 165CONFIG_I2C_TEGRA=y
104CONFIG_SPI=y 166CONFIG_SPI=y
105CONFIG_SPI_OMAP24XX=y 167CONFIG_SPI_OMAP24XX=y
168CONFIG_SPI_ORION=y
106CONFIG_SPI_PL022=y 169CONFIG_SPI_PL022=y
107CONFIG_SPI_SIRF=y 170CONFIG_SPI_SIRF=y
108CONFIG_SPI_TEGRA114=y 171CONFIG_SPI_TEGRA114=y
172CONFIG_SPI_TEGRA20_SFLASH=y
109CONFIG_SPI_TEGRA20_SLINK=y 173CONFIG_SPI_TEGRA20_SLINK=y
110CONFIG_PINCTRL_SINGLE=y 174CONFIG_PINCTRL_AS3722=y
175CONFIG_PINCTRL_PALMAS=y
176CONFIG_GPIO_SYSFS=y
111CONFIG_GPIO_GENERIC_PLATFORM=y 177CONFIG_GPIO_GENERIC_PLATFORM=y
178CONFIG_GPIO_PCA953X_IRQ=y
112CONFIG_GPIO_TWL4030=y 179CONFIG_GPIO_TWL4030=y
113CONFIG_REGULATOR_GPIO=y 180CONFIG_GPIO_PALMAS=y
181CONFIG_GPIO_TPS6586X=y
182CONFIG_GPIO_TPS65910=y
183CONFIG_BATTERY_SBS=y
184CONFIG_CHARGER_TPS65090=y
185CONFIG_POWER_RESET_AS3722=y
186CONFIG_POWER_RESET_GPIO=y
187CONFIG_SENSORS_LM90=y
188CONFIG_THERMAL=y
189CONFIG_ARMADA_THERMAL=y
190CONFIG_MFD_AS3722=y
191CONFIG_MFD_CROS_EC=y
192CONFIG_MFD_CROS_EC_SPI=y
193CONFIG_MFD_MAX8907=y
194CONFIG_MFD_PALMAS=y
195CONFIG_MFD_TPS65090=y
196CONFIG_MFD_TPS6586X=y
197CONFIG_MFD_TPS65910=y
198CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
114CONFIG_REGULATOR_AB8500=y 199CONFIG_REGULATOR_AB8500=y
200CONFIG_REGULATOR_AS3722=y
201CONFIG_REGULATOR_GPIO=y
202CONFIG_REGULATOR_MAX8907=y
203CONFIG_REGULATOR_PALMAS=y
115CONFIG_REGULATOR_TPS51632=y 204CONFIG_REGULATOR_TPS51632=y
116CONFIG_REGULATOR_TPS62360=y 205CONFIG_REGULATOR_TPS62360=y
206CONFIG_REGULATOR_TPS65090=y
207CONFIG_REGULATOR_TPS6586X=y
208CONFIG_REGULATOR_TPS65910=y
117CONFIG_REGULATOR_TWL4030=y 209CONFIG_REGULATOR_TWL4030=y
118CONFIG_REGULATOR_VEXPRESS=y 210CONFIG_REGULATOR_VEXPRESS=y
211CONFIG_MEDIA_SUPPORT=y
212CONFIG_MEDIA_CAMERA_SUPPORT=y
213CONFIG_MEDIA_USB_SUPPORT=y
119CONFIG_DRM=y 214CONFIG_DRM=y
120CONFIG_TEGRA_HOST1X=y
121CONFIG_DRM_TEGRA=y 215CONFIG_DRM_TEGRA=y
216CONFIG_DRM_PANEL_SIMPLE=y
122CONFIG_FB_ARMCLCD=y 217CONFIG_FB_ARMCLCD=y
123CONFIG_FB_WM8505=y 218CONFIG_FB_WM8505=y
124CONFIG_FB_SIMPLE=y 219CONFIG_FB_SIMPLE=y
220CONFIG_BACKLIGHT_LCD_SUPPORT=y
221CONFIG_BACKLIGHT_CLASS_DEVICE=y
222CONFIG_BACKLIGHT_PWM=y
223CONFIG_FRAMEBUFFER_CONSOLE=y
224CONFIG_SOUND=y
225CONFIG_SND=y
226CONFIG_SND_SOC=y
227CONFIG_SND_SOC_TEGRA=y
228CONFIG_SND_SOC_TEGRA_RT5640=y
229CONFIG_SND_SOC_TEGRA_WM8753=y
230CONFIG_SND_SOC_TEGRA_WM8903=y
231CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
232CONFIG_SND_SOC_TEGRA_ALC5632=y
233CONFIG_SND_SOC_TEGRA_MAX98090=y
125CONFIG_USB=y 234CONFIG_USB=y
126CONFIG_USB_XHCI_HCD=y 235CONFIG_USB_XHCI_HCD=y
127CONFIG_USB_EHCI_HCD=y 236CONFIG_USB_EHCI_HCD=y
@@ -132,8 +241,6 @@ CONFIG_USB_STORAGE=y
132CONFIG_USB_CHIPIDEA=y 241CONFIG_USB_CHIPIDEA=y
133CONFIG_USB_CHIPIDEA_HOST=y 242CONFIG_USB_CHIPIDEA_HOST=y
134CONFIG_AB8500_USB=y 243CONFIG_AB8500_USB=y
135CONFIG_NOP_USB_XCEIV=y
136CONFIG_OMAP_USB2=y
137CONFIG_OMAP_USB3=y 244CONFIG_OMAP_USB3=y
138CONFIG_SAMSUNG_USB2PHY=y 245CONFIG_SAMSUNG_USB2PHY=y
139CONFIG_SAMSUNG_USB3PHY=y 246CONFIG_SAMSUNG_USB3PHY=y
@@ -144,24 +251,32 @@ CONFIG_MMC=y
144CONFIG_MMC_BLOCK_MINORS=16 251CONFIG_MMC_BLOCK_MINORS=16
145CONFIG_MMC_ARMMMCI=y 252CONFIG_MMC_ARMMMCI=y
146CONFIG_MMC_SDHCI=y 253CONFIG_MMC_SDHCI=y
147CONFIG_MMC_SDHCI_PLTFM=y
148CONFIG_MMC_SDHCI_ESDHC_IMX=y 254CONFIG_MMC_SDHCI_ESDHC_IMX=y
149CONFIG_MMC_SDHCI_TEGRA=y 255CONFIG_MMC_SDHCI_TEGRA=y
150CONFIG_MMC_SDHCI_SPEAR=y 256CONFIG_MMC_SDHCI_SPEAR=y
151CONFIG_MMC_SDHCI_BCM_KONA=y 257CONFIG_MMC_SDHCI_BCM_KONA=y
152CONFIG_MMC_OMAP=y 258CONFIG_MMC_OMAP=y
153CONFIG_MMC_OMAP_HS=y 259CONFIG_MMC_OMAP_HS=y
260CONFIG_MMC_MVSDIO=y
154CONFIG_EDAC=y 261CONFIG_EDAC=y
155CONFIG_EDAC_MM_EDAC=y 262CONFIG_EDAC_MM_EDAC=y
156CONFIG_EDAC_HIGHBANK_MC=y 263CONFIG_EDAC_HIGHBANK_MC=y
157CONFIG_EDAC_HIGHBANK_L2=y 264CONFIG_EDAC_HIGHBANK_L2=y
158CONFIG_RTC_CLASS=y 265CONFIG_RTC_CLASS=y
266CONFIG_RTC_DRV_AS3722=y
267CONFIG_RTC_DRV_MAX8907=y
268CONFIG_RTC_DRV_PALMAS=y
159CONFIG_RTC_DRV_TWL4030=y 269CONFIG_RTC_DRV_TWL4030=y
270CONFIG_RTC_DRV_TPS6586X=y
271CONFIG_RTC_DRV_TPS65910=y
272CONFIG_RTC_DRV_EM3027=y
160CONFIG_RTC_DRV_PL031=y 273CONFIG_RTC_DRV_PL031=y
161CONFIG_RTC_DRV_VT8500=y 274CONFIG_RTC_DRV_VT8500=y
275CONFIG_RTC_DRV_MV=y
162CONFIG_RTC_DRV_TEGRA=y 276CONFIG_RTC_DRV_TEGRA=y
163CONFIG_DMADEVICES=y 277CONFIG_DMADEVICES=y
164CONFIG_DW_DMAC=y 278CONFIG_DW_DMAC=y
279CONFIG_MV_XOR=y
165CONFIG_TEGRA20_APB_DMA=y 280CONFIG_TEGRA20_APB_DMA=y
166CONFIG_STE_DMA40=y 281CONFIG_STE_DMA40=y
167CONFIG_SIRF_DMA=y 282CONFIG_SIRF_DMA=y
@@ -171,15 +286,34 @@ CONFIG_IMX_SDMA=y
171CONFIG_IMX_DMA=y 286CONFIG_IMX_DMA=y
172CONFIG_MXS_DMA=y 287CONFIG_MXS_DMA=y
173CONFIG_DMA_OMAP=y 288CONFIG_DMA_OMAP=y
289CONFIG_STAGING=y
290CONFIG_SENSORS_ISL29018=y
291CONFIG_SENSORS_ISL29028=y
292CONFIG_MFD_NVEC=y
293CONFIG_KEYBOARD_NVEC=y
294CONFIG_SERIO_NVEC_PS2=y
295CONFIG_NVEC_POWER=y
296CONFIG_TEGRA_IOMMU_GART=y
297CONFIG_TEGRA_IOMMU_SMMU=y
298CONFIG_MEMORY=y
299CONFIG_IIO=y
300CONFIG_AK8975=y
174CONFIG_PWM=y 301CONFIG_PWM=y
302CONFIG_PWM_TEGRA=y
175CONFIG_PWM_VT8500=y 303CONFIG_PWM_VT8500=y
304CONFIG_OMAP_USB2=y
176CONFIG_EXT4_FS=y 305CONFIG_EXT4_FS=y
306CONFIG_VFAT_FS=y
177CONFIG_TMPFS=y 307CONFIG_TMPFS=y
308CONFIG_SQUASHFS=y
309CONFIG_SQUASHFS_LZO=y
310CONFIG_SQUASHFS_XZ=y
178CONFIG_NFS_FS=y 311CONFIG_NFS_FS=y
179CONFIG_NFS_V3_ACL=y 312CONFIG_NFS_V3_ACL=y
180CONFIG_NFS_V4=y 313CONFIG_NFS_V4=y
181CONFIG_ROOT_NFS=y 314CONFIG_ROOT_NFS=y
182CONFIG_PRINTK_TIME=y 315CONFIG_PRINTK_TIME=y
183CONFIG_DEBUG_FS=y 316CONFIG_DEBUG_FS=y
184CONFIG_DEBUG_KERNEL=y 317CONFIG_MAGIC_SYSRQ=y
185CONFIG_LOCKUP_DETECTOR=y 318CONFIG_LOCKUP_DETECTOR=y
319CONFIG_CRYPTO_DEV_TEGRA_AES=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 5fdc9a09d339..00fe9e9710fd 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -29,11 +29,11 @@ CONFIG_ARCH_TEGRA_3x_SOC=y
29CONFIG_ARCH_TEGRA_114_SOC=y 29CONFIG_ARCH_TEGRA_114_SOC=y
30CONFIG_ARCH_TEGRA_124_SOC=y 30CONFIG_ARCH_TEGRA_124_SOC=y
31CONFIG_TEGRA_EMC_SCALING_ENABLE=y 31CONFIG_TEGRA_EMC_SCALING_ENABLE=y
32CONFIG_TRUSTED_FOUNDATIONS=y
32CONFIG_PCI=y 33CONFIG_PCI=y
33CONFIG_PCI_MSI=y 34CONFIG_PCI_MSI=y
34CONFIG_PCI_TEGRA=y 35CONFIG_PCI_TEGRA=y
35CONFIG_PCIEPORTBUS=y 36CONFIG_PCIEPORTBUS=y
36CONFIG_TRUSTED_FOUNDATIONS=y
37CONFIG_SMP=y 37CONFIG_SMP=y
38CONFIG_PREEMPT=y 38CONFIG_PREEMPT=y
39CONFIG_AEABI=y 39CONFIG_AEABI=y
@@ -125,7 +125,6 @@ CONFIG_SERIAL_TEGRA=y
125CONFIG_SERIAL_OF_PLATFORM=y 125CONFIG_SERIAL_OF_PLATFORM=y
126# CONFIG_HW_RANDOM is not set 126# CONFIG_HW_RANDOM is not set
127# CONFIG_I2C_COMPAT is not set 127# CONFIG_I2C_COMPAT is not set
128CONFIG_I2C_MUX=y
129CONFIG_I2C_MUX_PINCTRL=y 128CONFIG_I2C_MUX_PINCTRL=y
130CONFIG_I2C_TEGRA=y 129CONFIG_I2C_TEGRA=y
131CONFIG_SPI=y 130CONFIG_SPI=y
@@ -169,9 +168,8 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y
169CONFIG_MEDIA_USB_SUPPORT=y 168CONFIG_MEDIA_USB_SUPPORT=y
170CONFIG_USB_VIDEO_CLASS=m 169CONFIG_USB_VIDEO_CLASS=m
171CONFIG_DRM=y 170CONFIG_DRM=y
172CONFIG_DRM_PANEL=y
173CONFIG_DRM_PANEL_SIMPLE=y
174CONFIG_DRM_TEGRA=y 171CONFIG_DRM_TEGRA=y
172CONFIG_DRM_PANEL_SIMPLE=y
175CONFIG_BACKLIGHT_LCD_SUPPORT=y 173CONFIG_BACKLIGHT_LCD_SUPPORT=y
176# CONFIG_LCD_CLASS_DEVICE is not set 174# CONFIG_LCD_CLASS_DEVICE is not set
177CONFIG_BACKLIGHT_CLASS_DEVICE=y 175CONFIG_BACKLIGHT_CLASS_DEVICE=y
@@ -206,10 +204,7 @@ CONFIG_MMC_BLOCK_MINORS=16
206CONFIG_MMC_SDHCI=y 204CONFIG_MMC_SDHCI=y
207CONFIG_MMC_SDHCI_PLTFM=y 205CONFIG_MMC_SDHCI_PLTFM=y
208CONFIG_MMC_SDHCI_TEGRA=y 206CONFIG_MMC_SDHCI_TEGRA=y
209CONFIG_NEW_LEDS=y
210CONFIG_LEDS_CLASS=y
211CONFIG_LEDS_GPIO=y 207CONFIG_LEDS_GPIO=y
212CONFIG_LEDS_TRIGGERS=y
213CONFIG_LEDS_TRIGGER_TIMER=y 208CONFIG_LEDS_TRIGGER_TIMER=y
214CONFIG_LEDS_TRIGGER_ONESHOT=y 209CONFIG_LEDS_TRIGGER_ONESHOT=y
215CONFIG_LEDS_TRIGGER_HEARTBEAT=y 210CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -235,7 +230,6 @@ CONFIG_KEYBOARD_NVEC=y
235CONFIG_SERIO_NVEC_PS2=y 230CONFIG_SERIO_NVEC_PS2=y
236CONFIG_NVEC_POWER=y 231CONFIG_NVEC_POWER=y
237CONFIG_NVEC_PAZ00=y 232CONFIG_NVEC_PAZ00=y
238CONFIG_COMMON_CLK_DEBUG=y
239CONFIG_TEGRA_IOMMU_GART=y 233CONFIG_TEGRA_IOMMU_GART=y
240CONFIG_TEGRA_IOMMU_SMMU=y 234CONFIG_TEGRA_IOMMU_SMMU=y
241CONFIG_MEMORY=y 235CONFIG_MEMORY=y
@@ -265,6 +259,7 @@ CONFIG_NLS_CODEPAGE_437=y
265CONFIG_NLS_ISO8859_1=y 259CONFIG_NLS_ISO8859_1=y
266CONFIG_PRINTK_TIME=y 260CONFIG_PRINTK_TIME=y
267CONFIG_DEBUG_INFO=y 261CONFIG_DEBUG_INFO=y
262CONFIG_DEBUG_FS=y
268CONFIG_MAGIC_SYSRQ=y 263CONFIG_MAGIC_SYSRQ=y
269CONFIG_DEBUG_SLAB=y 264CONFIG_DEBUG_SLAB=y
270CONFIG_DEBUG_VM=y 265CONFIG_DEBUG_VM=y
diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig
index 018ad67f1b38..8f4649b301b2 100644
--- a/arch/arm/mach-hisi/Kconfig
+++ b/arch/arm/mach-hisi/Kconfig
@@ -12,6 +12,5 @@ config ARCH_HI3xxx
12 select HAVE_SMP 12 select HAVE_SMP
13 select PINCTRL 13 select PINCTRL
14 select PINCTRL_SINGLE 14 select PINCTRL_SINGLE
15 select SMP
16 help 15 help
17 Support for Hisilicon Hi36xx/Hi37xx processor family 16 Support for Hisilicon Hi36xx/Hi37xx processor family
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 5e84149d1790..a3ef961e4a93 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -64,6 +64,7 @@ static void __iomem *intcp_con_base;
64 64
65/* 65/*
66 * Logical Physical 66 * Logical Physical
67 * f1000000 10000000 Core module registers
67 * f1300000 13000000 Counter/Timer 68 * f1300000 13000000 Counter/Timer
68 * f1400000 14000000 Interrupt controller 69 * f1400000 14000000 Interrupt controller
69 * f1600000 16000000 UART 0 70 * f1600000 16000000 UART 0
@@ -75,6 +76,11 @@ static void __iomem *intcp_con_base;
75 76
76static struct map_desc intcp_io_desc[] __initdata __maybe_unused = { 77static struct map_desc intcp_io_desc[] __initdata __maybe_unused = {
77 { 78 {
79 .virtual = IO_ADDRESS(INTEGRATOR_HDR_BASE),
80 .pfn = __phys_to_pfn(INTEGRATOR_HDR_BASE),
81 .length = SZ_4K,
82 .type = MT_DEVICE
83 }, {
78 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE), 84 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE),
79 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE), 85 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE),
80 .length = SZ_4K, 86 .length = SZ_4K,
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 177cd073a83b..77e1ff057303 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/gpio.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/irq.h> 29#include <linux/irq.h>
@@ -176,11 +177,35 @@ static struct platform_device em7210_serial_device = {
176 .resource = &em7210_uart_resource, 177 .resource = &em7210_uart_resource,
177}; 178};
178 179
180#define EM7210_HARDWARE_POWER 0
181
179void em7210_power_off(void) 182void em7210_power_off(void)
180{ 183{
181 *IOP3XX_GPOE &= 0xfe; 184 int ret;
182 *IOP3XX_GPOD |= 0x01; 185
186 ret = gpio_direction_output(EM7210_HARDWARE_POWER, 1);
187 if (ret)
188 pr_crit("could not drive power off GPIO high\n");
189}
190
191static int __init em7210_request_gpios(void)
192{
193 int ret;
194
195 if (!machine_is_em7210())
196 return 0;
197
198 ret = gpio_request(EM7210_HARDWARE_POWER, "power");
199 if (ret) {
200 pr_err("could not request power off GPIO\n");
201 return 0;
202 }
203
204 pm_power_off = em7210_power_off;
205
206 return 0;
183} 207}
208device_initcall(em7210_request_gpios);
184 209
185static void __init em7210_init_machine(void) 210static void __init em7210_init_machine(void)
186{ 211{
@@ -194,9 +219,6 @@ static void __init em7210_init_machine(void)
194 219
195 i2c_register_board_info(0, em7210_i2c_devices, 220 i2c_register_board_info(0, em7210_i2c_devices,
196 ARRAY_SIZE(em7210_i2c_devices)); 221 ARRAY_SIZE(em7210_i2c_devices));
197
198
199 pm_power_off = em7210_power_off;
200} 222}
201 223
202MACHINE_START(EM7210, "Lanner EM7210") 224MACHINE_START(EM7210, "Lanner EM7210")
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index dabc5eee52e7..90a708fef541 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -10,7 +10,6 @@ config ARCH_KEYSTONE
10 select ARCH_WANT_OPTIONAL_GPIOLIB 10 select ARCH_WANT_OPTIONAL_GPIOLIB
11 select ARM_ERRATA_798181 if SMP 11 select ARM_ERRATA_798181 if SMP
12 select COMMON_CLK_KEYSTONE 12 select COMMON_CLK_KEYSTONE
13 select TI_EDMA
14 select ARCH_SUPPORTS_BIG_ENDIAN 13 select ARCH_SUPPORTS_BIG_ENDIAN
15 select ZONE_DMA if ARM_LPAE 14 select ZONE_DMA if ARM_LPAE
16 help 15 help
diff --git a/arch/arm/mach-kirkwood/pm.c b/arch/arm/mach-kirkwood/pm.c
index 8783a7184e73..c6ab8d9303a5 100644
--- a/arch/arm/mach-kirkwood/pm.c
+++ b/arch/arm/mach-kirkwood/pm.c
@@ -18,6 +18,7 @@
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <mach/bridge-regs.h> 20#include <mach/bridge-regs.h>
21#include "common.h"
21 22
22static void __iomem *ddr_operation_base; 23static void __iomem *ddr_operation_base;
23 24
@@ -65,9 +66,8 @@ static const struct platform_suspend_ops kirkwood_suspend_ops = {
65 .valid = kirkwood_pm_valid_standby, 66 .valid = kirkwood_pm_valid_standby,
66}; 67};
67 68
68int __init kirkwood_pm_init(void) 69void __init kirkwood_pm_init(void)
69{ 70{
70 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4); 71 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
71 suspend_set_ops(&kirkwood_suspend_ops); 72 suspend_set_ops(&kirkwood_suspend_ops);
72 return 0;
73} 73}
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index fe4fc1cbdfaf..f3b325f6cbd4 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -88,7 +88,7 @@ static int __init mvebu_soc_id_init(void)
88 } 88 }
89 89
90 pci_base = of_iomap(child, 0); 90 pci_base = of_iomap(child, 0);
91 if (IS_ERR(pci_base)) { 91 if (pci_base == NULL) {
92 pr_err("cannot map registers\n"); 92 pr_err("cannot map registers\n");
93 ret = -ENOMEM; 93 ret = -ENOMEM;
94 goto res_ioremap; 94 goto res_ioremap;
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index e51527835160..a6aae300542c 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -62,11 +62,17 @@ static inline int omap3_pm_init(void)
62 62
63#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) 63#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4)
64int omap4_pm_init(void); 64int omap4_pm_init(void);
65int omap4_pm_init_early(void);
65#else 66#else
66static inline int omap4_pm_init(void) 67static inline int omap4_pm_init(void)
67{ 68{
68 return 0; 69 return 0;
69} 70}
71
72static inline int omap4_pm_init_early(void)
73{
74 return 0;
75}
70#endif 76#endif
71 77
72#ifdef CONFIG_OMAP_MUX 78#ifdef CONFIG_OMAP_MUX
@@ -236,6 +242,7 @@ static inline void __iomem *omap4_get_scu_base(void)
236 242
237extern void __init gic_init_irq(void); 243extern void __init gic_init_irq(void);
238extern void gic_dist_disable(void); 244extern void gic_dist_disable(void);
245extern void gic_dist_enable(void);
239extern bool gic_dist_disabled(void); 246extern bool gic_dist_disabled(void);
240extern void gic_timer_retrigger(void); 247extern void gic_timer_retrigger(void);
241extern void omap_smc1(u32 fn, u32 arg); 248extern void omap_smc1(u32 fn, u32 arg);
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 4c8982ae9529..4c158c838d40 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -80,6 +80,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
80 int index) 80 int index)
81{ 81{
82 struct idle_statedata *cx = state_ptr + index; 82 struct idle_statedata *cx = state_ptr + index;
83 u32 mpuss_can_lose_context = 0;
83 84
84 /* 85 /*
85 * CPU0 has to wait and stay ON until CPU1 is OFF state. 86 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -104,6 +105,9 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
104 } 105 }
105 } 106 }
106 107
108 mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) &&
109 (cx->mpu_logic_state == PWRDM_POWER_OFF);
110
107 /* 111 /*
108 * Call idle CPU PM enter notifier chain so that 112 * Call idle CPU PM enter notifier chain so that
109 * VFP and per CPU interrupt context is saved. 113 * VFP and per CPU interrupt context is saved.
@@ -118,9 +122,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
118 * Call idle CPU cluster PM enter notifier chain 122 * Call idle CPU cluster PM enter notifier chain
119 * to save GIC and wakeupgen context. 123 * to save GIC and wakeupgen context.
120 */ 124 */
121 if ((cx->mpu_state == PWRDM_POWER_RET) && 125 if (mpuss_can_lose_context)
122 (cx->mpu_logic_state == PWRDM_POWER_OFF)) 126 cpu_cluster_pm_enter();
123 cpu_cluster_pm_enter();
124 } 127 }
125 128
126 omap4_enter_lowpower(dev->cpu, cx->cpu_state); 129 omap4_enter_lowpower(dev->cpu, cx->cpu_state);
@@ -128,9 +131,23 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
128 131
129 /* Wakeup CPU1 only if it is not offlined */ 132 /* Wakeup CPU1 only if it is not offlined */
130 if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) { 133 if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
134
135 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) &&
136 mpuss_can_lose_context)
137 gic_dist_disable();
138
131 clkdm_wakeup(cpu_clkdm[1]); 139 clkdm_wakeup(cpu_clkdm[1]);
132 omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON); 140 omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
133 clkdm_allow_idle(cpu_clkdm[1]); 141 clkdm_allow_idle(cpu_clkdm[1]);
142
143 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) &&
144 mpuss_can_lose_context) {
145 while (gic_dist_disabled()) {
146 udelay(1);
147 cpu_relax();
148 }
149 gic_timer_retrigger();
150 }
134 } 151 }
135 152
136 /* 153 /*
@@ -143,8 +160,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
143 * Call idle CPU cluster PM exit notifier chain 160 * Call idle CPU cluster PM exit notifier chain
144 * to restore GIC and wakeupgen context. 161 * to restore GIC and wakeupgen context.
145 */ 162 */
146 if (dev->cpu == 0 && (cx->mpu_state == PWRDM_POWER_RET) && 163 if (dev->cpu == 0 && mpuss_can_lose_context)
147 (cx->mpu_logic_state == PWRDM_POWER_OFF))
148 cpu_cluster_pm_exit(); 164 cpu_cluster_pm_exit();
149 165
150fail: 166fail:
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 47381fd8746f..d408b15b4fbf 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -641,6 +641,7 @@ void __init omap4430_init_early(void)
641 omap_cm_base_init(); 641 omap_cm_base_init();
642 omap4xxx_check_revision(); 642 omap4xxx_check_revision();
643 omap4xxx_check_features(); 643 omap4xxx_check_features();
644 omap4_pm_init_early();
644 omap44xx_prm_init(); 645 omap44xx_prm_init();
645 omap44xx_voltagedomains_init(); 646 omap44xx_voltagedomains_init();
646 omap44xx_powerdomains_init(); 647 omap44xx_powerdomains_init();
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index f991016e2a6a..667915d236f3 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -271,6 +271,9 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
271 else 271 else
272 omap_pm_ops.finish_suspend(save_state); 272 omap_pm_ops.finish_suspend(save_state);
273 273
274 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) && cpu)
275 gic_dist_enable();
276
274 /* 277 /*
275 * Restore the CPUx power state to ON otherwise CPUx 278 * Restore the CPUx power state to ON otherwise CPUx
276 * power domain can transitions to programmed low power 279 * power domain can transitions to programmed low power
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 75e95d4fb448..17550aa39d0f 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -39,8 +39,6 @@
39 39
40#define OMAP5_CORE_COUNT 0x2 40#define OMAP5_CORE_COUNT 0x2
41 41
42u16 pm44xx_errata;
43
44/* SCU base address */ 42/* SCU base address */
45static void __iomem *scu_base; 43static void __iomem *scu_base;
46 44
@@ -217,10 +215,8 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
217 if (scu_base) 215 if (scu_base)
218 scu_enable(scu_base); 216 scu_enable(scu_base);
219 217
220 if (cpu_is_omap446x()) { 218 if (cpu_is_omap446x())
221 startup_addr = omap4460_secondary_startup; 219 startup_addr = omap4460_secondary_startup;
222 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
223 }
224 220
225 /* 221 /*
226 * Write the address of secondary startup routine into the 222 * Write the address of secondary startup routine into the
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index dd893ec4c8f2..6cd3f3772ecf 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -127,6 +127,12 @@ void gic_dist_disable(void)
127 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL); 127 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
128} 128}
129 129
130void gic_dist_enable(void)
131{
132 if (gic_dist_base_addr)
133 __raw_writel(0x1, gic_dist_base_addr + GIC_DIST_CTRL);
134}
135
130bool gic_dist_disabled(void) 136bool gic_dist_disabled(void)
131{ 137{
132 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1); 138 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 82f0698933d8..eefb30cfcabd 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -24,6 +24,8 @@
24#include "powerdomain.h" 24#include "powerdomain.h"
25#include "pm.h" 25#include "pm.h"
26 26
27u16 pm44xx_errata;
28
27struct power_state { 29struct power_state {
28 struct powerdomain *pwrdm; 30 struct powerdomain *pwrdm;
29 u32 next_state; 31 u32 next_state;
@@ -199,6 +201,19 @@ static inline int omap4_init_static_deps(void)
199} 201}
200 202
201/** 203/**
204 * omap4_pm_init_early - Does early initialization necessary for OMAP4+ devices
205 *
206 * Initializes basic stuff for power management functionality.
207 */
208int __init omap4_pm_init_early(void)
209{
210 if (cpu_is_omap446x())
211 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
212
213 return 0;
214}
215
216/**
202 * omap4_pm_init - Init routine for OMAP4+ devices 217 * omap4_pm_init - Init routine for OMAP4+ devices
203 * 218 *
204 * Initializes all powerdomain and clockdomain target states 219 * Initializes all powerdomain and clockdomain target states
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index c492e1b3dfdb..807df142444b 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -15,8 +15,51 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/of_address.h> 16#include <linux/of_address.h>
17#include <linux/of_irq.h> 17#include <linux/of_irq.h>
18#include <asm/exception.h>
18#include <plat/irq.h> 19#include <plat/irq.h>
19#include <plat/orion-gpio.h> 20#include <plat/orion-gpio.h>
21#include <mach/bridge-regs.h>
22
23#ifdef CONFIG_MULTI_IRQ_HANDLER
24/*
25 * Compiling with both non-DT and DT support enabled, will
26 * break asm irq handler used by non-DT boards. Therefore,
27 * we provide a C-style irq handler even for non-DT boards,
28 * if MULTI_IRQ_HANDLER is set.
29 *
30 * Notes:
31 * - this is prepared for Kirkwood and Dove only, update
32 * accordingly if you add Orion5x or MV78x00.
33 * - Orion5x uses different macro names and has only one
34 * set of CAUSE/MASK registers.
35 * - MV78x00 uses the same macro names but has a third
36 * set of CAUSE/MASK registers.
37 *
38 */
39
40static void __iomem *orion_irq_base = IRQ_VIRT_BASE;
41
42asmlinkage void
43__exception_irq_entry orion_legacy_handle_irq(struct pt_regs *regs)
44{
45 u32 stat;
46
47 stat = readl_relaxed(orion_irq_base + IRQ_CAUSE_LOW_OFF);
48 stat &= readl_relaxed(orion_irq_base + IRQ_MASK_LOW_OFF);
49 if (stat) {
50 unsigned int hwirq = __fls(stat);
51 handle_IRQ(hwirq, regs);
52 return;
53 }
54 stat = readl_relaxed(orion_irq_base + IRQ_CAUSE_HIGH_OFF);
55 stat &= readl_relaxed(orion_irq_base + IRQ_MASK_HIGH_OFF);
56 if (stat) {
57 unsigned int hwirq = 32 + __fls(stat);
58 handle_IRQ(hwirq, regs);
59 return;
60 }
61}
62#endif
20 63
21void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) 64void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
22{ 65{
@@ -35,6 +78,10 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
35 ct->chip.irq_unmask = irq_gc_mask_set_bit; 78 ct->chip.irq_unmask = irq_gc_mask_set_bit;
36 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE, 79 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE,
37 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); 80 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
81
82#ifdef CONFIG_MULTI_IRQ_HANDLER
83 set_handle_irq(orion_legacy_handle_irq);
84#endif
38} 85}
39 86
40#ifdef CONFIG_OF 87#ifdef CONFIG_OF
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index b6739cb78e32..962fd35cbd8d 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -979,7 +979,7 @@ static int cci_probe(void)
979 979
980 nb_cci_ports = cci_config->nb_ace + cci_config->nb_ace_lite; 980 nb_cci_ports = cci_config->nb_ace + cci_config->nb_ace_lite;
981 981
982 ports = kcalloc(sizeof(*ports), nb_cci_ports, GFP_KERNEL); 982 ports = kcalloc(nb_cci_ports, sizeof(*ports), GFP_KERNEL);
983 if (!ports) 983 if (!ports)
984 return -ENOMEM; 984 return -ENOMEM;
985 985
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
index 5176e761166b..974b2db2fe10 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -17,6 +17,7 @@
17#include <linux/jiffies.h> 17#include <linux/jiffies.h>
18#include <linux/clockchips.h> 18#include <linux/clockchips.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/clk.h>
20 21
21#include <linux/io.h> 22#include <linux/io.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
@@ -101,11 +102,18 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw)
101static void __init kona_timers_init(struct device_node *node) 102static void __init kona_timers_init(struct device_node *node)
102{ 103{
103 u32 freq; 104 u32 freq;
105 struct clk *external_clk;
104 106
105 if (!of_property_read_u32(node, "clock-frequency", &freq)) 107 external_clk = of_clk_get_by_name(node, NULL);
108
109 if (!IS_ERR(external_clk)) {
110 arch_timer_rate = clk_get_rate(external_clk);
111 clk_prepare_enable(external_clk);
112 } else if (!of_property_read_u32(node, "clock-frequency", &freq)) {
106 arch_timer_rate = freq; 113 arch_timer_rate = freq;
107 else 114 } else {
108 panic("clock-frequency not set in the .dts file"); 115 panic("unable to determine clock-frequency");
116 }
109 117
110 /* Setup IRQ numbers */ 118 /* Setup IRQ numbers */
111 timers.tmr_irq = irq_of_parse_and_map(node, 0); 119 timers.tmr_irq = irq_of_parse_and_map(node, 0);
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 433cc8568dec..9300bc32784e 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -59,8 +59,6 @@
59#define PCI_MSI_DOORBELL_END (32) 59#define PCI_MSI_DOORBELL_END (32)
60#define PCI_MSI_DOORBELL_MASK 0xFFFF0000 60#define PCI_MSI_DOORBELL_MASK 0xFFFF0000
61 61
62static DEFINE_RAW_SPINLOCK(irq_controller_lock);
63
64static void __iomem *per_cpu_int_base; 62static void __iomem *per_cpu_int_base;
65static void __iomem *main_int_base; 63static void __iomem *main_int_base;
66static struct irq_domain *armada_370_xp_mpic_domain; 64static struct irq_domain *armada_370_xp_mpic_domain;
@@ -239,6 +237,8 @@ static inline int armada_370_xp_msi_init(struct device_node *node,
239#endif 237#endif
240 238
241#ifdef CONFIG_SMP 239#ifdef CONFIG_SMP
240static DEFINE_RAW_SPINLOCK(irq_controller_lock);
241
242static int armada_xp_set_affinity(struct irq_data *d, 242static int armada_xp_set_affinity(struct irq_data *d,
243 const struct cpumask *mask_val, bool force) 243 const struct cpumask *mask_val, bool force)
244{ 244{
diff --git a/include/linux/slab.h b/include/linux/slab.h
index a060142aa5f5..9260abdd67df 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -205,8 +205,8 @@ struct kmem_cache {
205 205
206#ifdef CONFIG_SLUB 206#ifdef CONFIG_SLUB
207/* 207/*
208 * SLUB allocates up to order 2 pages directly and otherwise 208 * SLUB directly allocates requests fitting in to an order-1 page
209 * passes the request to the page allocator. 209 * (PAGE_SIZE*2). Larger requests are passed to the page allocator.
210 */ 210 */
211#define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1) 211#define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
212#define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT) 212#define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT)
@@ -217,12 +217,12 @@ struct kmem_cache {
217 217
218#ifdef CONFIG_SLOB 218#ifdef CONFIG_SLOB
219/* 219/*
220 * SLOB passes all page size and larger requests to the page allocator. 220 * SLOB passes all requests larger than one page to the page allocator.
221 * No kmalloc array is necessary since objects of different sizes can 221 * No kmalloc array is necessary since objects of different sizes can
222 * be allocated from the same page. 222 * be allocated from the same page.
223 */ 223 */
224#define KMALLOC_SHIFT_MAX 30
225#define KMALLOC_SHIFT_HIGH PAGE_SHIFT 224#define KMALLOC_SHIFT_HIGH PAGE_SHIFT
225#define KMALLOC_SHIFT_MAX 30
226#ifndef KMALLOC_SHIFT_LOW 226#ifndef KMALLOC_SHIFT_LOW
227#define KMALLOC_SHIFT_LOW 3 227#define KMALLOC_SHIFT_LOW 3
228#endif 228#endif
diff --git a/mm/slab.c b/mm/slab.c
index eb043bf05f4c..b264214c77ea 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1946,7 +1946,7 @@ static void slab_destroy_debugcheck(struct kmem_cache *cachep,
1946/** 1946/**
1947 * slab_destroy - destroy and release all objects in a slab 1947 * slab_destroy - destroy and release all objects in a slab
1948 * @cachep: cache pointer being destroyed 1948 * @cachep: cache pointer being destroyed
1949 * @slabp: slab pointer being destroyed 1949 * @page: page pointer being destroyed
1950 * 1950 *
1951 * Destroy all the objs in a slab, and release the mem back to the system. 1951 * Destroy all the objs in a slab, and release the mem back to the system.
1952 * Before calling the slab must have been unlinked from the cache. The 1952 * Before calling the slab must have been unlinked from the cache. The
diff --git a/mm/slub.c b/mm/slub.c
index 2b1a6970e46f..7e3e0458bce4 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1000,23 +1000,22 @@ static inline void slab_free_hook(struct kmem_cache *s, void *x)
1000 1000
1001/* 1001/*
1002 * Tracking of fully allocated slabs for debugging purposes. 1002 * Tracking of fully allocated slabs for debugging purposes.
1003 *
1004 * list_lock must be held.
1005 */ 1003 */
1006static void add_full(struct kmem_cache *s, 1004static void add_full(struct kmem_cache *s,
1007 struct kmem_cache_node *n, struct page *page) 1005 struct kmem_cache_node *n, struct page *page)
1008{ 1006{
1007 lockdep_assert_held(&n->list_lock);
1008
1009 if (!(s->flags & SLAB_STORE_USER)) 1009 if (!(s->flags & SLAB_STORE_USER))
1010 return; 1010 return;
1011 1011
1012 list_add(&page->lru, &n->full); 1012 list_add(&page->lru, &n->full);
1013} 1013}
1014 1014
1015/* 1015static void remove_full(struct kmem_cache *s, struct kmem_cache_node *n, struct page *page)
1016 * list_lock must be held.
1017 */
1018static void remove_full(struct kmem_cache *s, struct page *page)
1019{ 1016{
1017 lockdep_assert_held(&n->list_lock);
1018
1020 if (!(s->flags & SLAB_STORE_USER)) 1019 if (!(s->flags & SLAB_STORE_USER))
1021 return; 1020 return;
1022 1021
@@ -1265,7 +1264,8 @@ static inline int check_object(struct kmem_cache *s, struct page *page,
1265 void *object, u8 val) { return 1; } 1264 void *object, u8 val) { return 1; }
1266static inline void add_full(struct kmem_cache *s, struct kmem_cache_node *n, 1265static inline void add_full(struct kmem_cache *s, struct kmem_cache_node *n,
1267 struct page *page) {} 1266 struct page *page) {}
1268static inline void remove_full(struct kmem_cache *s, struct page *page) {} 1267static inline void remove_full(struct kmem_cache *s, struct kmem_cache_node *n,
1268 struct page *page) {}
1269static inline unsigned long kmem_cache_flags(unsigned long object_size, 1269static inline unsigned long kmem_cache_flags(unsigned long object_size,
1270 unsigned long flags, const char *name, 1270 unsigned long flags, const char *name,
1271 void (*ctor)(void *)) 1271 void (*ctor)(void *))
@@ -1519,12 +1519,12 @@ static void discard_slab(struct kmem_cache *s, struct page *page)
1519 1519
1520/* 1520/*
1521 * Management of partially allocated slabs. 1521 * Management of partially allocated slabs.
1522 *
1523 * list_lock must be held.
1524 */ 1522 */
1525static inline void add_partial(struct kmem_cache_node *n, 1523static inline void add_partial(struct kmem_cache_node *n,
1526 struct page *page, int tail) 1524 struct page *page, int tail)
1527{ 1525{
1526 lockdep_assert_held(&n->list_lock);
1527
1528 n->nr_partial++; 1528 n->nr_partial++;
1529 if (tail == DEACTIVATE_TO_TAIL) 1529 if (tail == DEACTIVATE_TO_TAIL)
1530 list_add_tail(&page->lru, &n->partial); 1530 list_add_tail(&page->lru, &n->partial);
@@ -1532,12 +1532,11 @@ static inline void add_partial(struct kmem_cache_node *n,
1532 list_add(&page->lru, &n->partial); 1532 list_add(&page->lru, &n->partial);
1533} 1533}
1534 1534
1535/*
1536 * list_lock must be held.
1537 */
1538static inline void remove_partial(struct kmem_cache_node *n, 1535static inline void remove_partial(struct kmem_cache_node *n,
1539 struct page *page) 1536 struct page *page)
1540{ 1537{
1538 lockdep_assert_held(&n->list_lock);
1539
1541 list_del(&page->lru); 1540 list_del(&page->lru);
1542 n->nr_partial--; 1541 n->nr_partial--;
1543} 1542}
@@ -1547,8 +1546,6 @@ static inline void remove_partial(struct kmem_cache_node *n,
1547 * return the pointer to the freelist. 1546 * return the pointer to the freelist.
1548 * 1547 *
1549 * Returns a list of objects or NULL if it fails. 1548 * Returns a list of objects or NULL if it fails.
1550 *
1551 * Must hold list_lock since we modify the partial list.
1552 */ 1549 */
1553static inline void *acquire_slab(struct kmem_cache *s, 1550static inline void *acquire_slab(struct kmem_cache *s,
1554 struct kmem_cache_node *n, struct page *page, 1551 struct kmem_cache_node *n, struct page *page,
@@ -1558,6 +1555,8 @@ static inline void *acquire_slab(struct kmem_cache *s,
1558 unsigned long counters; 1555 unsigned long counters;
1559 struct page new; 1556 struct page new;
1560 1557
1558 lockdep_assert_held(&n->list_lock);
1559
1561 /* 1560 /*
1562 * Zap the freelist and set the frozen bit. 1561 * Zap the freelist and set the frozen bit.
1563 * The old freelist is the list of objects for the 1562 * The old freelist is the list of objects for the
@@ -1902,7 +1901,7 @@ redo:
1902 1901
1903 else if (l == M_FULL) 1902 else if (l == M_FULL)
1904 1903
1905 remove_full(s, page); 1904 remove_full(s, n, page);
1906 1905
1907 if (m == M_PARTIAL) { 1906 if (m == M_PARTIAL) {
1908 1907
@@ -2556,7 +2555,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
2556 new.inuse--; 2555 new.inuse--;
2557 if ((!new.inuse || !prior) && !was_frozen) { 2556 if ((!new.inuse || !prior) && !was_frozen) {
2558 2557
2559 if (kmem_cache_has_cpu_partial(s) && !prior) 2558 if (kmem_cache_has_cpu_partial(s) && !prior) {
2560 2559
2561 /* 2560 /*
2562 * Slab was on no list before and will be 2561 * Slab was on no list before and will be
@@ -2566,7 +2565,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
2566 */ 2565 */
2567 new.frozen = 1; 2566 new.frozen = 1;
2568 2567
2569 else { /* Needs to be taken off a list */ 2568 } else { /* Needs to be taken off a list */
2570 2569
2571 n = get_node(s, page_to_nid(page)); 2570 n = get_node(s, page_to_nid(page));
2572 /* 2571 /*
@@ -2615,7 +2614,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
2615 */ 2614 */
2616 if (!kmem_cache_has_cpu_partial(s) && unlikely(!prior)) { 2615 if (!kmem_cache_has_cpu_partial(s) && unlikely(!prior)) {
2617 if (kmem_cache_debug(s)) 2616 if (kmem_cache_debug(s))
2618 remove_full(s, page); 2617 remove_full(s, n, page);
2619 add_partial(n, page, DEACTIVATE_TO_TAIL); 2618 add_partial(n, page, DEACTIVATE_TO_TAIL);
2620 stat(s, FREE_ADD_PARTIAL); 2619 stat(s, FREE_ADD_PARTIAL);
2621 } 2620 }
@@ -2629,9 +2628,10 @@ slab_empty:
2629 */ 2628 */
2630 remove_partial(n, page); 2629 remove_partial(n, page);
2631 stat(s, FREE_REMOVE_PARTIAL); 2630 stat(s, FREE_REMOVE_PARTIAL);
2632 } else 2631 } else {
2633 /* Slab must be on the full list */ 2632 /* Slab must be on the full list */
2634 remove_full(s, page); 2633 remove_full(s, n, page);
2634 }
2635 2635
2636 spin_unlock_irqrestore(&n->list_lock, flags); 2636 spin_unlock_irqrestore(&n->list_lock, flags);
2637 stat(s, FREE_SLAB); 2637 stat(s, FREE_SLAB);
@@ -2905,7 +2905,13 @@ static void early_kmem_cache_node_alloc(int node)
2905 init_kmem_cache_node(n); 2905 init_kmem_cache_node(n);
2906 inc_slabs_node(kmem_cache_node, node, page->objects); 2906 inc_slabs_node(kmem_cache_node, node, page->objects);
2907 2907
2908 /*
2909 * the lock is for lockdep's sake, not for any actual
2910 * race protection
2911 */
2912 spin_lock(&n->list_lock);
2908 add_partial(n, page, DEACTIVATE_TO_HEAD); 2913 add_partial(n, page, DEACTIVATE_TO_HEAD);
2914 spin_unlock(&n->list_lock);
2909} 2915}
2910 2916
2911static void free_kmem_cache_nodes(struct kmem_cache *s) 2917static void free_kmem_cache_nodes(struct kmem_cache *s)
@@ -4314,7 +4320,13 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
4314 4320
4315 page = ACCESS_ONCE(c->partial); 4321 page = ACCESS_ONCE(c->partial);
4316 if (page) { 4322 if (page) {
4317 x = page->pobjects; 4323 node = page_to_nid(page);
4324 if (flags & SO_TOTAL)
4325 WARN_ON_ONCE(1);
4326 else if (flags & SO_OBJECTS)
4327 WARN_ON_ONCE(1);
4328 else
4329 x = page->pages;
4318 total += x; 4330 total += x;
4319 nodes[node] += x; 4331 nodes[node] += x;
4320 } 4332 }
@@ -5178,7 +5190,7 @@ static int sysfs_slab_add(struct kmem_cache *s)
5178 } 5190 }
5179 5191
5180 s->kobj.kset = slab_kset; 5192 s->kobj.kset = slab_kset;
5181 err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, name); 5193 err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name);
5182 if (err) { 5194 if (err) {
5183 kobject_put(&s->kobj); 5195 kobject_put(&s->kobj);
5184 return err; 5196 return err;
diff --git a/tools/power/x86/turbostat/.gitignore b/tools/power/x86/turbostat/.gitignore
new file mode 100644
index 000000000000..7521370d3568
--- /dev/null
+++ b/tools/power/x86/turbostat/.gitignore
@@ -0,0 +1 @@
turbostat
diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
index f09641da40d4..d1b3a361e526 100644
--- a/tools/power/x86/turbostat/Makefile
+++ b/tools/power/x86/turbostat/Makefile
@@ -5,7 +5,7 @@ DESTDIR :=
5 5
6turbostat : turbostat.c 6turbostat : turbostat.c
7CFLAGS += -Wall 7CFLAGS += -Wall
8CFLAGS += -I../../../../arch/x86/include/uapi/ 8CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"'
9 9
10%: %.c 10%: %.c
11 @mkdir -p $(BUILD_OUTPUT) 11 @mkdir -p $(BUILD_OUTPUT)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 9d77f13c2d25..77eb130168da 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -20,8 +20,10 @@
20 */ 20 */
21 21
22#define _GNU_SOURCE 22#define _GNU_SOURCE
23#include <asm/msr.h> 23#include MSRHEADER
24#include <stdarg.h>
24#include <stdio.h> 25#include <stdio.h>
26#include <err.h>
25#include <unistd.h> 27#include <unistd.h>
26#include <sys/types.h> 28#include <sys/types.h>
27#include <sys/wait.h> 29#include <sys/wait.h>
@@ -35,13 +37,16 @@
35#include <string.h> 37#include <string.h>
36#include <ctype.h> 38#include <ctype.h>
37#include <sched.h> 39#include <sched.h>
40#include <cpuid.h>
38 41
39char *proc_stat = "/proc/stat"; 42char *proc_stat = "/proc/stat";
40unsigned int interval_sec = 5; /* set with -i interval_sec */ 43unsigned int interval_sec = 5; /* set with -i interval_sec */
41unsigned int verbose; /* set with -v */ 44unsigned int verbose; /* set with -v */
42unsigned int rapl_verbose; /* set with -R */ 45unsigned int rapl_verbose; /* set with -R */
46unsigned int rapl_joules; /* set with -J */
43unsigned int thermal_verbose; /* set with -T */ 47unsigned int thermal_verbose; /* set with -T */
44unsigned int summary_only; /* set with -s */ 48unsigned int summary_only; /* set with -S */
49unsigned int dump_only; /* set with -s */
45unsigned int skip_c0; 50unsigned int skip_c0;
46unsigned int skip_c1; 51unsigned int skip_c1;
47unsigned int do_nhm_cstates; 52unsigned int do_nhm_cstates;
@@ -77,14 +82,32 @@ unsigned int tcc_activation_temp_override;
77double rapl_power_units, rapl_energy_units, rapl_time_units; 82double rapl_power_units, rapl_energy_units, rapl_time_units;
78double rapl_joule_counter_range; 83double rapl_joule_counter_range;
79 84
80#define RAPL_PKG (1 << 0) 85#define RAPL_PKG (1 << 0)
81#define RAPL_CORES (1 << 1) 86 /* 0x610 MSR_PKG_POWER_LIMIT */
82#define RAPL_GFX (1 << 2) 87 /* 0x611 MSR_PKG_ENERGY_STATUS */
83#define RAPL_DRAM (1 << 3) 88#define RAPL_PKG_PERF_STATUS (1 << 1)
84#define RAPL_PKG_PERF_STATUS (1 << 4) 89 /* 0x613 MSR_PKG_PERF_STATUS */
85#define RAPL_DRAM_PERF_STATUS (1 << 5) 90#define RAPL_PKG_POWER_INFO (1 << 2)
86#define RAPL_PKG_POWER_INFO (1 << 6) 91 /* 0x614 MSR_PKG_POWER_INFO */
87#define RAPL_CORE_POLICY (1 << 7) 92
93#define RAPL_DRAM (1 << 3)
94 /* 0x618 MSR_DRAM_POWER_LIMIT */
95 /* 0x619 MSR_DRAM_ENERGY_STATUS */
96 /* 0x61c MSR_DRAM_POWER_INFO */
97#define RAPL_DRAM_PERF_STATUS (1 << 4)
98 /* 0x61b MSR_DRAM_PERF_STATUS */
99
100#define RAPL_CORES (1 << 5)
101 /* 0x638 MSR_PP0_POWER_LIMIT */
102 /* 0x639 MSR_PP0_ENERGY_STATUS */
103#define RAPL_CORE_POLICY (1 << 6)
104 /* 0x63a MSR_PP0_POLICY */
105
106
107#define RAPL_GFX (1 << 7)
108 /* 0x640 MSR_PP1_POWER_LIMIT */
109 /* 0x641 MSR_PP1_ENERGY_STATUS */
110 /* 0x642 MSR_PP1_POLICY */
88#define TJMAX_DEFAULT 100 111#define TJMAX_DEFAULT 100
89 112
90#define MAX(a, b) ((a) > (b) ? (a) : (b)) 113#define MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -234,7 +257,7 @@ int get_msr(int cpu, off_t offset, unsigned long long *msr)
234 close(fd); 257 close(fd);
235 258
236 if (retval != sizeof *msr) { 259 if (retval != sizeof *msr) {
237 fprintf(stderr, "%s offset 0x%zx read failed\n", pathname, offset); 260 fprintf(stderr, "%s offset 0x%llx read failed\n", pathname, (unsigned long long)offset);
238 return -1; 261 return -1;
239 } 262 }
240 263
@@ -296,70 +319,92 @@ void print_header(void)
296 outp += sprintf(outp, " %%pc10"); 319 outp += sprintf(outp, " %%pc10");
297 } 320 }
298 321
299 if (do_rapl & RAPL_PKG) 322 if (do_rapl && !rapl_joules) {
300 outp += sprintf(outp, " Pkg_W"); 323 if (do_rapl & RAPL_PKG)
301 if (do_rapl & RAPL_CORES) 324 outp += sprintf(outp, " Pkg_W");
302 outp += sprintf(outp, " Cor_W"); 325 if (do_rapl & RAPL_CORES)
303 if (do_rapl & RAPL_GFX) 326 outp += sprintf(outp, " Cor_W");
304 outp += sprintf(outp, " GFX_W"); 327 if (do_rapl & RAPL_GFX)
305 if (do_rapl & RAPL_DRAM) 328 outp += sprintf(outp, " GFX_W");
306 outp += sprintf(outp, " RAM_W"); 329 if (do_rapl & RAPL_DRAM)
307 if (do_rapl & RAPL_PKG_PERF_STATUS) 330 outp += sprintf(outp, " RAM_W");
308 outp += sprintf(outp, " PKG_%%"); 331 if (do_rapl & RAPL_PKG_PERF_STATUS)
309 if (do_rapl & RAPL_DRAM_PERF_STATUS) 332 outp += sprintf(outp, " PKG_%%");
310 outp += sprintf(outp, " RAM_%%"); 333 if (do_rapl & RAPL_DRAM_PERF_STATUS)
334 outp += sprintf(outp, " RAM_%%");
335 } else {
336 if (do_rapl & RAPL_PKG)
337 outp += sprintf(outp, " Pkg_J");
338 if (do_rapl & RAPL_CORES)
339 outp += sprintf(outp, " Cor_J");
340 if (do_rapl & RAPL_GFX)
341 outp += sprintf(outp, " GFX_J");
342 if (do_rapl & RAPL_DRAM)
343 outp += sprintf(outp, " RAM_W");
344 if (do_rapl & RAPL_PKG_PERF_STATUS)
345 outp += sprintf(outp, " PKG_%%");
346 if (do_rapl & RAPL_DRAM_PERF_STATUS)
347 outp += sprintf(outp, " RAM_%%");
348 outp += sprintf(outp, " time");
311 349
350 }
312 outp += sprintf(outp, "\n"); 351 outp += sprintf(outp, "\n");
313} 352}
314 353
315int dump_counters(struct thread_data *t, struct core_data *c, 354int dump_counters(struct thread_data *t, struct core_data *c,
316 struct pkg_data *p) 355 struct pkg_data *p)
317{ 356{
318 fprintf(stderr, "t %p, c %p, p %p\n", t, c, p); 357 outp += sprintf(outp, "t %p, c %p, p %p\n", t, c, p);
319 358
320 if (t) { 359 if (t) {
321 fprintf(stderr, "CPU: %d flags 0x%x\n", t->cpu_id, t->flags); 360 outp += sprintf(outp, "CPU: %d flags 0x%x\n",
322 fprintf(stderr, "TSC: %016llX\n", t->tsc); 361 t->cpu_id, t->flags);
323 fprintf(stderr, "aperf: %016llX\n", t->aperf); 362 outp += sprintf(outp, "TSC: %016llX\n", t->tsc);
324 fprintf(stderr, "mperf: %016llX\n", t->mperf); 363 outp += sprintf(outp, "aperf: %016llX\n", t->aperf);
325 fprintf(stderr, "c1: %016llX\n", t->c1); 364 outp += sprintf(outp, "mperf: %016llX\n", t->mperf);
326 fprintf(stderr, "msr0x%x: %08llX\n", 365 outp += sprintf(outp, "c1: %016llX\n", t->c1);
366 outp += sprintf(outp, "msr0x%x: %08llX\n",
327 extra_delta_offset32, t->extra_delta32); 367 extra_delta_offset32, t->extra_delta32);
328 fprintf(stderr, "msr0x%x: %016llX\n", 368 outp += sprintf(outp, "msr0x%x: %016llX\n",
329 extra_delta_offset64, t->extra_delta64); 369 extra_delta_offset64, t->extra_delta64);
330 fprintf(stderr, "msr0x%x: %08llX\n", 370 outp += sprintf(outp, "msr0x%x: %08llX\n",
331 extra_msr_offset32, t->extra_msr32); 371 extra_msr_offset32, t->extra_msr32);
332 fprintf(stderr, "msr0x%x: %016llX\n", 372 outp += sprintf(outp, "msr0x%x: %016llX\n",
333 extra_msr_offset64, t->extra_msr64); 373 extra_msr_offset64, t->extra_msr64);
334 if (do_smi) 374 if (do_smi)
335 fprintf(stderr, "SMI: %08X\n", t->smi_count); 375 outp += sprintf(outp, "SMI: %08X\n", t->smi_count);
336 } 376 }
337 377
338 if (c) { 378 if (c) {
339 fprintf(stderr, "core: %d\n", c->core_id); 379 outp += sprintf(outp, "core: %d\n", c->core_id);
340 fprintf(stderr, "c3: %016llX\n", c->c3); 380 outp += sprintf(outp, "c3: %016llX\n", c->c3);
341 fprintf(stderr, "c6: %016llX\n", c->c6); 381 outp += sprintf(outp, "c6: %016llX\n", c->c6);
342 fprintf(stderr, "c7: %016llX\n", c->c7); 382 outp += sprintf(outp, "c7: %016llX\n", c->c7);
343 fprintf(stderr, "DTS: %dC\n", c->core_temp_c); 383 outp += sprintf(outp, "DTS: %dC\n", c->core_temp_c);
344 } 384 }
345 385
346 if (p) { 386 if (p) {
347 fprintf(stderr, "package: %d\n", p->package_id); 387 outp += sprintf(outp, "package: %d\n", p->package_id);
348 fprintf(stderr, "pc2: %016llX\n", p->pc2); 388 outp += sprintf(outp, "pc2: %016llX\n", p->pc2);
349 fprintf(stderr, "pc3: %016llX\n", p->pc3); 389 outp += sprintf(outp, "pc3: %016llX\n", p->pc3);
350 fprintf(stderr, "pc6: %016llX\n", p->pc6); 390 outp += sprintf(outp, "pc6: %016llX\n", p->pc6);
351 fprintf(stderr, "pc7: %016llX\n", p->pc7); 391 outp += sprintf(outp, "pc7: %016llX\n", p->pc7);
352 fprintf(stderr, "pc8: %016llX\n", p->pc8); 392 outp += sprintf(outp, "pc8: %016llX\n", p->pc8);
353 fprintf(stderr, "pc9: %016llX\n", p->pc9); 393 outp += sprintf(outp, "pc9: %016llX\n", p->pc9);
354 fprintf(stderr, "pc10: %016llX\n", p->pc10); 394 outp += sprintf(outp, "pc10: %016llX\n", p->pc10);
355 fprintf(stderr, "Joules PKG: %0X\n", p->energy_pkg); 395 outp += sprintf(outp, "Joules PKG: %0X\n", p->energy_pkg);
356 fprintf(stderr, "Joules COR: %0X\n", p->energy_cores); 396 outp += sprintf(outp, "Joules COR: %0X\n", p->energy_cores);
357 fprintf(stderr, "Joules GFX: %0X\n", p->energy_gfx); 397 outp += sprintf(outp, "Joules GFX: %0X\n", p->energy_gfx);
358 fprintf(stderr, "Joules RAM: %0X\n", p->energy_dram); 398 outp += sprintf(outp, "Joules RAM: %0X\n", p->energy_dram);
359 fprintf(stderr, "Throttle PKG: %0X\n", p->rapl_pkg_perf_status); 399 outp += sprintf(outp, "Throttle PKG: %0X\n",
360 fprintf(stderr, "Throttle RAM: %0X\n", p->rapl_dram_perf_status); 400 p->rapl_pkg_perf_status);
361 fprintf(stderr, "PTM: %dC\n", p->pkg_temp_c); 401 outp += sprintf(outp, "Throttle RAM: %0X\n",
402 p->rapl_dram_perf_status);
403 outp += sprintf(outp, "PTM: %dC\n", p->pkg_temp_c);
362 } 404 }
405
406 outp += sprintf(outp, "\n");
407
363 return 0; 408 return 0;
364} 409}
365 410
@@ -527,19 +572,39 @@ int format_counters(struct thread_data *t, struct core_data *c,
527 fmt6 = " %4.0f**"; 572 fmt6 = " %4.0f**";
528 } 573 }
529 574
530 if (do_rapl & RAPL_PKG) 575 if (do_rapl && !rapl_joules) {
531 outp += sprintf(outp, fmt6, p->energy_pkg * rapl_energy_units / interval_float); 576 if (do_rapl & RAPL_PKG)
532 if (do_rapl & RAPL_CORES) 577 outp += sprintf(outp, fmt6, p->energy_pkg * rapl_energy_units / interval_float);
533 outp += sprintf(outp, fmt6, p->energy_cores * rapl_energy_units / interval_float); 578 if (do_rapl & RAPL_CORES)
534 if (do_rapl & RAPL_GFX) 579 outp += sprintf(outp, fmt6, p->energy_cores * rapl_energy_units / interval_float);
535 outp += sprintf(outp, fmt5, p->energy_gfx * rapl_energy_units / interval_float); 580 if (do_rapl & RAPL_GFX)
536 if (do_rapl & RAPL_DRAM) 581 outp += sprintf(outp, fmt5, p->energy_gfx * rapl_energy_units / interval_float);
537 outp += sprintf(outp, fmt5, p->energy_dram * rapl_energy_units / interval_float); 582 if (do_rapl & RAPL_DRAM)
538 if (do_rapl & RAPL_PKG_PERF_STATUS ) 583 outp += sprintf(outp, fmt5, p->energy_dram * rapl_energy_units / interval_float);
539 outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 584 if (do_rapl & RAPL_PKG_PERF_STATUS)
540 if (do_rapl & RAPL_DRAM_PERF_STATUS ) 585 outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
541 outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); 586 if (do_rapl & RAPL_DRAM_PERF_STATUS)
587 outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
588 } else {
589 if (do_rapl & RAPL_PKG)
590 outp += sprintf(outp, fmt6,
591 p->energy_pkg * rapl_energy_units);
592 if (do_rapl & RAPL_CORES)
593 outp += sprintf(outp, fmt6,
594 p->energy_cores * rapl_energy_units);
595 if (do_rapl & RAPL_GFX)
596 outp += sprintf(outp, fmt5,
597 p->energy_gfx * rapl_energy_units);
598 if (do_rapl & RAPL_DRAM)
599 outp += sprintf(outp, fmt5,
600 p->energy_dram * rapl_energy_units);
601 if (do_rapl & RAPL_PKG_PERF_STATUS)
602 outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
603 if (do_rapl & RAPL_DRAM_PERF_STATUS)
604 outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
605 outp += sprintf(outp, fmt5, interval_float);
542 606
607 }
543done: 608done:
544 outp += sprintf(outp, "\n"); 609 outp += sprintf(outp, "\n");
545 610
@@ -622,12 +687,10 @@ delta_thread(struct thread_data *new, struct thread_data *old,
622 old->tsc = new->tsc - old->tsc; 687 old->tsc = new->tsc - old->tsc;
623 688
624 /* check for TSC < 1 Mcycles over interval */ 689 /* check for TSC < 1 Mcycles over interval */
625 if (old->tsc < (1000 * 1000)) { 690 if (old->tsc < (1000 * 1000))
626 fprintf(stderr, "Insanely slow TSC rate, TSC stops in idle?\n"); 691 errx(-3, "Insanely slow TSC rate, TSC stops in idle?\n"
627 fprintf(stderr, "You can disable all c-states by booting with \"idle=poll\"\n"); 692 "You can disable all c-states by booting with \"idle=poll\"\n"
628 fprintf(stderr, "or just the deep ones with \"processor.max_cstate=1\"\n"); 693 "or just the deep ones with \"processor.max_cstate=1\"");
629 exit(-3);
630 }
631 694
632 old->c1 = new->c1 - old->c1; 695 old->c1 = new->c1 - old->c1;
633 696
@@ -1173,24 +1236,43 @@ void free_all_buffers(void)
1173} 1236}
1174 1237
1175/* 1238/*
1239 * Open a file, and exit on failure
1240 */
1241FILE *fopen_or_die(const char *path, const char *mode)
1242{
1243 FILE *filep = fopen(path, "r");
1244 if (!filep)
1245 err(1, "%s: open failed", path);
1246 return filep;
1247}
1248
1249/*
1250 * Parse a file containing a single int.
1251 */
1252int parse_int_file(const char *fmt, ...)
1253{
1254 va_list args;
1255 char path[PATH_MAX];
1256 FILE *filep;
1257 int value;
1258
1259 va_start(args, fmt);
1260 vsnprintf(path, sizeof(path), fmt, args);
1261 va_end(args);
1262 filep = fopen_or_die(path, "r");
1263 if (fscanf(filep, "%d", &value) != 1)
1264 err(1, "%s: failed to parse number from file", path);
1265 fclose(filep);
1266 return value;
1267}
1268
1269/*
1176 * cpu_is_first_sibling_in_core(cpu) 1270 * cpu_is_first_sibling_in_core(cpu)
1177 * return 1 if given CPU is 1st HT sibling in the core 1271 * return 1 if given CPU is 1st HT sibling in the core
1178 */ 1272 */
1179int cpu_is_first_sibling_in_core(int cpu) 1273int cpu_is_first_sibling_in_core(int cpu)
1180{ 1274{
1181 char path[64]; 1275 return cpu == parse_int_file("/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
1182 FILE *filep;
1183 int first_cpu;
1184
1185 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
1186 filep = fopen(path, "r");
1187 if (filep == NULL) {
1188 perror(path);
1189 exit(1);
1190 }
1191 fscanf(filep, "%d", &first_cpu);
1192 fclose(filep);
1193 return (cpu == first_cpu);
1194} 1276}
1195 1277
1196/* 1278/*
@@ -1199,53 +1281,17 @@ int cpu_is_first_sibling_in_core(int cpu)
1199 */ 1281 */
1200int cpu_is_first_core_in_package(int cpu) 1282int cpu_is_first_core_in_package(int cpu)
1201{ 1283{
1202 char path[64]; 1284 return cpu == parse_int_file("/sys/devices/system/cpu/cpu%d/topology/core_siblings_list", cpu);
1203 FILE *filep;
1204 int first_cpu;
1205
1206 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/core_siblings_list", cpu);
1207 filep = fopen(path, "r");
1208 if (filep == NULL) {
1209 perror(path);
1210 exit(1);
1211 }
1212 fscanf(filep, "%d", &first_cpu);
1213 fclose(filep);
1214 return (cpu == first_cpu);
1215} 1285}
1216 1286
1217int get_physical_package_id(int cpu) 1287int get_physical_package_id(int cpu)
1218{ 1288{
1219 char path[80]; 1289 return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/physical_package_id", cpu);
1220 FILE *filep;
1221 int pkg;
1222
1223 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/physical_package_id", cpu);
1224 filep = fopen(path, "r");
1225 if (filep == NULL) {
1226 perror(path);
1227 exit(1);
1228 }
1229 fscanf(filep, "%d", &pkg);
1230 fclose(filep);
1231 return pkg;
1232} 1290}
1233 1291
1234int get_core_id(int cpu) 1292int get_core_id(int cpu)
1235{ 1293{
1236 char path[80]; 1294 return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/core_id", cpu);
1237 FILE *filep;
1238 int core;
1239
1240 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/core_id", cpu);
1241 filep = fopen(path, "r");
1242 if (filep == NULL) {
1243 perror(path);
1244 exit(1);
1245 }
1246 fscanf(filep, "%d", &core);
1247 fclose(filep);
1248 return core;
1249} 1295}
1250 1296
1251int get_num_ht_siblings(int cpu) 1297int get_num_ht_siblings(int cpu)
@@ -1257,11 +1303,7 @@ int get_num_ht_siblings(int cpu)
1257 char character; 1303 char character;
1258 1304
1259 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu); 1305 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
1260 filep = fopen(path, "r"); 1306 filep = fopen_or_die(path, "r");
1261 if (filep == NULL) {
1262 perror(path);
1263 exit(1);
1264 }
1265 /* 1307 /*
1266 * file format: 1308 * file format:
1267 * if a pair of number with a character between: 2 siblings (eg. 1-2, or 1,4) 1309 * if a pair of number with a character between: 2 siblings (eg. 1-2, or 1,4)
@@ -1331,17 +1373,11 @@ int for_all_proc_cpus(int (func)(int))
1331 int cpu_num; 1373 int cpu_num;
1332 int retval; 1374 int retval;
1333 1375
1334 fp = fopen(proc_stat, "r"); 1376 fp = fopen_or_die(proc_stat, "r");
1335 if (fp == NULL) {
1336 perror(proc_stat);
1337 exit(1);
1338 }
1339 1377
1340 retval = fscanf(fp, "cpu %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d\n"); 1378 retval = fscanf(fp, "cpu %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d\n");
1341 if (retval != 0) { 1379 if (retval != 0)
1342 perror("/proc/stat format"); 1380 err(1, "%s: failed to parse format", proc_stat);
1343 exit(1);
1344 }
1345 1381
1346 while (1) { 1382 while (1) {
1347 retval = fscanf(fp, "cpu%u %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d\n", &cpu_num); 1383 retval = fscanf(fp, "cpu%u %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d\n", &cpu_num);
@@ -1445,19 +1481,15 @@ void check_dev_msr()
1445{ 1481{
1446 struct stat sb; 1482 struct stat sb;
1447 1483
1448 if (stat("/dev/cpu/0/msr", &sb)) { 1484 if (stat("/dev/cpu/0/msr", &sb))
1449 fprintf(stderr, "no /dev/cpu/0/msr\n"); 1485 err(-5, "no /dev/cpu/0/msr\n"
1450 fprintf(stderr, "Try \"# modprobe msr\"\n"); 1486 "Try \"# modprobe msr\"");
1451 exit(-5);
1452 }
1453} 1487}
1454 1488
1455void check_super_user() 1489void check_super_user()
1456{ 1490{
1457 if (getuid() != 0) { 1491 if (getuid() != 0)
1458 fprintf(stderr, "must be root\n"); 1492 errx(-6, "must be root");
1459 exit(-6);
1460 }
1461} 1493}
1462 1494
1463int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model) 1495int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)
@@ -1479,7 +1511,7 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)
1479 case 0x3A: /* IVB */ 1511 case 0x3A: /* IVB */
1480 case 0x3E: /* IVB Xeon */ 1512 case 0x3E: /* IVB Xeon */
1481 case 0x3C: /* HSW */ 1513 case 0x3C: /* HSW */
1482 case 0x3F: /* HSW */ 1514 case 0x3F: /* HSX */
1483 case 0x45: /* HSW */ 1515 case 0x45: /* HSW */
1484 case 0x46: /* HSW */ 1516 case 0x46: /* HSW */
1485 case 0x37: /* BYT */ 1517 case 0x37: /* BYT */
@@ -1595,11 +1627,13 @@ void rapl_probe(unsigned int family, unsigned int model)
1595 case 0x2A: 1627 case 0x2A:
1596 case 0x3A: 1628 case 0x3A:
1597 case 0x3C: /* HSW */ 1629 case 0x3C: /* HSW */
1598 case 0x3F: /* HSW */
1599 case 0x45: /* HSW */ 1630 case 0x45: /* HSW */
1600 case 0x46: /* HSW */ 1631 case 0x46: /* HSW */
1601 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO; 1632 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO;
1602 break; 1633 break;
1634 case 0x3F: /* HSX */
1635 do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
1636 break;
1603 case 0x2D: 1637 case 0x2D:
1604 case 0x3E: 1638 case 0x3E:
1605 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS | RAPL_PKG_POWER_INFO; 1639 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS | RAPL_PKG_POWER_INFO;
@@ -1978,7 +2012,7 @@ void check_cpuid()
1978 2012
1979 eax = ebx = ecx = edx = 0; 2013 eax = ebx = ecx = edx = 0;
1980 2014
1981 asm("cpuid" : "=a" (max_level), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0)); 2015 __get_cpuid(0, &max_level, &ebx, &ecx, &edx);
1982 2016
1983 if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) 2017 if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e)
1984 genuine_intel = 1; 2018 genuine_intel = 1;
@@ -1987,7 +2021,7 @@ void check_cpuid()
1987 fprintf(stderr, "CPUID(0): %.4s%.4s%.4s ", 2021 fprintf(stderr, "CPUID(0): %.4s%.4s%.4s ",
1988 (char *)&ebx, (char *)&edx, (char *)&ecx); 2022 (char *)&ebx, (char *)&edx, (char *)&ecx);
1989 2023
1990 asm("cpuid" : "=a" (fms), "=c" (ecx), "=d" (edx) : "a" (1) : "ebx"); 2024 __get_cpuid(1, &fms, &ebx, &ecx, &edx);
1991 family = (fms >> 8) & 0xf; 2025 family = (fms >> 8) & 0xf;
1992 model = (fms >> 4) & 0xf; 2026 model = (fms >> 4) & 0xf;
1993 stepping = fms & 0xf; 2027 stepping = fms & 0xf;
@@ -1998,10 +2032,8 @@ void check_cpuid()
1998 fprintf(stderr, "%d CPUID levels; family:model:stepping 0x%x:%x:%x (%d:%d:%d)\n", 2032 fprintf(stderr, "%d CPUID levels; family:model:stepping 0x%x:%x:%x (%d:%d:%d)\n",
1999 max_level, family, model, stepping, family, model, stepping); 2033 max_level, family, model, stepping, family, model, stepping);
2000 2034
2001 if (!(edx & (1 << 5))) { 2035 if (!(edx & (1 << 5)))
2002 fprintf(stderr, "CPUID: no MSR\n"); 2036 errx(1, "CPUID: no MSR");
2003 exit(1);
2004 }
2005 2037
2006 /* 2038 /*
2007 * check max extended function levels of CPUID. 2039 * check max extended function levels of CPUID.
@@ -2009,31 +2041,27 @@ void check_cpuid()
2009 * This check is valid for both Intel and AMD. 2041 * This check is valid for both Intel and AMD.
2010 */ 2042 */
2011 ebx = ecx = edx = 0; 2043 ebx = ecx = edx = 0;
2012 asm("cpuid" : "=a" (max_level), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x80000000)); 2044 __get_cpuid(0x80000000, &max_level, &ebx, &ecx, &edx);
2013 2045
2014 if (max_level < 0x80000007) { 2046 if (max_level < 0x80000007)
2015 fprintf(stderr, "CPUID: no invariant TSC (max_level 0x%x)\n", max_level); 2047 errx(1, "CPUID: no invariant TSC (max_level 0x%x)", max_level);
2016 exit(1);
2017 }
2018 2048
2019 /* 2049 /*
2020 * Non-Stop TSC is advertised by CPUID.EAX=0x80000007: EDX.bit8 2050 * Non-Stop TSC is advertised by CPUID.EAX=0x80000007: EDX.bit8
2021 * this check is valid for both Intel and AMD 2051 * this check is valid for both Intel and AMD
2022 */ 2052 */
2023 asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x80000007)); 2053 __get_cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
2024 has_invariant_tsc = edx & (1 << 8); 2054 has_invariant_tsc = edx & (1 << 8);
2025 2055
2026 if (!has_invariant_tsc) { 2056 if (!has_invariant_tsc)
2027 fprintf(stderr, "No invariant TSC\n"); 2057 errx(1, "No invariant TSC");
2028 exit(1);
2029 }
2030 2058
2031 /* 2059 /*
2032 * APERF/MPERF is advertised by CPUID.EAX=0x6: ECX.bit0 2060 * APERF/MPERF is advertised by CPUID.EAX=0x6: ECX.bit0
2033 * this check is valid for both Intel and AMD 2061 * this check is valid for both Intel and AMD
2034 */ 2062 */
2035 2063
2036 asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x6)); 2064 __get_cpuid(0x6, &eax, &ebx, &ecx, &edx);
2037 has_aperf = ecx & (1 << 0); 2065 has_aperf = ecx & (1 << 0);
2038 do_dts = eax & (1 << 0); 2066 do_dts = eax & (1 << 0);
2039 do_ptm = eax & (1 << 6); 2067 do_ptm = eax & (1 << 6);
@@ -2047,7 +2075,7 @@ void check_cpuid()
2047 has_epb ? ", EPB": ""); 2075 has_epb ? ", EPB": "");
2048 2076
2049 if (!has_aperf) 2077 if (!has_aperf)
2050 exit(-1); 2078 errx(-1, "No APERF");
2051 2079
2052 do_nehalem_platform_info = genuine_intel && has_invariant_tsc; 2080 do_nehalem_platform_info = genuine_intel && has_invariant_tsc;
2053 do_nhm_cstates = genuine_intel; /* all Intel w/ non-stop TSC have NHM counters */ 2081 do_nhm_cstates = genuine_intel; /* all Intel w/ non-stop TSC have NHM counters */
@@ -2067,9 +2095,8 @@ void check_cpuid()
2067 2095
2068void usage() 2096void usage()
2069{ 2097{
2070 fprintf(stderr, "%s: [-v][-R][-T][-p|-P|-S][-c MSR# | -s]][-C MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n", 2098 errx(1, "%s: [-v][-R][-T][-p|-P|-S][-c MSR#][-C MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n",
2071 progname); 2099 progname);
2072 exit(1);
2073} 2100}
2074 2101
2075 2102
@@ -2112,19 +2139,15 @@ void topology_probe()
2112 fprintf(stderr, "num_cpus %d max_cpu_num %d\n", topo.num_cpus, topo.max_cpu_num); 2139 fprintf(stderr, "num_cpus %d max_cpu_num %d\n", topo.num_cpus, topo.max_cpu_num);
2113 2140
2114 cpus = calloc(1, (topo.max_cpu_num + 1) * sizeof(struct cpu_topology)); 2141 cpus = calloc(1, (topo.max_cpu_num + 1) * sizeof(struct cpu_topology));
2115 if (cpus == NULL) { 2142 if (cpus == NULL)
2116 perror("calloc cpus"); 2143 err(1, "calloc cpus");
2117 exit(1);
2118 }
2119 2144
2120 /* 2145 /*
2121 * Allocate and initialize cpu_present_set 2146 * Allocate and initialize cpu_present_set
2122 */ 2147 */
2123 cpu_present_set = CPU_ALLOC((topo.max_cpu_num + 1)); 2148 cpu_present_set = CPU_ALLOC((topo.max_cpu_num + 1));
2124 if (cpu_present_set == NULL) { 2149 if (cpu_present_set == NULL)
2125 perror("CPU_ALLOC"); 2150 err(3, "CPU_ALLOC");
2126 exit(3);
2127 }
2128 cpu_present_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1)); 2151 cpu_present_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1));
2129 CPU_ZERO_S(cpu_present_setsize, cpu_present_set); 2152 CPU_ZERO_S(cpu_present_setsize, cpu_present_set);
2130 for_all_proc_cpus(mark_cpu_present); 2153 for_all_proc_cpus(mark_cpu_present);
@@ -2133,10 +2156,8 @@ void topology_probe()
2133 * Allocate and initialize cpu_affinity_set 2156 * Allocate and initialize cpu_affinity_set
2134 */ 2157 */
2135 cpu_affinity_set = CPU_ALLOC((topo.max_cpu_num + 1)); 2158 cpu_affinity_set = CPU_ALLOC((topo.max_cpu_num + 1));
2136 if (cpu_affinity_set == NULL) { 2159 if (cpu_affinity_set == NULL)
2137 perror("CPU_ALLOC"); 2160 err(3, "CPU_ALLOC");
2138 exit(3);
2139 }
2140 cpu_affinity_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1)); 2161 cpu_affinity_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1));
2141 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set); 2162 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set);
2142 2163
@@ -2220,8 +2241,7 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data
2220 2241
2221 return; 2242 return;
2222error: 2243error:
2223 perror("calloc counters"); 2244 err(1, "calloc counters");
2224 exit(1);
2225} 2245}
2226/* 2246/*
2227 * init_counter() 2247 * init_counter()
@@ -2276,12 +2296,10 @@ int initialize_counters(int cpu_id)
2276 2296
2277void allocate_output_buffer() 2297void allocate_output_buffer()
2278{ 2298{
2279 output_buffer = calloc(1, (1 + topo.num_cpus) * 256); 2299 output_buffer = calloc(1, (1 + topo.num_cpus) * 1024);
2280 outp = output_buffer; 2300 outp = output_buffer;
2281 if (outp == NULL) { 2301 if (outp == NULL)
2282 perror("calloc"); 2302 err(-1, "calloc output buffer");
2283 exit(-1);
2284 }
2285} 2303}
2286 2304
2287void setup_all_buffers(void) 2305void setup_all_buffers(void)
@@ -2292,6 +2310,7 @@ void setup_all_buffers(void)
2292 allocate_output_buffer(); 2310 allocate_output_buffer();
2293 for_all_proc_cpus(initialize_counters); 2311 for_all_proc_cpus(initialize_counters);
2294} 2312}
2313
2295void turbostat_init() 2314void turbostat_init()
2296{ 2315{
2297 check_cpuid(); 2316 check_cpuid();
@@ -2335,17 +2354,13 @@ int fork_it(char **argv)
2335 } else { 2354 } else {
2336 2355
2337 /* parent */ 2356 /* parent */
2338 if (child_pid == -1) { 2357 if (child_pid == -1)
2339 perror("fork"); 2358 err(1, "fork");
2340 exit(1);
2341 }
2342 2359
2343 signal(SIGINT, SIG_IGN); 2360 signal(SIGINT, SIG_IGN);
2344 signal(SIGQUIT, SIG_IGN); 2361 signal(SIGQUIT, SIG_IGN);
2345 if (waitpid(child_pid, &status, 0) == -1) { 2362 if (waitpid(child_pid, &status, 0) == -1)
2346 perror("wait"); 2363 err(status, "waitpid");
2347 exit(status);
2348 }
2349 } 2364 }
2350 /* 2365 /*
2351 * n.b. fork_it() does not check for errors from for_all_cpus() 2366 * n.b. fork_it() does not check for errors from for_all_cpus()
@@ -2364,13 +2379,30 @@ int fork_it(char **argv)
2364 return status; 2379 return status;
2365} 2380}
2366 2381
2382int get_and_dump_counters(void)
2383{
2384 int status;
2385
2386 status = for_all_cpus(get_counters, ODD_COUNTERS);
2387 if (status)
2388 return status;
2389
2390 status = for_all_cpus(dump_counters, ODD_COUNTERS);
2391 if (status)
2392 return status;
2393
2394 flush_stdout();
2395
2396 return status;
2397}
2398
2367void cmdline(int argc, char **argv) 2399void cmdline(int argc, char **argv)
2368{ 2400{
2369 int opt; 2401 int opt;
2370 2402
2371 progname = argv[0]; 2403 progname = argv[0];
2372 2404
2373 while ((opt = getopt(argc, argv, "+pPSvi:sc:sC:m:M:RT:")) != -1) { 2405 while ((opt = getopt(argc, argv, "+pPsSvi:c:C:m:M:RJT:")) != -1) {
2374 switch (opt) { 2406 switch (opt) {
2375 case 'p': 2407 case 'p':
2376 show_core_only++; 2408 show_core_only++;
@@ -2378,6 +2410,9 @@ void cmdline(int argc, char **argv)
2378 case 'P': 2410 case 'P':
2379 show_pkg_only++; 2411 show_pkg_only++;
2380 break; 2412 break;
2413 case 's':
2414 dump_only++;
2415 break;
2381 case 'S': 2416 case 'S':
2382 summary_only++; 2417 summary_only++;
2383 break; 2418 break;
@@ -2405,6 +2440,10 @@ void cmdline(int argc, char **argv)
2405 case 'T': 2440 case 'T':
2406 tcc_activation_temp_override = atoi(optarg); 2441 tcc_activation_temp_override = atoi(optarg);
2407 break; 2442 break;
2443 case 'J':
2444 rapl_joules++;
2445 break;
2446
2408 default: 2447 default:
2409 usage(); 2448 usage();
2410 } 2449 }
@@ -2416,11 +2455,15 @@ int main(int argc, char **argv)
2416 cmdline(argc, argv); 2455 cmdline(argc, argv);
2417 2456
2418 if (verbose) 2457 if (verbose)
2419 fprintf(stderr, "turbostat v3.5 April 26, 2013" 2458 fprintf(stderr, "turbostat v3.6 Dec 2, 2013"
2420 " - Len Brown <lenb@kernel.org>\n"); 2459 " - Len Brown <lenb@kernel.org>\n");
2421 2460
2422 turbostat_init(); 2461 turbostat_init();
2423 2462
2463 /* dump counters and exit */
2464 if (dump_only)
2465 return get_and_dump_counters();
2466
2424 /* 2467 /*
2425 * if any params left, it must be a command to fork 2468 * if any params left, it must be a command to fork
2426 */ 2469 */