[kernel/f20] Linux v3.12.5 rebase

Justin M. Forbes jforbes at fedoraproject.org
Fri Dec 13 17:39:13 UTC 2013


commit 4c74055fdc4dda76c83c6d145a8f9aea9210886c
Author: Justin M. Forbes <jforbes at redhat.com>
Date:   Fri Dec 13 11:39:13 2013 -0600

    Linux v3.12.5 rebase

 ...fragment-outgoing-reassembled-skb-properl.patch |   39 -
 ...-t-WARN-on-host-commands-sent-when-firmwa.patch |   35 -
 ...ush-reasm-skb-through-instead-of-original.patch |  499 ----
 ...l-back-to-vmalloc-for-client-event-buffer.patch |   64 -
 KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch      |   53 -
 alps-Support-for-Dell-XT2-model.patch              |   25 -
 am335x-bone.patch                                  | 2580 -----------------
 arm-am33xx-arm-soc-upstream.patch                  | 2468 ++++++++++++++++
 arm-am33xx-bblack.patch                            |  610 ++++
 arm-am33xx-cpsw.patch                              |   23 +
 arm-exynos-mp.patch                                |  439 ---
 arm-highbank-for-3.12.patch                        |  200 --
 arm-imx6-utilite.patch                             |   95 +
 arm-omap-load-tfp410.patch                         |   28 +-
 arm-wandboard-quad.patch                           |   58 -
 bonding-driver-alb-learning.patch                  |  155 -
 ...NMAN-auth-for-unencapsulated-auth-methods.patch |   39 -
 config-arm-generic                                 |   33 +-
 config-arm64                                       |   33 +-
 config-armv7                                       |  122 +-
 config-armv7-generic                               |   70 +-
 config-armv7-lpae                                  |   36 +-
 config-generic                                     |  203 ++-
 config-no-extra                                    |   27 +
 config-powerpc-generic                             |    3 +-
 config-powerpc64                                   |    4 +-
 config-powerpc64p7                                 |    2 +
 config-s390x                                       |    5 +-
 config-x86-generic                                 |   11 +-
 config-x86_64-generic                              |    4 +-
 debug-bad-pte-modules.patch                        |   34 -
 drm-i915-hush-check-crtc-state.patch               |   20 -
 drm-intel-next.patch                               |    1 -
 drm-qxl-backport-fixes-for-Fedora.patch            |   13 -
 ...-fix-memory-leak-in-release-list-handling.patch |   30 -
 drm-radeon-24hz-audio-fixes.patch                  |  173 --
 ...r-Fix-a-race-in-elevator-switching-and-md.patch |  162 --
 ...r-acquire-q-sysfs_lock-in-elevator_change.patch |  121 -
 fix-child-thread-introspection.patch               |   76 -
 fix-radeon-sound.patch                             |  154 -
 ...gnment-in-recv_error-and-rxpmtu-functions.patch |  253 --
 ...t-leakage-of-uninitialized-memory-to-user.patch |  256 --
 ...k-trace-from-broken-irq-remapping-warning.patch |   47 -
 ...headroom-calculation-in-udp6_ufo_fragment.patch |   43 -
 iwl3945-better-skb-management-in-rx-path.patch     |   97 -
 iwl4965-better-skb-management-in-rx-path.patch     |   65 -
 ...-dvm-dont-override-mac80211-queue-setting.patch |   98 -
 kernel.spec                                        |  248 +--
 keys-krb-support.patch                             |   33 +-
 keys-x509-improv.patch                             | 2978 +++++++++++---------
 ...1-regression-since-introduction-of-ts2020.patch |   30 -
 modsign-uefi.patch                                 |    4 +-
 ...recvmsg-handler-msg_name-and-msg_namelen-.patch |  774 -----
 ...f_conntrack-use-RCU-safe-kfree-for-conntr.patch |   35 -
 ntp-Make-periodic-RTC-update-more-reliable.patch   |   44 -
 rt2800-add-support-for-rf3070.patch                |   80 -
 rt2800usb-slow-down-TX-status-polling.patch        |   53 -
 silence-noise.patch                                |   20 +-
 ...mon-Do-not-check-for-duplicate-slab-names.patch |   71 -
 sources                                            |    4 +-
 ...ace-gssd_running-with-more-reliable-check.patch |   45 +-
 taint-vbox.patch                                   |   15 -
 usbnet-fix-status-interrupt-urb-handling.patch     |   37 -
 ...u-Fixed-interaction-of-VFIO_IOMMU_MAP_DMA.patch |   39 -
 ...-fix-netif_receive_skb-use-in-irq-disable.patch |  121 -
 vmbugon-warnon.patch                               |   20 -
 x86-allow-1024-cpus.patch                          |   13 +
 67 files changed, 5292 insertions(+), 8978 deletions(-)
---
diff --git a/arm-am33xx-arm-soc-upstream.patch b/arm-am33xx-arm-soc-upstream.patch
new file mode 100644
index 0000000..3129c1a
--- /dev/null
+++ b/arm-am33xx-arm-soc-upstream.patch
@@ -0,0 +1,2468 @@
+Bugzilla: 1012025
+Upstream-status: Landed in 3.13-rc1
+
+From 9096ef3ab805b2e9fda732f3128a761810c1dea4 Mon Sep 17 00:00:00 2001
+From: Alexandre Belloni <alexandre.belloni at free-electrons.com>
+Date: Sat, 3 Aug 2013 20:00:54 +0200
+Subject: [PATCH 01/15] ARM: dts: AM33XX: Add PMU support
+
+ARM Performance Monitor Units are available on the am33xx,
+add the support in the dtsi.
+
+Tested with perf and oprofile on a regular beaglebone.
+
+Signed-off-by: Alexandre Belloni <alexandre.belloni at free-electrons.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am33xx.dtsi | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index f9c5da9..4d1c632 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -57,6 +57,11 @@
+ 		};
+ 	};
+ 
++	pmu {
++		compatible = "arm,cortex-a8-pmu";
++		interrupts = <3>;
++	};
++
+ 	/*
+ 	 * The soc node represents the soc top level view. It is uses for IPs
+ 	 * that are not memory mapped in the MPU view or for the MPU itself.
+-- 
+1.8.4.rc3
+
+From 41bae5a6301ff1cd48fd0c4ff32146059b8e1b73 Mon Sep 17 00:00:00 2001
+From: Lars Poeschel <poeschel at lemonage.de>
+Date: Wed, 7 Aug 2013 13:06:32 +0200
+Subject: [PATCH 02/15] ARM: dts: AM33xx: Correct gpio #interrupt-cells
+ property
+
+Following commit ff5c9059 and therefore other omap platforms using
+the gpio-omap driver correct the #interrupt-cells property on am33xx
+too. The omap gpio binding documentaion also states that
+the #interrupt-cells property should be 2.
+
+Signed-off-by: Lars Poeschel <poeschel at lemonage.de>
+Reviewed-by: Javier Martinez Canillas <javier at dowhile0.org>
+Acked-by: Mark Rutland <mark.rutland at arm.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am33xx.dtsi | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index 4d1c632..a7731ea 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -111,7 +111,7 @@
+ 			gpio-controller;
+ 			#gpio-cells = <2>;
+ 			interrupt-controller;
+-			#interrupt-cells = <1>;
++			#interrupt-cells = <2>;
+ 			reg = <0x44e07000 0x1000>;
+ 			interrupts = <96>;
+ 		};
+@@ -122,7 +122,7 @@
+ 			gpio-controller;
+ 			#gpio-cells = <2>;
+ 			interrupt-controller;
+-			#interrupt-cells = <1>;
++			#interrupt-cells = <2>;
+ 			reg = <0x4804c000 0x1000>;
+ 			interrupts = <98>;
+ 		};
+@@ -133,7 +133,7 @@
+ 			gpio-controller;
+ 			#gpio-cells = <2>;
+ 			interrupt-controller;
+-			#interrupt-cells = <1>;
++			#interrupt-cells = <2>;
+ 			reg = <0x481ac000 0x1000>;
+ 			interrupts = <32>;
+ 		};
+@@ -144,7 +144,7 @@
+ 			gpio-controller;
+ 			#gpio-cells = <2>;
+ 			interrupt-controller;
+-			#interrupt-cells = <1>;
++			#interrupt-cells = <2>;
+ 			reg = <0x481ae000 0x1000>;
+ 			interrupts = <62>;
+ 		};
+-- 
+1.8.4.rc3
+
+From 200835d6072367d401cc6eb76b05fef2a2919291 Mon Sep 17 00:00:00 2001
+From: Matt Porter <mdp at ti.com>
+Date: Tue, 10 Sep 2013 14:24:37 -0500
+Subject: [PATCH 03/15] ARM: dts: AM33XX: Add EDMA support
+
+Adds AM33XX EDMA support to the am33xx.dtsi as documented in
+Documentation/devicetree/bindings/dma/ti-edma.txt
+
+[Joel Fernandes <joelf at ti.com>]
+Drop DT entries that are non-hardware-description as discussed in [1]
+
+[1] https://patchwork.kernel.org/patch/2226761/
+
+Signed-off-by: Matt Porter <mporter at ti.com>
+Signed-off-by: Joel A Fernandes <joelagnel at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am33xx.dtsi | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index a7731ea..7a53e07 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -105,6 +105,18 @@
+ 			reg = <0x48200000 0x1000>;
+ 		};
+ 
++		edma: edma at 49000000 {
++			compatible = "ti,edma3";
++			ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
++			reg =	<0x49000000 0x10000>,
++				<0x44e10f90 0x10>;
++			interrupts = <12 13 14>;
++			#dma-cells = <1>;
++			dma-channels = <64>;
++			ti,edma-regions = <4>;
++			ti,edma-slots = <256>;
++		};
++
+ 		gpio0: gpio at 44e07000 {
+ 			compatible = "ti,omap4-gpio";
+ 			ti,hwmods = "gpio1";
+-- 
+1.8.4.rc3
+
+From 62ca70c0e2dfc1a4e9225b801cd769fd92f6de7c Mon Sep 17 00:00:00 2001
+From: Matt Porter <mporter at ti.com>
+Date: Tue, 10 Sep 2013 14:24:38 -0500
+Subject: [PATCH 04/15] ARM: dts: AM33XX: Add SPI DMA support
+
+Adds DMA resources to the AM33XX SPI nodes.
+
+Signed-off-by: Matt Porter <mporter at ti.com>
+Signed-off-by: Joel A Fernandes <joelagnel at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am33xx.dtsi | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index 7a53e07..9cd60bf 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -340,6 +340,11 @@
+ 			interrupts = <65>;
+ 			ti,spi-num-cs = <2>;
+ 			ti,hwmods = "spi0";
++			dmas = <&edma 16
++				&edma 17
++				&edma 18
++				&edma 19>;
++			dma-names = "tx0", "rx0", "tx1", "rx1";
+ 			status = "disabled";
+ 		};
+ 
+@@ -351,6 +356,11 @@
+ 			interrupts = <125>;
+ 			ti,spi-num-cs = <2>;
+ 			ti,hwmods = "spi1";
++			dmas = <&edma 42
++				&edma 43
++				&edma 44
++				&edma 45>;
++			dma-names = "tx0", "rx0", "tx1", "rx1";
+ 			status = "disabled";
+ 		};
+ 
+-- 
+1.8.4.rc3
+
+From de80038efb2254fd72e77f848eb867fc193b5a74 Mon Sep 17 00:00:00 2001
+From: Matt Porter <mporter at ti.com>
+Date: Tue, 10 Sep 2013 14:24:39 -0500
+Subject: [PATCH 05/15] ARM: dts: AM33XX: Add MMC support and documentation
+
+Adds AM33XX MMC support for am335x-bone, am335x-evm and am335x-evmsk boards.
+
+Also added is the DMA binding definitions based on the generic DMA request
+binding.
+
+Additional changes made to DTS:
+* Interrupt, reg and compatible properties added
+* ti,needs-special-hs-handling added
+
+Signed-off-by: Matt Porter <mporter at ti.com>
+Acked-by: Tony Lindgren <tony at atomide.com>
+Signed-off-by: Joel Fernandes <joelf at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      | 26 ++++++++++++++-
+ arch/arm/boot/dts/am335x-bone.dts                  | 11 +++++++
+ arch/arm/boot/dts/am335x-evm.dts                   |  7 ++++
+ arch/arm/boot/dts/am335x-evmsk.dts                 |  7 ++++
+ arch/arm/boot/dts/am33xx.dtsi                      | 38 ++++++++++++++++++++++
+ 5 files changed, 88 insertions(+), 1 deletion(-)
+
+diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+index ed271fc..8c8908a 100644
+--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
++++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+@@ -20,8 +20,29 @@ ti,dual-volt: boolean, supports dual voltage cards
+ ti,non-removable: non-removable slot (like eMMC)
+ ti,needs-special-reset: Requires a special softreset sequence
+ ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High Speed
++dmas: List of DMA specifiers with the controller specific format
++as described in the generic DMA client binding. A tx and rx
++specifier is required.
++dma-names: List of DMA request names. These strings correspond
++1:1 with the DMA specifiers listed in dmas. The string naming is
++to be "rx" and "tx" for RX and TX DMA requests, respectively.
++
++Examples:
++
++[hwmod populated DMA resources]
++
++	mmc1: mmc at 0x4809c000 {
++		compatible = "ti,omap4-hsmmc";
++		reg = <0x4809c000 0x400>;
++		ti,hwmods = "mmc1";
++		ti,dual-volt;
++		bus-width = <4>;
++		vmmc-supply = <&vmmc>; /* phandle to regulator node */
++		ti,non-removable;
++	};
++
++[generic DMA request binding]
+ 
+-Example:
+ 	mmc1: mmc at 0x4809c000 {
+ 		compatible = "ti,omap4-hsmmc";
+ 		reg = <0x4809c000 0x400>;
+@@ -30,4 +51,7 @@ Example:
+ 		bus-width = <4>;
+ 		vmmc-supply = <&vmmc>; /* phandle to regulator node */
+ 		ti,non-removable;
++		dmas = <&edma 24
++			&edma 25>;
++		dma-names = "tx", "rx";
+ 	};
+diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
+index 7993c48..d5f43fe 100644
+--- a/arch/arm/boot/dts/am335x-bone.dts
++++ b/arch/arm/boot/dts/am335x-bone.dts
+@@ -9,3 +9,14 @@
+ 
+ #include "am33xx.dtsi"
+ #include "am335x-bone-common.dtsi"
++
++&ldo3_reg {
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-always-on;
++};
++
++&mmc1 {
++	status = "okay";
++	vmmc-supply = <&ldo3_reg>;
++};
+diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
+index e8ec875..bc4a69d 100644
+--- a/arch/arm/boot/dts/am335x-evm.dts
++++ b/arch/arm/boot/dts/am335x-evm.dts
+@@ -477,6 +477,8 @@
+ 		};
+ 
+ 		vmmc_reg: regulator at 12 {
++			regulator-min-microvolt = <1800000>;
++			regulator-max-microvolt = <3300000>;
+ 			regulator-always-on;
+ 		};
+ 	};
+@@ -517,3 +519,8 @@
+ 		ti,adc-channels = <4 5 6 7>;
+ 	};
+ };
++
++&mmc1 {
++	status = "okay";
++	vmmc-supply = <&vmmc_reg>;
++};
+diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
+index 4f339fa..55fd194 100644
+--- a/arch/arm/boot/dts/am335x-evmsk.dts
++++ b/arch/arm/boot/dts/am335x-evmsk.dts
+@@ -393,6 +393,8 @@
+ 		};
+ 
+ 		vmmc_reg: regulator at 12 {
++			regulator-min-microvolt = <1800000>;
++			regulator-max-microvolt = <3300000>;
+ 			regulator-always-on;
+ 		};
+ 	};
+@@ -419,3 +421,8 @@
+ 	phy_id = <&davinci_mdio>, <1>;
+ 	phy-mode = "rgmii-txid";
+ };
++
++&mmc1 {
++	status = "okay";
++	vmmc-supply = <&vmmc_reg>;
++};
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index 9cd60bf..553adc6 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -245,6 +245,44 @@
+ 			status = "disabled";
+ 		};
+ 
++		mmc1: mmc at 48060000 {
++			compatible = "ti,omap4-hsmmc";
++			ti,hwmods = "mmc1";
++			ti,dual-volt;
++			ti,needs-special-reset;
++			ti,needs-special-hs-handling;
++			dmas = <&edma 24
++				&edma 25>;
++			dma-names = "tx", "rx";
++			interrupts = <64>;
++			interrupt-parent = <&intc>;
++			reg = <0x48060000 0x1000>;
++			status = "disabled";
++		};
++
++		mmc2: mmc at 481d8000 {
++			compatible = "ti,omap4-hsmmc";
++			ti,hwmods = "mmc2";
++			ti,needs-special-reset;
++			dmas = <&edma 2
++				&edma 3>;
++			dma-names = "tx", "rx";
++			interrupts = <28>;
++			interrupt-parent = <&intc>;
++			reg = <0x481d8000 0x1000>;
++			status = "disabled";
++		};
++
++		mmc3: mmc at 47810000 {
++			compatible = "ti,omap4-hsmmc";
++			ti,hwmods = "mmc3";
++			ti,needs-special-reset;
++			interrupts = <29>;
++			interrupt-parent = <&intc>;
++			reg = <0x47810000 0x1000>;
++			status = "disabled";
++		};
++
+ 		wdt2: wdt at 44e35000 {
+ 			compatible = "ti,omap3-wdt";
+ 			ti,hwmods = "wd_timer2";
+-- 
+1.8.4.rc3
+
+From 889d5b18a88681d7d1e5a1d1b5d2ffda07c506df Mon Sep 17 00:00:00 2001
+From: Alexander Holler <holler at ahsoftware.de>
+Date: Thu, 12 Sep 2013 20:35:32 +0200
+Subject: [PATCH 06/15] ARM: dts: am335x-bone: add CD for mmc1
+
+This enables the use of MMC cards even when no card was inserted at boot.
+
+Signed-off-by: Alexander Holler <holler at ahsoftware.de>
+Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
+Tested-by: Kevin Hilman <khilman at linaro.org>
+Reviewed-by: Nishanth Menon <nm at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 14 ++++++++++++++
+ arch/arm/boot/dts/am335x-bone.dts         |  1 -
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index 2f66ded..0d95d54 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -107,6 +107,12 @@
+ 				0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+ 			>;
+ 		};
++
++		mmc1_pins: pinmux_mmc1_pins {
++			pinctrl-single,pins = <
++				0x160 (PIN_INPUT | MUX_MODE7) /* GPIO0_6 */
++			>;
++		};
+ 	};
+ 
+ 	ocp {
+@@ -260,3 +266,11 @@
+ 	pinctrl-0 = <&davinci_mdio_default>;
+ 	pinctrl-1 = <&davinci_mdio_sleep>;
+ };
++
++&mmc1 {
++	status = "okay";
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc1_pins>;
++	cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
++	cd-inverted;
++};
+diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
+index d5f43fe..0d63348 100644
+--- a/arch/arm/boot/dts/am335x-bone.dts
++++ b/arch/arm/boot/dts/am335x-bone.dts
+@@ -17,6 +17,5 @@
+ };
+ 
+ &mmc1 {
+-	status = "okay";
+ 	vmmc-supply = <&ldo3_reg>;
+ };
+-- 
+1.8.4.rc3
+
+From 7e60fa2391c2e89f07452c2037209235dee67aee Mon Sep 17 00:00:00 2001
+From: Koen Kooi <koen at dominion.thruhere.net>
+Date: Thu, 12 Sep 2013 20:35:33 +0200
+Subject: [PATCH 07/15] ARM: dts: am335x-boneblack: add eMMC DT entry
+
+The pinmux is specified in am335x-bone-common.dtsi to be
+reused by the eMMC cape.
+
+Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
+Tested-by: Kevin Hilman <khilman at linaro.org>
+Reviewed-by: Nishanth Menon <nm at ti.com>
+[bcousson at baylibre.com: Fix traling spaces and useless comments]
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 22 ++++++++++++++++++++++
+ arch/arm/boot/dts/am335x-boneblack.dts    | 13 +++++++++++++
+ 2 files changed, 35 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index 0d95d54..c560cb7 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -113,6 +113,21 @@
+ 				0x160 (PIN_INPUT | MUX_MODE7) /* GPIO0_6 */
+ 			>;
+ 		};
++
++		emmc_pins: pinmux_emmc_pins {
++			pinctrl-single,pins = <
++				0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
++				0x84 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_csn2.mmc1_cmd */
++				0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
++				0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
++				0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
++				0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
++				0x10 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
++				0x14 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
++				0x18 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
++				0x1c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
++			>;
++		};
+ 	};
+ 
+ 	ocp {
+@@ -242,6 +257,13 @@
+ 			regulator-always-on;
+ 		};
+ 	};
++
++	vmmcsd_fixed: fixedregulator at 0 {
++		compatible = "regulator-fixed";
++		regulator-name = "vmmcsd_fixed";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++	};
+ };
+ 
+ &cpsw_emac0 {
+diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
+index 197cadf..16b3bea 100644
+--- a/arch/arm/boot/dts/am335x-boneblack.dts
++++ b/arch/arm/boot/dts/am335x-boneblack.dts
+@@ -15,3 +15,16 @@
+ 	regulator-max-microvolt = <1800000>;
+ 	regulator-always-on;
+ };
++
++&mmc1 {
++	vmmc-supply = <&vmmcsd_fixed>;
++};
++
++&mmc2 {
++	vmmc-supply = <&vmmcsd_fixed>;
++	pinctrl-names = "default";
++	pinctrl-0 = <&emmc_pins>;
++	bus-width = <8>;
++	status = "okay";
++	ti,vcc-aux-disable-is-sleep;
++};
+-- 
+1.8.4.rc3
+
+From 2b3a35fea12469734e2216a06c7fea6d5cb0d4d8 Mon Sep 17 00:00:00 2001
+From: Koen Kooi <koen at dominion.thruhere.net>
+Date: Thu, 12 Sep 2013 20:35:34 +0200
+Subject: [PATCH 08/15] ARM: dts: am335x-bone-common: switch mmc1 to 4-bit mode
+
+The micro-SD slot hooks up all four data pins so lets' use them.
+
+Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
+Tested-by: Kevin Hilman <khilman at linaro.org>
+Reviewed-by: Nishanth Menon <nm at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index c560cb7..fbb11dd 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -291,6 +291,7 @@
+ 
+ &mmc1 {
+ 	status = "okay";
++	bus-width = <0x4>;
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&mmc1_pins>;
+ 	cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
+-- 
+1.8.4.rc3
+
+From 387d315741b4126f228ee788094f9a00ecf8fde0 Mon Sep 17 00:00:00 2001
+From: Koen Kooi <koen at dominion.thruhere.net>
+Date: Thu, 12 Sep 2013 20:35:35 +0200
+Subject: [PATCH 09/15] ARM: dts: am335x-bone-common: add cpu0 and mmc1
+ triggers
+
+This matches the vendor 3.8.x configuration that is shipping
+with the boards.
+
+The LED layout is now:
+ USR0: heartbeat
+ USR1: mmc0 (micro-SD slot)
+ USR2: cpu0
+ USR3: mmc1 (eMMC)
+
+The cpu0 triggers was put in between the mmc triggers to make
+is easier to see where the disk activity is.
+
+Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
+Tested-by: Kevin Hilman <khilman at linaro.org>
+Reviewed-by: Nishanth Menon <nm at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index fbb11dd..56361ce 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -204,12 +204,14 @@
+ 		led at 4 {
+ 			label = "beaglebone:green:usr2";
+ 			gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
++			linux,default-trigger = "cpu0";
+ 			default-state = "off";
+ 		};
+ 
+ 		led at 5 {
+ 			label = "beaglebone:green:usr3";
+ 			gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
++			linux,default-trigger = "mmc1";
+ 			default-state = "off";
+ 		};
+ 	};
+-- 
+1.8.4.rc3
+
+From 28d36734db6d9682208ced9032de9ebda568da96 Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javier.martinez at collabora.co.uk>
+Date: Fri, 20 Sep 2013 17:00:00 +0200
+Subject: [PATCH 10/15] ARM: dts: AM33XX: use pinmux node defined in included
+ file
+
+am33xx boards DTS include the am33xx.dtsi Device Tree
+source file that already define a pinmux device node for
+the AM33XX SoC Pin Multiplex.
+
+Redefining this for each board makes the Device Tree files
+harder to modify and maintain so let's just use what is
+already defined in the included .dtsi file.
+
+Signed-off-by: Javier Martinez Canillas <javier.martinez at collabora.co.uk>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 218 ++++++++++++-------------
+ arch/arm/boot/dts/am335x-evm.dts          | 254 ++++++++++++++---------------
+ arch/arm/boot/dts/am335x-evmsk.dts        | 258 +++++++++++++++---------------
+ 3 files changed, 365 insertions(+), 365 deletions(-)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index 56361ce..29799ac 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -21,115 +21,6 @@
+ 		reg = <0x80000000 0x10000000>; /* 256 MB */
+ 	};
+ 
+-	am33xx_pinmux: pinmux at 44e10800 {
+-		pinctrl-names = "default";
+-		pinctrl-0 = <&clkout2_pin>;
+-
+-		user_leds_s0: user_leds_s0 {
+-			pinctrl-single,pins = <
+-				0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a5.gpio1_21 */
+-				0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7)	/* gpmc_a6.gpio1_22 */
+-				0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a7.gpio1_23 */
+-				0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7)	/* gpmc_a8.gpio1_24 */
+-			>;
+-		};
+-
+-		i2c0_pins: pinmux_i2c0_pins {
+-			pinctrl-single,pins = <
+-				0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
+-				0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
+-			>;
+-		};
+-
+-		uart0_pins: pinmux_uart0_pins {
+-			pinctrl-single,pins = <
+-				0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
+-				0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
+-			>;
+-		};
+-
+-		clkout2_pin: pinmux_clkout2_pin {
+-			pinctrl-single,pins = <
+-				0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)	/* xdma_event_intr1.clkout2 */
+-			>;
+-		};
+-
+-		cpsw_default: cpsw_default {
+-			pinctrl-single,pins = <
+-				/* Slave 1 */
+-				0x110 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxerr.mii1_rxerr */
+-				0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txen.mii1_txen */
+-				0x118 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxdv.mii1_rxdv */
+-				0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd3.mii1_txd3 */
+-				0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd2.mii1_txd2 */
+-				0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd1.mii1_txd1 */
+-				0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd0.mii1_txd0 */
+-				0x12c (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_txclk.mii1_txclk */
+-				0x130 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxclk.mii1_rxclk */
+-				0x134 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd3.mii1_rxd3 */
+-				0x138 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd2.mii1_rxd2 */
+-				0x13c (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd1.mii1_rxd1 */
+-				0x140 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd0.mii1_rxd0 */
+-			>;
+-		};
+-
+-		cpsw_sleep: cpsw_sleep {
+-			pinctrl-single,pins = <
+-				/* Slave 1 reset value */
+-				0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-			>;
+-		};
+-
+-		davinci_mdio_default: davinci_mdio_default {
+-			pinctrl-single,pins = <
+-				/* MDIO */
+-				0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
+-				0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
+-			>;
+-		};
+-
+-		davinci_mdio_sleep: davinci_mdio_sleep {
+-			pinctrl-single,pins = <
+-				/* MDIO reset value */
+-				0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-			>;
+-		};
+-
+-		mmc1_pins: pinmux_mmc1_pins {
+-			pinctrl-single,pins = <
+-				0x160 (PIN_INPUT | MUX_MODE7) /* GPIO0_6 */
+-			>;
+-		};
+-
+-		emmc_pins: pinmux_emmc_pins {
+-			pinctrl-single,pins = <
+-				0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+-				0x84 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_csn2.mmc1_cmd */
+-				0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
+-				0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
+-				0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
+-				0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
+-				0x10 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
+-				0x14 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
+-				0x18 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
+-				0x1c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
+-			>;
+-		};
+-	};
+-
+ 	ocp {
+ 		uart0: serial at 44e09000 {
+ 			pinctrl-names = "default";
+@@ -217,6 +108,115 @@
+ 	};
+ };
+ 
++&am33xx_pinmux {
++	pinctrl-names = "default";
++	pinctrl-0 = <&clkout2_pin>;
++
++	user_leds_s0: user_leds_s0 {
++		pinctrl-single,pins = <
++			0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a5.gpio1_21 */
++			0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7)	/* gpmc_a6.gpio1_22 */
++			0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a7.gpio1_23 */
++			0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7)	/* gpmc_a8.gpio1_24 */
++		>;
++	};
++
++	i2c0_pins: pinmux_i2c0_pins {
++		pinctrl-single,pins = <
++			0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
++			0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
++		>;
++	};
++
++	uart0_pins: pinmux_uart0_pins {
++		pinctrl-single,pins = <
++			0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
++			0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
++		>;
++	};
++
++	clkout2_pin: pinmux_clkout2_pin {
++		pinctrl-single,pins = <
++			0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)	/* xdma_event_intr1.clkout2 */
++		>;
++	};
++
++	cpsw_default: cpsw_default {
++		pinctrl-single,pins = <
++			/* Slave 1 */
++			0x110 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxerr.mii1_rxerr */
++			0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txen.mii1_txen */
++			0x118 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxdv.mii1_rxdv */
++			0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd3.mii1_txd3 */
++			0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd2.mii1_txd2 */
++			0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd1.mii1_txd1 */
++			0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* mii1_txd0.mii1_txd0 */
++			0x12c (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_txclk.mii1_txclk */
++			0x130 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxclk.mii1_rxclk */
++			0x134 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd3.mii1_rxd3 */
++			0x138 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd2.mii1_rxd2 */
++			0x13c (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd1.mii1_rxd1 */
++			0x140 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mii1_rxd0.mii1_rxd0 */
++		>;
++	};
++
++	cpsw_sleep: cpsw_sleep {
++		pinctrl-single,pins = <
++			/* Slave 1 reset value */
++			0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++		>;
++	};
++
++	davinci_mdio_default: davinci_mdio_default {
++		pinctrl-single,pins = <
++			/* MDIO */
++			0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
++			0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
++		>;
++	};
++
++	davinci_mdio_sleep: davinci_mdio_sleep {
++		pinctrl-single,pins = <
++			/* MDIO reset value */
++			0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++		>;
++	};
++
++	mmc1_pins: pinmux_mmc1_pins {
++		pinctrl-single,pins = <
++			0x160 (PIN_INPUT | MUX_MODE7) /* GPIO0_6 */
++		>;
++	};
++
++	emmc_pins: pinmux_emmc_pins {
++		pinctrl-single,pins = <
++			0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
++			0x84 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_csn2.mmc1_cmd */
++			0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
++			0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
++			0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
++			0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
++			0x10 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
++			0x14 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
++			0x18 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
++			0x1c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
++		>;
++	};
++};
++
+ /include/ "tps65217.dtsi"
+ 
+ &tps {
+diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
+index bc4a69d..1525cd6 100644
+--- a/arch/arm/boot/dts/am335x-evm.dts
++++ b/arch/arm/boot/dts/am335x-evm.dts
+@@ -24,133 +24,6 @@
+ 		reg = <0x80000000 0x10000000>; /* 256 MB */
+ 	};
+ 
+-	am33xx_pinmux: pinmux at 44e10800 {
+-		pinctrl-names = "default";
+-		pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0 &clkout2_pin>;
+-
+-		matrix_keypad_s0: matrix_keypad_s0 {
+-			pinctrl-single,pins = <
+-				0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a5.gpio1_21 */
+-				0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a6.gpio1_22 */
+-				0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a9.gpio1_25 */
+-				0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a10.gpio1_26 */
+-				0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a11.gpio1_27 */
+-			>;
+-		};
+-
+-		volume_keys_s0: volume_keys_s0 {
+-			pinctrl-single,pins = <
+-				0x150 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* spi0_sclk.gpio0_2 */
+-				0x154 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* spi0_d0.gpio0_3 */
+-			>;
+-		};
+-
+-		i2c0_pins: pinmux_i2c0_pins {
+-			pinctrl-single,pins = <
+-				0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
+-				0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
+-			>;
+-		};
+-
+-		i2c1_pins: pinmux_i2c1_pins {
+-			pinctrl-single,pins = <
+-				0x158 (PIN_INPUT_PULLUP | MUX_MODE2)	/* spi0_d1.i2c1_sda */
+-				0x15c (PIN_INPUT_PULLUP | MUX_MODE2)	/* spi0_cs0.i2c1_scl */
+-			>;
+-		};
+-
+-		uart0_pins: pinmux_uart0_pins {
+-			pinctrl-single,pins = <
+-				0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
+-				0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
+-			>;
+-		};
+-
+-		clkout2_pin: pinmux_clkout2_pin {
+-			pinctrl-single,pins = <
+-				0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)	/* xdma_event_intr1.clkout2 */
+-			>;
+-		};
+-
+-		nandflash_pins_s0: nandflash_pins_s0 {
+-			pinctrl-single,pins = <
+-				0x0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad0.gpmc_ad0 */
+-				0x4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad1.gpmc_ad1 */
+-				0x8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad2.gpmc_ad2 */
+-				0xc (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad3.gpmc_ad3 */
+-				0x10 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad4.gpmc_ad4 */
+-				0x14 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad5.gpmc_ad5 */
+-				0x18 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad6.gpmc_ad6 */
+-				0x1c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad7.gpmc_ad7 */
+-				0x70 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_wait0.gpmc_wait0 */
+-				0x74 (PIN_INPUT_PULLUP | MUX_MODE7)	/* gpmc_wpn.gpio0_30 */
+-				0x7c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_csn0.gpmc_csn0  */
+-				0x90 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_advn_ale.gpmc_advn_ale */
+-				0x94 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_oen_ren.gpmc_oen_ren */
+-				0x98 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_wen.gpmc_wen */
+-				0x9c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_be0n_cle.gpmc_be0n_cle */
+-			>;
+-		};
+-
+-		ecap0_pins: backlight_pins {
+-			pinctrl-single,pins = <
+-				0x164 0x0	/* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
+-			>;
+-		};
+-
+-		cpsw_default: cpsw_default {
+-			pinctrl-single,pins = <
+-				/* Slave 1 */
+-				0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txen.rgmii1_tctl */
+-				0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxdv.rgmii1_rctl */
+-				0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd3.rgmii1_td3 */
+-				0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd2.rgmii1_td2 */
+-				0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd1.rgmii1_td1 */
+-				0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd0.rgmii1_td0 */
+-				0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txclk.rgmii1_tclk */
+-				0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxclk.rgmii1_rclk */
+-				0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd3.rgmii1_rd3 */
+-				0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd2.rgmii1_rd2 */
+-				0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd1.rgmii1_rd1 */
+-				0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd0.rgmii1_rd0 */
+-			>;
+-		};
+-
+-		cpsw_sleep: cpsw_sleep {
+-			pinctrl-single,pins = <
+-				/* Slave 1 reset value */
+-				0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-			>;
+-		};
+-
+-		davinci_mdio_default: davinci_mdio_default {
+-			pinctrl-single,pins = <
+-				/* MDIO */
+-				0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
+-				0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
+-			>;
+-		};
+-
+-		davinci_mdio_sleep: davinci_mdio_sleep {
+-			pinctrl-single,pins = <
+-				/* MDIO reset value */
+-				0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-			>;
+-		};
+-	};
+-
+ 	ocp {
+ 		uart0: serial at 44e09000 {
+ 			pinctrl-names = "default";
+@@ -405,6 +278,133 @@
+ 	};
+ };
+ 
++&am33xx_pinmux {
++	pinctrl-names = "default";
++	pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0 &clkout2_pin>;
++
++	matrix_keypad_s0: matrix_keypad_s0 {
++		pinctrl-single,pins = <
++			0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a5.gpio1_21 */
++			0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a6.gpio1_22 */
++			0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a9.gpio1_25 */
++			0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a10.gpio1_26 */
++			0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_a11.gpio1_27 */
++		>;
++	};
++
++	volume_keys_s0: volume_keys_s0 {
++		pinctrl-single,pins = <
++			0x150 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* spi0_sclk.gpio0_2 */
++			0x154 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* spi0_d0.gpio0_3 */
++		>;
++	};
++
++	i2c0_pins: pinmux_i2c0_pins {
++		pinctrl-single,pins = <
++			0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
++			0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
++		>;
++	};
++
++	i2c1_pins: pinmux_i2c1_pins {
++		pinctrl-single,pins = <
++			0x158 (PIN_INPUT_PULLUP | MUX_MODE2)	/* spi0_d1.i2c1_sda */
++			0x15c (PIN_INPUT_PULLUP | MUX_MODE2)	/* spi0_cs0.i2c1_scl */
++		>;
++	};
++
++	uart0_pins: pinmux_uart0_pins {
++		pinctrl-single,pins = <
++			0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
++			0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
++		>;
++	};
++
++	clkout2_pin: pinmux_clkout2_pin {
++		pinctrl-single,pins = <
++			0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)	/* xdma_event_intr1.clkout2 */
++		>;
++	};
++
++	nandflash_pins_s0: nandflash_pins_s0 {
++		pinctrl-single,pins = <
++			0x0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad0.gpmc_ad0 */
++			0x4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad1.gpmc_ad1 */
++			0x8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad2.gpmc_ad2 */
++			0xc (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad3.gpmc_ad3 */
++			0x10 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad4.gpmc_ad4 */
++			0x14 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad5.gpmc_ad5 */
++			0x18 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad6.gpmc_ad6 */
++			0x1c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad7.gpmc_ad7 */
++			0x70 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_wait0.gpmc_wait0 */
++			0x74 (PIN_INPUT_PULLUP | MUX_MODE7)	/* gpmc_wpn.gpio0_30 */
++			0x7c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_csn0.gpmc_csn0  */
++			0x90 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_advn_ale.gpmc_advn_ale */
++			0x94 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_oen_ren.gpmc_oen_ren */
++			0x98 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_wen.gpmc_wen */
++			0x9c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_be0n_cle.gpmc_be0n_cle */
++		>;
++	};
++
++	ecap0_pins: backlight_pins {
++		pinctrl-single,pins = <
++			0x164 0x0	/* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
++		>;
++	};
++
++	cpsw_default: cpsw_default {
++		pinctrl-single,pins = <
++			/* Slave 1 */
++			0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txen.rgmii1_tctl */
++			0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxdv.rgmii1_rctl */
++			0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd3.rgmii1_td3 */
++			0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd2.rgmii1_td2 */
++			0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd1.rgmii1_td1 */
++			0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd0.rgmii1_td0 */
++			0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txclk.rgmii1_tclk */
++			0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxclk.rgmii1_rclk */
++			0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd3.rgmii1_rd3 */
++			0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd2.rgmii1_rd2 */
++			0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd1.rgmii1_rd1 */
++			0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd0.rgmii1_rd0 */
++		>;
++	};
++
++	cpsw_sleep: cpsw_sleep {
++		pinctrl-single,pins = <
++			/* Slave 1 reset value */
++			0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++		>;
++	};
++
++	davinci_mdio_default: davinci_mdio_default {
++		pinctrl-single,pins = <
++			/* MDIO */
++			0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
++			0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
++		>;
++	};
++
++	davinci_mdio_sleep: davinci_mdio_sleep {
++		pinctrl-single,pins = <
++			/* MDIO reset value */
++			0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++		>;
++	};
++};
++
+ #include "tps65910.dtsi"
+ 
+ &tps {
+diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
+index 55fd194..f0066fe 100644
+--- a/arch/arm/boot/dts/am335x-evmsk.dts
++++ b/arch/arm/boot/dts/am335x-evmsk.dts
+@@ -31,135 +31,6 @@
+ 		reg = <0x80000000 0x10000000>; /* 256 MB */
+ 	};
+ 
+-	am33xx_pinmux: pinmux at 44e10800 {
+-		pinctrl-names = "default";
+-		pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>;
+-
+-		user_leds_s0: user_leds_s0 {
+-			pinctrl-single,pins = <
+-				0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad4.gpio1_4 */
+-				0x14 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad5.gpio1_5 */
+-				0x18 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad6.gpio1_6 */
+-				0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad7.gpio1_7 */
+-			>;
+-		};
+-
+-		gpio_keys_s0: gpio_keys_s0 {
+-			pinctrl-single,pins = <
+-				0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_oen_ren.gpio2_3 */
+-				0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_advn_ale.gpio2_2 */
+-				0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_wait0.gpio0_30 */
+-				0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ben0_cle.gpio2_5 */
+-			>;
+-		};
+-
+-		i2c0_pins: pinmux_i2c0_pins {
+-			pinctrl-single,pins = <
+-				0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
+-				0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
+-			>;
+-		};
+-
+-		uart0_pins: pinmux_uart0_pins {
+-			pinctrl-single,pins = <
+-				0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
+-				0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* uart0_txd.uart0_txd */
+-			>;
+-		};
+-
+-		clkout2_pin: pinmux_clkout2_pin {
+-			pinctrl-single,pins = <
+-				0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)		/* xdma_event_intr1.clkout2 */
+-			>;
+-		};
+-
+-		ecap2_pins: backlight_pins {
+-			pinctrl-single,pins = <
+-				0x19c 0x4	/* mcasp0_ahclkr.ecap2_in_pwm2_out MODE4 */
+-			>;
+-		};
+-
+-		cpsw_default: cpsw_default {
+-			pinctrl-single,pins = <
+-				/* Slave 1 */
+-				0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txen.rgmii1_tctl */
+-				0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxdv.rgmii1_rctl */
+-				0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd3.rgmii1_td3 */
+-				0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd2.rgmii1_td2 */
+-				0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd1.rgmii1_td1 */
+-				0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd0.rgmii1_td0 */
+-				0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txclk.rgmii1_tclk */
+-				0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxclk.rgmii1_rclk */
+-				0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd3.rgmii1_rd3 */
+-				0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd2.rgmii1_rd2 */
+-				0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd1.rgmii1_rd1 */
+-				0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd0.rgmii1_rd0 */
+-
+-				/* Slave 2 */
+-				0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a0.rgmii2_tctl */
+-				0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a1.rgmii2_rctl */
+-				0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a2.rgmii2_td3 */
+-				0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a3.rgmii2_td2 */
+-				0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a4.rgmii2_td1 */
+-				0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a5.rgmii2_td0 */
+-				0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a6.rgmii2_tclk */
+-				0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a7.rgmii2_rclk */
+-				0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a8.rgmii2_rd3 */
+-				0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a9.rgmii2_rd2 */
+-				0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a10.rgmii2_rd1 */
+-				0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a11.rgmii2_rd0 */
+-			>;
+-		};
+-
+-		cpsw_sleep: cpsw_sleep {
+-			pinctrl-single,pins = <
+-				/* Slave 1 reset value */
+-				0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-
+-				/* Slave 2 reset value*/
+-				0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-			>;
+-		};
+-
+-		davinci_mdio_default: davinci_mdio_default {
+-			pinctrl-single,pins = <
+-				/* MDIO */
+-				0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
+-				0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
+-			>;
+-		};
+-
+-		davinci_mdio_sleep: davinci_mdio_sleep {
+-			pinctrl-single,pins = <
+-				/* MDIO reset value */
+-				0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-				0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+-			>;
+-		};
+-	};
+-
+ 	ocp {
+ 		uart0: serial at 44e09000 {
+ 			pinctrl-names = "default";
+@@ -321,6 +192,135 @@
+ 	};
+ };
+ 
++&am33xx_pinmux {
++	pinctrl-names = "default";
++	pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>;
++
++	user_leds_s0: user_leds_s0 {
++		pinctrl-single,pins = <
++			0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad4.gpio1_4 */
++			0x14 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad5.gpio1_5 */
++			0x18 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad6.gpio1_6 */
++			0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad7.gpio1_7 */
++		>;
++	};
++
++	gpio_keys_s0: gpio_keys_s0 {
++		pinctrl-single,pins = <
++			0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_oen_ren.gpio2_3 */
++			0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_advn_ale.gpio2_2 */
++			0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_wait0.gpio0_30 */
++			0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ben0_cle.gpio2_5 */
++		>;
++	};
++
++	i2c0_pins: pinmux_i2c0_pins {
++		pinctrl-single,pins = <
++			0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
++			0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
++		>;
++	};
++
++	uart0_pins: pinmux_uart0_pins {
++		pinctrl-single,pins = <
++			0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
++			0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)		/* uart0_txd.uart0_txd */
++		>;
++	};
++
++	clkout2_pin: pinmux_clkout2_pin {
++		pinctrl-single,pins = <
++			0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)		/* xdma_event_intr1.clkout2 */
++		>;
++	};
++
++	ecap2_pins: backlight_pins {
++		pinctrl-single,pins = <
++			0x19c 0x4	/* mcasp0_ahclkr.ecap2_in_pwm2_out MODE4 */
++		>;
++	};
++
++	cpsw_default: cpsw_default {
++		pinctrl-single,pins = <
++			/* Slave 1 */
++			0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txen.rgmii1_tctl */
++			0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxdv.rgmii1_rctl */
++			0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd3.rgmii1_td3 */
++			0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd2.rgmii1_td2 */
++			0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd1.rgmii1_td1 */
++			0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txd0.rgmii1_td0 */
++			0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* mii1_txclk.rgmii1_tclk */
++			0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxclk.rgmii1_rclk */
++			0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd3.rgmii1_rd3 */
++			0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd2.rgmii1_rd2 */
++			0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd1.rgmii1_rd1 */
++			0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* mii1_rxd0.rgmii1_rd0 */
++
++			/* Slave 2 */
++			0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a0.rgmii2_tctl */
++			0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a1.rgmii2_rctl */
++			0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a2.rgmii2_td3 */
++			0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a3.rgmii2_td2 */
++			0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a4.rgmii2_td1 */
++			0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a5.rgmii2_td0 */
++			0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a6.rgmii2_tclk */
++			0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a7.rgmii2_rclk */
++			0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a8.rgmii2_rd3 */
++			0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a9.rgmii2_rd2 */
++			0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a10.rgmii2_rd1 */
++			0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2)	/* gpmc_a11.rgmii2_rd0 */
++		>;
++	};
++
++	cpsw_sleep: cpsw_sleep {
++		pinctrl-single,pins = <
++			/* Slave 1 reset value */
++			0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++
++			/* Slave 2 reset value*/
++			0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++		>;
++	};
++
++	davinci_mdio_default: davinci_mdio_default {
++		pinctrl-single,pins = <
++			/* MDIO */
++			0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
++			0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
++		>;
++	};
++
++	davinci_mdio_sleep: davinci_mdio_sleep {
++		pinctrl-single,pins = <
++			/* MDIO reset value */
++			0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
++			0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
++		>;
++	};
++};
++
+ #include "tps65910.dtsi"
+ 
+ &tps {
+-- 
+1.8.4.rc3
+
+From ff7a46710ffc245a5c8e32cf1843aa3fea7aa1ff Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javier.martinez at collabora.co.uk>
+Date: Fri, 20 Sep 2013 17:42:19 +0200
+Subject: [PATCH 11/15] ARM: dts: AM33XX: don't redefine OCP bus and device
+ nodes
+
+The On Chip Peripherals (OCP) device node is a simplified
+representation of the AM33XX SoC interconnect. An OCP dev
+node is already defined in the am33xx.dtsi Device Tree
+source file included by am33xx based boards so there is
+no need to redefine this on each board DT file.
+
+Also, the OCP and IP modules directly connected to it are SoC
+internal details that is better to keep outside of board files.
+
+Signed-off-by: Javier Martinez Canillas <javier.martinez at collabora.co.uk>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 100 ++++----
+ arch/arm/boot/dts/am335x-evm.dts          | 380 +++++++++++++++---------------
+ arch/arm/boot/dts/am335x-evmsk.dts        | 148 ++++++------
+ 3 files changed, 311 insertions(+), 317 deletions(-)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index 29799ac..ff5c3ca 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -21,57 +21,6 @@
+ 		reg = <0x80000000 0x10000000>; /* 256 MB */
+ 	};
+ 
+-	ocp {
+-		uart0: serial at 44e09000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&uart0_pins>;
+-
+-			status = "okay";
+-		};
+-
+-		musb: usb at 47400000 {
+-			status = "okay";
+-
+-			control at 44e10000 {
+-				status = "okay";
+-			};
+-
+-			usb-phy at 47401300 {
+-				status = "okay";
+-			};
+-
+-			usb-phy at 47401b00 {
+-				status = "okay";
+-			};
+-
+-			usb at 47401000 {
+-				status = "okay";
+-			};
+-
+-			usb at 47401800 {
+-				status = "okay";
+-				dr_mode = "host";
+-			};
+-
+-			dma-controller at 07402000  {
+-				status = "okay";
+-			};
+-		};
+-
+-		i2c0: i2c at 44e0b000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&i2c0_pins>;
+-
+-			status = "okay";
+-			clock-frequency = <400000>;
+-
+-			tps: tps at 24 {
+-				reg = <0x24>;
+-			};
+-
+-		};
+-	};
+-
+ 	leds {
+ 		pinctrl-names = "default";
+ 		pinctrl-0 = <&user_leds_s0>;
+@@ -217,6 +166,55 @@
+ 	};
+ };
+ 
++&uart0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart0_pins>;
++
++	status = "okay";
++};
++
++&usb {
++	status = "okay";
++
++	control at 44e10000 {
++		status = "okay";
++	};
++
++	usb-phy at 47401300 {
++		status = "okay";
++	};
++
++	usb-phy at 47401b00 {
++		status = "okay";
++	};
++
++	usb at 47401000 {
++		status = "okay";
++	};
++
++	usb at 47401800 {
++		status = "okay";
++		dr_mode = "host";
++	};
++
++	dma-controller at 07402000  {
++		status = "okay";
++	};
++};
++
++&i2c0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2c0_pins>;
++
++	status = "okay";
++	clock-frequency = <400000>;
++
++	tps: tps at 24 {
++		reg = <0x24>;
++	};
++
++};
++
+ /include/ "tps65217.dtsi"
+ 
+ &tps {
+diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
+index 1525cd6..23b0a3e 100644
+--- a/arch/arm/boot/dts/am335x-evm.dts
++++ b/arch/arm/boot/dts/am335x-evm.dts
+@@ -24,197 +24,6 @@
+ 		reg = <0x80000000 0x10000000>; /* 256 MB */
+ 	};
+ 
+-	ocp {
+-		uart0: serial at 44e09000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&uart0_pins>;
+-
+-			status = "okay";
+-		};
+-
+-		i2c0: i2c at 44e0b000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&i2c0_pins>;
+-
+-			status = "okay";
+-			clock-frequency = <400000>;
+-
+-			tps: tps at 2d {
+-				reg = <0x2d>;
+-			};
+-		};
+-
+-		musb: usb at 47400000 {
+-			status = "okay";
+-
+-			control at 44e10000 {
+-				status = "okay";
+-			};
+-
+-			usb-phy at 47401300 {
+-				status = "okay";
+-			};
+-
+-			usb-phy at 47401b00 {
+-				status = "okay";
+-			};
+-
+-			usb at 47401000 {
+-				status = "okay";
+-			};
+-
+-			usb at 47401800 {
+-				status = "okay";
+-				dr_mode = "host";
+-			};
+-
+-			dma-controller at 07402000  {
+-				status = "okay";
+-			};
+-		};
+-
+-		i2c1: i2c at 4802a000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&i2c1_pins>;
+-
+-			status = "okay";
+-			clock-frequency = <100000>;
+-
+-			lis331dlh: lis331dlh at 18 {
+-				compatible = "st,lis331dlh", "st,lis3lv02d";
+-				reg = <0x18>;
+-				Vdd-supply = <&lis3_reg>;
+-				Vdd_IO-supply = <&lis3_reg>;
+-
+-				st,click-single-x;
+-				st,click-single-y;
+-				st,click-single-z;
+-				st,click-thresh-x = <10>;
+-				st,click-thresh-y = <10>;
+-				st,click-thresh-z = <10>;
+-				st,irq1-click;
+-				st,irq2-click;
+-				st,wakeup-x-lo;
+-				st,wakeup-x-hi;
+-				st,wakeup-y-lo;
+-				st,wakeup-y-hi;
+-				st,wakeup-z-lo;
+-				st,wakeup-z-hi;
+-				st,min-limit-x = <120>;
+-				st,min-limit-y = <120>;
+-				st,min-limit-z = <140>;
+-				st,max-limit-x = <550>;
+-				st,max-limit-y = <550>;
+-				st,max-limit-z = <750>;
+-			};
+-
+-			tsl2550: tsl2550 at 39 {
+-				compatible = "taos,tsl2550";
+-				reg = <0x39>;
+-			};
+-
+-			tmp275: tmp275 at 48 {
+-				compatible = "ti,tmp275";
+-				reg = <0x48>;
+-			};
+-		};
+-
+-		elm: elm at 48080000 {
+-			status = "okay";
+-		};
+-
+-		epwmss0: epwmss at 48300000 {
+-			status = "okay";
+-
+-			ecap0: ecap at 48300100 {
+-				status = "okay";
+-				pinctrl-names = "default";
+-				pinctrl-0 = <&ecap0_pins>;
+-			};
+-		};
+-
+-		gpmc: gpmc at 50000000 {
+-			status = "okay";
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&nandflash_pins_s0>;
+-			ranges = <0 0 0x08000000 0x10000000>;	/* CS0: NAND */
+-			nand at 0,0 {
+-				reg = <0 0 0>; /* CS0, offset 0 */
+-				nand-bus-width = <8>;
+-				ti,nand-ecc-opt = "bch8";
+-				gpmc,device-nand = "true";
+-				gpmc,device-width = <1>;
+-				gpmc,sync-clk-ps = <0>;
+-				gpmc,cs-on-ns = <0>;
+-				gpmc,cs-rd-off-ns = <44>;
+-				gpmc,cs-wr-off-ns = <44>;
+-				gpmc,adv-on-ns = <6>;
+-				gpmc,adv-rd-off-ns = <34>;
+-				gpmc,adv-wr-off-ns = <44>;
+-				gpmc,we-on-ns = <0>;
+-				gpmc,we-off-ns = <40>;
+-				gpmc,oe-on-ns = <0>;
+-				gpmc,oe-off-ns = <54>;
+-				gpmc,access-ns = <64>;
+-				gpmc,rd-cycle-ns = <82>;
+-				gpmc,wr-cycle-ns = <82>;
+-				gpmc,wait-on-read = "true";
+-				gpmc,wait-on-write = "true";
+-				gpmc,bus-turnaround-ns = <0>;
+-				gpmc,cycle2cycle-delay-ns = <0>;
+-				gpmc,clk-activation-ns = <0>;
+-				gpmc,wait-monitoring-ns = <0>;
+-				gpmc,wr-access-ns = <40>;
+-				gpmc,wr-data-mux-bus-ns = <0>;
+-
+-				#address-cells = <1>;
+-				#size-cells = <1>;
+-				elm_id = <&elm>;
+-
+-				/* MTD partition table */
+-				partition at 0 {
+-					label = "SPL1";
+-					reg = <0x00000000 0x000020000>;
+-				};
+-
+-				partition at 1 {
+-					label = "SPL2";
+-					reg = <0x00020000 0x00020000>;
+-				};
+-
+-				partition at 2 {
+-					label = "SPL3";
+-					reg = <0x00040000 0x00020000>;
+-				};
+-
+-				partition at 3 {
+-					label = "SPL4";
+-					reg = <0x00060000 0x00020000>;
+-				};
+-
+-				partition at 4 {
+-					label = "U-boot";
+-					reg = <0x00080000 0x001e0000>;
+-				};
+-
+-				partition at 5 {
+-					label = "environment";
+-					reg = <0x00260000 0x00020000>;
+-				};
+-
+-				partition at 6 {
+-					label = "Kernel";
+-					reg = <0x00280000 0x00500000>;
+-				};
+-
+-				partition at 7 {
+-					label = "File-System";
+-					reg = <0x00780000 0x0F880000>;
+-				};
+-			};
+-		};
+-	};
+-
+ 	vbat: fixedregulator at 0 {
+ 		compatible = "regulator-fixed";
+ 		regulator-name = "vbat";
+@@ -405,6 +214,195 @@
+ 	};
+ };
+ 
++&uart0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart0_pins>;
++
++	status = "okay";
++};
++
++&i2c0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2c0_pins>;
++
++	status = "okay";
++	clock-frequency = <400000>;
++
++	tps: tps at 2d {
++		reg = <0x2d>;
++	};
++};
++
++&usb {
++	status = "okay";
++
++	control at 44e10000 {
++		status = "okay";
++	};
++
++	usb-phy at 47401300 {
++		status = "okay";
++	};
++
++	usb-phy at 47401b00 {
++		status = "okay";
++	};
++
++	usb at 47401000 {
++		status = "okay";
++	};
++
++	usb at 47401800 {
++		status = "okay";
++		dr_mode = "host";
++	};
++
++	dma-controller at 07402000  {
++		status = "okay";
++	};
++};
++
++&i2c1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2c1_pins>;
++
++	status = "okay";
++	clock-frequency = <100000>;
++
++	lis331dlh: lis331dlh at 18 {
++		compatible = "st,lis331dlh", "st,lis3lv02d";
++		reg = <0x18>;
++		Vdd-supply = <&lis3_reg>;
++		Vdd_IO-supply = <&lis3_reg>;
++
++		st,click-single-x;
++		st,click-single-y;
++		st,click-single-z;
++		st,click-thresh-x = <10>;
++		st,click-thresh-y = <10>;
++		st,click-thresh-z = <10>;
++		st,irq1-click;
++		st,irq2-click;
++		st,wakeup-x-lo;
++		st,wakeup-x-hi;
++		st,wakeup-y-lo;
++		st,wakeup-y-hi;
++		st,wakeup-z-lo;
++		st,wakeup-z-hi;
++		st,min-limit-x = <120>;
++		st,min-limit-y = <120>;
++		st,min-limit-z = <140>;
++		st,max-limit-x = <550>;
++		st,max-limit-y = <550>;
++		st,max-limit-z = <750>;
++	};
++
++	tsl2550: tsl2550 at 39 {
++		compatible = "taos,tsl2550";
++		reg = <0x39>;
++	};
++
++	tmp275: tmp275 at 48 {
++		compatible = "ti,tmp275";
++		reg = <0x48>;
++	};
++};
++
++&elm {
++	status = "okay";
++};
++
++&epwmss0 {
++	status = "okay";
++
++	ecap0: ecap at 48300100 {
++		status = "okay";
++		pinctrl-names = "default";
++		pinctrl-0 = <&ecap0_pins>;
++	};
++};
++
++&gpmc {
++	status = "okay";
++	pinctrl-names = "default";
++	pinctrl-0 = <&nandflash_pins_s0>;
++	ranges = <0 0 0x08000000 0x10000000>;	/* CS0: NAND */
++	nand at 0,0 {
++		reg = <0 0 0>; /* CS0, offset 0 */
++		nand-bus-width = <8>;
++		ti,nand-ecc-opt = "bch8";
++		gpmc,device-nand = "true";
++		gpmc,device-width = <1>;
++		gpmc,sync-clk-ps = <0>;
++		gpmc,cs-on-ns = <0>;
++		gpmc,cs-rd-off-ns = <44>;
++		gpmc,cs-wr-off-ns = <44>;
++		gpmc,adv-on-ns = <6>;
++		gpmc,adv-rd-off-ns = <34>;
++		gpmc,adv-wr-off-ns = <44>;
++		gpmc,we-on-ns = <0>;
++		gpmc,we-off-ns = <40>;
++		gpmc,oe-on-ns = <0>;
++		gpmc,oe-off-ns = <54>;
++		gpmc,access-ns = <64>;
++		gpmc,rd-cycle-ns = <82>;
++		gpmc,wr-cycle-ns = <82>;
++		gpmc,wait-on-read = "true";
++		gpmc,wait-on-write = "true";
++		gpmc,bus-turnaround-ns = <0>;
++		gpmc,cycle2cycle-delay-ns = <0>;
++		gpmc,clk-activation-ns = <0>;
++		gpmc,wait-monitoring-ns = <0>;
++		gpmc,wr-access-ns = <40>;
++		gpmc,wr-data-mux-bus-ns = <0>;
++
++		#address-cells = <1>;
++		#size-cells = <1>;
++		elm_id = <&elm>;
++
++		/* MTD partition table */
++		partition at 0 {
++			label = "SPL1";
++			reg = <0x00000000 0x000020000>;
++		};
++
++		partition at 1 {
++			label = "SPL2";
++			reg = <0x00020000 0x00020000>;
++		};
++
++		partition at 2 {
++			label = "SPL3";
++			reg = <0x00040000 0x00020000>;
++		};
++
++		partition at 3 {
++			label = "SPL4";
++			reg = <0x00060000 0x00020000>;
++		};
++
++		partition at 4 {
++			label = "U-boot";
++			reg = <0x00080000 0x001e0000>;
++		};
++
++		partition at 5 {
++			label = "environment";
++			reg = <0x00260000 0x00020000>;
++		};
++
++		partition at 6 {
++			label = "Kernel";
++			reg = <0x00280000 0x00500000>;
++		};
++
++		partition at 7 {
++			label = "File-System";
++			reg = <0x00780000 0x0F880000>;
++		};
++	};
++};
++
+ #include "tps65910.dtsi"
+ 
+ &tps {
+diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
+index f0066fe..bc93895 100644
+--- a/arch/arm/boot/dts/am335x-evmsk.dts
++++ b/arch/arm/boot/dts/am335x-evmsk.dts
+@@ -31,81 +31,6 @@
+ 		reg = <0x80000000 0x10000000>; /* 256 MB */
+ 	};
+ 
+-	ocp {
+-		uart0: serial at 44e09000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&uart0_pins>;
+-
+-			status = "okay";
+-		};
+-
+-		i2c0: i2c at 44e0b000 {
+-			pinctrl-names = "default";
+-			pinctrl-0 = <&i2c0_pins>;
+-
+-			status = "okay";
+-			clock-frequency = <400000>;
+-
+-			tps: tps at 2d {
+-				reg = <0x2d>;
+-			};
+-
+-			lis331dlh: lis331dlh at 18 {
+-				compatible = "st,lis331dlh", "st,lis3lv02d";
+-				reg = <0x18>;
+-				Vdd-supply = <&lis3_reg>;
+-				Vdd_IO-supply = <&lis3_reg>;
+-
+-				st,click-single-x;
+-				st,click-single-y;
+-				st,click-single-z;
+-				st,click-thresh-x = <10>;
+-				st,click-thresh-y = <10>;
+-				st,click-thresh-z = <10>;
+-				st,irq1-click;
+-				st,irq2-click;
+-				st,wakeup-x-lo;
+-				st,wakeup-x-hi;
+-				st,wakeup-y-lo;
+-				st,wakeup-y-hi;
+-				st,wakeup-z-lo;
+-				st,wakeup-z-hi;
+-				st,min-limit-x = <120>;
+-				st,min-limit-y = <120>;
+-				st,min-limit-z = <140>;
+-				st,max-limit-x = <550>;
+-				st,max-limit-y = <550>;
+-				st,max-limit-z = <750>;
+-			};
+-		};
+-
+-		musb: usb at 47400000 {
+-			status = "okay";
+-
+-			control at 44e10000 {
+-				status = "okay";
+-			};
+-
+-			usb-phy at 47401300 {
+-				status = "okay";
+-			};
+-
+-			usb at 47401000 {
+-				status = "okay";
+-			};
+-		};
+-
+-		epwmss2: epwmss at 48304000 {
+-			status = "okay";
+-
+-			ecap2: ecap at 48304100 {
+-				status = "okay";
+-				pinctrl-names = "default";
+-				pinctrl-0 = <&ecap2_pins>;
+-			};
+-		};
+-	};
+-
+ 	vbat: fixedregulator at 0 {
+ 		compatible = "regulator-fixed";
+ 		regulator-name = "vbat";
+@@ -321,6 +246,79 @@
+ 	};
+ };
+ 
++&uart0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart0_pins>;
++
++	status = "okay";
++};
++
++&i2c0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2c0_pins>;
++
++	status = "okay";
++	clock-frequency = <400000>;
++
++	tps: tps at 2d {
++		reg = <0x2d>;
++	};
++
++	lis331dlh: lis331dlh at 18 {
++		compatible = "st,lis331dlh", "st,lis3lv02d";
++		reg = <0x18>;
++		Vdd-supply = <&lis3_reg>;
++		Vdd_IO-supply = <&lis3_reg>;
++
++		st,click-single-x;
++		st,click-single-y;
++		st,click-single-z;
++		st,click-thresh-x = <10>;
++		st,click-thresh-y = <10>;
++		st,click-thresh-z = <10>;
++		st,irq1-click;
++		st,irq2-click;
++		st,wakeup-x-lo;
++		st,wakeup-x-hi;
++		st,wakeup-y-lo;
++		st,wakeup-y-hi;
++		st,wakeup-z-lo;
++		st,wakeup-z-hi;
++		st,min-limit-x = <120>;
++		st,min-limit-y = <120>;
++		st,min-limit-z = <140>;
++		st,max-limit-x = <550>;
++		st,max-limit-y = <550>;
++		st,max-limit-z = <750>;
++	};
++};
++
++&usb {
++	status = "okay";
++
++	control at 44e10000 {
++		status = "okay";
++	};
++
++	usb-phy at 47401300 {
++		status = "okay";
++	};
++
++	usb at 47401000 {
++		status = "okay";
++	};
++};
++
++&epwmss2 {
++	status = "okay";
++
++	ecap2: ecap at 48304100 {
++		status = "okay";
++		pinctrl-names = "default";
++		pinctrl-0 = <&ecap2_pins>;
++	};
++};
++
+ #include "tps65910.dtsi"
+ 
+ &tps {
+-- 
+1.8.4.rc3
+
+From a9a966a91ca0304de63c03ef5131c08b1d19f60d Mon Sep 17 00:00:00 2001
+From: Dan Murphy <dmurphy at ti.com>
+Date: Wed, 2 Oct 2013 12:58:33 -0500
+Subject: [PATCH 12/15] ARM: dts: AM33XX: add ethernet alias's for am33xx
+
+Set the alias for ethernet0 and ethernet1 so that uBoot
+can set the MAC address appropriately.
+
+Currently u-boot cannot find the alias and there for does
+not set the MAC address.
+
+Signed-off-by: Dan Murphy <dmurphy at ti.com>
+Tested-by: Mugunthan V N <mugunthanvnm at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am33xx.dtsi | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index 553adc6..8aabaa0 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -30,6 +30,8 @@
+ 		usb1 = &usb1;
+ 		phy0 = &usb0_phy;
+ 		phy1 = &usb1_phy;
++		ethernet0 = &cpsw_emac0;
++		ethernet1 = &cpsw_emac1;
+ 	};
+ 
+ 	cpus {
+-- 
+1.8.4.rc3
+
+From 5339e0ba31b312715a5542a53c6a46c3e9a5f53b Mon Sep 17 00:00:00 2001
+From: Nishanth Menon <nm at ti.com>
+Date: Mon, 30 Sep 2013 09:40:16 -0500
+Subject: [PATCH 13/15] ARM: dts: am335x-boneblack: move fixed regulator to
+ board level
+
+3.3V fixed regulator does not belong to TPS node - as a result
+the fixed regulator is never probed and MMC is continually deferred
+due to lack of regulator.
+
+Move the fixed regulator to be at root of platform.
+
+Cc: Joel Fernandes <joelf at ti.com>
+Cc: Sekhar Nori <nsekhar at ti.com>
+Cc: Koen Kooi <koen at dominion.thruhere.net>
+Signed-off-by: Nishanth Menon <nm at ti.com>
+Tested-by: Felipe Balbi <balbi at ti.com>
+Tested-by: Balaji T K <balajitk at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index ff5c3ca..b3e6fcf 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -55,6 +55,13 @@
+ 			default-state = "off";
+ 		};
+ 	};
++
++	vmmcsd_fixed: fixedregulator at 0 {
++		compatible = "regulator-fixed";
++		regulator-name = "vmmcsd_fixed";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++	};
+ };
+ 
+ &am33xx_pinmux {
+@@ -257,13 +264,6 @@
+ 			regulator-always-on;
+ 		};
+ 	};
+-
+-	vmmcsd_fixed: fixedregulator at 0 {
+-		compatible = "regulator-fixed";
+-		regulator-name = "vmmcsd_fixed";
+-		regulator-min-microvolt = <3300000>;
+-		regulator-max-microvolt = <3300000>;
+-	};
+ };
+ 
+ &cpsw_emac0 {
+-- 
+1.8.4.rc3
+
+From 085e4e139ae508aab69c568d6bf2a6860a0bd607 Mon Sep 17 00:00:00 2001
+From: Balaji T K <balajitk at ti.com>
+Date: Fri, 27 Sep 2013 17:05:09 +0530
+Subject: [PATCH 14/15] ARM: dts: am335x-bone-common: correct mux mode for cmd
+ line
+
+Set pinmux_emmc_pins mux mode for cmd line to MODE2 in order
+to detect eMMC on BBB and BBW + eMMC cape.
+
+Signed-off-by: Balaji T K <balajitk at ti.com>
+Tested-by: Felipe Balbi <balbi at ti.com>
+Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index b3e6fcf..e3f27ec 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -160,7 +160,7 @@
+ 	emmc_pins: pinmux_emmc_pins {
+ 		pinctrl-single,pins = <
+ 			0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+-			0x84 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_csn2.mmc1_cmd */
++			0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+ 			0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
+ 			0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
+ 			0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
+-- 
+1.8.4.rc3
+
+commit d6cfc1e266d34d5b1f8a26bb272d2d2c466d89b8
+Author: Benoit Parrot <bparrot at ti.com>
+Date:   Thu Aug 8 18:28:14 2013 -0500
+
+    ARM: dts: AM33XX: Add LCDC info into am335x-evm
+    
+    Add LCDC device node in DT for am33xx
+    Add LCDC and Panel info in DT for am335x-evm
+    
+    Changes:
+    - remove redundant/unnecessary SoC specific setting in the board dts
+    - resolved conflicts on for_3.13/dts
+    
+    Signed-off-by: Benoit Parrot <bparrot at ti.com>
+    Signed-off-by: Joel Fernandes <joelf at ti.com>
+    Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+
+diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
+index ff834ad..eabacf9 100644
+--- a/arch/arm/boot/dts/am335x-evm.dts
++++ b/arch/arm/boot/dts/am335x-evm.dts
+@@ -85,6 +85,40 @@
+ 		brightness-levels = <0 51 53 56 62 75 101 152 255>;
+ 		default-brightness-level = <8>;
+ 	};
++
++	panel {
++		compatible = "ti,tilcdc,panel";
++		status = "okay";
++		pinctrl-names = "default";
++		pinctrl-0 = <&lcd_pins_s0>;
++		panel-info {
++			ac-bias           = <255>;
++			ac-bias-intrpt    = <0>;
++			dma-burst-sz      = <16>;
++			bpp               = <32>;
++			fdd               = <0x80>;
++			sync-edge         = <0>;
++			sync-ctrl         = <1>;
++			raster-order      = <0>;
++			fifo-th           = <0>;
++		};
++
++		display-timings {
++			800x480p62 {
++				clock-frequency = <30000000>;
++				hactive = <800>;
++				vactive = <480>;
++				hfront-porch = <39>;
++				hback-porch = <39>;
++				hsync-len = <47>;
++				vback-porch = <29>;
++				vfront-porch = <13>;
++				vsync-len = <2>;
++				hsync-active = <1>;
++				vsync-active = <1>;
++			};
++		};
++	};
+ };
+ 
+ &am33xx_pinmux {
+@@ -212,6 +246,39 @@
+ 			0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+ 		>;
+ 	};
++
++	lcd_pins_s0: lcd_pins_s0 {
++		pinctrl-single,pins = <
++			0x20 0x01	/* gpmc_ad8.lcd_data16, OUTPUT | MODE1 */
++			0x24 0x01	/* gpmc_ad9.lcd_data17, OUTPUT | MODE1 */
++			0x28 0x01	/* gpmc_ad10.lcd_data18, OUTPUT | MODE1 */
++			0x2c 0x01	/* gpmc_ad11.lcd_data19, OUTPUT | MODE1 */
++			0x30 0x01	/* gpmc_ad12.lcd_data20, OUTPUT | MODE1 */
++			0x34 0x01	/* gpmc_ad13.lcd_data21, OUTPUT | MODE1 */
++			0x38 0x01	/* gpmc_ad14.lcd_data22, OUTPUT | MODE1 */
++			0x3c 0x01	/* gpmc_ad15.lcd_data23, OUTPUT | MODE1 */
++			0xa0 0x00	/* lcd_data0.lcd_data0, OUTPUT | MODE0 */
++			0xa4 0x00	/* lcd_data1.lcd_data1, OUTPUT | MODE0 */
++			0xa8 0x00	/* lcd_data2.lcd_data2, OUTPUT | MODE0 */
++			0xac 0x00	/* lcd_data3.lcd_data3, OUTPUT | MODE0 */
++			0xb0 0x00	/* lcd_data4.lcd_data4, OUTPUT | MODE0 */
++			0xb4 0x00	/* lcd_data5.lcd_data5, OUTPUT | MODE0 */
++			0xb8 0x00	/* lcd_data6.lcd_data6, OUTPUT | MODE0 */
++			0xbc 0x00	/* lcd_data7.lcd_data7, OUTPUT | MODE0 */
++			0xc0 0x00	/* lcd_data8.lcd_data8, OUTPUT | MODE0 */
++			0xc4 0x00	/* lcd_data9.lcd_data9, OUTPUT | MODE0 */
++			0xc8 0x00	/* lcd_data10.lcd_data10, OUTPUT | MODE0 */
++			0xcc 0x00	/* lcd_data11.lcd_data11, OUTPUT | MODE0 */
++			0xd0 0x00	/* lcd_data12.lcd_data12, OUTPUT | MODE0 */
++			0xd4 0x00	/* lcd_data13.lcd_data13, OUTPUT | MODE0 */
++			0xd8 0x00	/* lcd_data14.lcd_data14, OUTPUT | MODE0 */
++			0xdc 0x00	/* lcd_data15.lcd_data15, OUTPUT | MODE0 */
++			0xe0 0x00	/* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
++			0xe4 0x00	/* lcd_hsync.lcd_hsync, OUTPUT | MODE0 */
++			0xe8 0x00	/* lcd_pclk.lcd_pclk, OUTPUT | MODE0 */
++			0xec 0x00	/* lcd_ac_bias_en.lcd_ac_bias_en, OUTPUT | MODE0 */
++		>;
++	};
+ };
+ 
+ &uart0 {
+@@ -308,6 +375,10 @@
+ 	};
+ };
+ 
++&lcdc {
++	status = "okay";
++};
++
+ &elm {
+ 	status = "okay";
+ };
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index c87bf4b..7db3c81 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -684,6 +684,15 @@
+ 			status = "disabled";
+ 		};
+ 
++		lcdc: lcdc at 4830e000 {
++			compatible = "ti,am33xx-tilcdc";
++			reg = <0x4830e000 0x1000>;
++			interrupt-parent = <&intc>;
++			interrupts = <36>;
++			ti,hwmods = "lcdc";
++			status = "disabled";
++		};
++
+ 		tscadc: tscadc at 44e0d000 {
+ 			compatible = "ti,am3359-tscadc";
+ 			reg = <0x44e0d000 0x1000>;
+commit 559a08e89350e269a4bba93629f39da5dd8e4fef
+Author: Darren Etheridge <detheridge at ti.com>
+Date:   Fri Sep 20 15:01:42 2013 -0500
+
+    ARM: dts: AM33XX beagle black: add pinmux and hdmi node to enable display
+    
+    Enable the hdmi output and the LCD Controller on BeagleBone
+    Black. Also configure the correct pinmux for output of
+    video data from the SoC to the HDMI encoder.
+    
+    Signed-off-by: Darren Etheridge <detheridge at ti.com>
+    Signed-off-by: Joel Fernandes <joelf at ti.com>
+    Signed-off-by: Benoit Cousson <bcousson at baylibre.com>
+
+diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
+index 16b3bea..6b71ad9 100644
+--- a/arch/arm/boot/dts/am335x-boneblack.dts
++++ b/arch/arm/boot/dts/am335x-boneblack.dts
+@@ -28,3 +28,51 @@
+ 	status = "okay";
+ 	ti,vcc-aux-disable-is-sleep;
+ };
++
++&am33xx_pinmux {
++	nxp_hdmi_bonelt_pins: nxp_hdmi_bonelt_pins {
++		pinctrl-single,pins = <
++			0x1b0 0x03      /* xdma_event_intr0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */
++			0xa0 0x08       /* lcd_data0.lcd_data0, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xa4 0x08       /* lcd_data1.lcd_data1, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xa8 0x08       /* lcd_data2.lcd_data2, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xac 0x08       /* lcd_data3.lcd_data3, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xb0 0x08       /* lcd_data4.lcd_data4, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xb4 0x08       /* lcd_data5.lcd_data5, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xb8 0x08       /* lcd_data6.lcd_data6, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xbc 0x08       /* lcd_data7.lcd_data7, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xc0 0x08       /* lcd_data8.lcd_data8, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xc4 0x08       /* lcd_data9.lcd_data9, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xc8 0x08       /* lcd_data10.lcd_data10, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xcc 0x08       /* lcd_data11.lcd_data11, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xd0 0x08       /* lcd_data12.lcd_data12, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xd4 0x08       /* lcd_data13.lcd_data13, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xd8 0x08       /* lcd_data14.lcd_data14, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xdc 0x08       /* lcd_data15.lcd_data15, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
++			0xe0 0x00       /* lcd_vsync.lcd_vsync, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
++			0xe4 0x00       /* lcd_hsync.lcd_hsync, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
++			0xe8 0x00       /* lcd_pclk.lcd_pclk, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
++			0xec 0x00       /* lcd_ac_bias_en.lcd_ac_bias_en, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
++		>;
++	};
++	nxp_hdmi_bonelt_off_pins: nxp_hdmi_bonelt_off_pins {
++		pinctrl-single,pins = <
++			0x1b0 0x03      /* xdma_event_intr0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */
++		>;
++	};
++};
++
++&lcdc {
++	status = "okay";
++};
++
++/ {
++	hdmi {
++		compatible = "ti,tilcdc,slave";
++		i2c = <&i2c0>;
++		pinctrl-names = "default", "off";
++		pinctrl-0 = <&nxp_hdmi_bonelt_pins>;
++		pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>;
++		status = "okay";
++	};
++};
+commit d4cbe80db468dcfaa058f9f00a332784e5dff316
+Author: Suman Anna <s-anna at ti.com>
+Date:   Thu Oct 10 16:15:35 2013 -0500
+
+    ARM: dts: AM33XX: Add hwspinlock node
+    
+    Add the hwspinlock device tree node for AM33xx family
+    of SoCs.
+    
+    Signed-off-by: Suman Anna <s-anna at ti.com>
+    Signed-off-by: Tony Lindgren <tony at atomide.com>
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index 0ca13ad..9ae258e 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -288,6 +288,12 @@
+ 			status = "disabled";
+ 		};
+ 
++		hwspinlock: spinlock at 480ca000 {
++			compatible = "ti,omap4-hwspinlock";
++			reg = <0x480ca000 0x1000>;
++			ti,hwmods = "spinlock";
++		};
++
+ 		wdt2: wdt at 44e35000 {
+ 			compatible = "ti,omap3-wdt";
+ 			ti,hwmods = "wd_timer2";
diff --git a/arm-am33xx-bblack.patch b/arm-am33xx-bblack.patch
new file mode 100644
index 0000000..4f62c9d
--- /dev/null
+++ b/arm-am33xx-bblack.patch
@@ -0,0 +1,610 @@
+Bugzilla: 1012025
+Upstream-status: In beagle github repository https://github.com/beagleboard/kernel
+
+From 82fe302f565e00cfde3e96c6132df93b39525e7b Mon Sep 17 00:00:00 2001
+From: Philipp Zabel <p.zabel at pengutronix.de>
+Date: Tue, 28 May 2013 17:06:15 +0200
+Subject: [PATCH] reset: Add driver for gpio-controlled reset pins
+
+This driver implements a reset controller device that toggle a gpio
+connected to a reset pin of a peripheral IC. The delay between assertion
+and de-assertion of the reset signal can be configured via device tree.
+
+Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
+Reviewed-by: Stephen Warren <swarren at nvidia.com>
+---
+ .../devicetree/bindings/reset/gpio-reset.txt       |  35 +++++
+ drivers/reset/Kconfig                              |  11 ++
+ drivers/reset/Makefile                             |   1 +
+ drivers/reset/gpio-reset.c                         | 169 +++++++++++++++++++++
+ 4 files changed, 216 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/reset/gpio-reset.txt
+ create mode 100644 drivers/reset/gpio-reset.c
+
+diff --git a/Documentation/devicetree/bindings/reset/gpio-reset.txt b/Documentation/devicetree/bindings/reset/gpio-reset.txt
+new file mode 100644
+index 0000000..bca5348
+--- /dev/null
++++ b/Documentation/devicetree/bindings/reset/gpio-reset.txt
+@@ -0,0 +1,35 @@
++GPIO reset controller
++=====================
++
++A GPIO reset controller controls a single GPIO that is connected to the reset
++pin of a peripheral IC. Please also refer to reset.txt in this directory for
++common reset controller binding usage.
++
++Required properties:
++- compatible: Should be "gpio-reset"
++- reset-gpios: A gpio used as reset line. The gpio specifier for this property
++               depends on the gpio controller that provides the gpio.
++- #reset-cells: 0, see below
++
++Optional properties:
++- reset-delay-us: delay in microseconds. The gpio reset line will be asserted for
++                  this duration to reset.
++- initially-in-reset: boolean. If not set, the initial state should be a
++                      deasserted reset line. If this property exists, the
++                      reset line should be kept in reset.
++
++example:
++
++sii902x_reset: gpio-reset {
++	compatible = "gpio-reset";
++	reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
++	reset-delay-us = <10000>;
++	initially-in-reset;
++	#reset-cells = <0>;
++};
++
++/* Device with nRESET pin connected to GPIO5_0 */
++sii902x at 39 {
++	/* ... */
++	resets = <&sii902x_reset>; /* active-low GPIO5_0, 10 ms delay */
++};
+diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
+index c9d04f7..1a862df 100644
+--- a/drivers/reset/Kconfig
++++ b/drivers/reset/Kconfig
+@@ -11,3 +11,14 @@ menuconfig RESET_CONTROLLER
+ 	  via GPIOs or SoC-internal reset controller modules.
+ 
+ 	  If unsure, say no.
++
++if RESET_CONTROLLER
++
++config RESET_GPIO
++	tristate "GPIO reset controller support"
++	depends on GPIOLIB && OF
++	help
++	  This driver provides support for reset lines that are controlled
++	  directly by GPIOs.
++
++endif
+diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
+index 1e2d83f..b854f20 100644
+--- a/drivers/reset/Makefile
++++ b/drivers/reset/Makefile
+@@ -1 +1,2 @@
+ obj-$(CONFIG_RESET_CONTROLLER) += core.o
++obj-$(CONFIG_RESET_GPIO) += gpio-reset.o
+diff --git a/drivers/reset/gpio-reset.c b/drivers/reset/gpio-reset.c
+new file mode 100644
+index 0000000..acc1076
+--- /dev/null
++++ b/drivers/reset/gpio-reset.c
+@@ -0,0 +1,169 @@
++/*
++ * GPIO Reset Controller driver
++ *
++ * Copyright 2013 Philipp Zabel, Pengutronix
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++#include <linux/delay.h>
++#include <linux/err.h>
++#include <linux/gpio.h>
++#include <linux/module.h>
++#include <linux/of_gpio.h>
++#include <linux/platform_device.h>
++#include <linux/reset-controller.h>
++
++struct gpio_reset_data {
++	struct reset_controller_dev rcdev;
++	unsigned int gpio;
++	bool active_low;
++	u32 delay_us;
++};
++
++static void __gpio_reset_set(struct reset_controller_dev *rcdev, int asserted)
++{
++	struct gpio_reset_data *drvdata = container_of(rcdev,
++			struct gpio_reset_data, rcdev);
++	int value = asserted;
++
++	if (drvdata->active_low)
++		value = !value;
++
++	gpio_set_value(drvdata->gpio, value);
++}
++
++static int gpio_reset(struct reset_controller_dev *rcdev, unsigned long id)
++{
++	struct gpio_reset_data *drvdata = container_of(rcdev,
++			struct gpio_reset_data, rcdev);
++
++	if (drvdata->delay_us < 0)
++		return -ENOSYS;
++
++	__gpio_reset_set(rcdev, 1);
++	udelay(drvdata->delay_us);
++	__gpio_reset_set(rcdev, 0);
++
++	return 0;
++}
++
++static int gpio_reset_assert(struct reset_controller_dev *rcdev,
++		unsigned long id)
++{
++	__gpio_reset_set(rcdev, 1);
++
++	return 0;
++}
++
++static int gpio_reset_deassert(struct reset_controller_dev *rcdev,
++		unsigned long id)
++{
++	__gpio_reset_set(rcdev, 0);
++
++	return 0;
++}
++
++static struct reset_control_ops gpio_reset_ops = {
++	.reset = gpio_reset,
++	.assert = gpio_reset_assert,
++	.deassert = gpio_reset_deassert,
++};
++
++static int of_gpio_reset_xlate(struct reset_controller_dev *rcdev,
++			       const struct of_phandle_args *reset_spec)
++{
++	if (WARN_ON(reset_spec->args_count != 0))
++		return -EINVAL;
++
++	return 0;
++}
++
++static int gpio_reset_probe(struct platform_device *pdev)
++{
++	struct device_node *np = pdev->dev.of_node;
++	struct gpio_reset_data *drvdata;
++	enum of_gpio_flags flags;
++	unsigned long gpio_flags;
++	bool initially_in_reset;
++	int ret;
++
++	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
++	if (drvdata == NULL)
++		return -ENOMEM;
++
++	if (of_gpio_named_count(np, "reset-gpios") != 1)
++		return -EINVAL;
++
++	drvdata->gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags);
++	if (drvdata->gpio == -EPROBE_DEFER) {
++		return drvdata->gpio;
++	} else if (!gpio_is_valid(drvdata->gpio)) {
++		dev_err(&pdev->dev, "invalid reset gpio: %d\n", drvdata->gpio);
++		return drvdata->gpio;
++	}
++
++	drvdata->active_low = flags & OF_GPIO_ACTIVE_LOW;
++
++	ret = of_property_read_u32(np, "reset-delay-us", &drvdata->delay_us);
++	if (ret < 0)
++		return ret;
++
++	initially_in_reset = of_property_read_bool(np, "initially-in-reset");
++	if (drvdata->active_low ^ initially_in_reset)
++		gpio_flags = GPIOF_OUT_INIT_HIGH;
++	else
++		gpio_flags = GPIOF_OUT_INIT_LOW;
++
++	ret = devm_gpio_request_one(&pdev->dev, drvdata->gpio, gpio_flags, NULL);
++	if (ret < 0) {
++		dev_err(&pdev->dev, "failed to request gpio %d: %d\n",
++			drvdata->gpio, ret);
++		return ret;
++	}
++
++	drvdata->rcdev.of_node = np;
++	drvdata->rcdev.owner = THIS_MODULE;
++	drvdata->rcdev.nr_resets = 1;
++	drvdata->rcdev.ops = &gpio_reset_ops;
++	drvdata->rcdev.of_xlate = of_gpio_reset_xlate;
++	reset_controller_register(&drvdata->rcdev);
++
++	platform_set_drvdata(pdev, drvdata);
++
++	return 0;
++}
++
++static int gpio_reset_remove(struct platform_device *pdev)
++{
++	struct gpio_reset_data *drvdata = platform_get_drvdata(pdev);
++
++	reset_controller_unregister(&drvdata->rcdev);
++
++	return 0;
++}
++
++static struct of_device_id gpio_reset_dt_ids[] = {
++	{ .compatible = "gpio-reset" },
++	{ }
++};
++
++static struct platform_driver gpio_reset_driver = {
++	.probe = gpio_reset_probe,
++	.remove = gpio_reset_remove,
++	.driver = {
++		.name = "gpio-reset",
++		.owner = THIS_MODULE,
++		.of_match_table = of_match_ptr(gpio_reset_dt_ids),
++	},
++};
++
++module_platform_driver(gpio_reset_driver);
++
++MODULE_AUTHOR("Philipp Zabel <p.zabel at pengutronix.de>");
++MODULE_DESCRIPTION("gpio reset controller");
++MODULE_LICENSE("GPL");
++MODULE_ALIAS("platform:gpio-reset");
++MODULE_DEVICE_TABLE(of, gpio_reset_dt_ids);
+-- 
+1.8.2.1
+
+From 03664ac63b20b55af9522449bbad048476d259d5 Mon Sep 17 00:00:00 2001
+From: Joel Fernandes <joelf at ti.com>
+Date: Wed, 3 Jul 2013 17:29:44 -0500
+Subject: [PATCH 2/2] sound: soc: soc-dmaengine-pcm: Add support for new
+ DMAEngine request API
+
+Formerly these resources were coming HWMOD on OMAP-like SoCs. With the
+impending removal of HWMOD data, drivers are being converted to use the
+"of-dma" method of requesting DMA channels which from DT and can be obtained
+using the dma_request_slave_channel API. Add support to the soc-dmaengine-pcm
+helpers so that we can fetch and open channels using this method.
+
+Signed-off-by: Joel Fernandes <joelf at ti.com>
+---
+ sound/core/pcm_dmaengine.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
+index aa924d9..461fe4f 100644
+--- a/sound/core/pcm_dmaengine.c
++++ b/sound/core/pcm_dmaengine.c
+@@ -276,6 +276,16 @@ struct dma_chan *snd_dmaengine_pcm_request_channel(dma_filter_fn filter_fn,
+ }
+ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_request_channel);
+ 
++struct dma_chan *snd_dmaengine_pcm_request_slave_channel(
++	struct snd_pcm_substream *substream, char *name)
++{
++	struct snd_soc_pcm_runtime *rtd = substream->private_data;
++	struct device *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai);
++
++	return dma_request_slave_channel(dev, name);
++}
++EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_request_slave_channel);
++
+ /**
+  * snd_dmaengine_pcm_open - Open a dmaengine based PCM substream
+  * @substream: PCM substream
+@@ -334,6 +344,18 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
+ }
+ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan);
+ 
++int snd_dmaengine_pcm_open_request_slave_chan(struct snd_pcm_substream *substream, char *name)
++{
++	if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
++		return snd_dmaengine_pcm_open(substream,
++			    snd_dmaengine_pcm_request_slave_channel(substream, "tx"));
++	} else {
++		return snd_dmaengine_pcm_open(substream,
++			    snd_dmaengine_pcm_request_slave_channel(substream, "rx"));
++	}
++}
++EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_slave_chan);
++
+ /**
+  * snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
+  * @substream: PCM substream
+-- 
+1.8.4.rc3
+
+From ae38683badc8c80b29ccc8aa4e059f900b603551 Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <panto at antoniou-consulting.com>
+Date: Fri, 26 Oct 2012 15:48:00 +0300
+Subject: [PATCH 1/2] omap-hsmmc: Correct usage of of_find_node_by_name
+
+of_find_node_by_name expect to have the parent node reference taken.
+---
+ drivers/mmc/host/omap_hsmmc.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
+index 6ac63df..f5b660c 100644
+--- a/drivers/mmc/host/omap_hsmmc.c
++++ b/drivers/mmc/host/omap_hsmmc.c
+@@ -1893,6 +1893,16 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
+ 	 * as we want. */
+ 	mmc->max_segs = 1024;
+ 
++	/* Eventually we should get our max_segs limitation for EDMA by
++	 * querying the dmaengine API */
++	if (pdev->dev.of_node) {
++		struct device_node *parent = of_node_get(pdev->dev.of_node->parent);
++		struct device_node *node;
++		node = of_find_node_by_name(parent, "edma");
++		if (node)
++			mmc->max_segs = 16;
++	}
++
+ 	mmc->max_blk_size = 512;       /* Block Length at max can be 1024 */
+ 	mmc->max_blk_count = 0xFFFF;    /* No. of Blocks is 16 bits */
+ 	mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
+-- 
+1.8.2.1
+
+From 5d93a65cfc4ff6aaf78ab49f71daa2a644ea2ace Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <panto at antoniou-consulting.com>
+Date: Fri, 30 Nov 2012 12:18:16 +0200
+Subject: [PATCH 2/2] omap_hsmmc: Add reset gpio
+
+Add a gpio property for controlling reset of the mmc device.
+eMMC on the beaglebone black requires it.
+
+Signed-off-by: Pantelis Antoniou <panto at antoniou-consulting.com>
+---
+ drivers/mmc/host/omap_hsmmc.c          | 40 +++++++++++++++++++++++++++++++++-
+ include/linux/platform_data/mmc-omap.h |  3 +++
+ 2 files changed, 42 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
+index f5b660c..1bdb90f 100644
+--- a/drivers/mmc/host/omap_hsmmc.c
++++ b/drivers/mmc/host/omap_hsmmc.c
+@@ -41,6 +41,8 @@
+ #include <linux/pinctrl/consumer.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/platform_data/mmc-omap.h>
++#include <linux/pinctrl/consumer.h>
++#include <linux/err.h>
+ 
+ /* OMAP HSMMC Host Controller Registers */
+ #define OMAP_HSMMC_SYSSTATUS	0x0014
+@@ -392,6 +394,7 @@ static inline int omap_hsmmc_have_reg(void)
+ static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
+ {
+ 	int ret;
++	unsigned long flags;
+ 
+ 	if (gpio_is_valid(pdata->slots[0].switch_pin)) {
+ 		if (pdata->slots[0].cover)
+@@ -421,6 +424,24 @@ static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
+ 	} else
+ 		pdata->slots[0].gpio_wp = -EINVAL;
+ 
++	if (gpio_is_valid(pdata->slots[0].gpio_reset)) {
++		flags = pdata->slots[0].gpio_reset_active_low ?
++				GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
++		ret = gpio_request_one(pdata->slots[0].gpio_reset, flags,
++				"mmc_reset");
++		if (ret)
++			goto err_free_wp;
++
++		/* hold reset */
++		udelay(pdata->slots[0].gpio_reset_hold_us);
++
++		gpio_set_value(pdata->slots[0].gpio_reset,
++				!pdata->slots[0].gpio_reset_active_low);
++
++	} else
++		pdata->slots[0].gpio_reset = -EINVAL;
++
++
+ 	return 0;
+ 
+ err_free_wp:
+@@ -434,6 +455,8 @@ err_free_sp:
+ 
+ static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
+ {
++	if (gpio_is_valid(pdata->slots[0].gpio_reset))
++		gpio_free(pdata->slots[0].gpio_reset);
+ 	if (gpio_is_valid(pdata->slots[0].gpio_wp))
+ 		gpio_free(pdata->slots[0].gpio_wp);
+ 	if (gpio_is_valid(pdata->slots[0].switch_pin))
+@@ -788,7 +811,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
+ 	 * ac, bc, adtc, bcr. Only commands ending an open ended transfer need
+ 	 * a val of 0x3, rest 0x0.
+ 	 */
+-	if (cmd == host->mrq->stop)
++	if (host->mrq && cmd == host->mrq->stop)
+ 		cmdtype = 0x3;
+ 
+ 	cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22);
+@@ -830,6 +853,8 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req
+ 	int dma_ch;
+ 	unsigned long flags;
+ 
++	BUG_ON(mrq == NULL);
++
+ 	spin_lock_irqsave(&host->irq_lock, flags);
+ 	host->req_in_progress = 0;
+ 	dma_ch = host->dma_ch;
+@@ -1720,6 +1745,7 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
+ 	struct device_node *np = dev->of_node;
+ 	u32 bus_width, max_freq;
+ 	int cd_gpio, wp_gpio;
++	enum of_gpio_flags reset_flags;
+ 
+ 	cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
+ 	wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
+@@ -1737,6 +1763,14 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
+ 	pdata->nr_slots = 1;
+ 	pdata->slots[0].switch_pin = cd_gpio;
+ 	pdata->slots[0].gpio_wp = wp_gpio;
++	reset_flags = 0;
++	pdata->slots[0].gpio_reset = of_get_named_gpio_flags(np,
++			"reset-gpios", 0, &reset_flags);
++	pdata->slots[0].gpio_reset_active_low =
++		(reset_flags & OF_GPIO_ACTIVE_LOW) != 0;
++	pdata->slots[0].gpio_reset_hold_us = 100;	/* default */
++	of_property_read_u32(np, "reset-gpio-hold-us",
++			&pdata->slots[0].gpio_reset_hold_us);
+ 
+ 	if (of_find_property(np, "ti,non-removable", NULL)) {
+ 		pdata->slots[0].nonremovable = true;
+@@ -1802,6 +1836,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
+ 		return -ENXIO;
+ 	}
+ 
++	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
++	if (IS_ERR(pinctrl))
++		dev_warn(&pdev->dev, "unable to select pin group\n");
++
+ 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ 	irq = platform_get_irq(pdev, 0);
+ 	if (res == NULL || irq < 0)
+diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
+index 2bf1b30..d548994 100644
+--- a/include/linux/platform_data/mmc-omap.h
++++ b/include/linux/platform_data/mmc-omap.h
+@@ -115,6 +115,9 @@ struct omap_mmc_platform_data {
+ 
+ 		int switch_pin;			/* gpio (card detect) */
+ 		int gpio_wp;			/* gpio (write protect) */
++		int gpio_reset;			/* gpio (reset) */
++		int gpio_reset_active_low;	/* 1 if reset is active low */
++		u32 gpio_reset_hold_us;		/* time to hold in us */
+ 
+ 		int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
+ 		int (*set_power)(struct device *dev, int slot,
+-- 
+1.8.2.1
+
+From b45e4df71f07f2178db133db540e3f15e0b4ec05 Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <panto at antoniou-consulting.com>
+Date: Sat, 15 Sep 2012 12:00:41 +0300
+Subject: [PATCH] pinctrl: pinctrl-single must be initialized early.
+
+When using pinctrl-single to handle i2c initialization, it has
+to be done early. Whether this is the best way to do so, is an
+exercise left to the reader.
+---
+ drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
+index a82ace4..aeef35d 100644
+--- a/drivers/pinctrl/pinctrl-single.c
++++ b/drivers/pinctrl/pinctrl-single.c
+@@ -1673,7 +1673,17 @@ static struct platform_driver pcs_driver = {
+ #endif
+ };
+ 
+-module_platform_driver(pcs_driver);
++static int __init pcs_init(void)
++{
++	return platform_driver_register(&pcs_driver);
++}
++postcore_initcall(pcs_init);
++
++static void __exit pcs_exit(void)
++{
++	platform_driver_unregister(&pcs_driver);
++}
++module_exit(pcs_exit);
+ 
+ MODULE_AUTHOR("Tony Lindgren <tony at atomide.com>");
+ MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");
+-- 
+1.8.2.1
+
+From e5e7abd2de7d8d4c74b5a1ccc6d47988250bd17d Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <panto at antoniou-consulting.com>
+Date: Fri, 28 Jun 2013 18:39:55 +0300
+Subject: [PATCH 1/4] dts: beaglebone: Add I2C definitions for EEPROMs & capes
+
+Add the I2C definitions for the EEPROM devices on the baseboard
+and on the possibly connected capes.
+
+Signed-off-by: Pantelis Antoniou <panto at antoniou-consulting.com>
+---
+ arch/arm/boot/dts/am335x-bone-common.dtsi | 39 +++++++++++++++++++++++++++++++
+ 1 file changed, 39 insertions(+)
+
+diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
+index e3f27ec..2d12775 100644
+--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
++++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
+@@ -84,6 +84,13 @@
+ 		>;
+ 	};
+ 
++	i2c2_pins: pinmux_i2c2_pins {
++		pinctrl-single,pins = <
++			0x178 0x73 	/* uart1_ctsn.i2c2_sda, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
++			0x17c 0x73	/* uart1_rtsn.i2c2_scl, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
++		>;
++	};
++
+ 	uart0_pins: pinmux_uart0_pins {
+ 		pinctrl-single,pins = <
+ 			0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
+@@ -220,6 +227,38 @@
+ 		reg = <0x24>;
+ 	};
+ 
++	baseboard_eeprom: baseboard_eeprom at 50 {
++		compatible = "at,24c256";
++		reg = <0x50>;
++	};
++};
++
++&i2c2 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2c2_pins>;
++
++	status = "okay";
++	clock-frequency = <100000>;
++
++	cape_eeprom0: cape_eeprom0 at 54 {
++		compatible = "at,24c256";
++		reg = <0x54>;
++	};
++
++	cape_eeprom1: cape_eeprom1 at 55 {
++		compatible = "at,24c256";
++		reg = <0x55>;
++	};
++
++	cape_eeprom2: cape_eeprom2 at 56 {
++		compatible = "at,24c256";
++		reg = <0x56>;
++	};
++
++	cape_eeprom3: cape_eeprom3 at 57 {
++		compatible = "at,24c256";
++		reg = <0x57>;
++	};
+ };
+ 
+ /include/ "tps65217.dtsi"
+-- 
+1.8.4.rc3
diff --git a/arm-am33xx-cpsw.patch b/arm-am33xx-cpsw.patch
new file mode 100644
index 0000000..1a38cdd
--- /dev/null
+++ b/arm-am33xx-cpsw.patch
@@ -0,0 +1,23 @@
+Bugzilla: 1012025
+Upstream-status: An initial work around for the cpsw driver issue trying to access HW registers
+with clock disabled. Upstream is working on a proper fix with the hope to land it in 3.13.
+
+--- linux-3.12.4-1.fc20.x86_64/drivers/net/ethernet/ti/cpsw.c.orig	2013-12-11 20:52:41.576478796 +0000
++++ linux-3.12.4-1.fc20.x86_64/drivers/net/ethernet/ti/cpsw.c	2013-12-11 20:55:14.418692261 +0000
+@@ -2001,6 +2001,8 @@
+ 		goto clean_cpsw_iores_ret;
+ 	}
+ 	priv->regs = ss_regs;
++
++	pm_runtime_get_sync(&pdev->dev);
+ 	priv->version = __raw_readl(&priv->regs->id_ver);
+ 	priv->host_port = HOST_PORT_NUM;
+ 
+@@ -2161,6 +2163,7 @@
+ 			goto clean_irq_ret;
+ 		}
+ 	}
++	pm_runtime_put_sync(&pdev->dev);
+ 
+ 	return 0;
+ 
diff --git a/arm-imx6-utilite.patch b/arm-imx6-utilite.patch
new file mode 100644
index 0000000..58a839a
--- /dev/null
+++ b/arm-imx6-utilite.patch
@@ -0,0 +1,95 @@
+Add initial support for cm-fx6 module.
+
+cm-fx6 is a module based on mx6q SoC with the following features:
+- Up to 4GB of DDR3
+- 1 LCD/DVI output port
+- 1 HDMI output port
+- 2 LVDS LCD ports
+- Gigabit Ethernet
+- Analog Audio
+- CAN
+- SATA
+- NAND
+- PCIE
+
+This patch allows to boot up the module, configures the serial console,
+the Ethernet adapter and the hearbeat led.
+
+Signed-off-by: Valentin Raevsky <valentin at xxxxxxxxxxxxxx>
+Acked-by: Igor Grinberg <grinberg at xxxxxxxxxxxxxx>
+---
+ arch/arm/boot/dts/imx6q-cm-fx6.dts |   51 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 51 insertions(+)
+ create mode 100644 arch/arm/boot/dts/imx6q-cm-fx6.dts
+
+diff --git a/arch/arm/boot/dts/imx6q-cm-fx6.dts b/arch/arm/boot/dts/imx6q-cm-fx6.dts
+new file mode 100644
+index 0000000..1080215
+--- /dev/null
++++ b/arch/arm/boot/dts/imx6q-cm-fx6.dts
+@@ -0,0 +1,51 @@
++/*
++ * Copyright 2013 CompuLab Ltd.
++ *
++ * The code contained herein is licensed under the GNU General Public
++ * License. You may obtain a copy of the GNU General Public License
++ * Version 2 or later at the following locations:
++ *
++ * http://www.opensource.org/licenses/gpl-license.html
++ * http://www.gnu.org/copyleft/gpl.html
++ */
++
++/dts-v1/;
++#include "imx6q.dtsi"
++
++/ {
++	model = "CompuLab CM-FX6";
++	compatible = "compulab,cm-fx6", "fsl,imx6q";
++
++	memory {
++		reg = <0x10000000 0x80000000>;
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		debug-led {
++			label = "Heartbeat";
++			gpios = <&gpio2 31 0>;
++			linux,default-trigger = "heartbeat";
++		};
++	};
++};
++
++&gpmi {
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinctrl_gpmi_nand_1>;
++	status = "okay";
++};
++
++&fec {
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinctrl_enet_1>;
++	phy-mode = "rgmii";
++	status = "okay";
++};
++
++&uart4 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinctrl_uart4_1>;
++	status = "okay";
++};
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -137,6 +137,7 @@
+ 	imx6dl-sabresd.dtb \
+ 	imx6dl-wandboard.dtb \
+ 	imx6q-arm2.dtb \
++	imx6q-cm-fx6.dtb \
+ 	imx6q-phytec-pbab01.dtb \
+ 	imx6q-sabreauto.dtb \
+ 	imx6q-sabrelite.dtb \
+-- 
+1.7.9.5
+
diff --git a/arm-omap-load-tfp410.patch b/arm-omap-load-tfp410.patch
index 0f2ba54..3ef21a0 100644
--- a/arm-omap-load-tfp410.patch
+++ b/arm-omap-load-tfp410.patch
@@ -1,14 +1,14 @@
-diff -urNp linux-3.9.4-300.fc19.armv7hl_orig/drivers/video/omap2/dss/core.c linux-3.9.4-300.fc19.armv7hl/drivers/video/omap2/dss/core.c
---- linux-3.9.4-300.fc19.armv7hl_orig/drivers/video/omap2/dss/core.c	2013-04-28 20:36:01.000000000 -0400
-+++ linux-3.9.4-300.fc19.armv7hl/drivers/video/omap2/dss/core.c	2013-05-31 12:24:07.711334359 -0400
-@@ -596,6 +596,9 @@ static int __init omap_dss_init(void)
- {
- 	int r;
- 
-+	/* hack to load panel-tfp410 driver */
-+	request_module("panel-tfp410");
-+
- 	r = omap_dss_bus_register();
- 	if (r)
- 		return r;
-Binary files linux-3.9.4-300.fc19.armv7hl_orig/drivers/video/omap2/dss/.Makefile.swp and linux-3.9.4-300.fc19.armv7hl/drivers/video/omap2/dss/.Makefile.swp differ
+diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
+index 60d3958..0e304ce 100644
+--- a/drivers/video/omap2/dss/core.c
++++ b/drivers/video/omap2/dss/core.c
+@@ -298,6 +298,9 @@ static int __init omap_dss_init(void)
+ 	int r;
+ 	int i;
+ 
++	/* hack to load encoder-tfp410 driver */
++	request_module("encoder-tfp410");
++
+ 	r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
+ 	if (r)
+ 		return r;
diff --git a/config-arm-generic b/config-arm-generic
index 64561f8..a0cf6e6 100644
--- a/config-arm-generic
+++ b/config-arm-generic
@@ -7,7 +7,13 @@ CONFIG_HW_PERF_EVENTS=y
 CONFIG_MMC=y
 CONFIG_NFS_FS=y
 # CONFIG_PID_IN_CONTEXTIDR is not set
+
 CONFIG_PWM=y
+CONFIG_PWM_SYSFS=y
+
+CONFIG_RESET_CONTROLLER=y
+CONFIG_RESET_GPIO=y
+
 CONFIG_RCU_FANOUT_LEAF=16
 # CONFIG_RTC_DRV_SNVS is not set
 CONFIG_BACKLIGHT_PWM=m
@@ -17,6 +23,7 @@ CONFIG_ARM_ARCH_TIMER=y
 # CONFIG_ARM_DT_BL_CPUFREQ is not set
 CONFIG_NR_CPUS=8
 CONFIG_ARM_DMA_USE_IOMMU=y
+CONFIG_DMA_VIRTUAL_CHANNELS=y
 
 # ARM AMBA generic HW
 CONFIG_ARM_AMBA=y
@@ -44,10 +51,11 @@ CONFIG_PROC_DEVICETREE=y
 CONFIG_OF=y
 CONFIG_OF_ADDRESS=y
 CONFIG_OF_DEVICE=y
+CONFIG_OF_DYNAMIC=y
 CONFIG_OF_EARLY_FLATTREE=y
 CONFIG_OF_FLATTREE=y
 CONFIG_OF_GPIO=y
-CONFIG_OF_I2C=y
+CONFIG_OF_I2C=m
 CONFIG_OF_IRQ=y
 CONFIG_OF_MDIO=m
 CONFIG_OF_MTD=y
@@ -61,6 +69,7 @@ CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_EXTCON=m
 CONFIG_OF_EXTCON=m
 CONFIG_EXTCON_GPIO=m
+CONFIG_EXTCON_ADC_JACK=m
 
 # MTD
 CONFIG_MTD_BLKDEVS=m
@@ -75,14 +84,29 @@ CONFIG_MTD_OF_PARTS=m
 CONFIG_MTD_PHYSMAP=m
 CONFIG_MTD_PHYSMAP_OF=m
 # CONFIG_MTD_PHYSMAP_COMPAT is not set
-CONFIG_OF_MTD=y
 
 # GPIO
-CONFIG_GENERIC_GPIO=y
+CONFIG_GPIO_DEVRES=y
+CONFIG_GPIO_GENERIC=m
 CONFIG_GPIOLIB=y
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_MDIO_GPIO=m
 CONFIG_POWER_RESET_GPIO=y
+CONFIG_POWER_RESET_RESTART=y
+
+#i2c
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_GPIO=m
+CONFIG_I2C_MUX=m
+# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set
+CONFIG_I2C_MUX_GPIO=m
+CONFIG_I2C_MUX_PINCTRL=m
+CONFIG_I2C_MUX_PCA9541=m
+
+# Sensors
+CONFIG_SENSORS_IIO_HWMON=m
+CONFIG_IIO_SYSFS_TRIGGER=m
 
 # MFD
 CONFIG_MFD_CORE=m
@@ -101,9 +125,6 @@ CONFIG_SMC911X=m
 # CONFIG_IRQ_DOMAIN_DEBUG is not set
 # CONFIG_LEDS_RENESAS_TPU is not set
 # CONFIG_LOCK_STAT is not set
-# CONFIG_PCIEPORTBUS is not set
-
-CONFIG_I2C=y
 
 ### turn off things which make no sense on embedded SoC
 
diff --git a/config-arm64 b/config-arm64
index 46cf830..8502950 100644
--- a/config-arm64
+++ b/config-arm64
@@ -30,7 +30,6 @@ CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_IO=y
 CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GPIO_DEVRES=y
 CONFIG_HAVE_64BIT_ALIGNED_ACCESS=y
 CONFIG_HAVE_ARCH_PFN_VALID=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
@@ -67,7 +66,6 @@ CONFIG_VM_EVENT_COUNTERS=y
 # not arm64
 # CONFIG_HW_RANDOM_ATMEL is not set
 # CONFIG_HW_RANDOM_EXYNOS is not set
-# CONFIG_GPIO_GENERIC_PLATFORM is not set
 # CONFIG_GPIO_ADNP is not set
 # CONFIG_GPIO_MCP23S08 is not set
 # CONFIG_MDIO_BUS_MUX_GPIO is not set
@@ -81,33 +79,4 @@ CONFIG_VM_EVENT_COUNTERS=y
 #  dma issues in headers
 # CONFIG_PARPORT_PC is not set
 # CONFIG_VGA_CONSOLE is not set
-
-# CONFIG_CHARGER_MAX8997 is not set
-# CONFIG_MFD_AS3711 is not set
-# CONFIG_PMIC_ADP5520 is not set
-# CONFIG_MFD_AAT2870_CORE is not set
-# CONFIG_PMIC_DA903X is not set
-# CONFIG_MFD_DA9052_I2C is not set
-# CONFIG_MFD_DA9055 is not set
-# CONFIG_MFD_88PM800 is not set
-# CONFIG_MFD_88PM805 is not set
-# CONFIG_MFD_MAX77686 is not set
-# CONFIG_MFD_MAX77693 is not set
-# CONFIG_MFD_MAX8907 is not set
-# CONFIG_MFD_RC5T583 is not set
-# CONFIG_MFD_SMSC is not set
-# CONFIG_MFD_LP8788 is not set
-# CONFIG_MFD_PALMAS is not set
-# CONFIG_MFD_TPS65090 is not set
-# CONFIG_MFD_TPS65910 is not set
-# CONFIG_MFD_TPS65912_I2C is not set
-# CONFIG_MFD_TPS80031 is not set
-# CONFIG_TWL4030_CORE is not set
-# CONFIG_TWL6040_CORE is not set
-# CONFIG_REGULATOR_LP872X is not set
-# CONFIG_REGULATOR_S2MPS11 is not set
-# CONFIG_LEDS_MAX8997 is not set
-# CONFIG_RTC_DRV_MAX8997 is not set
-# CONFIG_EXTCON_MAX8997 is not set
-# CONFIG_MFD_MAX8997 is not set
-# CONFIG_MFD_SEC_CORE is not set
+CONFIG_POWER_RESET_XGENE=y
diff --git a/config-armv7 b/config-armv7
index 4fca3bb..5df800c 100644
--- a/config-armv7
+++ b/config-armv7
@@ -10,7 +10,7 @@ CONFIG_ARCH_ROCKCHIP=y
 CONFIG_ARCH_SOCFPGA=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_TEGRA=y
-# CONFIG_ARCH_U8500 is not set
+CONFIG_ARCH_U8500=y
 # CONFIG_ARCH_VIRT is not set
 CONFIG_ARCH_ZYNQ=y
 
@@ -19,9 +19,6 @@ CONFIG_ARCH_ZYNQ=y
 # CONFIG_XEN is not set
 # CONFIG_ARM_VIRT_EXT is not set
 
-# Generic
-CONFIG_REMOTEPROC=m
-
 # mvebu
 CONFIG_MACH_ARMADA_370_XP=y
 CONFIG_MACH_ARMADA_370=y
@@ -58,12 +55,11 @@ CONFIG_ARCH_OMAP2PLUS_TYPICAL=y
 CONFIG_ARCH_OMAP3=y
 CONFIG_ARCH_OMAP4=y
 CONFIG_SOC_OMAP5=y
+# CONFIG_SOC_DRA7XX is not set
 # CONFIG_SOC_OMAP2420 is not set
 # CONFIG_SOC_OMAP2430 is not set
 CONFIG_SOC_OMAP3430=y
 CONFIG_SOC_TI81XX=y
-CONFIG_SOC_AM33XX=y
-CONFIG_SOC_AM43XX=y
 CONFIG_MACH_OMAP_GENERIC=y
 CONFIG_MACH_OMAP3_BEAGLE=y
 CONFIG_MACH_DEVKIT8000=y
@@ -71,8 +67,8 @@ CONFIG_MACH_OMAP_LDP=y
 CONFIG_MACH_OMAP3530_LV_SOM=y
 CONFIG_MACH_OMAP3_TORPEDO=y
 CONFIG_MACH_OVERO=y
-CONFIG_MACH_OMAP3EVM=y
-CONFIG_MACH_OMAP3517EVM=y
+# CONFIG_MACH_OMAP3EVM is not set
+# CONFIG_MACH_OMAP3517EVM is not set
 CONFIG_MACH_CRANEBOARD=y
 CONFIG_MACH_OMAP3_PANDORA=y
 CONFIG_MACH_TOUCHBOOK=y
@@ -87,8 +83,8 @@ CONFIG_MACH_CM_T3517=y
 CONFIG_MACH_IGEP0030=y
 CONFIG_MACH_SBC3530=y
 CONFIG_MACH_OMAP_3630SDP=y
-CONFIG_MACH_TI8168EVM=y
-CONFIG_MACH_TI8148EVM=y
+# CONFIG_MACH_TI8168EVM is not set
+# CONFIG_MACH_TI8148EVM is not set
 
 CONFIG_SOC_HAS_REALTIME_COUNTER=y
 CONFIG_OMAP_RESET_CLOCKS=y
@@ -113,17 +109,6 @@ CONFIG_OMAP3_EMU=y
 CONFIG_OMAP_WATCHDOG=m
 CONFIG_TWL4030_WATCHDOG=m
 
-CONFIG_TI_ST=m
-CONFIG_TI_EDMA=y
-CONFIG_TI_DAC7512=m
-CONFIG_TI_DAVINCI_EMAC=y
-CONFIG_TI_DAVINCI_MDIO=y
-CONFIG_TI_DAVINCI_CPDMA=y
-CONFIG_TI_CPSW=y
-CONFIG_TI_CPTS=y
-CONFIG_TI_EMIF=m
-CONFIG_REGULATOR_TI_ABB=y
-
 CONFIG_SERIAL_OMAP=y
 CONFIG_SERIAL_OMAP_CONSOLE=y
 
@@ -136,31 +121,26 @@ CONFIG_TWL4030_CORE=y
 CONFIG_TWL4030_MADC=m
 CONFIG_TWL4030_POWER=y
 CONFIG_TWL4030_WATCHDOG=m
+CONFIG_BATTERY_TWL4030_MADC=m
+CONFIG_OMAP_USB2=m
+CONFIG_OMAP_USB3=m
 CONFIG_TWL4030_USB=m
 CONFIG_TWL6030_USB=m
 CONFIG_TWL6030_PWM=m
 CONFIG_TWL6040_CORE=y
 CONFIG_CLK_TWL6040=m
 CONFIG_OMAP_INTERCONNECT=m
-CONFIG_MFD_TI_AM335X_TSCADC=y
 CONFIG_MFD_OMAP_USB_HOST=y
 CONFIG_MTD_ONENAND_OMAP2=m
 CONFIG_HDQ_MASTER_OMAP=m
 CONFIG_REGULATOR_TWL4030=y
 CONFIG_BACKLIGHT_PANDORA=m
 CONFIG_OMAP_OCP2SCP=m
-CONFIG_OMAP_USB2=m
-CONFIG_OMAP_USB3=m
 CONFIG_USB_EHCI_HCD_OMAP=m
 CONFIG_USB_OHCI_HCD_PLATFORM=m
 CONFIG_USB_OHCI_HCD_OMAP3=y
 CONFIG_USB_MUSB_AM35X=m
 CONFIG_USB_MUSB_OMAP2PLUS=m
-CONFIG_USB_TI_CPPI41_DMA=m
-CONFIG_AM335X_PHY_USB=m
-CONFIG_USB_MUSB_HDRC=m
-# CONFIG_USB_GADGET_MUSB_HDRC is not set
-# CONFIG_USB_MUSB_DEBUG is not set
 CONFIG_OMAP_CONTROL_USB=m
 CONFIG_MMC_OMAP=y
 CONFIG_MMC_OMAP_HS=y
@@ -169,6 +149,7 @@ CONFIG_RTC_DRV_MAX8907=m
 CONFIG_RTC_DRV_TWL4030=y
 CONFIG_RTC_DRV_OMAP=y
 CONFIG_SENSORS_TWL4030_MADC=m
+CONFIG_TWL6030_GPADC=m
 
 # OMAP5 (possibly other devices too)
 CONFIG_MFD_PALMAS=y
@@ -181,19 +162,16 @@ CONFIG_GPIO_PALMAS=y
 CONFIG_WL_TI=y
 CONFIG_WLCORE_SDIO=m
 CONFIG_WLCORE_SPI=m
-CONFIG_WL1251_SPI=m
-CONFIG_WL12XX_SPI=m
-CONFIG_WL12XX_SDIO_TEST=m
 CONFIG_WL18XX=m
 CONFIG_WILINK_PLATFORM_DATA=y
 CONFIG_MFD_WL1273_CORE=m
 CONFIG_NFC_WILINK=m
 
 CONFIG_MTD_NAND_OMAP2=m
-CONFIG_SPI_DAVINCI=m
 CONFIG_SPI_OMAP24XX=m
 CONFIG_MFD_TI_SSP=m
 CONFIG_SPI_TI_SSP=m
+CONFIG_SPI_TI_QSPI=m
 
 CONFIG_INPUT_TWL4030_PWRBUTTON=m
 CONFIG_INPUT_TWL4030_VIBRA=m
@@ -225,7 +203,6 @@ CONFIG_CRYPTO_DEV_OMAP_SHAM=m
 CONFIG_CRYPTO_DEV_OMAP_AES=m
 CONFIG_HW_RANDOM_OMAP=m
 
-CONFIG_DRM_TILCDC=m
 CONFIG_DRM_OMAP=m
 CONFIG_DRM_OMAP_NUM_CRTCS=2
 CONFIG_OMAP2_VRFB=y
@@ -248,17 +225,6 @@ CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=0
 CONFIG_OMAP2_DSS_SLEEP_BEFORE_RESET=y
 CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y
 
-CONFIG_PANEL_GENERIC_DPI=m
-CONFIG_PANEL_TFP410=m
-CONFIG_PANEL_SHARP_LS037V7DW01=m
-CONFIG_PANEL_PICODLP=m
-CONFIG_PANEL_TAAL=m
-CONFIG_PANEL_NEC_NL8048HL11_01B=m
-CONFIG_PANEL_TPO_TD043MTEA1=m
-CONFIG_PANEL_LGPHILIPS_LB035Q02=m
-CONFIG_PANEL_ACX565AKM=m
-# CONFIG_PANEL_N8X0 is not set
-
 CONFIG_DISPLAY_ENCODER_TFP410=m
 CONFIG_DISPLAY_ENCODER_TPD12S015=m
 CONFIG_DISPLAY_CONNECTOR_DVI=m
@@ -293,6 +259,7 @@ CONFIG_SND_OMAP_SOC=m
 CONFIG_SND_SOC_I2C_AND_SPI=m
 CONFIG_SND_OMAP_SOC_AM3517EVM=m
 CONFIG_SND_OMAP_SOC_DMIC=m
+CONFIG_SND_OMAP_SOC_HDMI=m
 CONFIG_SND_OMAP_SOC_IGEP0020=m
 CONFIG_SND_OMAP_SOC_MCBSP=m
 CONFIG_SND_OMAP_SOC_MCPDM=m
@@ -329,13 +296,43 @@ CONFIG_OMAP_REMOTEPROC=m
 # CONFIG_OMAP_MUX_DEBUG is not set
 # CONFIG_VIDEO_OMAP3_DEBUG is not set
 
+# AM33xx
+CONFIG_SOC_AM33XX=y
+CONFIG_SOC_AM43XX=y
+CONFIG_AM335X_CONTROL_USB=m
+CONFIG_AM335X_PHY_USB=m
+CONFIG_USB_MUSB_AM335X_CHILD=y
+CONFIG_MFD_TI_AM335X_TSCADC=m
+CONFIG_TI_ST=m
+CONFIG_TI_DAC7512=m
+CONFIG_TI_DAVINCI_EMAC=m
+CONFIG_TI_DAVINCI_MDIO=m
+CONFIG_TI_DAVINCI_CPDMA=m
+CONFIG_TI_CPSW=m
+CONFIG_TI_CPTS=y
+CONFIG_TI_EMIF=m
+CONFIG_DRM_TILCDC=m
+CONFIG_SPI_DAVINCI=m
+CONFIG_REGULATOR_TI_ABB=m
+CONFIG_TI_PRIV_EDMA=y
+CONFIG_TI_EDMA=y
+# Terribly unstable so disable for now
+# CONFIG_USB_TI_CPPI41_DMA is not set
+# CONFIG_TI_CPPI41 is not set
+CONFIG_MFD_TI_AM335X_TSCADC=m
+CONFIG_CHARGER_BQ24190=m
+CONFIG_TI_ADC081C=m
+CONFIG_TI_AM335X_ADC=m
+CONFIG_PWM_TIPWMSS=y
+
 # Allwinner a1x
 CONFIG_PINCTRL_SUNXI=y
+CONFIG_SUNXI_WATCHDOG=m
 CONFIG_MDIO_SUN4I=m
 CONFIG_NET_VENDOR_ALLWINNER=y
 CONFIG_SUN4I_EMAC=m
 
-# imx 
+# i.MX
 CONFIG_MXC_IRQ_PRIOR=y
 # CONFIG_MXC_DEBUG_BOARD is not set
 CONFIG_SOC_IMX53=y
@@ -345,6 +342,7 @@ CONFIG_MACH_IMX51_DT=y
 # CONFIG_MACH_MX51_BABBAGE is not set
 # CONFIG_MACH_EUKREA_CPUIMX51SD is not set
 CONFIG_ARM_IMX6Q_CPUFREQ=m
+CONFIG_IMX_THERMAL=m
 CONFIG_PATA_IMX=m
 CONFIG_USB_CHIPIDEA=m
 CONFIG_USB_CHIPIDEA_UDC=y
@@ -356,6 +354,7 @@ CONFIG_FEC=m
 CONFIG_KEYBOARD_IMX=m
 CONFIG_SERIAL_IMX=y
 CONFIG_SERIAL_IMX_CONSOLE=y
+CONFIG_PINCTRL_IMX6SL=y
 CONFIG_I2C_IMX=m
 CONFIG_SPI_IMX=m
 CONFIG_MFD_MC13783=m
@@ -365,6 +364,7 @@ CONFIG_IMX_WEIM=y
 CONFIG_IMX2_WDT=m
 CONFIG_HW_RANDOM_MXC_RNGA=m
 CONFIG_CRYPTO_DEV_SAHARA=m
+CONFIG_RTC_DRV_SNVS=m
 # CONFIG_FB_MX3 is not set
 
 CONFIG_SND_IMX_SOC=m
@@ -377,6 +377,7 @@ CONFIG_SND_SOC_IMX_PCM_DMA=m
 CONFIG_SND_SOC_IMX_SGTL5000=m
 CONFIG_SND_SOC_IMX_WM8962=m
 CONFIG_SND_SOC_IMX_MC13783=m
+CONFIG_SND_SOC_IMX_SPDIF=m
 
 CONFIG_USB_EHCI_MXC=m
 CONFIG_USB_IMX21_HCD=m
@@ -398,6 +399,7 @@ CONFIG_PWM_IMX=m
 CONFIG_BACKLIGHT_PWM=m
 CONFIG_DRM_IMX=m
 CONFIG_DRM_IMX_FB_HELPER=m
+CONFIG_DRM_IMX_HDMI=m
 CONFIG_DRM_IMX_IPUV3_CORE=m
 CONFIG_DRM_IMX_IPUV3=m
 # CONFIG_DRM_IMX_LDB is not set
@@ -412,11 +414,12 @@ CONFIG_REGULATOR_MC13783=m
 CONFIG_REGULATOR_MC13892=m
 CONFIG_LEDS_MC13783=m
 CONFIG_RTC_DRV_MC13XXX=m
+CONFIG_CAN_FLEXCAN=m
 
 CONFIG_INPUT_PWM_BEEPER=m
 CONFIG_INPUT_88PM80X_ONKEY=m
 
-# i.MX6Q (and likely Samsung among others)
+# i.MX6Q (and likely Samsung among others) 
 CONFIG_MFD_DA9052_I2C=y
 CONFIG_MFD_DA9052_SPI=y
 CONFIG_MFD_DA9055=y
@@ -437,11 +440,6 @@ CONFIG_RTC_DRV_DA9055=m
 CONFIG_REGULATOR_DA9052=m
 CONFIG_REGULATOR_DA9055=m
 
-# exynos
-# CONFIG_DRM_EXYNOS is not set
-# CONFIG_PINCTRL_EXYNOS5440 is not set
-# CONFIG_PINCTRL_EXYNOS is not set
-
 # picoxcell
 CONFIG_CRYPTO_DEV_PICOXCELL=m
 CONFIG_HW_RANDOM_PICOXCELL=m
@@ -452,6 +450,7 @@ CONFIG_MACH_SNOWBALL=y
 CONFIG_MACH_UX500_DT=y
 
 CONFIG_ABX500_CORE=y
+CONFIG_ARM_U8500_CPUIDLE=y
 CONFIG_UX500_DEBUG_UART=2
 CONFIG_AB8500_CORE=y
 CONFIG_STE_DMA40=y
@@ -485,6 +484,19 @@ CONFIG_CW1200=m
 CONFIG_CW1200_WLAN_SDIO=m
 CONFIG_CW1200_WLAN_SPI=m
 CONFIG_UX500_WATCHDOG=m
+CONFIG_IIO_ST_ACCEL_3AXIS=m
+CONFIG_IIO_ST_GYRO_3AXIS=m
+CONFIG_IIO_ST_GYRO_I2C_3AXIS=m
+CONFIG_IIO_ST_GYRO_SPI_3AXIS=m
+CONFIG_IIO_ST_MAGN_3AXIS=m
+CONFIG_IIO_ST_MAGN_I2C_3AXIS=m
+CONFIG_IIO_ST_MAGN_SPI_3AXIS=m
+CONFIG_IIO_ST_PRESS=m
+CONFIG_IIO_ST_PRESS_I2C=m
+CONFIG_IIO_ST_PRESS_SPI=m
+CONFIG_IIO_ST_SENSORS_I2C=m
+CONFIG_IIO_ST_SENSORS_SPI=m
+CONFIG_IIO_ST_SENSORS_CORE=m
 
 # tegra
 CONFIG_ARCH_TEGRA_2x_SOC=y
@@ -496,7 +508,7 @@ CONFIG_TEGRA30_MC=y
 
 CONFIG_SERIAL_TEGRA=y
 
-CONFIG_TEGRA_PCI=y
+CONFIG_PCI_TEGRA=y
 CONFIG_TEGRA_IOMMU_GART=y
 CONFIG_TEGRA_IOMMU_SMMU=y
 CONFIG_MMC_SDHCI_TEGRA=m
@@ -567,7 +579,7 @@ CONFIG_SERIAL_UARTLITE_CONSOLE=y
 CONFIG_SERIAL_XILINX_PS_UART=y
 CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
 CONFIG_COMMON_CLK_AXI_CLKGEN=m
-CONFIG_CPU_IDLE_ZYNQ=y
+CONFIG_ARM_ZYNQ_CPUIDLE=y
 CONFIG_LATTICE_ECP3_CONFIG=m
 CONFIG_NET_VENDOR_XILINX=y
 CONFIG_XILINX_EMACLITE=m
@@ -582,6 +594,7 @@ CONFIG_MFD_T7L66XB=y
 CONFIG_MFD_TC6387XB=y
 
 # Generic drivers
+CONFIG_REMOTEPROC=m
 
 # Regulator drivers
 CONFIG_REGULATOR_FAN53555=m
@@ -634,7 +647,6 @@ CONFIG_REGULATOR_MAX8973=m
 # CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
 
 # CONFIG_VIRTUALIZATION is not set
-# CONFIG_CHARGER_MANAGER is not set
 # CONFIG_POWER_RESET_QNAP is not set
 # CONFIG_OMAP2_DSS_DEBUG is not set
 # CONFIG_DRM_TEGRA_DEBUG is not set
diff --git a/config-armv7-generic b/config-armv7-generic
index 254ae3b..7800af2 100644
--- a/config-armv7-generic
+++ b/config-armv7-generic
@@ -14,6 +14,7 @@ CONFIG_AEABI=y
 CONFIG_VFP=y
 CONFIG_VFPv3=y
 CONFIG_NEON=y
+CONFIG_KERNEL_MODE_NEON=y
 
 CONFIG_ARM_UNWIND=y
 CONFIG_ARM_THUMB=y
@@ -56,14 +57,15 @@ CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y
 # CONFIG_ARCH_SIRF is not set
 # CONFIG_ARCH_U8500 is not set
 # CONFIG_ARCH_WM8850 is not set
+# CONFIG_ARCH_SHMOBILE_MULTI is not set
 
 # highbank
 # 2013/04/19 - stability issues
-# CONFIG_CPU_IDLE_CALXEDA is not set
 CONFIG_EDAC_HIGHBANK_MC=m
 CONFIG_EDAC_HIGHBANK_L2=m
 CONFIG_SATA_HIGHBANK=m
 CONFIG_ARM_HIGHBANK_CPUFREQ=m
+CONFIG_ARM_HIGHBANK_CPUIDLE=y
 
 # errata
 # v5/v6
@@ -93,6 +95,7 @@ CONFIG_PL310_ERRATA_769419=y
 CONFIG_PJ4B_ERRATA_4742=y
 # Cortex-A15
 # CONFIG_ARM_ERRATA_798181 is not set
+# CONFIG_ARM_ERRATA_773022 is not set
 
 # generic that deviates from or should be merged into config-generic
 CONFIG_SMP_ON_UP=y
@@ -104,13 +107,10 @@ CONFIG_SCHED_SMT=y
 
 CONFIG_RCU_FANOUT=32
 
-CONFIG_VIRTIO_CONSOLE=m
-
-# 2013/04/19 - disable due to stability issues in 3.9 for the moment
-# CONFIG_CPU_IDLE is not set
-## CONFIG_CPU_IDLE_GOV_LADDER is not set
-# CONFIG_CPU_IDLE_GOV_MENU is not set
-# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set
+CONFIG_CPU_IDLE=y
+# CONFIG_CPU_IDLE_GOV_LADDER is not set
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
 
 # CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set
 
@@ -138,7 +138,6 @@ CONFIG_LBDAF=y
 CONFIG_USE_OF=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_ARM_APPENDED_DTB=y
-CONFIG_I2C_MUX_PINCTRL=m
 
 # General vexpress ARM drivers
 CONFIG_ARM_TIMER_SP804=y
@@ -156,6 +155,7 @@ CONFIG_PL330_DMA=m
 CONFIG_AMBA_PL08X=y
 CONFIG_ARM_SP805_WATCHDOG=m
 CONFIG_GPIO_PL061=y
+CONFIG_PL320_MBOX=y
 
 # usb
 CONFIG_USB_OTG=y
@@ -167,7 +167,7 @@ CONFIG_AX88796_93CX6=y
 CONFIG_USB_ISP1760_HCD=m
 # CONFIG_USB_EHCI_HCD_ORION is not set
 
-# usb gadget
+# usb gadget 
 CONFIG_USB_GADGET=m
 CONFIG_USB_GADGET_MUSB_HDRC=m
 CONFIG_USB_GADGET_VBUS_DRAW=100
@@ -240,6 +240,7 @@ CONFIG_PINMUX=y
 CONFIG_PINCONF=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
+CONFIG_GENERIC_PINCONF=y
 # CONFIG_PINCTRL_SAMSUNG is not set
 # CONFIG_PINCTRL_EXYNOS4 is not set
 
@@ -248,7 +249,6 @@ CONFIG_GPIO_GENERIC_PLATFORM=m
 # CONFIG_GPIO_EM is not set
 CONFIG_GPIO_ADNP=m
 CONFIG_GPIO_MCP23S08=m
-CONFIG_POWER_RESET_GPIO=y
 CONFIG_SERIAL_8250_EM=m
 CONFIG_INPUT_GPIO_TILT_POLLED=m
 CONFIG_MDIO_BUS_MUX_GPIO=m
@@ -302,9 +302,11 @@ CONFIG_MPCORE_WATCHDOG=m
 
 # Thermal / powersaving
 CONFIG_THERMAL=y
-CONFIG_POWER_RESET_RESTART=y
 CONFIG_ARM_PSCI=y
 
+# Mailbox
+CONFIG_MAILBOX=y
+
 # MTD
 # CONFIG_MG_DISK is not set
 CONFIG_MTD_DATAFLASH=m
@@ -328,20 +330,28 @@ CONFIG_SPI_DW_PCI=m
 # CONFIG_MMC_DW_EXYNOS is not set
 # CONFIG_MMC_DW_IDMAC is not set
 CONFIG_USB_DWC2=m
+# CONFIG_USB_DWC2_DEBUG is not set
+# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set
 CONFIG_USB_DWC3=m
+CONFIG_USB_DWC3_OMAP=m
+CONFIG_USB_DWC3_EXYNOS=m
+CONFIG_USB_DWC3_PCI=m
 # CONFIG_USB_DWC3_DEBUG is not set
 CONFIG_DW_WATCHDOG=m
 
 # Sound
-CONFIG_SND_ARM=y
-CONFIG_SND_ARMAACI=m
 CONFIG_SND_SOC=m
 CONFIG_SND_SPI=y
+CONFIG_SND_ARM=y
+CONFIG_SND_ARMAACI=m
+CONFIG_SND_COMPRESS_OFFLOAD=m
 CONFIG_SND_DESIGNWARE_I2S=m
+CONFIG_SND_DMAENGINE_PCM=m
+CONFIG_SND_JACK=y
 CONFIG_SND_SIMPLE_CARD=m
-CONFIG_SND_SOC_CACHE_LZO=y
 CONFIG_SND_SOC_ALL_CODECS=m
-CONFIG_SND_SOC_DMAENGINE_PCM=y
+CONFIG_SND_SOC_CACHE_LZO=y
+CONFIG_SND_SOC_DMIC=m
 CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
 # CONFIG_SND_ATMEL_SOC is not set
 
@@ -365,10 +375,8 @@ CONFIG_RTC_DRV_TPS80031=m
 # Regulators
 CONFIG_REGULATOR=y
 CONFIG_RFKILL_REGULATOR=m
-CONFIG_CHARGER_MANAGER=y
 # CONFIG_REGULATOR_DUMMY is not set
 CONFIG_REGULATOR_FIXED_VOLTAGE=m
-CONFIG_REGULATOR_FIXED_VOLTAGE=m
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=m
 CONFIG_REGULATOR_USERSPACE_CONSUMER=m
 CONFIG_REGULATOR_GPIO=m
@@ -378,6 +386,7 @@ CONFIG_REGULATOR_FAN53555=m
 CONFIG_REGULATOR_ISL6271A=m
 CONFIG_REGULATOR_LP3971=m
 CONFIG_REGULATOR_LP3972=m
+CONFIG_REGULATOR_LP872X=m
 CONFIG_REGULATOR_LP8755=m
 CONFIG_REGULATOR_MAX1586=m
 CONFIG_REGULATOR_MAX8649=m
@@ -396,16 +405,25 @@ CONFIG_REGULATOR_TPS6586X=m
 CONFIG_REGULATOR_TPS65910=m
 CONFIG_REGULATOR_TPS65912=m
 CONFIG_REGULATOR_TPS80031=m
+
+CONFIG_CHARGER_MANAGER=y
 CONFIG_CHARGER_TPS65090=m
+CONFIG_PDA_POWER=m
+CONFIG_GENERIC_ADC_BATTERY=m
 
+# Sensors
+CONFIG_TMP006=m
+CONFIG_BMP085=y
+CONFIG_BMP085_I2C=m
+CONFIG_BMP085_SPI=m
 CONFIG_SENSORS_AD7314=m
 CONFIG_SENSORS_ADCXX=m
-CONFIG_SENSORS_LM70=m
-CONFIG_SENSORS_MAX1111=m
 CONFIG_SENSORS_ADS7871=m
-CONFIG_SENSORS_LIS3_SPI=m
 CONFIG_SENSORS_GPIO_FAN=m
 CONFIG_SENSORS_HTU21=m
+CONFIG_SENSORS_LIS3_SPI=m
+CONFIG_SENSORS_LM70=m
+CONFIG_SENSORS_MAX1111=m
 
 CONFIG_LCD_L4F00242T03=m
 CONFIG_LCD_LMS283GF05=m
@@ -434,9 +452,10 @@ CONFIG_LEDS_DAC124S085=m
 CONFIG_LEDS_PWM=m
 CONFIG_BMP085_SPI=m
 
-# Display
-
+# Contiguous Memory Allocator
+CONFIG_OF_RESERVED_MEM=y
 CONFIG_CMA=y
+CONFIG_DMA_CMA=y
 # CONFIG_CMA_DEBUG is not set
 CONFIG_CMA_SIZE_MBYTES=16
 CONFIG_CMA_SIZE_SEL_MBYTES=y
@@ -445,6 +464,7 @@ CONFIG_CMA_SIZE_SEL_MBYTES=y
 # CONFIG_CMA_SIZE_SEL_MAX is not set
 CONFIG_CMA_ALIGNMENT=8
 CONFIG_CMA_AREAS=7
+CONFIG_SRAM=y
 
 # Ethernet
 CONFIG_KS8851=m
@@ -479,6 +499,9 @@ CONFIG_UBIFS_FS_LZO=y
 CONFIG_UBIFS_FS_ZLIB=y
 # CONFIG_UBIFS_FS_DEBUG is not set
 
+# Sensors
+CONFIG_SENSORS_HTU21=m
+
 # Should be in generic
 CONFIG_BPF_JIT=y
 # CONFIG_NET_VENDOR_CIRRUS is not set
@@ -512,6 +535,7 @@ CONFIG_BPF_JIT=y
 # CONFIG_COMMON_CLK_AXI_CLKGEN is not set
 # CONFIG_SPI_TOPCLIFF_PCH is not set
 # CONFIG_SPI_PXA2XX is not set
+# CONFIG_SPI_FSL_DSPI is not set
 
 # these modules all fail with missing __bad_udelay
 # http://www.spinics.net/lists/arm/msg15615.html provides some background
diff --git a/config-armv7-lpae b/config-armv7-lpae
index 16aa0ed..f2cfb02 100644
--- a/config-armv7-lpae
+++ b/config-armv7-lpae
@@ -32,6 +32,7 @@ CONFIG_ARM_DMA_IOMMU_ALIGNMENT=8
 
 # Cortex-A15
 CONFIG_ARM_ERRATA_798181=y
+CONFIG_ARM_ERRATA_773022=y
 
 CONFIG_KVM=y
 CONFIG_KVM_ARM_HOST=y
@@ -65,7 +66,9 @@ CONFIG_SERIAL_SAMSUNG_CONSOLE=y
 CONFIG_SOC_EXYNOS5250=y
 CONFIG_SOC_EXYNOS5420=y
 CONFIG_SOC_EXYNOS5440=y
-CONFIG_ARM_EXYNOS_CPUFREQ=y
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5440_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS_CPUFREQ is not set
 # CONFIG_GENERIC_CPUFREQ_CPU0 is not set
 CONFIG_EXYNOS_THERMAL=m
 CONFIG_PCI_EXYNOS=y
@@ -134,31 +137,6 @@ CONFIG_S3C_LOWLEVEL_UART_PORT=1
 # CONFIG_S3C2410_WATCHDOG is not set
 # CONFIG_MMC_SDHCI_S3C is not set
 # CONFIG_TEGRA_HOST1X is not set
-
-# CONFIG_CHARGER_MAX8997 is not set
-# CONFIG_MFD_AS3711 is not set
-# CONFIG_PMIC_ADP5520 is not set
-# CONFIG_MFD_AAT2870_CORE is not set
-# CONFIG_PMIC_DA903X is not set
-# CONFIG_MFD_DA9052_I2C is not set
-# CONFIG_MFD_DA9055 is not set
-# CONFIG_MFD_88PM800 is not set
-# CONFIG_MFD_88PM805 is not set
-# CONFIG_MFD_MAX77686 is not set
-# CONFIG_MFD_MAX77693 is not set
-# CONFIG_MFD_MAX8907 is not set
-# CONFIG_MFD_RC5T583 is not set
-# CONFIG_MFD_SMSC is not set
-# CONFIG_MFD_LP8788 is not set
-# CONFIG_MFD_PALMAS is not set
-# CONFIG_MFD_TPS65090 is not set
-# CONFIG_MFD_TPS65910 is not set
-# CONFIG_MFD_TPS65912_I2C is not set
-# CONFIG_MFD_TPS80031 is not set
-# CONFIG_TWL4030_CORE is not set
-# CONFIG_TWL6040_CORE is not set
-# CONFIG_REGULATOR_LP872X is not set
-# CONFIG_REGULATOR_S2MPS11 is not set
-# CONFIG_LEDS_MAX8997 is not set
-# CONFIG_RTC_DRV_MAX8997 is not set
-# CONFIG_EXTCON_MAX8997 is not set
+# CONFIG_SPI_DAVINCI is not set
+# CONFIG_I2C_DAVINCI is not set
+# CONFIG_TI_SOC_THERMAL is not set
diff --git a/config-generic b/config-generic
index 079ad75..c2f589b 100644
--- a/config-generic
+++ b/config-generic
@@ -61,6 +61,8 @@ CONFIG_PID_NS=y
 CONFIG_UTS_NS=y
 CONFIG_IPC_NS=y
 CONFIG_NET_NS=y
+# CONFIG_USER_NS is not set
+# CONFIG_UIDGID_STRICT_TYPE_CHECKS is not set
 
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_PREEMPT_NONE is not set
@@ -146,6 +148,7 @@ CONFIG_MMC_VUB300=m
 # CONFIG_MMC_SDHCI_PXAV2 is not set
 # CONFIG_MMC_SDHCI_PXAV3 is not set
 
+
 CONFIG_CB710_CORE=m
 # CONFIG_CB710_DEBUG is not set
 
@@ -160,6 +163,7 @@ CONFIG_INFINIBAND_SRP=m
 CONFIG_INFINIBAND_SRPT=m
 CONFIG_INFINIBAND_USER_MAD=m
 CONFIG_INFINIBAND_USER_ACCESS=m
+# CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING is not set  #staging
 CONFIG_INFINIBAND_IPATH=m
 CONFIG_INFINIBAND_ISER=m
 CONFIG_INFINIBAND_ISERT=m
@@ -205,6 +209,7 @@ CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_FW_LOADER_USER_HELPER is not set
 
 # CONFIG_CMA is not set
+# CONFIG_DMA_CMA is not set
 
 # CONFIG_SPI is not set
 
@@ -331,6 +336,7 @@ CONFIG_BLK_DEV_BSG=y
 CONFIG_BLK_DEV_BSGLIB=y
 CONFIG_BLK_DEV_INTEGRITY=y
 CONFIG_BLK_DEV_THROTTLING=y
+# CONFIG_BLK_CMDLINE_PARSER is not set
 
 
 #
@@ -438,6 +444,7 @@ CONFIG_MEGARAID_MM=m
 CONFIG_MEGARAID_MAILBOX=m
 CONFIG_MEGARAID_LEGACY=m
 CONFIG_MEGARAID_SAS=m
+CONFIG_SCSI_ESAS2R=m
 CONFIG_SCSI_MVSAS=m
 # CONFIG_SCSI_MVSAS_DEBUG is not set
 CONFIG_SCSI_MVSAS_TASKLET=y
@@ -935,6 +942,7 @@ CONFIG_IP_NF_TARGET_ECN=m
 CONFIG_IP_NF_TARGET_LOG=m
 CONFIG_IP_NF_TARGET_ULOG=m
 CONFIG_IP_NF_TARGET_REJECT=y
+CONFIG_IP_NF_TARGET_SYNPROXY=m
 CONFIG_IP_NF_TARGET_TTL=m
 CONFIG_NF_NAT_IPV4=m
 CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -968,6 +976,7 @@ CONFIG_IP6_NF_RAW=m
 CONFIG_IP6_NF_SECURITY=m
 CONFIG_IP6_NF_TARGET_LOG=m
 CONFIG_IP6_NF_TARGET_REJECT=m
+CONFIG_IP6_NF_TARGET_SYNPROXY=m
 CONFIG_IP6_NF_TARGET_HL=m
 CONFIG_NF_NAT_IPV6=m
 CONFIG_IP6_NF_TARGET_MASQUERADE=m
@@ -1097,6 +1106,7 @@ CONFIG_NET_SCH_CHOKE=m
 CONFIG_NET_SCH_QFQ=m
 CONFIG_NET_SCH_CODEL=m
 CONFIG_NET_SCH_FQ_CODEL=m
+CONFIG_NET_SCH_FQ=m
 CONFIG_NET_SCH_PLUG=m
 CONFIG_NET_CLS=y
 CONFIG_NET_CLS_ACT=y
@@ -1143,6 +1153,7 @@ CONFIG_BATMAN_ADV_NC=y
 # CONFIG_BATMAN_ADV_DEBUG is not set
 CONFIG_OPENVSWITCH=m
 CONFIG_OPENVSWITCH_GRE=y
+CONFIG_OPENVSWITCH_VXLAN=y
 CONFIG_VSOCKETS=m
 CONFIG_NETPRIO_CGROUP=m
 
@@ -1331,7 +1342,7 @@ CONFIG_IXGBE_DCA=y
 CONFIG_IXGBE_DCB=y
 CONFIG_IXGBE_HWMON=y
 CONFIG_IXGBE_PTP=y
-
+CONFIG_I40E=m
 
 # CONFIG_NET_VENDOR_I825XX is not set
 CONFIG_NET_VENDOR_MARVELL=y
@@ -1376,6 +1387,7 @@ CONFIG_NET_VENDOR_QLOGIC=y
 CONFIG_QLA3XXX=m
 CONFIG_QLCNIC=m
 CONFIG_QLCNIC_SRIOV=y
+CONFIG_QLCNIC_DCB=y
 CONFIG_QLGE=m
 CONFIG_NETXEN_NIC=m
 
@@ -1679,6 +1691,7 @@ CONFIG_RT2500USB=m
 CONFIG_RT2800USB=m
 CONFIG_RT2800USB_RT33XX=y
 CONFIG_RT2800USB_RT35XX=y
+CONFIG_RT2800USB_RT3573=y
 CONFIG_RT2800USB_RT53XX=y
 CONFIG_RT2800USB_RT55XX=y
 CONFIG_RT2800USB_UNKNOWN=y
@@ -1699,12 +1712,9 @@ CONFIG_USB_NET_SMSC75XX=m
 CONFIG_ZD1211RW=m
 # CONFIG_ZD1211RW_DEBUG is not set
 
-CONFIG_WL12XX_MENU=m
 CONFIG_WL12XX=m
-# CONFIG_WL12XX_HT is not set
 CONFIG_WL12XX_SPI=m
 CONFIG_WL12XX_SDIO=m
-# CONFIG_WL12XX_SDIO_TEST is not set
 
 CONFIG_WL1251=m
 CONFIG_WL1251_SPI=m
@@ -2017,6 +2027,7 @@ CONFIG_INPUT_SPARSEKMAP=m
 # CONFIG_INPUT_IMS_PCU is not set
 CONFIG_INPUT_CMA3000=m
 CONFIG_INPUT_CMA3000_I2C=m
+CONFIG_INPUT_IDEAPAD_SLIDEBAR=m
 
 #
 # Input I/O drivers
@@ -2200,6 +2211,7 @@ CONFIG_TCG_NSC=m
 CONFIG_TCG_ATMEL=m
 # CONFIG_TCG_INFINEON is not set
 # CONFIG_TCG_ST33_I2C is not set
+# CONFIG_TCG_XEN is not set
 CONFIG_TELCLOCK=m
 
 #
@@ -2238,6 +2250,13 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_XILINX_PS_UART is not set
 # CONFIG_SERIAL_TIMBERDALE is not set
+CONFIG_SERIAL_ARC=m
+CONFIG_SERIAL_ARC_NR_PORTS=1
+# CONFIG_SERIAL_RP2 is not set
+# CONFIG_SERIAL_FSL_LPUART is not set
+# CONFIG_SERIAL_ST_ASC is not set
+# CONFIG_SERIAL_PCH_UART is not set
+
 CONFIG_UNIX98_PTYS=y
 CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
 # CONFIG_LEGACY_PTYS is not set
@@ -2347,10 +2366,12 @@ CONFIG_SENSORS_GL518SM=m
 CONFIG_SENSORS_GL520SM=m
 CONFIG_SENSORS_HDAPS=m
 # CONFIG_SENSORS_HIH6130 is not set
+# CONFIG_SENSORS_HTU21 is not set
 # CONFIG_SENSORS_I5K_AMB is not set
 # FIXME: IBMAEM x86 only?
 CONFIG_SENSORS_IBMAEM=m
 CONFIG_SENSORS_IBMPEX=m
+# CONFIG_SENSORS_IIO_HWMON is not set
 CONFIG_SENSORS_IT87=m
 CONFIG_SENSORS_K8TEMP=m
 CONFIG_SENSORS_K10TEMP=m
@@ -2452,17 +2473,125 @@ CONFIG_SENSORS_MAX8688=m
 CONFIG_SENSORS_MAX1668=m
 CONFIG_SENSORS_MAX197=m
 
+# Industrial I/O subsystem configuration
+CONFIG_IIO=m
+CONFIG_IIO_BUFFER=y
+CONFIG_IIO_BUFFER_CB=y
+# CONFIG_IIO_KFIFO_BUF is not set
+CONFIG_IIO_TRIGGERED_BUFFER=m
+CONFIG_IIO_TRIGGER=y
+CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
+CONFIG_IIO_INTERRUPT_TRIGGER=m
+CONFIG_HID_SENSOR_IIO_COMMON=m
+CONFIG_HID_SENSOR_IIO_TRIGGER=m
+CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS=y
+# CONFIG_IIO_SYSFS_TRIGGER is not set
+# CONFIG_AD5446 is not set
+# CONFIG_AD5380 is not set
+# CONFIG_AD5064 is not set
+# CONFIG_BMA180 is not set
+# CONFIG_MAX1363 is not set
+# CONFIG_MAX517 is not set
+# CONFIG_MCP4725 is not set
+# CONFIG_ITG3200 is not set
+# CONFIG_APDS9300 is not set
+# CONFIG_TSL2583 is not set
+# CONFIG_TSL2x7x is not set
+# CONFIG_NAU7802 is not set
+# CONFIG_TI_ADC081C is not set
+# CONFIG_EXYNOS_ADC is not set
+# CONFIG_VIPERBOARD_ADC is not set
+# CONFIG_INV_MPU6050_IIO is not set
+CONFIG_IIO_ST_GYRO_3AXIS=m
+CONFIG_IIO_ST_MAGN_3AXIS=m
+CONFIG_IIO_ST_ACCEL_3AXIS=m
+# CONFIG_ADJD_S311 is not set
+# CONFIG_SENSORS_TSL2563 is not set
+# CONFIG_VCNL4000 is not set
+# CONFIG_AK8975 is not set
+# CONFIG_TMP006 is not set
+# CONFIG_IIO_ST_PRESS is not set
+# CONFIG_KXSD9 is not set
+# CONFIG_AD7266 is not set
+# CONFIG_AD7298 is not set
+# CONFIG_AD7476 is not set
+# CONFIG_AD7791 is not set
+# CONFIG_AD7793 is not set
+# CONFIG_AD7887 is not set
+# CONFIG_AD7923 is not set
+# CONFIG_MCP320X is not set
+# CONFIG_AD8366 is not set
+# CONFIG_AD5360 is not set
+# CONFIG_AD5421 is not set
+# CONFIG_AD5449 is not set
+# CONFIG_AD5504 is not set
+# CONFIG_AD5624R_SPI is not set
+# CONFIG_AD5686 is not set
+# CONFIG_AD5755 is not set
+# CONFIG_AD5764 is not set
+# CONFIG_AD5791 is not set
+# CONFIG_AD7303 is not set
+# CONFIG_AD9523 is not set
+# CONFIG_ADF4350 is not set
+# CONFIG_ADIS16080 is not set
+# CONFIG_ADIS16130 is not set
+# CONFIG_ADIS16136 is not set
+# CONFIG_ADIS16260 is not set
+# CONFIG_ADXRS450 is not set
+# CONFIG_ADIS16400 is not set
+# CONFIG_ADIS16480 is not set
+
+# staging IIO drivers
+# CONFIG_AD7291 is not set
+# CONFIG_AD7606 is not set
+# CONFIG_AD799X is not set
+# CONFIG_ADT7316 is not set
+# CONFIG_AD7150 is not set
+# CONFIG_AD7152 is not set
+# CONFIG_AD7746 is not set
+# CONFIG_AD5933 is not set
+# CONFIG_ADE7854 is not set
+# CONFIG_SENSORS_ISL29018 is not set
+# CONFIG_SENSORS_ISL29028 is not set
+# CONFIG_SENSORS_HMC5843 is not set
+# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set
+# CONFIG_IIO_SIMPLE_DUMMY is not set
+# CONFIG_ADIS16201 is not set
+# CONFIG_ADIS16203 is not set
+# CONFIG_ADIS16204 is not set
+# CONFIG_ADIS16209 is not set
+# CONFIG_ADIS16220 is not set
+# CONFIG_ADIS16240 is not set
+# CONFIG_LIS3L02DQ is not set
+# CONFIG_SCA3000 is not set
+# CONFIG_AD7780 is not set
+# CONFIG_AD7816 is not set
+# CONFIG_AD7192 is not set
+# CONFIG_AD7280 is not set
+# CONFIG_AD5930 is not set
+# CONFIG_AD9832 is not set
+# CONFIG_AD9834 is not set
+# CONFIG_AD9850 is not set
+# CONFIG_AD9852 is not set
+# CONFIG_AD9910 is not set
+# CONFIG_AD9951 is not set
+# CONFIG_ADIS16060 is not set
+# CONFIG_ADE7753 is not set
+# CONFIG_ADE7754 is not set
+# CONFIG_ADE7758 is not set
+# CONFIG_ADE7759 is not set
+# CONFIG_AD2S90 is not set
+# CONFIG_AD2S1200 is not set
+# CONFIG_AD2S1210 is not set
+
+
+
 # CONFIG_HMC6352 is not set
 # CONFIG_BMP085 is not set
 # CONFIG_BMP085_I2C is not set
 # CONFIG_PCH_PHUB is not set
-# CONFIG_SERIAL_PCH_UART is not set
 # CONFIG_USB_SWITCH_FSA9480 is not set
 # CONFIG_SRAM is not set
-CONFIG_SERIAL_ARC=m
-CONFIG_SERIAL_ARC_NR_PORTS=1
-# CONFIG_SERIAL_RP2 is not set
-# CONFIG_SERIAL_FSL_LPUART is not set
 
 CONFIG_W1=m
 CONFIG_W1_CON=y
@@ -2604,6 +2733,7 @@ CONFIG_RTC_DRV_PCF50633=m
 CONFIG_RTC_DRV_DS3232=m
 CONFIG_RTC_DRV_ISL12022=m
 # CONFIG_RTC_DRV_HID_SENSOR_TIME is not set
+# CONFIG_RTC_DRV_MOXART is not set
 
 CONFIG_R3964=m
 # CONFIG_APPLICOM is not set
@@ -2645,6 +2775,7 @@ CONFIG_DRM_MGAG200=m  # do not enable on f17 or older
 # CONFIG_DRM_SAVAGE is not set
 CONFIG_DRM_I915=m
 CONFIG_DRM_I915_KMS=y
+# CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT is not set
 CONFIG_DRM_VIA=m
 CONFIG_DRM_NOUVEAU=m
 CONFIG_NOUVEAU_DEBUG=5
@@ -2722,6 +2853,7 @@ CONFIG_VIDEO_CX88=m
 CONFIG_VIDEO_CX88_DVB=m
 CONFIG_VIDEO_CX88_ALSA=m
 CONFIG_VIDEO_CX88_BLACKBIRD=m
+CONFIG_VIDEO_CX88_ENABLE_VP3054=y
 CONFIG_VIDEO_CX88_VP3054=m
 CONFIG_VIDEO_EM28XX=m
 CONFIG_VIDEO_EM28XX_ALSA=m
@@ -2746,6 +2878,7 @@ CONFIG_VIDEO_SAA7134_ALSA=m
 CONFIG_VIDEO_SAA7134_DVB=m
 CONFIG_VIDEO_SAA7134_RC=y
 CONFIG_VIDEO_USBVISION=m
+CONFIG_VIDEO_STK1160_COMMON=m
 CONFIG_VIDEO_STK1160=m
 CONFIG_VIDEO_STK1160_AC97=y
 CONFIG_VIDEO_W9966=m
@@ -2926,6 +3059,7 @@ CONFIG_IR_GPIO_CIR=m
 CONFIG_V4L_MEM2MEM_DRIVERS=y
 # CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set
 # CONFIG_VIDEO_SH_VEU is not set
+# CONFIG_VIDEO_RENESAS_VSP1 is not set
 # CONFIG_V4L_TEST_DRIVERS is not set
 
 # CONFIG_VIDEO_MEM2MEM_TESTDEV is not set
@@ -3231,9 +3365,15 @@ CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_EHCI_TT_NEWSCHED=y
 # CONFIG_USB_EHCI_MV is not set
 # CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+CONFIG_USB_ISP1362_HCD=m
+CONFIG_USB_FUSBH200_HCD=m
+# CONFIG_USB_FOTG210_HCD is not set
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_HCD_PCI=y
 # CONFIG_USB_OHCI_HCD_SSB is not set
+# CONFIG_USB_HCD_TEST_MODE is not set
 # CONFIG_USB_OHCI_HCD_PLATFORM is not set
 CONFIG_USB_UHCI_HCD=y
 CONFIG_USB_SL811_HCD=m
@@ -3242,8 +3382,6 @@ CONFIG_USB_SL811_HCD_ISO=y
 # CONFIG_USB_R8A66597_HCD is not set
 CONFIG_USB_XHCI_HCD=y
 # CONFIG_USB_XHCI_HCD_DEBUGGING is not set
-CONFIG_USB_ISP1362_HCD=m
-CONFIG_USB_FUSBH200_HCD=m
 
 #
 # USB Device Class drivers
@@ -3333,9 +3471,14 @@ CONFIG_HID_SMARTJOYPLUS=m
 CONFIG_HID_TOPSEED=m
 CONFIG_HID_THINGM=m
 CONFIG_HID_THRUSTMASTER=m
+CONFIG_HID_XINMO=m
 CONFIG_HID_ZEROPLUS=m
 CONFIG_HID_ZYDACRON=m
 CONFIG_HID_SENSOR_HUB=m
+CONFIG_HID_SENSOR_GYRO_3D=m
+CONFIG_HID_SENSOR_MAGNETOMETER_3D=m
+CONFIG_HID_SENSOR_ALS=m
+CONFIG_HID_SENSOR_ACCEL_3D=m
 CONFIG_HID_EMS_FF=m
 CONFIG_HID_ELECOM=m
 CONFIG_HID_ELO=m
@@ -3403,6 +3546,7 @@ CONFIG_USB_GSPCA_SPCA506=m
 CONFIG_USB_GSPCA_SPCA508=m
 CONFIG_USB_GSPCA_SPCA561=m
 CONFIG_USB_GSPCA_STK014=m
+CONFIG_USB_GSPCA_STK1135=m
 CONFIG_USB_GSPCA_SUNPLUS=m
 CONFIG_USB_GSPCA_T613=m
 CONFIG_USB_GSPCA_TOPRO=m
@@ -3446,6 +3590,7 @@ CONFIG_USB_SPEEDTOUCH=m
 CONFIG_USB_NET_AX8817X=m
 CONFIG_USB_NET_AX88179_178A=m
 CONFIG_USB_NET_DM9601=m
+CONFIG_USB_NET_SR9700=m
 CONFIG_USB_NET_SMSC95XX=m
 CONFIG_USB_NET_GL620A=m
 CONFIG_USB_NET_NET1080=m
@@ -3490,6 +3635,7 @@ CONFIG_USB_USS720=m
 #
 CONFIG_USB_SERIAL=y
 CONFIG_USB_SERIAL_GENERIC=y
+CONFIG_USB_SERIAL_SIMPLE=m
 CONFIG_USB_SERIAL_AIRCABLE=m
 CONFIG_USB_SERIAL_ARK3116=m
 CONFIG_USB_SERIAL_BELKIN=m
@@ -3584,6 +3730,7 @@ CONFIG_USB_PHY=y
 # CONFIG_OMAP_USB2 is not set
 # CONFIG_OMAP_USB3 is not set
 # CONFIG_OMAP_CONTROL_USB is not set
+# CONFIG_AM335X_PHY_USB is not set
 # CONFIG_SAMSUNG_USBPHY is not set
 # CONFIG_SAMSUNG_USB2PHY is not set
 # CONFIG_SAMSUNG_USB3PHY is not set
@@ -3600,8 +3747,6 @@ CONFIG_USB_FILE_STORAGE=m
 # CONFIG_USB_GADGET is not set
 # CONFIG_USB_DWC3 is not set
 # CONFIG_USB_GADGETFS is not set
-# CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1760_HCD is not set
 # CONFIG_USB_OXU210HP_HCD is not set
 CONFIG_USB_IOWARRIOR=m
 CONFIG_USB_ISIGHTFW=m
@@ -3628,6 +3773,7 @@ CONFIG_RADIO_SI4713=m
 CONFIG_USB_MR800=m
 CONFIG_USB_STKWEBCAM=m
 # CONFIG_USB_TEST is not set
+# CONFIG_USB_EHSET_TEST_FIXTURE is not set
 CONFIG_USB_TRANCEVIBRATOR=m
 CONFIG_USB_U132_HCD=m
 CONFIG_USB_UEAGLEATM=m
@@ -3706,6 +3852,7 @@ CONFIG_MFD_VIPERBOARD=m
 # CONFIG_MFD_SI476X_CORE is not set
 # CONFIG_MFD_TPS65912 is not set
 # CONFIG_MFD_SYSCON is not set
+# CONFIG_MFD_DA9063 is not set
 
 #
 # File systems
@@ -3755,6 +3902,7 @@ CONFIG_AUTOFS4_FS=y
 CONFIG_NILFS2_FS=m
 # CONFIG_LOGFS is not set
 CONFIG_CEPH_FS=m
+CONFIG_CEPH_FSCACHE=y
 CONFIG_BLK_DEV_RBD=m
 CONFIG_CEPH_LIB=m
 # CONFIG_CEPH_LIB_USE_DNS_RESOLVER is not set
@@ -3809,6 +3957,7 @@ CONFIG_ECRYPT_FS=m
 # CONFIG_ECRYPT_FS_MESSAGING is not set
 CONFIG_HFS_FS=m
 CONFIG_HFSPLUS_FS=m
+# CONFIG_HFSPLUS_FS_POSIX_ACL is not set
 CONFIG_BEFS_FS=m
 # CONFIG_BEFS_DEBUG is not set
 # CONFIG_BFS_FS is not set
@@ -3910,6 +4059,7 @@ CONFIG_BTRFS_FS_POSIX_ACL=y
 # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
 # CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
 # CONFIG_BTRFS_DEBUG is not set
+# CONFIG_BTRFS_ASSERT is not set
 
 CONFIG_CONFIGFS_FS=y
 
@@ -3947,6 +4097,7 @@ CONFIG_SUN_PARTITION=y
 # CONFIG_SYSV68_PARTITION is not set
 CONFIG_UNIXWARE_DISKLABEL=y
 # CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_CMDLINE_PARTITION is not set
 
 CONFIG_NLS=y
 
@@ -4035,6 +4186,9 @@ CONFIG_HEADERS_CHECK=y
 # This generates a huge amount of dmesg spew
 # CONFIG_DEBUG_KOBJECT is not set
 #
+# This breaks booting until the module patches are in-tree
+# CONFIG_DEBUG_KOBJECT_RELEASE is not set
+#
 #
 # These debug options are deliberatly left on (even in 'make release' kernels).
 # They aren't that much of a performance impact, and the value
@@ -4236,6 +4390,9 @@ CONFIG_FB_ATY_BACKLIGHT=y
 # CONFIG_BACKLIGHT_SAHARA is not set
 CONFIG_BACKLIGHT_WM831X=m
 CONFIG_BACKLIGHT_LP855X=m
+# CONFIG_BACKLIGHT_GPIO is not set
+# CONFIG_BACKLIGHT_LV5207LP is not set
+# CONFIG_BACKLIGHT_BD6107 is not set
 
 CONFIG_LCD_CLASS_DEVICE=m
 CONFIG_LCD_PLATFORM=m
@@ -4385,7 +4542,8 @@ CONFIG_LEDS_DELL_NETBOOKS=m
 # CONFIG_LEDS_LM355x is not set
 # CONFIG_LEDS_OT200 is not set
 # CONFIG_LEDS_PWM is not set
-# CONFIG_LEDS_RENESAS_TPU is not set
+# CONFIG_LEDS_LP8501 is not set
+# CONFIG_LEDS_PCA963X is not set
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=m
 CONFIG_LEDS_TRIGGER_ONESHOT=m
@@ -4475,6 +4633,7 @@ CONFIG_POWER_SUPPLY=y
 
 # CONFIG_TEST_POWER is not set
 CONFIG_APM_POWER=m
+# CONFIG_GENERIC_ADC_BATTERY is not set
 # CONFIG_WM831X_POWER is not set
 
 # CONFIG_BATTERY_DS2760 is not set
@@ -4494,6 +4653,7 @@ CONFIG_APM_POWER=m
 # CONFIG_CHARGER_GPIO is not set
 # CONFIG_CHARGER_PCF50633 is not set
 # CONFIG_CHARGER_BQ2415X is not set
+# CONFIG_CHARGER_BQ24190 is not set
 CONFIG_POWER_RESET=y
 
 # CONFIG_PDA_POWER is not set
@@ -4509,6 +4669,7 @@ CONFIG_UIO_AEC=m
 CONFIG_UIO_SERCOS3=m
 CONFIG_UIO_PCI_GENERIC=m
 # CONFIG_UIO_NETX is not set
+# CONFIG_UIO_MF624 is not set
 
 CONFIG_VFIO=m
 CONFIG_VFIO_IOMMU_TYPE1=m
@@ -4548,6 +4709,7 @@ CONFIG_MEMSTICK=m
 # CONFIG_MEMSTICK_DEBUG is not set
 # CONFIG_MEMSTICK_UNSAFE_RESUME is not set
 CONFIG_MSPRO_BLOCK=m
+# CONFIG_MS_BLOCK is not set
 CONFIG_MEMSTICK_TIFM_MS=m
 CONFIG_MEMSTICK_JMICRON_38X=m
 CONFIG_MEMSTICK_R592=m
@@ -4616,6 +4778,7 @@ CONFIG_STAGING_MEDIA=y
 # CONFIG_TI_ST is not set
 # CONFIG_FB_XGI is not set
 # CONFIG_VIDEO_GO7007 is not set
+# CONFIG_USB_MSI3101 is not set
 # CONFIG_DT3155 is not set
 # CONFIG_W35UND is not set
 # CONFIG_PRISM2_USB is not set
@@ -4628,7 +4791,6 @@ CONFIG_USB_ATMEL=m
 # CONFIG_POHMELFS is not set
 # CONFIG_IDE_PHISON is not set
 # CONFIG_LINE6_USB is not set
-# CONFIG_IIO is not set
 # CONFIG_VME_BUS is not set
 # CONFIG_RAR_REGISTER is not set
 # CONFIG_VT6656 is not set
@@ -4642,6 +4804,7 @@ CONFIG_RTL8192E=m
 # CONFIG_INPUT_GPIO is not set
 # CONFIG_VIDEO_CX25821 is not set
 # CONFIG_R8187SE is not set
+# CONFIG_R8188EU is not set
 # CONFIG_RTL8192U is not set
 # CONFIG_FB_SM7XX is not set
 # CONFIG_SPECTRA is not set
@@ -4649,6 +4812,7 @@ CONFIG_RTL8192E=m
 # CONFIG_EASYCAP is not set
 # CONFIG_SOLO6X10 is not set
 # CONFIG_ACPI_QUICKSTART is not set
+# CONFIG_LTE_GDM724X is not set
 CONFIG_R8712U=m # Larry Finger maintains this (rhbz 699618)
 # CONFIG_R8712_AP is not set
 # CONFIG_ATH6K_LEGACY is not set
@@ -4682,6 +4846,10 @@ CONFIG_ALTERA_STAPL=m
 # CONFIG_CED1401 is not set
 # CONFIG_DGRP is not set
 # CONFIG_SB105X is not set
+# CONFIG_LUSTRE_FS is not set
+# CONFIG_XILLYBUS is not set
+# CONFIG_DGAP is not set
+# CONFIG_DGNC is not set
 # END OF STAGING
 
 #
@@ -4737,6 +4905,7 @@ CONFIG_MAC802154=m
 CONFIG_NET_MPLS_GSO=m
 
 # CONFIG_EXTCON is not set
+# CONFIG_EXTCON_ADC_JACK is not set
 # CONFIG_MEMORY is not set
 
 CONFIG_PPS=m
@@ -4766,6 +4935,7 @@ CONFIG_ZSWAP=y
 # CONFIG_W1_MASTER_GPIO is not set
 # CONFIG_LEDS_GPIO is not set
 CONFIG_GPIO_SYSFS=y
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
 # CONFIG_GPIO_MAX732X is not set
 # CONFIG_GPIO_PCA953X is not set
 # CONFIG_GPIO_PCF857X is not set
@@ -4834,6 +5004,7 @@ CONFIG_BCMA=m
 CONFIG_BCMA_BLOCKIO=y
 CONFIG_BCMA_HOST_PCI_POSSIBLE=y
 CONFIG_BCMA_HOST_PCI=y
+# CONFIG_BCMA_HOST_SOC is not set
 CONFIG_BCMA_DRIVER_GMAC_CMN=y
 CONFIG_BCMA_DRIVER_GPIO=y
 # CONFIG_BCMA_DEBUG is not set
@@ -4862,5 +5033,3 @@ CONFIG_FMC_CHARDEV=m
 # CONFIG_CRYPTO_KEY_TYPE is not set
 # CONFIG_PGP_LIBRARY is not set
 # CONFIG_PGP_PRELOAD is not set
-
-# CONFIG_AM335X_PHY_USB is not set
diff --git a/config-no-extra b/config-no-extra
new file mode 100644
index 0000000..7539a17
--- /dev/null
+++ b/config-no-extra
@@ -0,0 +1,27 @@
+### config-no-extra: only (to a first approximation) modules listed in
+###   mod-extra.list should be listed here. 
+
+# CONFIG_ISDN is not set
+# CONFIG_RDS is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATALK is not set
+# CONFIG_HAMRADIO is not set
+
+# CONFIG_DEV_APPLETALK is not set
+
+# CONFIG_FUSION is not set
+# CONFIG_I2O is not set
+
+# CONFIG_NET_TULIP is not set
+
+# CONFIG_HERMES is not set
+
+# CONFIG_OCFS2_FS is not set
+# CONFIG_CUSE is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_UFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
diff --git a/config-powerpc-generic b/config-powerpc-generic
index f24becf..7ba1a5d 100644
--- a/config-powerpc-generic
+++ b/config-powerpc-generic
@@ -334,7 +334,6 @@ CONFIG_I2C_MPC=m
 # CONFIG_CRYPTO_DEV_FSL_CAAM is not set
 # CONFIG_CRYPTO_SHA1_PPC is not set
 
-# CONFIG_GPIO_GENERIC_PLATFORM is not set
 # CONFIG_GPIO_MCP23S08 is not set
 
 # CONFIG_CAN_FLEXCAN is not set
@@ -380,3 +379,5 @@ CONFIG_BACKLIGHT_PWM=m
 CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=n
 
 CONFIG_XZ_DEC_POWERPC=y
+
+CONFIG_CRASH=m
diff --git a/config-powerpc64 b/config-powerpc64
index c3f57b1..b430449 100644
--- a/config-powerpc64
+++ b/config-powerpc64
@@ -136,6 +136,8 @@ CONFIG_RELOCATABLE=y
 
 CONFIG_RCU_FANOUT=64
 
+CONFIG_CMA=y
+# CONFIG_CMA_DEBUG is not set
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=y
 # CONFIG_KVM_EXIT_TIMING is not set
@@ -176,5 +178,3 @@ CONFIG_BPF_JIT=y
 # CONFIG_PPC_TRANSACTIONAL_MEM is not set
 # CONFIG_SND_HDA_INTEL is not set
 CONFIG_BLK_DEV_RSXX=m
-
-CONFIG_CRASH=m
diff --git a/config-powerpc64p7 b/config-powerpc64p7
index 8f09bc8..0e0d957 100644
--- a/config-powerpc64p7
+++ b/config-powerpc64p7
@@ -127,6 +127,8 @@ CONFIG_RELOCATABLE=y
 
 CONFIG_RCU_FANOUT=64
 
+CONFIG_CMA=y
+# CONFIG_CMA_DEBUG is not set
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=y
 # CONFIG_KVM_EXIT_TIMING is not set
diff --git a/config-s390x b/config-s390x
index eced08b..6f3d325 100644
--- a/config-s390x
+++ b/config-s390x
@@ -235,8 +235,6 @@ CONFIG_SCM_BLOCK_CLUSTER_WRITE=y
 # CONFIG_S390_PTDUMP is not set
 # CONFIG_ASYMMETRIC_KEY_TYPE is not set
 # CONFIG_PCI is not set
-# CONFIG_GPIO_GENERIC_PLATFORM is not set
-# CONFIG_GPIO_MCP23S08 is not set
 
 # CONFIG_NEW_LEDS is not set
 # CONFIG_HID is not set
@@ -249,6 +247,7 @@ CONFIG_SCM_BLOCK_CLUSTER_WRITE=y
 # CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
+# CONFIG_SERIO is not set
 
 # CONFIG_ACCESSIBILITY is not set
 # CONFIG_AUXDISPLAY is not set
@@ -267,6 +266,8 @@ CONFIG_SCM_BLOCK_CLUSTER_WRITE=y
 # CONFIG_I2C_PARPORT is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_PTP_1588_CLOCK is not set
+# CONFIG_PPS is not set
 
 # CONFIG_PHYLIB is not set
 # CONFIG_ATM_DRIVERS is not set
diff --git a/config-x86-generic b/config-x86-generic
index 9418475..a21ec7a 100644
--- a/config-x86-generic
+++ b/config-x86-generic
@@ -40,6 +40,8 @@ CONFIG_EFI_VARS_PSTORE=y
 CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=y
 CONFIG_EFI_PCDP=y
 CONFIG_FB_EFI=y
+# needs FB_SIMPLE to work correctly
+# CONFIG_X86_SYSFB is not set
 
 # FIXME: 32bit only?
 # CONFIG_FB_N411 is not set
@@ -254,6 +256,7 @@ CONFIG_PARAVIRT_TIME_ACCOUNTING=y
 CONFIG_KVM_CLOCK=y
 CONFIG_KVM_GUEST=y
 CONFIG_KVM_MMU_AUDIT=y # default $x would be nice...
+# CONFIG_KVM_DEBUG_FS is not set
 
 CONFIG_XEN=y
 # CONFIG_XEN_DEBUG is not set
@@ -362,6 +365,9 @@ CONFIG_LPC_ICH=m
 
 CONFIG_GPIO_ICH=m
 # CONFIG_GPIO_LYNXPOINT is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_F7188X is not set
+
 
 CONFIG_PCI_CNB20LE_QUIRK=y
 
@@ -398,9 +404,6 @@ CONFIG_HP_ACCEL=m
 
 # CONFIG_RAPIDIO is not set
 
-# CONFIG_GPIO_GENERIC_PLATFORM is not set
-# CONFIG_GPIO_MCP23S08 is not set
-
 CONFIG_SCHED_SMT=y
 CONFIG_CC_STACKPROTECTOR=y
 CONFIG_RELOCATABLE=y
@@ -459,3 +462,5 @@ CONFIG_MODULE_SIG_UEFI=y
 
 CONFIG_VMXNET3=m
 CONFIG_VFIO_PCI_VGA=y
+
+# CONFIG_NTB is not set
diff --git a/config-x86_64-generic b/config-x86_64-generic
index 0d85873..4f36d4d 100644
--- a/config-x86_64-generic
+++ b/config-x86_64-generic
@@ -16,8 +16,10 @@ CONFIG_X86_64_ACPI_NUMA=y
 CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y
 CONFIG_NUMA_BALANCING=y
 
-CONFIG_NR_CPUS=128
+# https://lists.fedoraproject.org/pipermail/kernel/2013-November/004601.html
+CONFIG_NR_CPUS=1024
 CONFIG_PHYSICAL_START=0x1000000
+CONFIG_PHYSICAL_ALIGN=0x1000000
 
 CONFIG_IA32_EMULATION=y
 # CONFIG_IA32_AOUT is not set
diff --git a/drm-qxl-backport-fixes-for-Fedora.patch b/drm-qxl-backport-fixes-for-Fedora.patch
index c46060d..04848b5 100644
--- a/drm-qxl-backport-fixes-for-Fedora.patch
+++ b/drm-qxl-backport-fixes-for-Fedora.patch
@@ -150,19 +150,6 @@ index 7e96f4f..18c599d 100644
  };
  
  /* forward declaration for QXL_INFO_IO */
-diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
-index 88722f2..f437b30 100644
---- a/drivers/gpu/drm/qxl/qxl_fb.c
-+++ b/drivers/gpu/drm/qxl/qxl_fb.c
-@@ -108,7 +108,7 @@ static void qxl_fb_dirty_flush(struct fb_info *info)
- 	u32 x1, x2, y1, y2;
- 
- 	/* TODO: hard coding 32 bpp */
--	int stride = qfbdev->qfb.base.pitches[0] * 4;
-+	int stride = qfbdev->qfb.base.pitches[0];
- 
- 	x1 = qfbdev->dirty.x1;
- 	x2 = qfbdev->dirty.x2;
 diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
 index 9e8da9e..e0ddd5b 100644
 --- a/drivers/gpu/drm/qxl/qxl_kms.c
diff --git a/kernel.spec b/kernel.spec
index a670495..cac37d7 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -62,19 +62,19 @@ Summary: The Linux kernel
 # For non-released -rc kernels, this will be appended after the rcX and
 # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
 #
-%global baserelease 301
+%global baserelease 300
 %global fedora_build %{baserelease}
 
 # base_sublevel is the kernel version we're starting with and patching
 # on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base,
 # which yields a base_sublevel of 0.
-%define base_sublevel 11
+%define base_sublevel 12
 
 ## If this is a released kernel ##
 %if 0%{?released_kernel}
 
 # Do we have a -stable update to apply?
-%define stable_update 10
+%define stable_update 5
 # Is it a -stable RC?
 %define stable_rc 0
 # Set rpm version accordingly
@@ -493,13 +493,13 @@ ExclusiveOS: Linux
 #
 # List the packages used during the kernel build
 #
-BuildRequires: module-init-tools, patch >= 2.5.4, bash >= 2.03, sh-utils, tar
-BuildRequires: bzip2, xz, findutils, gzip, m4, perl, perl-Carp, make >= 3.78, diffutils, gawk
-BuildRequires: gcc >= 3.4.2, binutils >= 2.12, redhat-rpm-config, hmaccalc
+BuildRequires: kmod, patch, bash, sh-utils, tar
+BuildRequires: bzip2, xz, findutils, gzip, m4, perl, perl-Carp, make, diffutils, gawk
+BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc
 BuildRequires: net-tools, hostname, bc
 BuildRequires: xmlto, asciidoc
 %if %{with_sparse}
-BuildRequires: sparse >= 0.4.1
+BuildRequires: sparse
 %endif
 %if %{with_perf}
 BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison
@@ -510,11 +510,7 @@ BuildRequires: pciutils-devel gettext
 %endif
 BuildConflicts: rhbuildsys(DiskFree) < 500Mb
 %if %{with_debuginfo}
-# Fancy new debuginfo generation introduced in Fedora 8/RHEL 6.
-# The -r flag to find-debuginfo.sh invokes eu-strip --reloc-debug-sections
-# which reduces the number of relocations in kernel module .ko.debug files and
-# was introduced with rpm 4.9 and elfutils 0.153.
-BuildRequires: rpm-build >= 4.9.0-1, elfutils >= elfutils-0.153-1
+BuildRequires: rpm-build, elfutils
 %define debuginfo_args --strict-build-id -r
 %endif
 
@@ -543,6 +539,7 @@ Source20: Makefile.config
 Source21: config-debug
 Source22: config-nodebug
 Source23: config-generic
+Source24: config-no-extra
 
 Source30: config-x86-generic
 Source31: config-i686-PAE
@@ -624,15 +621,6 @@ Patch09: upstream-reverts.patch
 
 # Standalone patches
 
-#drop with next rebase
-Patch100: taint-vbox.patch
-
-#drop with next rebase
-Patch110: vmbugon-warnon.patch
-
-#drop with next rebase
-Patch201: debug-bad-pte-modules.patch
-
 Patch390: defaults-acpi-video.patch
 Patch396: acpi-sony-nonvs-blacklist.patch
 
@@ -646,6 +634,8 @@ Patch470: die-floppy-die.patch
 Patch510: silence-noise.patch
 Patch530: silence-fbcon-logo.patch
 
+Patch600: x86-allow-1024-cpus.patch
+
 Patch800: crash-driver.patch
 
 # crypto/
@@ -668,19 +658,12 @@ Patch1003: sysrq-secure-boot.patch
 
 # nouveau + drm fixes
 # intel drm is all merged upstream
-Patch1824: drm-intel-next.patch
 Patch1825: drm-i915-dp-stfu.patch
-Patch1826: drm-i915-hush-check-crtc-state.patch
 
 # Quiet boot fixes
 # silence the ACPI blacklist code
 Patch2802: silence-acpi-blacklist.patch
 
-# media patches
-Patch2899: v4l-dvb-fixes.patch
-Patch2900: v4l-dvb-update.patch
-Patch2901: v4l-dvb-experimental.patch
-
 # fs fixes
 
 # NFSv4
@@ -703,8 +686,6 @@ Patch15000: nowatchdog-on-virt.patch
 # lpae
 Patch21001: arm-lpae-ax88796.patch
 Patch21004: arm-sound-soc-samsung-dma-avoid-another-64bit-division.patch
-Patch21005: arm-exynos-mp.patch
-Patch21006: arm-highbank-for-3.12.patch
 
 # ARM omap
 Patch21010: arm-omap-load-tfp410.patch
@@ -712,12 +693,17 @@ Patch21010: arm-omap-load-tfp410.patch
 # ARM tegra
 Patch21020: arm-tegra-usb-no-reset-linux33.patch
 
-# ARM wandboard
-Patch21030: arm-wandboard-quad.patch
-# https://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/patch/?id=3f1a91aa25579ba5e7268a47a73d2a83e4802c62
+# ARM i.MX6
+# http://www.spinics.net/lists/devicetree/msg08276.html
+Patch21025: arm-imx6-utilite.patch
 
-# AM33xx
-Patch21100: am335x-bone.patch
+# am33xx (BeagleBone)
+# https://github.com/beagleboard/kernel
+# Pulled primarily from the above git repo. First patch is all in arm-soc
+# scheduled for 3.13. The others should be landing via other trees
+Patch21030: arm-am33xx-arm-soc-upstream.patch
+Patch21031: arm-am33xx-bblack.patch
+Patch21032: arm-am33xx-cpsw.patch
 
 #rhbz 754518
 Patch21235: scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
@@ -730,42 +716,9 @@ Patch21247: ath9k_rx_dma_stop_check.patch
 
 Patch22000: weird-root-dentry-name-debug.patch
 
-#rhbz 927469
-Patch23006: fix-child-thread-introspection.patch
-
 Patch25047: drm-radeon-Disable-writeback-by-default-on-ppc.patch
 
-#rhbz 977040
-Patch25056: iwl3945-better-skb-management-in-rx-path.patch
-Patch25057: iwl4965-better-skb-management-in-rx-path.patch
-
-#rhbz 963715
-Patch25077: media-cx23885-Fix-TeVii-S471-regression-since-introduction-of-ts2020.patch
-
-#rhbz 985522
-Patch25107: ntp-Make-periodic-RTC-update-more-reliable.patch
-
-#rhbz 971893
-Patch25109: bonding-driver-alb-learning.patch
-
-#rhbz 902012
-Patch25114: elevator-Fix-a-race-in-elevator-switching-and-md.patch
-Patch25115: elevator-acquire-q-sysfs_lock-in-elevator_change.patch
-
-#rhbz 974072
-Patch25117: rt2800-add-support-for-rf3070.patch
-
-#rhbz 1015989
-Patch25122: netfilter-nf_conntrack-use-RCU-safe-kfree-for-conntr.patch
-
-#rhbz 982153
-Patch25123: iommu-Remove-stack-trace-from-broken-irq-remapping-warning.patch
-
-#rhbz 998732
-Patch25125: vfio-iommu-Fixed-interaction-of-VFIO_IOMMU_MAP_DMA.patch
-
 #rhbz 896695
-Patch25126: 0001-iwlwifi-don-t-WARN-on-host-commands-sent-when-firmwa.patch
 Patch25127: 0002-iwlwifi-don-t-WARN-on-bad-firmware-state.patch
 
 #rhbz 993744
@@ -774,43 +727,11 @@ Patch25128: dm-cache-policy-mq_fix-large-scale-table-allocation-bug.patch
 #rhbz 1000439
 Patch25129: cpupower-Fix-segfault-due-to-incorrect-getopt_long-a.patch
 
-#rhbz 1010679
-Patch25130: fix-radeon-sound.patch
-Patch25149: drm-radeon-24hz-audio-fixes.patch
-
-#rhbz 984696
-Patch25132: rt2800usb-slow-down-TX-status-polling.patch
-
-#rhbz 1023413
-Patch25135: alps-Support-for-Dell-XT2-model.patch
-
-#rhbz 1011621
-Patch25137: cifs-Allow-LANMAN-auth-for-unencapsulated-auth-methods.patch
-
-#rhbz 1025769
-Patch25142: iwlwifi-dvm-dont-override-mac80211-queue-setting.patch
-
-Patch25143: drm-qxl-backport-fixes-for-Fedora.patch
-Patch25160: drm-qxl-fix-memory-leak-in-release-list-handling.patch
-
-Patch25144: Input-evdev-fall-back-to-vmalloc-for-client-event-buffer.patch
-
-#CVE-2013-4563 rhbz 1030015 1030017
-Patch25145: ipv6-fix-headroom-calculation-in-udp6_ufo_fragment.patch
-
-#rhbz 1015905
-Patch25146: 0001-ip6_output-fragment-outgoing-reassembled-skb-properl.patch
-Patch25147: 0002-netfilter-push-reasm-skb-through-instead-of-original.patch
+Patch25140: drm-qxl-backport-fixes-for-Fedora.patch
 
 #rhbz 1011362
 Patch25148: alx-Reset-phy-speed-after-resume.patch
 
-#rhbz 1031086
-Patch25150: slab_common-Do-not-check-for-duplicate-slab-names.patch
-
-#rhbz 967652
-Patch25151: KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch
-
 # Fix 15sec NFS mount delay
 Patch25152: sunrpc-create-a-new-dummy-pipe-for-gssd-to-hold-open.patch
 Patch25153: sunrpc-replace-gssd_running-with-more-reliable-check.patch
@@ -819,22 +740,9 @@ Patch25154: nfs-check-gssd-running-before-krb5i-auth.patch
 #CVE-2013-6382 rhbz 1033603 1034670
 Patch25157: xfs-underflow-bug-in-xfs_attrlist_by_handle.patch
 
-#rhbz 1022733
-Patch25158: via-velocity-fix-netif_receive_skb-use-in-irq-disable.patch
-
-#rhbz 998342
-Patch25159: usbnet-fix-status-interrupt-urb-handling.patch
-
-#CVE-2013-6405 rhbz 1035875 1035887
-Patch25161: inet-prevent-leakage-of-uninitialized-memory-to-user.patch
-Patch25162: inet-fix-addr_len-msg_namelen-assignment-in-recv_error-and-rxpmtu-functions.patch
-
 #rhbz 958826
 Patch25164: dell-laptop.patch
 
-#CVE-2013-XXXX rhbz 1039845 1039874
-Patch25165: net-rework-recvmsg-handler-msg_name-and-msg_namelen-.patch
-
 #rhbz 1030802
 Patch25170: Input-elantech-add-support-for-newer-August-2013-dev.patch
 Patch25171: elantech-Properly-differentiate-between-clickpads-an.patch
@@ -1391,17 +1299,9 @@ ApplyOptionalPatch compile-fixes.patch
 # revert patches from upstream that conflict or that we get via other means
 ApplyOptionalPatch upstream-reverts.patch -R
 
-#drop with next rebase
-ApplyPatch taint-vbox.patch
-
-#drop with next rebase
-ApplyPatch vmbugon-warnon.patch
-
-#drop with next rebase
-ApplyPatch debug-bad-pte-modules.patch
-
 # Architecture patches
 # x86(-64)
+ApplyPatch x86-allow-1024-cpus.patch
 
 # ARM64
 
@@ -1410,14 +1310,13 @@ ApplyPatch debug-bad-pte-modules.patch
 #
 ApplyPatch arm-lpae-ax88796.patch
 ApplyPatch arm-sound-soc-samsung-dma-avoid-another-64bit-division.patch
-ApplyPatch arm-exynos-mp.patch
-ApplyPatch arm-highbank-for-3.12.patch
 ApplyPatch arm-omap-load-tfp410.patch
 ApplyPatch arm-tegra-usb-no-reset-linux33.patch
-ApplyPatch arm-wandboard-quad.patch
+ApplyPatch arm-imx6-utilite.patch
 
-# Fix OMAP and AM33xx (BeagleBone)
-ApplyPatch am335x-bone.patch
+ApplyPatch arm-am33xx-arm-soc-upstream.patch
+ApplyPatch arm-am33xx-bblack.patch
+ApplyPatch arm-am33xx-cpsw.patch
 
 #
 # bugfixes to drivers and filesystems
@@ -1500,21 +1399,13 @@ ApplyPatch sysrq-secure-boot.patch
 # Nouveau DRM
 
 # Intel DRM
-ApplyOptionalPatch drm-intel-next.patch
 ApplyPatch drm-i915-dp-stfu.patch
-ApplyPatch drm-i915-hush-check-crtc-state.patch
 
 # Radeon DRM
 
 # silence the ACPI blacklist code
 ApplyPatch silence-acpi-blacklist.patch
 
-# V4L/DVB updates/fixes/experimental drivers
-#  apply if non-empty
-ApplyOptionalPatch v4l-dvb-fixes.patch
-ApplyOptionalPatch v4l-dvb-update.patch
-ApplyOptionalPatch v4l-dvb-experimental.patch
-
 # Patches headed upstream
 ApplyPatch fs-proc-devtree-remove_proc_entry.patch
 
@@ -1531,7 +1422,7 @@ ApplyPatch nowatchdog-on-virt.patch
 #rhbz 754518
 ApplyPatch scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
 
-ApplyPatch weird-root-dentry-name-debug.patch
+#pplyPatch weird-root-dentry-name-debug.patch
 
 # https://fedoraproject.org/wiki/Features/Checkpoint_Restore
 ApplyPatch criu-no-expert.patch
@@ -1539,42 +1430,9 @@ ApplyPatch criu-no-expert.patch
 #rhbz 892811
 ApplyPatch ath9k_rx_dma_stop_check.patch
 
-#rhbz 927469
-ApplyPatch fix-child-thread-introspection.patch
-
 ApplyPatch drm-radeon-Disable-writeback-by-default-on-ppc.patch
 
-#rhbz 977040
-ApplyPatch iwl3945-better-skb-management-in-rx-path.patch
-ApplyPatch iwl4965-better-skb-management-in-rx-path.patch
-
-#rhbz 963715
-ApplyPatch media-cx23885-Fix-TeVii-S471-regression-since-introduction-of-ts2020.patch
-
-#rhbz 985522
-ApplyPatch ntp-Make-periodic-RTC-update-more-reliable.patch
-
-#rhbz 971893
-ApplyPatch bonding-driver-alb-learning.patch
-
-#rhbz 902012
-ApplyPatch elevator-Fix-a-race-in-elevator-switching-and-md.patch
-ApplyPatch elevator-acquire-q-sysfs_lock-in-elevator_change.patch
-
-#rhbz 974072
-ApplyPatch rt2800-add-support-for-rf3070.patch
-
-#rhbz 1015989
-ApplyPatch netfilter-nf_conntrack-use-RCU-safe-kfree-for-conntr.patch
-
-#rhbz 982153
-ApplyPatch iommu-Remove-stack-trace-from-broken-irq-remapping-warning.patch
-
-#rhbz 998732
-ApplyPatch vfio-iommu-Fixed-interaction-of-VFIO_IOMMU_MAP_DMA.patch
-
 #rhbz 896695
-ApplyPatch 0001-iwlwifi-don-t-WARN-on-host-commands-sent-when-firmwa.patch
 ApplyPatch 0002-iwlwifi-don-t-WARN-on-bad-firmware-state.patch
 
 #rhbz 993744
@@ -1583,43 +1441,11 @@ ApplyPatch dm-cache-policy-mq_fix-large-scale-table-allocation-bug.patch
 #rhbz 1000439
 ApplyPatch cpupower-Fix-segfault-due-to-incorrect-getopt_long-a.patch
 
-#rhbz 1010679
-ApplyPatch fix-radeon-sound.patch
-ApplyPatch drm-radeon-24hz-audio-fixes.patch
-
-#rhbz 984696
-ApplyPatch rt2800usb-slow-down-TX-status-polling.patch
-
-#rhbz 1023413
-ApplyPatch alps-Support-for-Dell-XT2-model.patch
-
-#rhbz 1011621
-ApplyPatch cifs-Allow-LANMAN-auth-for-unencapsulated-auth-methods.patch
-
-#rhbz 1025769
-ApplyPatch iwlwifi-dvm-dont-override-mac80211-queue-setting.patch
-
 ApplyPatch drm-qxl-backport-fixes-for-Fedora.patch
-ApplyPatch drm-qxl-fix-memory-leak-in-release-list-handling.patch
-
-ApplyPatch Input-evdev-fall-back-to-vmalloc-for-client-event-buffer.patch
-
-#CVE-2013-4563 rhbz 1030015 1030017
-ApplyPatch ipv6-fix-headroom-calculation-in-udp6_ufo_fragment.patch
-
-#rhbz 1015905
-ApplyPatch 0001-ip6_output-fragment-outgoing-reassembled-skb-properl.patch
-ApplyPatch 0002-netfilter-push-reasm-skb-through-instead-of-original.patch
 
 #rhbz 1011362
 ApplyPatch alx-Reset-phy-speed-after-resume.patch
 
-#rhbz 1031086
-ApplyPatch slab_common-Do-not-check-for-duplicate-slab-names.patch
-
-#rhbz 967652
-ApplyPatch KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch
-
 # Fix 15sec NFS mount delay
 ApplyPatch sunrpc-create-a-new-dummy-pipe-for-gssd-to-hold-open.patch
 ApplyPatch sunrpc-replace-gssd_running-with-more-reliable-check.patch
@@ -1628,22 +1454,9 @@ ApplyPatch nfs-check-gssd-running-before-krb5i-auth.patch
 #CVE-2013-6382 rhbz 1033603 1034670
 ApplyPatch xfs-underflow-bug-in-xfs_attrlist_by_handle.patch
 
-#rhbz 1022733
-ApplyPatch via-velocity-fix-netif_receive_skb-use-in-irq-disable.patch
-
-#rhbz 998342
-ApplyPatch usbnet-fix-status-interrupt-urb-handling.patch
-
-#CVE-2013-6405 rhbz 1035875 1035887
-ApplyPatch inet-prevent-leakage-of-uninitialized-memory-to-user.patch
-ApplyPatch inet-fix-addr_len-msg_namelen-assignment-in-recv_error-and-rxpmtu-functions.patch
-
 #rhbz 958826
 ApplyPatch dell-laptop.patch
 
-#CVE-2013-XXXX rhbz 1039845 1039874
-ApplyPatch net-rework-recvmsg-handler-msg_name-and-msg_namelen-.patch
-
 #rhbz 1030802
 ApplyPatch Input-elantech-add-support-for-newer-August-2013-dev.patch
 ApplyPatch elantech-Properly-differentiate-between-clickpads-an.patch
@@ -2012,7 +1825,7 @@ BuildKernel %make_target %kernel_image smp
 %endif
 
 %global perf_make \
-  make -s %{?cross_opts} %{?_smp_mflags} -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 prefix=%{_prefix}
+  make -s %{?cross_opts} %{?_smp_mflags} -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 NO_BIONIC=1 prefix=%{_prefix}
 %if %{with_perf}
 # perf
 %{perf_make} all
@@ -2462,6 +2275,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Fri Dec 13 2013 Justin M. Forbes <jforbes at fedoraproject.org - 3.12.5-300
+- Linux v3.12.5 rebase
+
 * Thu Dec 12 2013 Josh Boyer <jwboyer at fedoraproject.org>
 - CVE-2013-4587 kvm: out-of-bounds access (rhbz 1030986 1042071)
 - CVE-2013-6376 kvm: BUG_ON in apic_cluster_id (rhbz 1033106 1042099)
diff --git a/keys-krb-support.patch b/keys-krb-support.patch
index 07a909d..8bffaae 100644
--- a/keys-krb-support.patch
+++ b/keys-krb-support.patch
@@ -1,4 +1,4 @@
-From 64160c504842a359801cff17464931fa028ff164 Mon Sep 17 00:00:00 2001
+From d7ccdaa17aab12a49f5e9e327b55167c4af26bf8 Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
 Date: Fri, 30 Aug 2013 15:37:54 +0100
 Subject: [PATCH 1/2] KEYS: Implement a big key type that can save to tmpfs
@@ -308,7 +308,7 @@ index 0000000..5f9defc
 1.8.3.1
 
 
-From b1e5b74e060add16de8d6005802644fa1700167f Mon Sep 17 00:00:00 2001
+From 862e98313b10123fa4352117b0b0c0f5a530cefb Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
 Date: Fri, 30 Aug 2013 15:37:54 +0100
 Subject: [PATCH 2/2] KEYS: Add per-user_namespace registers for persistent
@@ -377,7 +377,7 @@ Tested-by: Simo Sorce <simo at redhat.com>
 cc: Serge E. Hallyn <serge.hallyn at ubuntu.com>
 cc: Eric W. Biederman <ebiederm at xmission.com>
 ---
- include/linux/user_namespace.h |   6 ++
+ include/linux/user_namespace.h |   7 ++
  include/uapi/linux/keyctl.h    |   1 +
  kernel/user.c                  |   4 +
  kernel/user_namespace.c        |   6 ++
@@ -388,23 +388,24 @@ cc: Eric W. Biederman <ebiederm at xmission.com>
  security/keys/keyctl.c         |   3 +
  security/keys/persistent.c     | 169 +++++++++++++++++++++++++++++++++++++++++
  security/keys/sysctl.c         |  11 +++
- 11 files changed, 230 insertions(+)
+ 11 files changed, 231 insertions(+)
  create mode 100644 security/keys/persistent.c
 
 diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
-index b6b215f..cf21958 100644
+index 4db2985..bb0639d 100644
 --- a/include/linux/user_namespace.h
 +++ b/include/linux/user_namespace.h
-@@ -28,6 +28,12 @@ struct user_namespace {
+@@ -27,6 +27,13 @@ struct user_namespace {
+ 	kuid_t			owner;
+ 	kgid_t			group;
  	unsigned int		proc_inum;
- 	bool			may_mount_sysfs;
- 	bool			may_mount_proc;
 +
 +	/* Register of per-UID persistent keyrings for this namespace */
 +#ifdef CONFIG_PERSISTENT_KEYRINGS
 +	struct key		*persistent_keyring_register;
 +	struct rw_semaphore	persistent_keyring_register_sem;
 +#endif
++
  };
  
  extern struct user_namespace init_user_ns;
@@ -420,13 +421,13 @@ index c9b7f4fa..840cb99 100644
  
  #endif /*  _LINUX_KEYCTL_H */
 diff --git a/kernel/user.c b/kernel/user.c
-index 69b4c3d..6c9e1b9 100644
+index 5bbb919..a3a0dbf 100644
 --- a/kernel/user.c
 +++ b/kernel/user.c
-@@ -53,6 +53,10 @@ struct user_namespace init_user_ns = {
+@@ -51,6 +51,10 @@ struct user_namespace init_user_ns = {
+ 	.owner = GLOBAL_ROOT_UID,
+ 	.group = GLOBAL_ROOT_GID,
  	.proc_inum = PROC_USER_INIT_INO,
- 	.may_mount_sysfs = true,
- 	.may_mount_proc = true,
 +#ifdef CONFIG_KEYS_KERBEROS_CACHE
 +	.krb_cache_register_sem =
 +	__RWSEM_INITIALIZER(init_user_ns.krb_cache_register_sem),
@@ -435,12 +436,12 @@ index 69b4c3d..6c9e1b9 100644
  EXPORT_SYMBOL_GPL(init_user_ns);
  
 diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
-index d8c30db..ef7985e 100644
+index 13fb113..2dbc299 100644
 --- a/kernel/user_namespace.c
 +++ b/kernel/user_namespace.c
-@@ -99,6 +99,9 @@ int create_user_ns(struct cred *new)
+@@ -101,6 +101,9 @@ int create_user_ns(struct cred *new)
  
- 	update_mnt_policy(ns);
+ 	set_cred_user_ns(new, ns);
  
 +#ifdef CONFIG_PERSISTENT_KEYRINGS
 +	rwsem_init(&ns->persistent_keyring_register_sem);
@@ -448,7 +449,7 @@ index d8c30db..ef7985e 100644
  	return 0;
  }
  
-@@ -123,6 +126,9 @@ void free_user_ns(struct user_namespace *ns)
+@@ -130,6 +133,9 @@ void free_user_ns(struct user_namespace *ns)
  
  	do {
  		parent = ns->parent;
diff --git a/keys-x509-improv.patch b/keys-x509-improv.patch
index b3341cf..db07ea3 100644
--- a/keys-x509-improv.patch
+++ b/keys-x509-improv.patch
@@ -1,1580 +1,1808 @@
-From abaac4978b6719e7ae12babb6be5e35184b61cde Mon Sep 17 00:00:00 2001
+From 775d395f8bd8ef08971c77f54c38ec7b9355ba4f Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:07:13 +0100
-Subject: [PATCH 01/14] KEYS: Load *.x509 files into kernel keyring
-
-Load all the files matching the pattern "*.x509" that are to be found in kernel
-base source dir and base build dir into the module signing keyring.
+Date: Fri, 30 Aug 2013 16:15:10 +0100
+Subject: [PATCH 01/18] KEYS: Rename public key parameter name arrays
 
-The "extra_certificates" file is then redundant.
+Rename the arrays of public key parameters (public key algorithm names, hash
+algorithm names and ID type names) so that the array name ends in "_name".
 
 Signed-off-by: David Howells <dhowells at redhat.com>
+Reviewed-by: Kees Cook <keescook at chromium.org>
+Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- kernel/Makefile              | 35 +++++++++++++++++++++++++++++------
- kernel/modsign_certificate.S |  3 +--
- 2 files changed, 30 insertions(+), 8 deletions(-)
+ crypto/asymmetric_keys/public_key.c      | 14 +++++++-------
+ crypto/asymmetric_keys/x509_public_key.c |  8 ++++----
+ include/crypto/public_key.h              |  6 +++---
+ kernel/module_signing.c                  |  4 ++--
+ 4 files changed, 16 insertions(+), 16 deletions(-)
 
-diff --git a/kernel/Makefile b/kernel/Makefile
-index 470839d..4a2ee4e 100644
---- a/kernel/Makefile
-+++ b/kernel/Makefile
-@@ -141,17 +141,40 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
- 	$(call if_changed,bc)
+diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
+index cb2e291..b313df1 100644
+--- a/crypto/asymmetric_keys/public_key.c
++++ b/crypto/asymmetric_keys/public_key.c
+@@ -22,13 +22,13 @@
  
- ifeq ($(CONFIG_MODULE_SIG),y)
-+###############################################################################
- #
--# Pull the signing certificate and any extra certificates into the kernel
-+# Roll all the X.509 certificates that we can find together and pull
-+# them into the kernel.
- #
-+###############################################################################
-+X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
-+X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
-+X509_CERTIFICATES := $(sort $(X509_CERTIFICATES-y))
-+
-+ifeq ($(X509_CERTIFICATES),)
-+$(warning *** No X.509 certificates found ***)
-+endif
-+
-+ifneq ($(wildcard $(obj)/.x509.list),)
-+ifneq ($(shell cat $(obj)/.x509.list),$(X509_CERTIFICATES))
-+$(info X.509 certificate list changed)
-+$(shell rm $(obj)/.x509.list)
-+endif
-+endif
-+
-+kernel/modsign_certificate.o: $(obj)/x509_certificate_list
+ MODULE_LICENSE("GPL");
  
--quiet_cmd_touch = TOUCH   $@
--      cmd_touch = touch   $@
-+quiet_cmd_x509certs  = CERTS   $@
-+      cmd_x509certs  = cat $(X509_CERTIFICATES) /dev/null >$@
-+targets += $(obj)/x509_certificate_list
-+$(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list
-+	$(call if_changed,x509certs)
+-const char *const pkey_algo[PKEY_ALGO__LAST] = {
++const char *const pkey_algo_name[PKEY_ALGO__LAST] = {
+ 	[PKEY_ALGO_DSA]		= "DSA",
+ 	[PKEY_ALGO_RSA]		= "RSA",
+ };
+-EXPORT_SYMBOL_GPL(pkey_algo);
++EXPORT_SYMBOL_GPL(pkey_algo_name);
  
--extra_certificates:
--	$(call cmd,touch)
-+targets += $(obj)/.x509.list
-+$(obj)/.x509.list:
-+	@echo $(X509_CERTIFICATES) >$@
+-const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
++const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = {
+ 	[PKEY_HASH_MD4]		= "md4",
+ 	[PKEY_HASH_MD5]		= "md5",
+ 	[PKEY_HASH_SHA1]	= "sha1",
+@@ -38,13 +38,13 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
+ 	[PKEY_HASH_SHA512]	= "sha512",
+ 	[PKEY_HASH_SHA224]	= "sha224",
+ };
+-EXPORT_SYMBOL_GPL(pkey_hash_algo);
++EXPORT_SYMBOL_GPL(pkey_hash_algo_name);
  
--kernel/modsign_certificate.o: signing_key.x509 extra_certificates
-+clean-files := x509_certificate_list .x509.list
+-const char *const pkey_id_type[PKEY_ID_TYPE__LAST] = {
++const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST] = {
+ 	[PKEY_ID_PGP]		= "PGP",
+ 	[PKEY_ID_X509]		= "X509",
+ };
+-EXPORT_SYMBOL_GPL(pkey_id_type);
++EXPORT_SYMBOL_GPL(pkey_id_type_name);
  
- ###############################################################################
- #
-diff --git a/kernel/modsign_certificate.S b/kernel/modsign_certificate.S
-index 4a9a86d..6fe03c7 100644
---- a/kernel/modsign_certificate.S
-+++ b/kernel/modsign_certificate.S
-@@ -7,6 +7,5 @@
- 	.section ".init.data","aw"
+ /*
+  * Provide a part of a description of the key for /proc/keys.
+@@ -56,7 +56,7 @@ static void public_key_describe(const struct key *asymmetric_key,
  
- GLOBAL(modsign_certificate_list)
--	.incbin "signing_key.x509"
--	.incbin "extra_certificates"
-+	.incbin "kernel/x509_certificate_list"
- GLOBAL(modsign_certificate_list_end)
+ 	if (key)
+ 		seq_printf(m, "%s.%s",
+-			   pkey_id_type[key->id_type], key->algo->name);
++			   pkey_id_type_name[key->id_type], key->algo->name);
+ }
+ 
+ /*
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
+index 06007f0..afbbc36 100644
+--- a/crypto/asymmetric_keys/x509_public_key.c
++++ b/crypto/asymmetric_keys/x509_public_key.c
+@@ -49,7 +49,7 @@ static int x509_check_signature(const struct public_key *pub,
+ 	/* Allocate the hashing algorithm we're going to need and find out how
+ 	 * big the hash operational data will be.
+ 	 */
+-	tfm = crypto_alloc_shash(pkey_hash_algo[cert->sig_hash_algo], 0, 0);
++	tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig_hash_algo], 0, 0);
+ 	if (IS_ERR(tfm))
+ 		return (PTR_ERR(tfm) == -ENOENT) ? -ENOPKG : PTR_ERR(tfm);
+ 
+@@ -117,7 +117,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 
+ 	pr_devel("Cert Issuer: %s\n", cert->issuer);
+ 	pr_devel("Cert Subject: %s\n", cert->subject);
+-	pr_devel("Cert Key Algo: %s\n", pkey_algo[cert->pkey_algo]);
++	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pkey_algo]);
+ 	pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
+ 		 cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
+ 		 cert->valid_from.tm_mday, cert->valid_from.tm_hour,
+@@ -127,8 +127,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 		 cert->valid_to.tm_mday, cert->valid_to.tm_hour,
+ 		 cert->valid_to.tm_min,  cert->valid_to.tm_sec);
+ 	pr_devel("Cert Signature: %s + %s\n",
+-		 pkey_algo[cert->sig_pkey_algo],
+-		 pkey_hash_algo[cert->sig_hash_algo]);
++		 pkey_algo_name[cert->sig_pkey_algo],
++		 pkey_hash_algo_name[cert->sig_hash_algo]);
+ 
+ 	if (!cert->fingerprint || !cert->authority) {
+ 		pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",
+diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
+index f5b0224..619d570 100644
+--- a/include/crypto/public_key.h
++++ b/include/crypto/public_key.h
+@@ -22,7 +22,7 @@ enum pkey_algo {
+ 	PKEY_ALGO__LAST
+ };
+ 
+-extern const char *const pkey_algo[PKEY_ALGO__LAST];
++extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
+ 
+ enum pkey_hash_algo {
+ 	PKEY_HASH_MD4,
+@@ -36,7 +36,7 @@ enum pkey_hash_algo {
+ 	PKEY_HASH__LAST
+ };
+ 
+-extern const char *const pkey_hash_algo[PKEY_HASH__LAST];
++extern const char *const pkey_hash_algo_name[PKEY_HASH__LAST];
+ 
+ enum pkey_id_type {
+ 	PKEY_ID_PGP,		/* OpenPGP generated key ID */
+@@ -44,7 +44,7 @@ enum pkey_id_type {
+ 	PKEY_ID_TYPE__LAST
+ };
+ 
+-extern const char *const pkey_id_type[PKEY_ID_TYPE__LAST];
++extern const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST];
+ 
+ /*
+  * Cryptographic data for the public-key subtype of the asymmetric key type.
+diff --git a/kernel/module_signing.c b/kernel/module_signing.c
+index f2970bd..ee47640 100644
+--- a/kernel/module_signing.c
++++ b/kernel/module_signing.c
+@@ -54,7 +54,7 @@ static struct public_key_signature *mod_make_digest(enum pkey_hash_algo hash,
+ 	/* Allocate the hashing algorithm we're going to need and find out how
+ 	 * big the hash operational data will be.
+ 	 */
+-	tfm = crypto_alloc_shash(pkey_hash_algo[hash], 0, 0);
++	tfm = crypto_alloc_shash(pkey_hash_algo_name[hash], 0, 0);
+ 	if (IS_ERR(tfm))
+ 		return (PTR_ERR(tfm) == -ENOENT) ? ERR_PTR(-ENOPKG) : ERR_CAST(tfm);
+ 
+@@ -217,7 +217,7 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen)
+ 		return -ENOPKG;
+ 
+ 	if (ms.hash >= PKEY_HASH__LAST ||
+-	    !pkey_hash_algo[ms.hash])
++	    !pkey_hash_algo_name[ms.hash])
+ 		return -ENOPKG;
+ 
+ 	key = request_asymmetric_key(sig, ms.signer_len,
 -- 
 1.8.3.1
 
 
-
-From 2d6ac2896c3b4b48be96b7dbdfda1668609e35aa Mon Sep 17 00:00:00 2001
+From d12f06db05dacb455714f00f070cce844fb3e44c Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:07:30 +0100
-Subject: [PATCH 03/14] KEYS: Separate the kernel signature checking keyring
- from module signing
+Date: Fri, 30 Aug 2013 16:15:18 +0100
+Subject: [PATCH 02/18] KEYS: Move the algorithm pointer array from x509 to
+ public_key.c
 
-Separate the kernel signature checking keyring from module signing so that it
-can be used by code other than the module-signing code.
+Move the public-key algorithm pointer array from x509_public_key.c to
+public_key.c as it isn't X.509 specific.
 
 Signed-off-by: David Howells <dhowells at redhat.com>
+Reviewed-by: Kees Cook <keescook at chromium.org>
+Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- include/keys/system_keyring.h |  23 ++++++++++
- init/Kconfig                  |  13 ++++++
- kernel/Makefile               |  17 ++++---
- kernel/modsign_certificate.S  |  11 -----
- kernel/modsign_pubkey.c       | 104 ------------------------------------------
- kernel/module-internal.h      |   2 -
- kernel/module_signing.c       |   3 +-
- kernel/system_certificates.S  |  11 +++++
- kernel/system_keyring.c       | 103 +++++++++++++++++++++++++++++++++++++++++
- 9 files changed, 163 insertions(+), 124 deletions(-)
- create mode 100644 include/keys/system_keyring.h
- delete mode 100644 kernel/modsign_certificate.S
- delete mode 100644 kernel/modsign_pubkey.c
- create mode 100644 kernel/system_certificates.S
- create mode 100644 kernel/system_keyring.c
+ crypto/asymmetric_keys/public_key.c      |  8 ++++++++
+ crypto/asymmetric_keys/x509_public_key.c | 11 +----------
+ include/crypto/public_key.h              |  1 +
+ 3 files changed, 10 insertions(+), 10 deletions(-)
 
-diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
-new file mode 100644
-index 0000000..8dabc39
---- /dev/null
-+++ b/include/keys/system_keyring.h
-@@ -0,0 +1,23 @@
-+/* System keyring containing trusted public keys.
-+ *
-+ * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
-+ * Written by David Howells (dhowells at redhat.com)
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public Licence
-+ * as published by the Free Software Foundation; either version
-+ * 2 of the Licence, or (at your option) any later version.
-+ */
+diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
+index b313df1..796ce08 100644
+--- a/crypto/asymmetric_keys/public_key.c
++++ b/crypto/asymmetric_keys/public_key.c
+@@ -28,6 +28,14 @@ const char *const pkey_algo_name[PKEY_ALGO__LAST] = {
+ };
+ EXPORT_SYMBOL_GPL(pkey_algo_name);
+ 
++const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST] = {
++#if defined(CONFIG_PUBLIC_KEY_ALGO_RSA) || \
++	defined(CONFIG_PUBLIC_KEY_ALGO_RSA_MODULE)
++	[PKEY_ALGO_RSA]		= &RSA_public_key_algorithm,
++#endif
++};
++EXPORT_SYMBOL_GPL(pkey_algo);
 +
-+#ifndef _KEYS_SYSTEM_KEYRING_H
-+#define _KEYS_SYSTEM_KEYRING_H
-+
-+#ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
-+
-+#include <linux/key.h>
-+
-+extern struct key *system_trusted_keyring;
-+
-+#endif
-+
-+#endif /* _KEYS_SYSTEM_KEYRING_H */
-diff --git a/init/Kconfig b/init/Kconfig
-index 247084b..6abf0e0 100644
---- a/init/Kconfig
-+++ b/init/Kconfig
-@@ -1664,6 +1664,18 @@ config BASE_SMALL
- 	default 0 if BASE_FULL
- 	default 1 if !BASE_FULL
+ const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = {
+ 	[PKEY_HASH_MD4]		= "md4",
+ 	[PKEY_HASH_MD5]		= "md5",
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
+index afbbc36..fe38628 100644
+--- a/crypto/asymmetric_keys/x509_public_key.c
++++ b/crypto/asymmetric_keys/x509_public_key.c
+@@ -23,15 +23,6 @@
+ #include "public_key.h"
+ #include "x509_parser.h"
  
-+config SYSTEM_TRUSTED_KEYRING
-+	bool "Provide system-wide ring of trusted keys"
-+	depends on KEYS
-+	help
-+	  Provide a system keyring to which trusted keys can be added.  Keys in
-+	  the keyring are considered to be trusted.  Keys may be added at will
-+	  by the kernel from compiled-in data and from hardware key stores, but
-+	  userspace may only add extra keys if those keys can be verified by
-+	  keys already in the keyring.
-+
-+	  Keys in this keyring are used by module signature checking.
+-static const
+-struct public_key_algorithm *x509_public_key_algorithms[PKEY_ALGO__LAST] = {
+-	[PKEY_ALGO_DSA]		= NULL,
+-#if defined(CONFIG_PUBLIC_KEY_ALGO_RSA) || \
+-	defined(CONFIG_PUBLIC_KEY_ALGO_RSA_MODULE)
+-	[PKEY_ALGO_RSA]		= &RSA_public_key_algorithm,
+-#endif
+-};
+-
+ /*
+  * Check the signature on a certificate using the provided public key
+  */
+@@ -174,7 +165,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 		goto error_free_cert;
+ 	}
+ 
+-	cert->pub->algo = x509_public_key_algorithms[cert->pkey_algo];
++	cert->pub->algo = pkey_algo[cert->pkey_algo];
+ 	cert->pub->id_type = PKEY_ID_X509;
+ 
+ 	/* Check the signature on the key */
+diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
+index 619d570..46bde25 100644
+--- a/include/crypto/public_key.h
++++ b/include/crypto/public_key.h
+@@ -23,6 +23,7 @@ enum pkey_algo {
+ };
+ 
+ extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
++extern const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST];
+ 
+ enum pkey_hash_algo {
+ 	PKEY_HASH_MD4,
+-- 
+1.8.3.1
+
+
+From 8d2905bce58b356e9b5313a4aaebb5085bb4c151 Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells at redhat.com>
+Date: Fri, 30 Aug 2013 16:15:24 +0100
+Subject: [PATCH 03/18] KEYS: Store public key algo ID in public_key struct
+
+Store public key algo ID in public_key struct for reference purposes.  This
+allows it to be removed from the x509_certificate struct and used to find a
+default in public_key_verify_signature().
+
+Signed-off-by: David Howells <dhowells at redhat.com>
+Reviewed-by: Kees Cook <keescook at chromium.org>
+Reviewed-by: Josh Boyer <jwboyer at redhat.com>
+---
+ crypto/asymmetric_keys/x509_cert_parser.c | 5 +++--
+ crypto/asymmetric_keys/x509_parser.h      | 1 -
+ crypto/asymmetric_keys/x509_public_key.c  | 4 ++--
+ include/crypto/public_key.h               | 1 +
+ 4 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
+index facbf26..8cc253d 100644
+--- a/crypto/asymmetric_keys/x509_cert_parser.c
++++ b/crypto/asymmetric_keys/x509_cert_parser.c
+@@ -343,8 +343,9 @@ int x509_extract_key_data(void *context, size_t hdrlen,
+ 	if (ctx->last_oid != OID_rsaEncryption)
+ 		return -ENOPKG;
+ 
+-	/* There seems to be an extraneous 0 byte on the front of the data */
+-	ctx->cert->pkey_algo = PKEY_ALGO_RSA;
++	ctx->cert->pub->pkey_algo = PKEY_ALGO_RSA;
 +
- menuconfig MODULES
- 	bool "Enable loadable module support"
- 	help
-@@ -1736,6 +1748,7 @@ config MODULE_SRCVERSION_ALL
- config MODULE_SIG
- 	bool "Module signature verification"
- 	depends on MODULES
-+	select SYSTEM_TRUSTED_KEYRING
- 	select KEYS
- 	select CRYPTO
- 	select ASYMMETRIC_KEY_TYPE
-diff --git a/kernel/Makefile b/kernel/Makefile
-index 7bd1565..68f7182 100644
---- a/kernel/Makefile
-+++ b/kernel/Makefile
-@@ -52,8 +52,9 @@ obj-$(CONFIG_SMP) += spinlock.o
- obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
- obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
- obj-$(CONFIG_UID16) += uid16.o
-+obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
- obj-$(CONFIG_MODULES) += module.o
--obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o
-+obj-$(CONFIG_MODULE_SIG) += module_signing.o
- obj-$(CONFIG_KALLSYMS) += kallsyms.o
- obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
- obj-$(CONFIG_KEXEC) += kexec.o
-@@ -140,13 +141,14 @@ targets += timeconst.h
- $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
- 	$(call if_changed,bc)
++	/* Discard the BIT STRING metadata */
+ 	ctx->key = value + 1;
+ 	ctx->key_size = vlen - 1;
+ 	return 0;
+diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
+index f86dc5f..e583ad0 100644
+--- a/crypto/asymmetric_keys/x509_parser.h
++++ b/crypto/asymmetric_keys/x509_parser.h
+@@ -20,7 +20,6 @@ struct x509_certificate {
+ 	char		*authority;		/* Authority key fingerprint as hex */
+ 	struct tm	valid_from;
+ 	struct tm	valid_to;
+-	enum pkey_algo	pkey_algo : 8;		/* Public key algorithm */
+ 	enum pkey_algo	sig_pkey_algo : 8;	/* Signature public key algorithm */
+ 	enum pkey_hash_algo sig_hash_algo : 8;	/* Signature hash algorithm */
+ 	const void	*tbs;			/* Signed data */
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
+index fe38628..fac574c 100644
+--- a/crypto/asymmetric_keys/x509_public_key.c
++++ b/crypto/asymmetric_keys/x509_public_key.c
+@@ -108,7 +108,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
  
--ifeq ($(CONFIG_MODULE_SIG),y)
- ###############################################################################
- #
--# Roll all the X.509 certificates that we can find together and pull
--# them into the kernel.
-+# Roll all the X.509 certificates that we can find together and pull them into
-+# the kernel so that they get loaded into the system trusted keyring during
-+# boot.
- #
- ###############################################################################
-+ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
- X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
- X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
- X509_CERTIFICATES := $(sort $(realpath $(X509_CERTIFICATES-y)))
-@@ -162,10 +164,11 @@ $(shell rm $(obj)/.x509.list)
- endif
- endif
+ 	pr_devel("Cert Issuer: %s\n", cert->issuer);
+ 	pr_devel("Cert Subject: %s\n", cert->subject);
+-	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pkey_algo]);
++	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pub->pkey_algo]);
+ 	pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
+ 		 cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
+ 		 cert->valid_from.tm_mday, cert->valid_from.tm_hour,
+@@ -165,7 +165,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 		goto error_free_cert;
+ 	}
  
--kernel/modsign_certificate.o: $(obj)/x509_certificate_list
-+kernel/system_certificates.o: $(obj)/x509_certificate_list
+-	cert->pub->algo = pkey_algo[cert->pkey_algo];
++	cert->pub->algo = pkey_algo[cert->pub->pkey_algo];
+ 	cert->pub->id_type = PKEY_ID_X509;
  
- quiet_cmd_x509certs  = CERTS   $@
--      cmd_x509certs  = cat $(X509_CERTIFICATES) /dev/null >$@
-+      cmd_x509certs  = cat $(X509_CERTIFICATES) /dev/null >$@ $(foreach X509,$(X509_CERTIFICATES),; echo "  - Including cert $(X509)")
+ 	/* Check the signature on the key */
+diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
+index 46bde25..05778df 100644
+--- a/include/crypto/public_key.h
++++ b/include/crypto/public_key.h
+@@ -60,6 +60,7 @@ struct public_key {
+ #define PKEY_CAN_DECRYPT	0x02
+ #define PKEY_CAN_SIGN		0x04
+ #define PKEY_CAN_VERIFY		0x08
++	enum pkey_algo pkey_algo : 8;
+ 	enum pkey_id_type id_type : 8;
+ 	union {
+ 		MPI	mpi[5];
+-- 
+1.8.3.1
+
+
+From df1662a5b9f37a88c1e112d4052eca79efc8e6fc Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells at redhat.com>
+Date: Fri, 30 Aug 2013 16:15:30 +0100
+Subject: [PATCH 04/18] KEYS: Split public_key_verify_signature() and make
+ available
+
+Modify public_key_verify_signature() so that it now takes a public_key struct
+rather than a key struct and supply a wrapper that takes a key struct.  The
+wrapper is then used by the asymmetric key subtype and the modified function is
+used by X.509 self-signature checking and can be used by other things also.
+
+Signed-off-by: David Howells <dhowells at redhat.com>
+Reviewed-by: Kees Cook <keescook at chromium.org>
+Reviewed-by: Josh Boyer <jwboyer at redhat.com>
+---
+ crypto/asymmetric_keys/public_key.c      | 40 +++++++++++++++++++++++++-------
+ crypto/asymmetric_keys/public_key.h      |  6 +++++
+ crypto/asymmetric_keys/x509_public_key.c |  2 +-
+ 3 files changed, 39 insertions(+), 9 deletions(-)
+
+diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
+index 796ce08..49ac8d8 100644
+--- a/crypto/asymmetric_keys/public_key.c
++++ b/crypto/asymmetric_keys/public_key.c
+@@ -86,21 +86,45 @@ EXPORT_SYMBOL_GPL(public_key_destroy);
+ /*
+  * Verify a signature using a public key.
+  */
+-static int public_key_verify_signature(const struct key *key,
+-				       const struct public_key_signature *sig)
++int public_key_verify_signature(const struct public_key *pk,
++				const struct public_key_signature *sig)
+ {
+-	const struct public_key *pk = key->payload.data;
++	const struct public_key_algorithm *algo;
 +
- targets += $(obj)/x509_certificate_list
- $(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list
- 	$(call if_changed,x509certs)
-@@ -175,7 +178,9 @@ $(obj)/.x509.list:
- 	@echo $(X509_CERTIFICATES) >$@
++	BUG_ON(!pk);
++	BUG_ON(!pk->mpi[0]);
++	BUG_ON(!pk->mpi[1]);
++	BUG_ON(!sig);
++	BUG_ON(!sig->digest);
++	BUG_ON(!sig->mpi[0]);
++
++	algo = pk->algo;
++	if (!algo) {
++		if (pk->pkey_algo >= PKEY_ALGO__LAST)
++			return -ENOPKG;
++		algo = pkey_algo[pk->pkey_algo];
++		if (!algo)
++			return -ENOPKG;
++	}
  
- clean-files := x509_certificate_list .x509.list
-+endif
+-	if (!pk->algo->verify_signature)
++	if (!algo->verify_signature)
+ 		return -ENOTSUPP;
  
-+ifeq ($(CONFIG_MODULE_SIG),y)
- ###############################################################################
- #
- # If module signing is requested, say by allyesconfig, but a key has not been
-diff --git a/kernel/modsign_certificate.S b/kernel/modsign_certificate.S
-deleted file mode 100644
-index 6fe03c7..0000000
---- a/kernel/modsign_certificate.S
-+++ /dev/null
-@@ -1,11 +0,0 @@
--#include <linux/export.h>
--
--#define GLOBAL(name)	\
--	.globl VMLINUX_SYMBOL(name);	\
--	VMLINUX_SYMBOL(name):
--
--	.section ".init.data","aw"
--
--GLOBAL(modsign_certificate_list)
--	.incbin "kernel/x509_certificate_list"
--GLOBAL(modsign_certificate_list_end)
-diff --git a/kernel/modsign_pubkey.c b/kernel/modsign_pubkey.c
-deleted file mode 100644
-index 2b6e699..0000000
---- a/kernel/modsign_pubkey.c
-+++ /dev/null
-@@ -1,104 +0,0 @@
--/* Public keys for module signature verification
-- *
-- * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
-- * Written by David Howells (dhowells at redhat.com)
-- *
-- * This program is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU General Public Licence
-- * as published by the Free Software Foundation; either version
-- * 2 of the Licence, or (at your option) any later version.
-- */
--
--#include <linux/kernel.h>
--#include <linux/sched.h>
--#include <linux/cred.h>
--#include <linux/err.h>
--#include <keys/asymmetric-type.h>
--#include "module-internal.h"
--
--struct key *modsign_keyring;
--
--extern __initdata const u8 modsign_certificate_list[];
--extern __initdata const u8 modsign_certificate_list_end[];
--
--/*
-- * We need to make sure ccache doesn't cache the .o file as it doesn't notice
-- * if modsign.pub changes.
-- */
--static __initdata const char annoy_ccache[] = __TIME__ "foo";
--
--/*
-- * Load the compiled-in keys
-- */
--static __init int module_verify_init(void)
--{
--	pr_notice("Initialise module verification\n");
--
--	modsign_keyring = keyring_alloc(".module_sign",
--					KUIDT_INIT(0), KGIDT_INIT(0),
--					current_cred(),
--					((KEY_POS_ALL & ~KEY_POS_SETATTR) |
--					 KEY_USR_VIEW | KEY_USR_READ),
--					KEY_ALLOC_NOT_IN_QUOTA, NULL);
--	if (IS_ERR(modsign_keyring))
--		panic("Can't allocate module signing keyring\n");
--
--	return 0;
--}
--
--/*
-- * Must be initialised before we try and load the keys into the keyring.
-- */
--device_initcall(module_verify_init);
--
--/*
-- * Load the compiled-in keys
-- */
--static __init int load_module_signing_keys(void)
--{
--	key_ref_t key;
--	const u8 *p, *end;
--	size_t plen;
--
--	pr_notice("Loading module verification certificates\n");
--
--	end = modsign_certificate_list_end;
--	p = modsign_certificate_list;
--	while (p < end) {
--		/* Each cert begins with an ASN.1 SEQUENCE tag and must be more
--		 * than 256 bytes in size.
--		 */
--		if (end - p < 4)
--			goto dodgy_cert;
--		if (p[0] != 0x30 &&
--		    p[1] != 0x82)
--			goto dodgy_cert;
--		plen = (p[2] << 8) | p[3];
--		plen += 4;
--		if (plen > end - p)
--			goto dodgy_cert;
--
--		key = key_create_or_update(make_key_ref(modsign_keyring, 1),
--					   "asymmetric",
--					   NULL,
--					   p,
--					   plen,
--					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
--					   KEY_USR_VIEW,
--					   KEY_ALLOC_NOT_IN_QUOTA);
--		if (IS_ERR(key))
--			pr_err("MODSIGN: Problem loading in-kernel X.509 certificate (%ld)\n",
--			       PTR_ERR(key));
--		else
--			pr_notice("MODSIGN: Loaded cert '%s'\n",
--				  key_ref_to_ptr(key)->description);
--		p += plen;
--	}
--
--	return 0;
--
--dodgy_cert:
--	pr_err("MODSIGN: Problem parsing in-kernel X.509 certificate list\n");
--	return 0;
--}
--late_initcall(load_module_signing_keys);
-diff --git a/kernel/module-internal.h b/kernel/module-internal.h
-index 24f9247..915e123 100644
---- a/kernel/module-internal.h
-+++ b/kernel/module-internal.h
-@@ -9,6 +9,4 @@
-  * 2 of the Licence, or (at your option) any later version.
-  */
+-	if (sig->nr_mpi != pk->algo->n_sig_mpi) {
++	if (sig->nr_mpi != algo->n_sig_mpi) {
+ 		pr_debug("Signature has %u MPI not %u\n",
+-			 sig->nr_mpi, pk->algo->n_sig_mpi);
++			 sig->nr_mpi, algo->n_sig_mpi);
+ 		return -EINVAL;
+ 	}
  
--extern struct key *modsign_keyring;
--
- extern int mod_verify_sig(const void *mod, unsigned long *_modlen);
-diff --git a/kernel/module_signing.c b/kernel/module_signing.c
-index f2970bd..0034e36 100644
---- a/kernel/module_signing.c
-+++ b/kernel/module_signing.c
-@@ -14,6 +14,7 @@
- #include <crypto/public_key.h>
- #include <crypto/hash.h>
- #include <keys/asymmetric-type.h>
-+#include <keys/system_keyring.h>
- #include "module-internal.h"
+-	return pk->algo->verify_signature(pk, sig);
++	return algo->verify_signature(pk, sig);
++}
++EXPORT_SYMBOL_GPL(public_key_verify_signature);
++
++static int public_key_verify_signature_2(const struct key *key,
++					 const struct public_key_signature *sig)
++{
++	const struct public_key *pk = key->payload.data;
++	return public_key_verify_signature(pk, sig);
+ }
  
  /*
-@@ -157,7 +158,7 @@ static struct key *request_asymmetric_key(const char *signer, size_t signer_len,
- 
- 	pr_debug("Look up: \"%s\"\n", id);
+@@ -111,6 +135,6 @@ struct asymmetric_key_subtype public_key_subtype = {
+ 	.name			= "public_key",
+ 	.describe		= public_key_describe,
+ 	.destroy		= public_key_destroy,
+-	.verify_signature	= public_key_verify_signature,
++	.verify_signature	= public_key_verify_signature_2,
+ };
+ EXPORT_SYMBOL_GPL(public_key_subtype);
+diff --git a/crypto/asymmetric_keys/public_key.h b/crypto/asymmetric_keys/public_key.h
+index 5e5e356..5c37a22 100644
+--- a/crypto/asymmetric_keys/public_key.h
++++ b/crypto/asymmetric_keys/public_key.h
+@@ -28,3 +28,9 @@ struct public_key_algorithm {
+ };
  
--	key = keyring_search(make_key_ref(modsign_keyring, 1),
-+	key = keyring_search(make_key_ref(system_trusted_keyring, 1),
- 			     &key_type_asymmetric, id);
- 	if (IS_ERR(key))
- 		pr_warn("Request for unknown module key '%s' err %ld\n",
-diff --git a/kernel/system_certificates.S b/kernel/system_certificates.S
-new file mode 100644
-index 0000000..5cffe86
---- /dev/null
-+++ b/kernel/system_certificates.S
-@@ -0,0 +1,11 @@
-+#include <linux/export.h>
-+
-+#define GLOBAL(name)	\
-+	.globl VMLINUX_SYMBOL(name);	\
-+	VMLINUX_SYMBOL(name):
-+
-+	.section ".init.data","aw"
-+
-+GLOBAL(system_certificate_list)
-+	.incbin "kernel/x509_certificate_list"
-+GLOBAL(system_certificate_list_end)
-diff --git a/kernel/system_keyring.c b/kernel/system_keyring.c
-new file mode 100644
-index 0000000..cd5cd3f
---- /dev/null
-+++ b/kernel/system_keyring.c
-@@ -0,0 +1,103 @@
-+/* System trusted keyring for trusted public keys
-+ *
-+ * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
-+ * Written by David Howells (dhowells at redhat.com)
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public Licence
-+ * as published by the Free Software Foundation; either version
-+ * 2 of the Licence, or (at your option) any later version.
-+ */
-+
-+#include <linux/export.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/cred.h>
-+#include <linux/err.h>
-+#include <keys/asymmetric-type.h>
-+#include <keys/system_keyring.h>
-+#include "module-internal.h"
-+
-+struct key *system_trusted_keyring;
-+EXPORT_SYMBOL_GPL(system_trusted_keyring);
-+
-+extern __initdata const u8 system_certificate_list[];
-+extern __initdata const u8 system_certificate_list_end[];
-+
-+/*
-+ * Load the compiled-in keys
-+ */
-+static __init int system_trusted_keyring_init(void)
-+{
-+	pr_notice("Initialise system trusted keyring\n");
-+
-+	system_trusted_keyring =
-+		keyring_alloc(".system_keyring",
-+			      KUIDT_INIT(0), KGIDT_INIT(0), current_cred(),
-+			      ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
-+			       KEY_USR_VIEW | KEY_USR_READ),
-+			      KEY_ALLOC_NOT_IN_QUOTA, NULL);
-+	if (IS_ERR(system_trusted_keyring))
-+		panic("Can't allocate system trusted keyring\n");
-+
-+	return 0;
-+}
+ extern const struct public_key_algorithm RSA_public_key_algorithm;
 +
 +/*
-+ * Must be initialised before we try and load the keys into the keyring.
++ * public_key.c
 + */
-+device_initcall(system_trusted_keyring_init);
-+
-+/*
-+ * Load the compiled-in list of X.509 certificates.
-+ */
-+static __init int load_system_certificate_list(void)
-+{
-+	key_ref_t key;
-+	const u8 *p, *end;
-+	size_t plen;
-+
-+	pr_notice("Loading compiled-in X.509 certificates\n");
-+
-+	end = system_certificate_list_end;
-+	p = system_certificate_list;
-+	while (p < end) {
-+		/* Each cert begins with an ASN.1 SEQUENCE tag and must be more
-+		 * than 256 bytes in size.
-+		 */
-+		if (end - p < 4)
-+			goto dodgy_cert;
-+		if (p[0] != 0x30 &&
-+		    p[1] != 0x82)
-+			goto dodgy_cert;
-+		plen = (p[2] << 8) | p[3];
-+		plen += 4;
-+		if (plen > end - p)
-+			goto dodgy_cert;
-+
-+		key = key_create_or_update(make_key_ref(system_trusted_keyring, 1),
-+					   "asymmetric",
-+					   NULL,
-+					   p,
-+					   plen,
-+					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
-+					   KEY_USR_VIEW,
-+					   KEY_ALLOC_NOT_IN_QUOTA);
-+		if (IS_ERR(key)) {
-+			pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
-+			       PTR_ERR(key));
-+		} else {
-+			pr_notice("Loaded X.509 cert '%s'\n",
-+				  key_ref_to_ptr(key)->description);
-+			key_ref_put(key);
-+		}
-+		p += plen;
-+	}
-+
-+	return 0;
-+
-+dodgy_cert:
-+	pr_err("Problem parsing in-kernel X.509 certificate list\n");
-+	return 0;
-+}
-+late_initcall(load_system_certificate_list);
++extern int public_key_verify_signature(const struct public_key *pk,
++				       const struct public_key_signature *sig);
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
+index fac574c..8cb2f70 100644
+--- a/crypto/asymmetric_keys/x509_public_key.c
++++ b/crypto/asymmetric_keys/x509_public_key.c
+@@ -76,7 +76,7 @@ static int x509_check_signature(const struct public_key *pub,
+ 	if (ret < 0)
+ 		goto error_mpi;
+ 
+-	ret = pub->algo->verify_signature(pub, sig);
++	ret = public_key_verify_signature(pub, sig);
+ 
+ 	pr_debug("Cert Verification: %d\n", ret);
+ 
 -- 
 1.8.3.1
 
 
-From 6f90d07a776d7babf30a3322dafd66c8c25db681 Mon Sep 17 00:00:00 2001
+From 322d3b7e2debb3c7983dce2b80a5aefa4e7b1bda Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:07:37 +0100
-Subject: [PATCH 04/14] KEYS: Add a 'trusted' flag and a 'trusted only' flag
+Date: Fri, 30 Aug 2013 16:15:37 +0100
+Subject: [PATCH 05/18] KEYS: Store public key algo ID in public_key_signature
+ struct
 
-Add KEY_FLAG_TRUSTED to indicate that a key either comes from a trusted source
-or had a cryptographic signature chain that led back to a trusted key the
-kernel already possessed.
+Store public key algorithm ID in public_key_signature struct for reference
+purposes.  This allows a public_key_signature struct to be embedded in
+struct x509_certificate and other places more easily.
 
-Add KEY_FLAGS_TRUSTED_ONLY to indicate that a keyring will only accept links to
-keys marked with KEY_FLAGS_TRUSTED.
+Signed-off-by: David Howells <dhowells at redhat.com>
+Reviewed-by: Kees Cook <keescook at chromium.org>
+Reviewed-by: Josh Boyer <jwboyer at redhat.com>
+---
+ include/crypto/public_key.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
+index 05778df..b34fda4 100644
+--- a/include/crypto/public_key.h
++++ b/include/crypto/public_key.h
+@@ -90,6 +90,7 @@ struct public_key_signature {
+ 	u8 *digest;
+ 	u8 digest_size;			/* Number of bytes in digest */
+ 	u8 nr_mpi;			/* Occupancy of mpi[] */
++	enum pkey_algo pkey_algo : 8;
+ 	enum pkey_hash_algo pkey_hash_algo : 8;
+ 	union {
+ 		MPI mpi[2];
+-- 
+1.8.3.1
+
+
+From 743143dd12661df376dcfc916b626b01d8ec84a4 Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells at redhat.com>
+Date: Fri, 30 Aug 2013 16:16:34 +0100
+Subject: [PATCH 06/18] X.509: struct x509_certificate needs struct tm
+ declaring
+
+struct x509_certificate needs struct tm declaring by #inclusion of linux/time.h
+prior to its definition.
 
 Signed-off-by: David Howells <dhowells at redhat.com>
 Reviewed-by: Kees Cook <keescook at chromium.org>
+Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- include/linux/key-type.h | 1 +
- include/linux/key.h      | 3 +++
- kernel/system_keyring.c  | 4 +++-
- security/keys/key.c      | 8 ++++++++
- security/keys/keyring.c  | 4 ++++
- 5 files changed, 19 insertions(+), 1 deletion(-)
+ crypto/asymmetric_keys/x509_parser.h | 1 +
+ 1 file changed, 1 insertion(+)
 
-diff --git a/include/linux/key-type.h b/include/linux/key-type.h
-index f58737b..a74c3a8 100644
---- a/include/linux/key-type.h
-+++ b/include/linux/key-type.h
-@@ -45,6 +45,7 @@ struct key_preparsed_payload {
- 	const void	*data;		/* Raw data */
- 	size_t		datalen;	/* Raw datalen */
- 	size_t		quotalen;	/* Quota length for proposed payload */
-+	bool		trusted;	/* True if key is trusted */
- };
- 
- typedef int (*request_key_actor_t)(struct key_construction *key,
-diff --git a/include/linux/key.h b/include/linux/key.h
-index 010dbb6..80d6774 100644
---- a/include/linux/key.h
-+++ b/include/linux/key.h
-@@ -168,6 +168,8 @@ struct key {
- #define KEY_FLAG_NEGATIVE	5	/* set if key is negative */
- #define KEY_FLAG_ROOT_CAN_CLEAR	6	/* set if key can be cleared by root without permission */
- #define KEY_FLAG_INVALIDATED	7	/* set if key has been invalidated */
-+#define KEY_FLAG_TRUSTED	8	/* set if key is trusted */
-+#define KEY_FLAG_TRUSTED_ONLY	9	/* set if keyring only accepts links to trusted keys */
- 
- 	/* the key type and key description string
- 	 * - the desc is used to match a key against search criteria
-@@ -218,6 +220,7 @@ extern struct key *key_alloc(struct key_type *type,
- #define KEY_ALLOC_IN_QUOTA	0x0000	/* add to quota, reject if would overrun */
- #define KEY_ALLOC_QUOTA_OVERRUN	0x0001	/* add to quota, permit even if overrun */
- #define KEY_ALLOC_NOT_IN_QUOTA	0x0002	/* not in quota */
-+#define KEY_ALLOC_TRUSTED	0x0004	/* Key should be flagged as trusted */
- 
- extern void key_revoke(struct key *key);
- extern void key_invalidate(struct key *key);
-diff --git a/kernel/system_keyring.c b/kernel/system_keyring.c
-index cd5cd3f..4ca7072 100644
---- a/kernel/system_keyring.c
-+++ b/kernel/system_keyring.c
-@@ -40,6 +40,7 @@ static __init int system_trusted_keyring_init(void)
- 	if (IS_ERR(system_trusted_keyring))
- 		panic("Can't allocate system trusted keyring\n");
- 
-+	set_bit(KEY_FLAG_TRUSTED_ONLY, &system_trusted_keyring->flags);
- 	return 0;
- }
- 
-@@ -82,7 +83,8 @@ static __init int load_system_certificate_list(void)
- 					   plen,
- 					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
- 					   KEY_USR_VIEW,
--					   KEY_ALLOC_NOT_IN_QUOTA);
-+					   KEY_ALLOC_NOT_IN_QUOTA |
-+					   KEY_ALLOC_TRUSTED);
- 		if (IS_ERR(key)) {
- 			pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
- 			       PTR_ERR(key));
-diff --git a/security/keys/key.c b/security/keys/key.c
-index a819b5c..d331ea9 100644
---- a/security/keys/key.c
-+++ b/security/keys/key.c
-@@ -300,6 +300,8 @@ struct key *key_alloc(struct key_type *type, const char *desc,
- 
- 	if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
- 		key->flags |= 1 << KEY_FLAG_IN_QUOTA;
-+	if (flags & KEY_ALLOC_TRUSTED)
-+		key->flags |= 1 << KEY_FLAG_TRUSTED;
- 
- 	memset(&key->type_data, 0, sizeof(key->type_data));
- 
-@@ -813,6 +815,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
- 	prep.data = payload;
- 	prep.datalen = plen;
- 	prep.quotalen = index_key.type->def_datalen;
-+	prep.trusted = flags & KEY_ALLOC_TRUSTED;
- 	if (index_key.type->preparse) {
- 		ret = index_key.type->preparse(&prep);
- 		if (ret < 0) {
-@@ -827,6 +830,11 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
- 	}
- 	index_key.desc_len = strlen(index_key.description);
+diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
+index e583ad0..2d01182 100644
+--- a/crypto/asymmetric_keys/x509_parser.h
++++ b/crypto/asymmetric_keys/x509_parser.h
+@@ -9,6 +9,7 @@
+  * 2 of the Licence, or (at your option) any later version.
+  */
  
-+	key_ref = ERR_PTR(-EPERM);
-+	if (!prep.trusted && test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags))
-+		goto error_free_prep;
-+	flags |= prep.trusted ? KEY_ALLOC_TRUSTED : 0;
-+
- 	ret = __key_link_begin(keyring, &index_key, &edit);
- 	if (ret < 0) {
- 		key_ref = ERR_PTR(ret);
-diff --git a/security/keys/keyring.c b/security/keys/keyring.c
-index f7cdea2..9b6f6e0 100644
---- a/security/keys/keyring.c
-+++ b/security/keys/keyring.c
-@@ -1183,6 +1183,10 @@ int key_link(struct key *keyring, struct key *key)
- 	key_check(keyring);
- 	key_check(key);
++#include <linux/time.h>
+ #include <crypto/public_key.h>
  
-+	if (test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags) &&
-+	    !test_bit(KEY_FLAG_TRUSTED, &key->flags))
-+		return -EPERM;
-+
- 	ret = __key_link_begin(keyring, &key->index_key, &edit);
- 	if (ret == 0) {
- 		kdebug("begun {%d,%d}", keyring->serial, atomic_read(&keyring->usage));
+ struct x509_certificate {
 -- 
 1.8.3.1
 
 
-From 559cc3ad765e1b443bc89965be9ef9ff3caabdcc Mon Sep 17 00:00:00 2001
+From a326ca89468c73dacb00fa247e92873d09e1387b Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:15:10 +0100
-Subject: [PATCH 05/14] KEYS: Rename public key parameter name arrays
+Date: Fri, 30 Aug 2013 16:18:02 +0100
+Subject: [PATCH 07/18] X.509: Embed public_key_signature struct and create
+ filler function
 
-Rename the arrays of public key parameters (public key algorithm names, hash
-algorithm names and ID type names) so that the array name ends in "_name".
+Embed a public_key_signature struct in struct x509_certificate, eliminating
+now unnecessary fields, and split x509_check_signature() to create a filler
+function for it that attaches a digest of the signed data and an MPI that
+represents the signature data.  x509_free_certificate() is then modified to
+deal with these.
+
+Whilst we're at it, export both x509_check_signature() and the new
+x509_get_sig_params().
 
 Signed-off-by: David Howells <dhowells at redhat.com>
 Reviewed-by: Kees Cook <keescook at chromium.org>
 Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- crypto/asymmetric_keys/public_key.c      | 14 +++++++-------
- crypto/asymmetric_keys/x509_public_key.c |  8 ++++----
- include/crypto/public_key.h              |  6 +++---
- kernel/module_signing.c                  |  4 ++--
- 4 files changed, 16 insertions(+), 16 deletions(-)
+ crypto/asymmetric_keys/x509_cert_parser.c | 30 +++++------
+ crypto/asymmetric_keys/x509_parser.h      | 16 ++++--
+ crypto/asymmetric_keys/x509_public_key.c  | 83 +++++++++++++++++--------------
+ 3 files changed, 74 insertions(+), 55 deletions(-)
 
-diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
-index cb2e291..b313df1 100644
---- a/crypto/asymmetric_keys/public_key.c
-+++ b/crypto/asymmetric_keys/public_key.c
-@@ -22,13 +22,13 @@
- 
- MODULE_LICENSE("GPL");
- 
--const char *const pkey_algo[PKEY_ALGO__LAST] = {
-+const char *const pkey_algo_name[PKEY_ALGO__LAST] = {
- 	[PKEY_ALGO_DSA]		= "DSA",
- 	[PKEY_ALGO_RSA]		= "RSA",
- };
--EXPORT_SYMBOL_GPL(pkey_algo);
-+EXPORT_SYMBOL_GPL(pkey_algo_name);
+diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
+index 8cc253d..144201c 100644
+--- a/crypto/asymmetric_keys/x509_cert_parser.c
++++ b/crypto/asymmetric_keys/x509_cert_parser.c
+@@ -47,6 +47,8 @@ void x509_free_certificate(struct x509_certificate *cert)
+ 		kfree(cert->subject);
+ 		kfree(cert->fingerprint);
+ 		kfree(cert->authority);
++		kfree(cert->sig.digest);
++		mpi_free(cert->sig.rsa.s);
+ 		kfree(cert);
+ 	}
+ }
+@@ -152,33 +154,33 @@ int x509_note_pkey_algo(void *context, size_t hdrlen,
+ 		return -ENOPKG; /* Unsupported combination */
  
--const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
-+const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = {
- 	[PKEY_HASH_MD4]		= "md4",
- 	[PKEY_HASH_MD5]		= "md5",
- 	[PKEY_HASH_SHA1]	= "sha1",
-@@ -38,13 +38,13 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
- 	[PKEY_HASH_SHA512]	= "sha512",
- 	[PKEY_HASH_SHA224]	= "sha224",
- };
--EXPORT_SYMBOL_GPL(pkey_hash_algo);
-+EXPORT_SYMBOL_GPL(pkey_hash_algo_name);
+ 	case OID_md4WithRSAEncryption:
+-		ctx->cert->sig_hash_algo = PKEY_HASH_MD5;
+-		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
++		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_MD5;
++		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
+ 		break;
  
--const char *const pkey_id_type[PKEY_ID_TYPE__LAST] = {
-+const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST] = {
- 	[PKEY_ID_PGP]		= "PGP",
- 	[PKEY_ID_X509]		= "X509",
- };
--EXPORT_SYMBOL_GPL(pkey_id_type);
-+EXPORT_SYMBOL_GPL(pkey_id_type_name);
+ 	case OID_sha1WithRSAEncryption:
+-		ctx->cert->sig_hash_algo = PKEY_HASH_SHA1;
+-		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
++		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA1;
++		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
+ 		break;
  
- /*
-  * Provide a part of a description of the key for /proc/keys.
-@@ -56,7 +56,7 @@ static void public_key_describe(const struct key *asymmetric_key,
+ 	case OID_sha256WithRSAEncryption:
+-		ctx->cert->sig_hash_algo = PKEY_HASH_SHA256;
+-		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
++		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA256;
++		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
+ 		break;
  
- 	if (key)
- 		seq_printf(m, "%s.%s",
--			   pkey_id_type[key->id_type], key->algo->name);
-+			   pkey_id_type_name[key->id_type], key->algo->name);
+ 	case OID_sha384WithRSAEncryption:
+-		ctx->cert->sig_hash_algo = PKEY_HASH_SHA384;
+-		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
++		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA384;
++		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
+ 		break;
+ 
+ 	case OID_sha512WithRSAEncryption:
+-		ctx->cert->sig_hash_algo = PKEY_HASH_SHA512;
+-		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
++		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA512;
++		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
+ 		break;
+ 
+ 	case OID_sha224WithRSAEncryption:
+-		ctx->cert->sig_hash_algo = PKEY_HASH_SHA224;
+-		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
++		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA224;
++		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
+ 		break;
+ 	}
+ 
+@@ -203,8 +205,8 @@ int x509_note_signature(void *context, size_t hdrlen,
+ 		return -EINVAL;
+ 	}
+ 
+-	ctx->cert->sig = value;
+-	ctx->cert->sig_size = vlen;
++	ctx->cert->raw_sig = value;
++	ctx->cert->raw_sig_size = vlen;
+ 	return 0;
  }
  
+diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
+index 2d01182..87d9cc2 100644
+--- a/crypto/asymmetric_keys/x509_parser.h
++++ b/crypto/asymmetric_keys/x509_parser.h
+@@ -21,12 +21,11 @@ struct x509_certificate {
+ 	char		*authority;		/* Authority key fingerprint as hex */
+ 	struct tm	valid_from;
+ 	struct tm	valid_to;
+-	enum pkey_algo	sig_pkey_algo : 8;	/* Signature public key algorithm */
+-	enum pkey_hash_algo sig_hash_algo : 8;	/* Signature hash algorithm */
+ 	const void	*tbs;			/* Signed data */
+-	size_t		tbs_size;		/* Size of signed data */
+-	const void	*sig;			/* Signature data */
+-	size_t		sig_size;		/* Size of sigature */
++	unsigned	tbs_size;		/* Size of signed data */
++	unsigned	raw_sig_size;		/* Size of sigature */
++	const void	*raw_sig;		/* Signature data */
++	struct public_key_signature sig;	/* Signature parameters */
+ };
+ 
  /*
+@@ -34,3 +33,10 @@ struct x509_certificate {
+  */
+ extern void x509_free_certificate(struct x509_certificate *cert);
+ extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen);
++
++/*
++ * x509_public_key.c
++ */
++extern int x509_get_sig_params(struct x509_certificate *cert);
++extern int x509_check_signature(const struct public_key *pub,
++				struct x509_certificate *cert);
 diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index 06007f0..afbbc36 100644
+index 8cb2f70..b7c81d8 100644
 --- a/crypto/asymmetric_keys/x509_public_key.c
 +++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -49,7 +49,7 @@ static int x509_check_signature(const struct public_key *pub,
+@@ -24,72 +24,83 @@
+ #include "x509_parser.h"
+ 
+ /*
+- * Check the signature on a certificate using the provided public key
++ * Set up the signature parameters in an X.509 certificate.  This involves
++ * digesting the signed data and extracting the signature.
+  */
+-static int x509_check_signature(const struct public_key *pub,
+-				const struct x509_certificate *cert)
++int x509_get_sig_params(struct x509_certificate *cert)
+ {
+-	struct public_key_signature *sig;
+ 	struct crypto_shash *tfm;
+ 	struct shash_desc *desc;
+ 	size_t digest_size, desc_size;
++	void *digest;
+ 	int ret;
+ 
+ 	pr_devel("==>%s()\n", __func__);
+-	
++
++	if (cert->sig.rsa.s)
++		return 0;
++
++	cert->sig.rsa.s = mpi_read_raw_data(cert->raw_sig, cert->raw_sig_size);
++	if (!cert->sig.rsa.s)
++		return -ENOMEM;
++	cert->sig.nr_mpi = 1;
++
  	/* Allocate the hashing algorithm we're going to need and find out how
  	 * big the hash operational data will be.
  	 */
--	tfm = crypto_alloc_shash(pkey_hash_algo[cert->sig_hash_algo], 0, 0);
-+	tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig_hash_algo], 0, 0);
+-	tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig_hash_algo], 0, 0);
++	tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig.pkey_hash_algo], 0, 0);
  	if (IS_ERR(tfm))
  		return (PTR_ERR(tfm) == -ENOENT) ? -ENOPKG : PTR_ERR(tfm);
  
-@@ -117,7 +117,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 
- 	pr_devel("Cert Issuer: %s\n", cert->issuer);
- 	pr_devel("Cert Subject: %s\n", cert->subject);
--	pr_devel("Cert Key Algo: %s\n", pkey_algo[cert->pkey_algo]);
-+	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pkey_algo]);
- 	pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
- 		 cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
- 		 cert->valid_from.tm_mday, cert->valid_from.tm_hour,
-@@ -127,8 +127,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 		 cert->valid_to.tm_mday, cert->valid_to.tm_hour,
- 		 cert->valid_to.tm_min,  cert->valid_to.tm_sec);
- 	pr_devel("Cert Signature: %s + %s\n",
--		 pkey_algo[cert->sig_pkey_algo],
--		 pkey_hash_algo[cert->sig_hash_algo]);
-+		 pkey_algo_name[cert->sig_pkey_algo],
-+		 pkey_hash_algo_name[cert->sig_hash_algo]);
+ 	desc_size = crypto_shash_descsize(tfm) + sizeof(*desc);
+ 	digest_size = crypto_shash_digestsize(tfm);
  
- 	if (!cert->fingerprint || !cert->authority) {
- 		pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",
-diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
-index f5b0224..619d570 100644
---- a/include/crypto/public_key.h
-+++ b/include/crypto/public_key.h
-@@ -22,7 +22,7 @@ enum pkey_algo {
- 	PKEY_ALGO__LAST
- };
+-	/* We allocate the hash operational data storage on the end of our
+-	 * context data.
++	/* We allocate the hash operational data storage on the end of the
++	 * digest storage space.
+ 	 */
+ 	ret = -ENOMEM;
+-	sig = kzalloc(sizeof(*sig) + desc_size + digest_size, GFP_KERNEL);
+-	if (!sig)
+-		goto error_no_sig;
++	digest = kzalloc(digest_size + desc_size, GFP_KERNEL);
++	if (!digest)
++		goto error;
  
--extern const char *const pkey_algo[PKEY_ALGO__LAST];
-+extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
+-	sig->pkey_hash_algo	= cert->sig_hash_algo;
+-	sig->digest		= (u8 *)sig + sizeof(*sig) + desc_size;
+-	sig->digest_size	= digest_size;
++	cert->sig.digest = digest;
++	cert->sig.digest_size = digest_size;
  
- enum pkey_hash_algo {
- 	PKEY_HASH_MD4,
-@@ -36,7 +36,7 @@ enum pkey_hash_algo {
- 	PKEY_HASH__LAST
- };
+-	desc = (void *)sig + sizeof(*sig);
+-	desc->tfm	= tfm;
+-	desc->flags	= CRYPTO_TFM_REQ_MAY_SLEEP;
++	desc = digest + digest_size;
++	desc->tfm = tfm;
++	desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
  
--extern const char *const pkey_hash_algo[PKEY_HASH__LAST];
-+extern const char *const pkey_hash_algo_name[PKEY_HASH__LAST];
+ 	ret = crypto_shash_init(desc);
+ 	if (ret < 0)
+ 		goto error;
++	might_sleep();
++	ret = crypto_shash_finup(desc, cert->tbs, cert->tbs_size, digest);
++error:
++	crypto_free_shash(tfm);
++	pr_devel("<==%s() = %d\n", __func__, ret);
++	return ret;
++}
++EXPORT_SYMBOL_GPL(x509_get_sig_params);
  
- enum pkey_id_type {
- 	PKEY_ID_PGP,		/* OpenPGP generated key ID */
-@@ -44,7 +44,7 @@ enum pkey_id_type {
- 	PKEY_ID_TYPE__LAST
- };
+-	ret = -ENOMEM;
+-	sig->rsa.s = mpi_read_raw_data(cert->sig, cert->sig_size);
+-	if (!sig->rsa.s)
+-		goto error;
++/*
++ * Check the signature on a certificate using the provided public key
++ */
++int x509_check_signature(const struct public_key *pub,
++			 struct x509_certificate *cert)
++{
++	int ret;
  
--extern const char *const pkey_id_type[PKEY_ID_TYPE__LAST];
-+extern const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST];
+-	ret = crypto_shash_finup(desc, cert->tbs, cert->tbs_size, sig->digest);
+-	if (ret < 0)
+-		goto error_mpi;
++	pr_devel("==>%s()\n", __func__);
  
- /*
-  * Cryptographic data for the public-key subtype of the asymmetric key type.
-diff --git a/kernel/module_signing.c b/kernel/module_signing.c
-index 0034e36..0b6b870 100644
---- a/kernel/module_signing.c
-+++ b/kernel/module_signing.c
-@@ -55,7 +55,7 @@ static struct public_key_signature *mod_make_digest(enum pkey_hash_algo hash,
- 	/* Allocate the hashing algorithm we're going to need and find out how
- 	 * big the hash operational data will be.
- 	 */
--	tfm = crypto_alloc_shash(pkey_hash_algo[hash], 0, 0);
-+	tfm = crypto_alloc_shash(pkey_hash_algo_name[hash], 0, 0);
- 	if (IS_ERR(tfm))
- 		return (PTR_ERR(tfm) == -ENOENT) ? ERR_PTR(-ENOPKG) : ERR_CAST(tfm);
+-	ret = public_key_verify_signature(pub, sig);
++	ret = x509_get_sig_params(cert);
++	if (ret < 0)
++		return ret;
  
-@@ -218,7 +218,7 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen)
- 		return -ENOPKG;
++	ret = public_key_verify_signature(pub, &cert->sig);
+ 	pr_debug("Cert Verification: %d\n", ret);
+-
+-error_mpi:
+-	mpi_free(sig->rsa.s);
+-error:
+-	kfree(sig);
+-error_no_sig:
+-	crypto_free_shash(tfm);
+-
+-	pr_devel("<==%s() = %d\n", __func__, ret);
+ 	return ret;
+ }
++EXPORT_SYMBOL_GPL(x509_check_signature);
  
- 	if (ms.hash >= PKEY_HASH__LAST ||
--	    !pkey_hash_algo[ms.hash])
-+	    !pkey_hash_algo_name[ms.hash])
- 		return -ENOPKG;
+ /*
+  * Attempt to parse a data blob for a key as an X509 certificate.
+@@ -118,8 +129,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 		 cert->valid_to.tm_mday, cert->valid_to.tm_hour,
+ 		 cert->valid_to.tm_min,  cert->valid_to.tm_sec);
+ 	pr_devel("Cert Signature: %s + %s\n",
+-		 pkey_algo_name[cert->sig_pkey_algo],
+-		 pkey_hash_algo_name[cert->sig_hash_algo]);
++		 pkey_algo_name[cert->sig.pkey_algo],
++		 pkey_hash_algo_name[cert->sig.pkey_hash_algo]);
  
- 	key = request_asymmetric_key(sig, ms.signer_len,
+ 	if (!cert->fingerprint || !cert->authority) {
+ 		pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",
 -- 
 1.8.3.1
 
 
-From a0aab2065bbdd0bc56ae6d7767e1df7c58b8997f Mon Sep 17 00:00:00 2001
+From 2857db9154b0fcfb8ba490c12f98cd47cc3f46fc Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:15:18 +0100
-Subject: [PATCH 06/14] KEYS: Move the algorithm pointer array from x509 to
- public_key.c
+Date: Fri, 30 Aug 2013 16:18:15 +0100
+Subject: [PATCH 08/18] X.509: Check the algorithm IDs obtained from parsing an
+ X.509 certificate
 
-Move the public-key algorithm pointer array from x509_public_key.c to
-public_key.c as it isn't X.509 specific.
+Check that the algorithm IDs obtained from the ASN.1 parse by OID lookup
+corresponds to algorithms that are available to us.
 
+Reported-by: Kees Cook <keescook at chromium.org>
 Signed-off-by: David Howells <dhowells at redhat.com>
-Reviewed-by: Kees Cook <keescook at chromium.org>
-Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- crypto/asymmetric_keys/public_key.c      |  8 ++++++++
- crypto/asymmetric_keys/x509_public_key.c | 11 +----------
- include/crypto/public_key.h              |  1 +
- 3 files changed, 10 insertions(+), 10 deletions(-)
+ crypto/asymmetric_keys/x509_public_key.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
 
-diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
-index b313df1..796ce08 100644
---- a/crypto/asymmetric_keys/public_key.c
-+++ b/crypto/asymmetric_keys/public_key.c
-@@ -28,6 +28,14 @@ const char *const pkey_algo_name[PKEY_ALGO__LAST] = {
- };
- EXPORT_SYMBOL_GPL(pkey_algo_name);
- 
-+const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST] = {
-+#if defined(CONFIG_PUBLIC_KEY_ALGO_RSA) || \
-+	defined(CONFIG_PUBLIC_KEY_ALGO_RSA_MODULE)
-+	[PKEY_ALGO_RSA]		= &RSA_public_key_algorithm,
-+#endif
-+};
-+EXPORT_SYMBOL_GPL(pkey_algo);
-+
- const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = {
- 	[PKEY_HASH_MD4]		= "md4",
- 	[PKEY_HASH_MD5]		= "md5",
 diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index afbbc36..fe38628 100644
+index b7c81d8..eb368d4 100644
 --- a/crypto/asymmetric_keys/x509_public_key.c
 +++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -23,15 +23,6 @@
- #include "public_key.h"
- #include "x509_parser.h"
- 
--static const
--struct public_key_algorithm *x509_public_key_algorithms[PKEY_ALGO__LAST] = {
--	[PKEY_ALGO_DSA]		= NULL,
--#if defined(CONFIG_PUBLIC_KEY_ALGO_RSA) || \
--	defined(CONFIG_PUBLIC_KEY_ALGO_RSA_MODULE)
--	[PKEY_ALGO_RSA]		= &RSA_public_key_algorithm,
--#endif
--};
--
- /*
-  * Check the signature on a certificate using the provided public key
-  */
-@@ -174,7 +165,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 		goto error_free_cert;
- 	}
- 
--	cert->pub->algo = x509_public_key_algorithms[cert->pkey_algo];
-+	cert->pub->algo = pkey_algo[cert->pkey_algo];
- 	cert->pub->id_type = PKEY_ID_X509;
- 
- 	/* Check the signature on the key */
-diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
-index 619d570..46bde25 100644
---- a/include/crypto/public_key.h
-+++ b/include/crypto/public_key.h
-@@ -23,6 +23,7 @@ enum pkey_algo {
- };
- 
- extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
-+extern const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST];
+@@ -119,6 +119,17 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
  
- enum pkey_hash_algo {
- 	PKEY_HASH_MD4,
+ 	pr_devel("Cert Issuer: %s\n", cert->issuer);
+ 	pr_devel("Cert Subject: %s\n", cert->subject);
++
++	if (cert->pub->pkey_algo >= PKEY_ALGO__LAST ||
++	    cert->sig.pkey_algo >= PKEY_ALGO__LAST ||
++	    cert->sig.pkey_hash_algo >= PKEY_HASH__LAST ||
++	    !pkey_algo[cert->pub->pkey_algo] ||
++	    !pkey_algo[cert->sig.pkey_algo] ||
++	    !pkey_hash_algo_name[cert->sig.pkey_hash_algo]) {
++		ret = -ENOPKG;
++		goto error_free_cert;
++	}
++
+ 	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pub->pkey_algo]);
+ 	pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
+ 		 cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
 -- 
 1.8.3.1
 
 
-From 7009b65ddc1d8bf62dc017795265b9cf331a4d70 Mon Sep 17 00:00:00 2001
+From f78f0e8694517a3b1e5393d6ea0d46084bdc816a Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:15:24 +0100
-Subject: [PATCH 07/14] KEYS: Store public key algo ID in public_key struct
+Date: Fri, 30 Aug 2013 16:18:31 +0100
+Subject: [PATCH 09/18] X.509: Handle certificates that lack an
+ authorityKeyIdentifier field
 
-Store public key algo ID in public_key struct for reference purposes.  This
-allows it to be removed from the x509_certificate struct and used to find a
-default in public_key_verify_signature().
+Handle certificates that lack an authorityKeyIdentifier field by assuming
+they're self-signed and checking their signatures against themselves.
 
 Signed-off-by: David Howells <dhowells at redhat.com>
 Reviewed-by: Kees Cook <keescook at chromium.org>
 Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- crypto/asymmetric_keys/x509_cert_parser.c | 5 +++--
- crypto/asymmetric_keys/x509_parser.h      | 1 -
- crypto/asymmetric_keys/x509_public_key.c  | 4 ++--
- include/crypto/public_key.h               | 1 +
- 4 files changed, 6 insertions(+), 5 deletions(-)
+ crypto/asymmetric_keys/x509_public_key.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
 
-diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
-index facbf26..8cc253d 100644
---- a/crypto/asymmetric_keys/x509_cert_parser.c
-+++ b/crypto/asymmetric_keys/x509_cert_parser.c
-@@ -343,8 +343,9 @@ int x509_extract_key_data(void *context, size_t hdrlen,
- 	if (ctx->last_oid != OID_rsaEncryption)
- 		return -ENOPKG;
- 
--	/* There seems to be an extraneous 0 byte on the front of the data */
--	ctx->cert->pkey_algo = PKEY_ALGO_RSA;
-+	ctx->cert->pub->pkey_algo = PKEY_ALGO_RSA;
-+
-+	/* Discard the BIT STRING metadata */
- 	ctx->key = value + 1;
- 	ctx->key_size = vlen - 1;
- 	return 0;
-diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
-index f86dc5f..e583ad0 100644
---- a/crypto/asymmetric_keys/x509_parser.h
-+++ b/crypto/asymmetric_keys/x509_parser.h
-@@ -20,7 +20,6 @@ struct x509_certificate {
- 	char		*authority;		/* Authority key fingerprint as hex */
- 	struct tm	valid_from;
- 	struct tm	valid_to;
--	enum pkey_algo	pkey_algo : 8;		/* Public key algorithm */
- 	enum pkey_algo	sig_pkey_algo : 8;	/* Signature public key algorithm */
- 	enum pkey_hash_algo sig_hash_algo : 8;	/* Signature hash algorithm */
- 	const void	*tbs;			/* Signed data */
 diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index fe38628..fac574c 100644
+index eb368d4..0f55e3b 100644
 --- a/crypto/asymmetric_keys/x509_public_key.c
 +++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -108,7 +108,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+@@ -143,8 +143,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 		 pkey_algo_name[cert->sig.pkey_algo],
+ 		 pkey_hash_algo_name[cert->sig.pkey_hash_algo]);
  
- 	pr_devel("Cert Issuer: %s\n", cert->issuer);
- 	pr_devel("Cert Subject: %s\n", cert->subject);
--	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pkey_algo]);
-+	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pub->pkey_algo]);
- 	pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
- 		 cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
- 		 cert->valid_from.tm_mday, cert->valid_from.tm_hour,
-@@ -165,7 +165,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+-	if (!cert->fingerprint || !cert->authority) {
+-		pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",
++	if (!cert->fingerprint) {
++		pr_warn("Cert for '%s' must have a SubjKeyId extension\n",
+ 			cert->subject);
+ 		ret = -EKEYREJECTED;
  		goto error_free_cert;
- 	}
- 
--	cert->pub->algo = pkey_algo[cert->pkey_algo];
-+	cert->pub->algo = pkey_algo[cert->pub->pkey_algo];
+@@ -190,8 +190,9 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 	cert->pub->algo = pkey_algo[cert->pub->pkey_algo];
  	cert->pub->id_type = PKEY_ID_X509;
  
- 	/* Check the signature on the key */
-diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
-index 46bde25..05778df 100644
---- a/include/crypto/public_key.h
-+++ b/include/crypto/public_key.h
-@@ -60,6 +60,7 @@ struct public_key {
- #define PKEY_CAN_DECRYPT	0x02
- #define PKEY_CAN_SIGN		0x04
- #define PKEY_CAN_VERIFY		0x08
-+	enum pkey_algo pkey_algo : 8;
- 	enum pkey_id_type id_type : 8;
- 	union {
- 		MPI	mpi[5];
+-	/* Check the signature on the key */
+-	if (strcmp(cert->fingerprint, cert->authority) == 0) {
++	/* Check the signature on the key if it appears to be self-signed */
++	if (!cert->authority ||
++	    strcmp(cert->fingerprint, cert->authority) == 0) {
+ 		ret = x509_check_signature(cert->pub, cert);
+ 		if (ret < 0)
+ 			goto error_free_cert;
 -- 
 1.8.3.1
 
 
-From cad6ff6b429f31611ccb231cfe6adcb69d891352 Mon Sep 17 00:00:00 2001
+From 33f859fea67ab5307da4049e947fbc23cdd13a27 Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:15:30 +0100
-Subject: [PATCH 08/14] KEYS: Split public_key_verify_signature() and make
- available
+Date: Fri, 30 Aug 2013 16:07:13 +0100
+Subject: [PATCH 11/18] KEYS: Load *.x509 files into kernel keyring
 
-Modify public_key_verify_signature() so that it now takes a public_key struct
-rather than a key struct and supply a wrapper that takes a key struct.  The
-wrapper is then used by the asymmetric key subtype and the modified function is
-used by X.509 self-signature checking and can be used by other things also.
+Load all the files matching the pattern "*.x509" that are to be found in kernel
+base source dir and base build dir into the module signing keyring.
+
+The "extra_certificates" file is then redundant.
 
 Signed-off-by: David Howells <dhowells at redhat.com>
-Reviewed-by: Kees Cook <keescook at chromium.org>
-Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- crypto/asymmetric_keys/public_key.c      | 40 +++++++++++++++++++++++++-------
- crypto/asymmetric_keys/public_key.h      |  6 +++++
- crypto/asymmetric_keys/x509_public_key.c |  2 +-
- 3 files changed, 39 insertions(+), 9 deletions(-)
+ kernel/Makefile              | 35 +++++++++++++++++++++++++++++------
+ kernel/modsign_certificate.S |  3 +--
+ 2 files changed, 30 insertions(+), 8 deletions(-)
 
-diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
-index 796ce08..49ac8d8 100644
---- a/crypto/asymmetric_keys/public_key.c
-+++ b/crypto/asymmetric_keys/public_key.c
-@@ -86,21 +86,45 @@ EXPORT_SYMBOL_GPL(public_key_destroy);
- /*
-  * Verify a signature using a public key.
+diff --git a/kernel/Makefile b/kernel/Makefile
+index 1ce4755..c34e5f9 100644
+--- a/kernel/Makefile
++++ b/kernel/Makefile
+@@ -142,17 +142,40 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
+ 	$(call if_changed,bc)
+ 
+ ifeq ($(CONFIG_MODULE_SIG),y)
++###############################################################################
+ #
+-# Pull the signing certificate and any extra certificates into the kernel
++# Roll all the X.509 certificates that we can find together and pull
++# them into the kernel.
+ #
++###############################################################################
++X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
++X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
++X509_CERTIFICATES := $(sort $(X509_CERTIFICATES-y))
++
++ifeq ($(X509_CERTIFICATES),)
++$(warning *** No X.509 certificates found ***)
++endif
++
++ifneq ($(wildcard $(obj)/.x509.list),)
++ifneq ($(shell cat $(obj)/.x509.list),$(X509_CERTIFICATES))
++$(info X.509 certificate list changed)
++$(shell rm $(obj)/.x509.list)
++endif
++endif
++
++kernel/modsign_certificate.o: $(obj)/x509_certificate_list
+ 
+-quiet_cmd_touch = TOUCH   $@
+-      cmd_touch = touch   $@
++quiet_cmd_x509certs  = CERTS   $@
++      cmd_x509certs  = cat $(X509_CERTIFICATES) /dev/null >$@
++targets += $(obj)/x509_certificate_list
++$(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list
++	$(call if_changed,x509certs)
+ 
+-extra_certificates:
+-	$(call cmd,touch)
++targets += $(obj)/.x509.list
++$(obj)/.x509.list:
++	@echo $(X509_CERTIFICATES) >$@
+ 
+-kernel/modsign_certificate.o: signing_key.x509 extra_certificates
++clean-files := x509_certificate_list .x509.list
+ 
+ ###############################################################################
+ #
+diff --git a/kernel/modsign_certificate.S b/kernel/modsign_certificate.S
+index 4a9a86d..6fe03c7 100644
+--- a/kernel/modsign_certificate.S
++++ b/kernel/modsign_certificate.S
+@@ -7,6 +7,5 @@
+ 	.section ".init.data","aw"
+ 
+ GLOBAL(modsign_certificate_list)
+-	.incbin "signing_key.x509"
+-	.incbin "extra_certificates"
++	.incbin "kernel/x509_certificate_list"
+ GLOBAL(modsign_certificate_list_end)
+-- 
+1.8.3.1
+
+
+From 068606ba7df3206e5a09b544b4b89ed09cd30f44 Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells at redhat.com>
+Date: Fri, 30 Aug 2013 17:13:15 +0100
+Subject: [PATCH 12/18] KEYS: Have make canonicalise the paths of the X.509
+ certs better to deduplicate
+
+Have make canonicalise the paths of the X.509 certificates before we sort them
+as this allows $(sort) to better remove duplicates.
+
+Signed-off-by: David Howells <dhowells at redhat.com>
+---
+ kernel/Makefile | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/kernel/Makefile b/kernel/Makefile
+index c34e5f9..2c24195 100644
+--- a/kernel/Makefile
++++ b/kernel/Makefile
+@@ -144,13 +144,19 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
+ ifeq ($(CONFIG_MODULE_SIG),y)
+ ###############################################################################
+ #
+-# Roll all the X.509 certificates that we can find together and pull
+-# them into the kernel.
++# Roll all the X.509 certificates that we can find together and pull them into
++# the kernel.
++#
++# We look in the source root and the build root for all files whose name ends
++# in ".x509".  Unfortunately, this will generate duplicate filenames, so we
++# have make canonicalise the pathnames and then sort them to discard the
++# duplicates.
+ #
+ ###############################################################################
+ X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
+ X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
+-X509_CERTIFICATES := $(sort $(X509_CERTIFICATES-y))
++X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
++				$(or $(realpath $(CERT)),$(CERT))))
+ 
+ ifeq ($(X509_CERTIFICATES),)
+ $(warning *** No X.509 certificates found ***)
+-- 
+1.8.3.1
+
+
+From 9006cfbd669e9ba52d1a91db2ffd9482ad8a6090 Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells at redhat.com>
+Date: Fri, 30 Aug 2013 16:07:30 +0100
+Subject: [PATCH 13/18] KEYS: Separate the kernel signature checking keyring
+ from module signing
+
+Separate the kernel signature checking keyring from module signing so that it
+can be used by code other than the module-signing code.
+
+Signed-off-by: David Howells <dhowells at redhat.com>
+---
+ include/keys/system_keyring.h |  23 ++++++++++
+ init/Kconfig                  |  13 ++++++
+ kernel/Makefile               |  15 ++++--
+ kernel/modsign_certificate.S  |  11 -----
+ kernel/modsign_pubkey.c       | 104 ------------------------------------------
+ kernel/module-internal.h      |   2 -
+ kernel/module_signing.c       |   3 +-
+ kernel/system_certificates.S  |  11 +++++
+ kernel/system_keyring.c       | 103 +++++++++++++++++++++++++++++++++++++++++
+ 9 files changed, 162 insertions(+), 123 deletions(-)
+ create mode 100644 include/keys/system_keyring.h
+ delete mode 100644 kernel/modsign_certificate.S
+ delete mode 100644 kernel/modsign_pubkey.c
+ create mode 100644 kernel/system_certificates.S
+ create mode 100644 kernel/system_keyring.c
+
+diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
+new file mode 100644
+index 0000000..8dabc39
+--- /dev/null
++++ b/include/keys/system_keyring.h
+@@ -0,0 +1,23 @@
++/* System keyring containing trusted public keys.
++ *
++ * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
++ * Written by David Howells (dhowells at redhat.com)
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public Licence
++ * as published by the Free Software Foundation; either version
++ * 2 of the Licence, or (at your option) any later version.
++ */
++
++#ifndef _KEYS_SYSTEM_KEYRING_H
++#define _KEYS_SYSTEM_KEYRING_H
++
++#ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
++
++#include <linux/key.h>
++
++extern struct key *system_trusted_keyring;
++
++#endif
++
++#endif /* _KEYS_SYSTEM_KEYRING_H */
+diff --git a/init/Kconfig b/init/Kconfig
+index 18bd9e3..cf14d07 100644
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -1668,6 +1668,18 @@ config BASE_SMALL
+ 	default 0 if BASE_FULL
+ 	default 1 if !BASE_FULL
+ 
++config SYSTEM_TRUSTED_KEYRING
++	bool "Provide system-wide ring of trusted keys"
++	depends on KEYS
++	help
++	  Provide a system keyring to which trusted keys can be added.  Keys in
++	  the keyring are considered to be trusted.  Keys may be added at will
++	  by the kernel from compiled-in data and from hardware key stores, but
++	  userspace may only add extra keys if those keys can be verified by
++	  keys already in the keyring.
++
++	  Keys in this keyring are used by module signature checking.
++
+ menuconfig MODULES
+ 	bool "Enable loadable module support"
+ 	option modules
+@@ -1741,6 +1753,7 @@ config MODULE_SRCVERSION_ALL
+ config MODULE_SIG
+ 	bool "Module signature verification"
+ 	depends on MODULES
++	select SYSTEM_TRUSTED_KEYRING
+ 	select KEYS
+ 	select CRYPTO
+ 	select ASYMMETRIC_KEY_TYPE
+diff --git a/kernel/Makefile b/kernel/Makefile
+index 2c24195..6313698 100644
+--- a/kernel/Makefile
++++ b/kernel/Makefile
+@@ -54,8 +54,9 @@ obj-$(CONFIG_SMP) += spinlock.o
+ obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
+ obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
+ obj-$(CONFIG_UID16) += uid16.o
++obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
+ obj-$(CONFIG_MODULES) += module.o
+-obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o
++obj-$(CONFIG_MODULE_SIG) += module_signing.o
+ obj-$(CONFIG_KALLSYMS) += kallsyms.o
+ obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
+ obj-$(CONFIG_KEXEC) += kexec.o
+@@ -141,11 +142,11 @@ targets += timeconst.h
+ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
+ 	$(call if_changed,bc)
+ 
+-ifeq ($(CONFIG_MODULE_SIG),y)
+ ###############################################################################
+ #
+ # Roll all the X.509 certificates that we can find together and pull them into
+-# the kernel.
++# the kernel so that they get loaded into the system trusted keyring during
++# boot.
+ #
+ # We look in the source root and the build root for all files whose name ends
+ # in ".x509".  Unfortunately, this will generate duplicate filenames, so we
+@@ -153,6 +154,7 @@ ifeq ($(CONFIG_MODULE_SIG),y)
+ # duplicates.
+ #
+ ###############################################################################
++ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
+ X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
+ X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
+ X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
+@@ -169,10 +171,11 @@ $(shell rm $(obj)/.x509.list)
+ endif
+ endif
+ 
+-kernel/modsign_certificate.o: $(obj)/x509_certificate_list
++kernel/system_certificates.o: $(obj)/x509_certificate_list
+ 
+ quiet_cmd_x509certs  = CERTS   $@
+-      cmd_x509certs  = cat $(X509_CERTIFICATES) /dev/null >$@
++      cmd_x509certs  = cat $(X509_CERTIFICATES) /dev/null >$@ $(foreach X509,$(X509_CERTIFICATES),; echo "  - Including cert $(X509)")
++
+ targets += $(obj)/x509_certificate_list
+ $(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list
+ 	$(call if_changed,x509certs)
+@@ -182,7 +185,9 @@ $(obj)/.x509.list:
+ 	@echo $(X509_CERTIFICATES) >$@
+ 
+ clean-files := x509_certificate_list .x509.list
++endif
+ 
++ifeq ($(CONFIG_MODULE_SIG),y)
+ ###############################################################################
+ #
+ # If module signing is requested, say by allyesconfig, but a key has not been
+diff --git a/kernel/modsign_certificate.S b/kernel/modsign_certificate.S
+deleted file mode 100644
+index 6fe03c7..0000000
+--- a/kernel/modsign_certificate.S
++++ /dev/null
+@@ -1,11 +0,0 @@
+-#include <linux/export.h>
+-
+-#define GLOBAL(name)	\
+-	.globl VMLINUX_SYMBOL(name);	\
+-	VMLINUX_SYMBOL(name):
+-
+-	.section ".init.data","aw"
+-
+-GLOBAL(modsign_certificate_list)
+-	.incbin "kernel/x509_certificate_list"
+-GLOBAL(modsign_certificate_list_end)
+diff --git a/kernel/modsign_pubkey.c b/kernel/modsign_pubkey.c
+deleted file mode 100644
+index 7cbd450..0000000
+--- a/kernel/modsign_pubkey.c
++++ /dev/null
+@@ -1,104 +0,0 @@
+-/* Public keys for module signature verification
+- *
+- * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
+- * Written by David Howells (dhowells at redhat.com)
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public Licence
+- * as published by the Free Software Foundation; either version
+- * 2 of the Licence, or (at your option) any later version.
+- */
+-
+-#include <linux/kernel.h>
+-#include <linux/sched.h>
+-#include <linux/cred.h>
+-#include <linux/err.h>
+-#include <keys/asymmetric-type.h>
+-#include "module-internal.h"
+-
+-struct key *modsign_keyring;
+-
+-extern __initconst const u8 modsign_certificate_list[];
+-extern __initconst const u8 modsign_certificate_list_end[];
+-
+-/*
+- * We need to make sure ccache doesn't cache the .o file as it doesn't notice
+- * if modsign.pub changes.
+- */
+-static __initconst const char annoy_ccache[] = __TIME__ "foo";
+-
+-/*
+- * Load the compiled-in keys
+- */
+-static __init int module_verify_init(void)
+-{
+-	pr_notice("Initialise module verification\n");
+-
+-	modsign_keyring = keyring_alloc(".module_sign",
+-					KUIDT_INIT(0), KGIDT_INIT(0),
+-					current_cred(),
+-					((KEY_POS_ALL & ~KEY_POS_SETATTR) |
+-					 KEY_USR_VIEW | KEY_USR_READ),
+-					KEY_ALLOC_NOT_IN_QUOTA, NULL);
+-	if (IS_ERR(modsign_keyring))
+-		panic("Can't allocate module signing keyring\n");
+-
+-	return 0;
+-}
+-
+-/*
+- * Must be initialised before we try and load the keys into the keyring.
+- */
+-device_initcall(module_verify_init);
+-
+-/*
+- * Load the compiled-in keys
+- */
+-static __init int load_module_signing_keys(void)
+-{
+-	key_ref_t key;
+-	const u8 *p, *end;
+-	size_t plen;
+-
+-	pr_notice("Loading module verification certificates\n");
+-
+-	end = modsign_certificate_list_end;
+-	p = modsign_certificate_list;
+-	while (p < end) {
+-		/* Each cert begins with an ASN.1 SEQUENCE tag and must be more
+-		 * than 256 bytes in size.
+-		 */
+-		if (end - p < 4)
+-			goto dodgy_cert;
+-		if (p[0] != 0x30 &&
+-		    p[1] != 0x82)
+-			goto dodgy_cert;
+-		plen = (p[2] << 8) | p[3];
+-		plen += 4;
+-		if (plen > end - p)
+-			goto dodgy_cert;
+-
+-		key = key_create_or_update(make_key_ref(modsign_keyring, 1),
+-					   "asymmetric",
+-					   NULL,
+-					   p,
+-					   plen,
+-					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
+-					   KEY_USR_VIEW,
+-					   KEY_ALLOC_NOT_IN_QUOTA);
+-		if (IS_ERR(key))
+-			pr_err("MODSIGN: Problem loading in-kernel X.509 certificate (%ld)\n",
+-			       PTR_ERR(key));
+-		else
+-			pr_notice("MODSIGN: Loaded cert '%s'\n",
+-				  key_ref_to_ptr(key)->description);
+-		p += plen;
+-	}
+-
+-	return 0;
+-
+-dodgy_cert:
+-	pr_err("MODSIGN: Problem parsing in-kernel X.509 certificate list\n");
+-	return 0;
+-}
+-late_initcall(load_module_signing_keys);
+diff --git a/kernel/module-internal.h b/kernel/module-internal.h
+index 24f9247..915e123 100644
+--- a/kernel/module-internal.h
++++ b/kernel/module-internal.h
+@@ -9,6 +9,4 @@
+  * 2 of the Licence, or (at your option) any later version.
   */
--static int public_key_verify_signature(const struct key *key,
--				       const struct public_key_signature *sig)
-+int public_key_verify_signature(const struct public_key *pk,
-+				const struct public_key_signature *sig)
- {
--	const struct public_key *pk = key->payload.data;
-+	const struct public_key_algorithm *algo;
-+
-+	BUG_ON(!pk);
-+	BUG_ON(!pk->mpi[0]);
-+	BUG_ON(!pk->mpi[1]);
-+	BUG_ON(!sig);
-+	BUG_ON(!sig->digest);
-+	BUG_ON(!sig->mpi[0]);
-+
-+	algo = pk->algo;
-+	if (!algo) {
-+		if (pk->pkey_algo >= PKEY_ALGO__LAST)
-+			return -ENOPKG;
-+		algo = pkey_algo[pk->pkey_algo];
-+		if (!algo)
-+			return -ENOPKG;
-+	}
  
--	if (!pk->algo->verify_signature)
-+	if (!algo->verify_signature)
- 		return -ENOTSUPP;
+-extern struct key *modsign_keyring;
+-
+ extern int mod_verify_sig(const void *mod, unsigned long *_modlen);
+diff --git a/kernel/module_signing.c b/kernel/module_signing.c
+index ee47640..0b6b870 100644
+--- a/kernel/module_signing.c
++++ b/kernel/module_signing.c
+@@ -14,6 +14,7 @@
+ #include <crypto/public_key.h>
+ #include <crypto/hash.h>
+ #include <keys/asymmetric-type.h>
++#include <keys/system_keyring.h>
+ #include "module-internal.h"
  
--	if (sig->nr_mpi != pk->algo->n_sig_mpi) {
-+	if (sig->nr_mpi != algo->n_sig_mpi) {
- 		pr_debug("Signature has %u MPI not %u\n",
--			 sig->nr_mpi, pk->algo->n_sig_mpi);
-+			 sig->nr_mpi, algo->n_sig_mpi);
- 		return -EINVAL;
- 	}
+ /*
+@@ -157,7 +158,7 @@ static struct key *request_asymmetric_key(const char *signer, size_t signer_len,
  
--	return pk->algo->verify_signature(pk, sig);
-+	return algo->verify_signature(pk, sig);
-+}
-+EXPORT_SYMBOL_GPL(public_key_verify_signature);
+ 	pr_debug("Look up: \"%s\"\n", id);
+ 
+-	key = keyring_search(make_key_ref(modsign_keyring, 1),
++	key = keyring_search(make_key_ref(system_trusted_keyring, 1),
+ 			     &key_type_asymmetric, id);
+ 	if (IS_ERR(key))
+ 		pr_warn("Request for unknown module key '%s' err %ld\n",
+diff --git a/kernel/system_certificates.S b/kernel/system_certificates.S
+new file mode 100644
+index 0000000..5cffe86
+--- /dev/null
++++ b/kernel/system_certificates.S
+@@ -0,0 +1,11 @@
++#include <linux/export.h>
 +
-+static int public_key_verify_signature_2(const struct key *key,
-+					 const struct public_key_signature *sig)
++#define GLOBAL(name)	\
++	.globl VMLINUX_SYMBOL(name);	\
++	VMLINUX_SYMBOL(name):
++
++	.section ".init.data","aw"
++
++GLOBAL(system_certificate_list)
++	.incbin "kernel/x509_certificate_list"
++GLOBAL(system_certificate_list_end)
+diff --git a/kernel/system_keyring.c b/kernel/system_keyring.c
+new file mode 100644
+index 0000000..51c3514
+--- /dev/null
++++ b/kernel/system_keyring.c
+@@ -0,0 +1,103 @@
++/* System trusted keyring for trusted public keys
++ *
++ * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
++ * Written by David Howells (dhowells at redhat.com)
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public Licence
++ * as published by the Free Software Foundation; either version
++ * 2 of the Licence, or (at your option) any later version.
++ */
++
++#include <linux/export.h>
++#include <linux/kernel.h>
++#include <linux/sched.h>
++#include <linux/cred.h>
++#include <linux/err.h>
++#include <keys/asymmetric-type.h>
++#include <keys/system_keyring.h>
++#include "module-internal.h"
++
++struct key *system_trusted_keyring;
++EXPORT_SYMBOL_GPL(system_trusted_keyring);
++
++extern __initconst const u8 system_certificate_list[];
++extern __initconst const u8 system_certificate_list_end[];
++
++/*
++ * Load the compiled-in keys
++ */
++static __init int system_trusted_keyring_init(void)
 +{
-+	const struct public_key *pk = key->payload.data;
-+	return public_key_verify_signature(pk, sig);
- }
- 
- /*
-@@ -111,6 +135,6 @@ struct asymmetric_key_subtype public_key_subtype = {
- 	.name			= "public_key",
- 	.describe		= public_key_describe,
- 	.destroy		= public_key_destroy,
--	.verify_signature	= public_key_verify_signature,
-+	.verify_signature	= public_key_verify_signature_2,
- };
- EXPORT_SYMBOL_GPL(public_key_subtype);
-diff --git a/crypto/asymmetric_keys/public_key.h b/crypto/asymmetric_keys/public_key.h
-index 5e5e356..5c37a22 100644
---- a/crypto/asymmetric_keys/public_key.h
-+++ b/crypto/asymmetric_keys/public_key.h
-@@ -28,3 +28,9 @@ struct public_key_algorithm {
- };
- 
- extern const struct public_key_algorithm RSA_public_key_algorithm;
++	pr_notice("Initialise system trusted keyring\n");
++
++	system_trusted_keyring =
++		keyring_alloc(".system_keyring",
++			      KUIDT_INIT(0), KGIDT_INIT(0), current_cred(),
++			      ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
++			       KEY_USR_VIEW | KEY_USR_READ),
++			      KEY_ALLOC_NOT_IN_QUOTA, NULL);
++	if (IS_ERR(system_trusted_keyring))
++		panic("Can't allocate system trusted keyring\n");
++
++	return 0;
++}
 +
 +/*
-+ * public_key.c
++ * Must be initialised before we try and load the keys into the keyring.
 + */
-+extern int public_key_verify_signature(const struct public_key *pk,
-+				       const struct public_key_signature *sig);
-diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index fac574c..8cb2f70 100644
---- a/crypto/asymmetric_keys/x509_public_key.c
-+++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -76,7 +76,7 @@ static int x509_check_signature(const struct public_key *pub,
- 	if (ret < 0)
- 		goto error_mpi;
- 
--	ret = pub->algo->verify_signature(pub, sig);
-+	ret = public_key_verify_signature(pub, sig);
- 
- 	pr_debug("Cert Verification: %d\n", ret);
- 
--- 
-1.8.3.1
-
-
-From 87854340605a64fcc54109ea415d9e54c45e8533 Mon Sep 17 00:00:00 2001
-From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:15:37 +0100
-Subject: [PATCH 09/14] KEYS: Store public key algo ID in public_key_signature
- struct
-
-Store public key algorithm ID in public_key_signature struct for reference
-purposes.  This allows a public_key_signature struct to be embedded in
-struct x509_certificate and other places more easily.
-
-Signed-off-by: David Howells <dhowells at redhat.com>
-Reviewed-by: Kees Cook <keescook at chromium.org>
-Reviewed-by: Josh Boyer <jwboyer at redhat.com>
----
- include/crypto/public_key.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
-index 05778df..b34fda4 100644
---- a/include/crypto/public_key.h
-+++ b/include/crypto/public_key.h
-@@ -90,6 +90,7 @@ struct public_key_signature {
- 	u8 *digest;
- 	u8 digest_size;			/* Number of bytes in digest */
- 	u8 nr_mpi;			/* Occupancy of mpi[] */
-+	enum pkey_algo pkey_algo : 8;
- 	enum pkey_hash_algo pkey_hash_algo : 8;
- 	union {
- 		MPI mpi[2];
--- 
-1.8.3.1
-
-
-From ae4684a05d87123de310b69c616922dc993694ca Mon Sep 17 00:00:00 2001
-From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:16:34 +0100
-Subject: [PATCH 10/14] X.509: struct x509_certificate needs struct tm
- declaring
-
-struct x509_certificate needs struct tm declaring by #inclusion of linux/time.h
-prior to its definition.
-
-Signed-off-by: David Howells <dhowells at redhat.com>
-Reviewed-by: Kees Cook <keescook at chromium.org>
-Reviewed-by: Josh Boyer <jwboyer at redhat.com>
----
- crypto/asymmetric_keys/x509_parser.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
-index e583ad0..2d01182 100644
---- a/crypto/asymmetric_keys/x509_parser.h
-+++ b/crypto/asymmetric_keys/x509_parser.h
-@@ -9,6 +9,7 @@
-  * 2 of the Licence, or (at your option) any later version.
-  */
- 
-+#include <linux/time.h>
- #include <crypto/public_key.h>
- 
- struct x509_certificate {
++device_initcall(system_trusted_keyring_init);
++
++/*
++ * Load the compiled-in list of X.509 certificates.
++ */
++static __init int load_system_certificate_list(void)
++{
++	key_ref_t key;
++	const u8 *p, *end;
++	size_t plen;
++
++	pr_notice("Loading compiled-in X.509 certificates\n");
++
++	end = system_certificate_list_end;
++	p = system_certificate_list;
++	while (p < end) {
++		/* Each cert begins with an ASN.1 SEQUENCE tag and must be more
++		 * than 256 bytes in size.
++		 */
++		if (end - p < 4)
++			goto dodgy_cert;
++		if (p[0] != 0x30 &&
++		    p[1] != 0x82)
++			goto dodgy_cert;
++		plen = (p[2] << 8) | p[3];
++		plen += 4;
++		if (plen > end - p)
++			goto dodgy_cert;
++
++		key = key_create_or_update(make_key_ref(system_trusted_keyring, 1),
++					   "asymmetric",
++					   NULL,
++					   p,
++					   plen,
++					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
++					   KEY_USR_VIEW,
++					   KEY_ALLOC_NOT_IN_QUOTA);
++		if (IS_ERR(key)) {
++			pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
++			       PTR_ERR(key));
++		} else {
++			pr_notice("Loaded X.509 cert '%s'\n",
++				  key_ref_to_ptr(key)->description);
++			key_ref_put(key);
++		}
++		p += plen;
++	}
++
++	return 0;
++
++dodgy_cert:
++	pr_err("Problem parsing in-kernel X.509 certificate list\n");
++	return 0;
++}
++late_initcall(load_system_certificate_list);
 -- 
 1.8.3.1
 
 
-From dacde6f44ebe5a5c89bd1a25b35b1b63c139b375 Mon Sep 17 00:00:00 2001
+From c0522b3236c27359bd61fee0f0b74be9f8e2ad60 Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:18:02 +0100
-Subject: [PATCH 11/14] X.509: Embed public_key_signature struct and create
- filler function
+Date: Fri, 30 Aug 2013 16:07:37 +0100
+Subject: [PATCH 14/18] KEYS: Add a 'trusted' flag and a 'trusted only' flag
 
-Embed a public_key_signature struct in struct x509_certificate, eliminating
-now unnecessary fields, and split x509_check_signature() to create a filler
-function for it that attaches a digest of the signed data and an MPI that
-represents the signature data.  x509_free_certificate() is then modified to
-deal with these.
+Add KEY_FLAG_TRUSTED to indicate that a key either comes from a trusted source
+or had a cryptographic signature chain that led back to a trusted key the
+kernel already possessed.
 
-Whilst we're at it, export both x509_check_signature() and the new
-x509_get_sig_params().
+Add KEY_FLAGS_TRUSTED_ONLY to indicate that a keyring will only accept links to
+keys marked with KEY_FLAGS_TRUSTED.
 
 Signed-off-by: David Howells <dhowells at redhat.com>
 Reviewed-by: Kees Cook <keescook at chromium.org>
-Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- crypto/asymmetric_keys/x509_cert_parser.c | 30 +++++------
- crypto/asymmetric_keys/x509_parser.h      | 16 ++++--
- crypto/asymmetric_keys/x509_public_key.c  | 83 +++++++++++++++++--------------
- 3 files changed, 74 insertions(+), 55 deletions(-)
+ include/linux/key-type.h | 1 +
+ include/linux/key.h      | 3 +++
+ kernel/system_keyring.c  | 4 +++-
+ security/keys/key.c      | 8 ++++++++
+ security/keys/keyring.c  | 4 ++++
+ 5 files changed, 19 insertions(+), 1 deletion(-)
 
-diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
-index 8cc253d..144201c 100644
---- a/crypto/asymmetric_keys/x509_cert_parser.c
-+++ b/crypto/asymmetric_keys/x509_cert_parser.c
-@@ -47,6 +47,8 @@ void x509_free_certificate(struct x509_certificate *cert)
- 		kfree(cert->subject);
- 		kfree(cert->fingerprint);
- 		kfree(cert->authority);
-+		kfree(cert->sig.digest);
-+		mpi_free(cert->sig.rsa.s);
- 		kfree(cert);
- 	}
- }
-@@ -152,33 +154,33 @@ int x509_note_pkey_algo(void *context, size_t hdrlen,
- 		return -ENOPKG; /* Unsupported combination */
- 
- 	case OID_md4WithRSAEncryption:
--		ctx->cert->sig_hash_algo = PKEY_HASH_MD5;
--		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
-+		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_MD5;
-+		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
- 		break;
- 
- 	case OID_sha1WithRSAEncryption:
--		ctx->cert->sig_hash_algo = PKEY_HASH_SHA1;
--		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
-+		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA1;
-+		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
- 		break;
- 
- 	case OID_sha256WithRSAEncryption:
--		ctx->cert->sig_hash_algo = PKEY_HASH_SHA256;
--		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
-+		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA256;
-+		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
- 		break;
- 
- 	case OID_sha384WithRSAEncryption:
--		ctx->cert->sig_hash_algo = PKEY_HASH_SHA384;
--		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
-+		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA384;
-+		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
- 		break;
- 
- 	case OID_sha512WithRSAEncryption:
--		ctx->cert->sig_hash_algo = PKEY_HASH_SHA512;
--		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
-+		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA512;
-+		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
- 		break;
- 
- 	case OID_sha224WithRSAEncryption:
--		ctx->cert->sig_hash_algo = PKEY_HASH_SHA224;
--		ctx->cert->sig_pkey_algo = PKEY_ALGO_RSA;
-+		ctx->cert->sig.pkey_hash_algo = PKEY_HASH_SHA224;
-+		ctx->cert->sig.pkey_algo = PKEY_ALGO_RSA;
- 		break;
- 	}
- 
-@@ -203,8 +205,8 @@ int x509_note_signature(void *context, size_t hdrlen,
- 		return -EINVAL;
- 	}
- 
--	ctx->cert->sig = value;
--	ctx->cert->sig_size = vlen;
-+	ctx->cert->raw_sig = value;
-+	ctx->cert->raw_sig_size = vlen;
- 	return 0;
- }
- 
-diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
-index 2d01182..87d9cc2 100644
---- a/crypto/asymmetric_keys/x509_parser.h
-+++ b/crypto/asymmetric_keys/x509_parser.h
-@@ -21,12 +21,11 @@ struct x509_certificate {
- 	char		*authority;		/* Authority key fingerprint as hex */
- 	struct tm	valid_from;
- 	struct tm	valid_to;
--	enum pkey_algo	sig_pkey_algo : 8;	/* Signature public key algorithm */
--	enum pkey_hash_algo sig_hash_algo : 8;	/* Signature hash algorithm */
- 	const void	*tbs;			/* Signed data */
--	size_t		tbs_size;		/* Size of signed data */
--	const void	*sig;			/* Signature data */
--	size_t		sig_size;		/* Size of sigature */
-+	unsigned	tbs_size;		/* Size of signed data */
-+	unsigned	raw_sig_size;		/* Size of sigature */
-+	const void	*raw_sig;		/* Signature data */
-+	struct public_key_signature sig;	/* Signature parameters */
+diff --git a/include/linux/key-type.h b/include/linux/key-type.h
+index f58737b..a74c3a8 100644
+--- a/include/linux/key-type.h
++++ b/include/linux/key-type.h
+@@ -45,6 +45,7 @@ struct key_preparsed_payload {
+ 	const void	*data;		/* Raw data */
+ 	size_t		datalen;	/* Raw datalen */
+ 	size_t		quotalen;	/* Quota length for proposed payload */
++	bool		trusted;	/* True if key is trusted */
  };
  
- /*
-@@ -34,3 +33,10 @@ struct x509_certificate {
-  */
- extern void x509_free_certificate(struct x509_certificate *cert);
- extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen);
-+
-+/*
-+ * x509_public_key.c
-+ */
-+extern int x509_get_sig_params(struct x509_certificate *cert);
-+extern int x509_check_signature(const struct public_key *pub,
-+				struct x509_certificate *cert);
-diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index 8cb2f70..b7c81d8 100644
---- a/crypto/asymmetric_keys/x509_public_key.c
-+++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -24,72 +24,83 @@
- #include "x509_parser.h"
- 
- /*
-- * Check the signature on a certificate using the provided public key
-+ * Set up the signature parameters in an X.509 certificate.  This involves
-+ * digesting the signed data and extracting the signature.
-  */
--static int x509_check_signature(const struct public_key *pub,
--				const struct x509_certificate *cert)
-+int x509_get_sig_params(struct x509_certificate *cert)
- {
--	struct public_key_signature *sig;
- 	struct crypto_shash *tfm;
- 	struct shash_desc *desc;
- 	size_t digest_size, desc_size;
-+	void *digest;
- 	int ret;
- 
- 	pr_devel("==>%s()\n", __func__);
--	
-+
-+	if (cert->sig.rsa.s)
-+		return 0;
-+
-+	cert->sig.rsa.s = mpi_read_raw_data(cert->raw_sig, cert->raw_sig_size);
-+	if (!cert->sig.rsa.s)
-+		return -ENOMEM;
-+	cert->sig.nr_mpi = 1;
-+
- 	/* Allocate the hashing algorithm we're going to need and find out how
- 	 * big the hash operational data will be.
- 	 */
--	tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig_hash_algo], 0, 0);
-+	tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig.pkey_hash_algo], 0, 0);
- 	if (IS_ERR(tfm))
- 		return (PTR_ERR(tfm) == -ENOENT) ? -ENOPKG : PTR_ERR(tfm);
- 
- 	desc_size = crypto_shash_descsize(tfm) + sizeof(*desc);
- 	digest_size = crypto_shash_digestsize(tfm);
- 
--	/* We allocate the hash operational data storage on the end of our
--	 * context data.
-+	/* We allocate the hash operational data storage on the end of the
-+	 * digest storage space.
- 	 */
- 	ret = -ENOMEM;
--	sig = kzalloc(sizeof(*sig) + desc_size + digest_size, GFP_KERNEL);
--	if (!sig)
--		goto error_no_sig;
-+	digest = kzalloc(digest_size + desc_size, GFP_KERNEL);
-+	if (!digest)
-+		goto error;
+ typedef int (*request_key_actor_t)(struct key_construction *key,
+diff --git a/include/linux/key.h b/include/linux/key.h
+index 010dbb6..80d6774 100644
+--- a/include/linux/key.h
++++ b/include/linux/key.h
+@@ -168,6 +168,8 @@ struct key {
+ #define KEY_FLAG_NEGATIVE	5	/* set if key is negative */
+ #define KEY_FLAG_ROOT_CAN_CLEAR	6	/* set if key can be cleared by root without permission */
+ #define KEY_FLAG_INVALIDATED	7	/* set if key has been invalidated */
++#define KEY_FLAG_TRUSTED	8	/* set if key is trusted */
++#define KEY_FLAG_TRUSTED_ONLY	9	/* set if keyring only accepts links to trusted keys */
  
--	sig->pkey_hash_algo	= cert->sig_hash_algo;
--	sig->digest		= (u8 *)sig + sizeof(*sig) + desc_size;
--	sig->digest_size	= digest_size;
-+	cert->sig.digest = digest;
-+	cert->sig.digest_size = digest_size;
+ 	/* the key type and key description string
+ 	 * - the desc is used to match a key against search criteria
+@@ -218,6 +220,7 @@ extern struct key *key_alloc(struct key_type *type,
+ #define KEY_ALLOC_IN_QUOTA	0x0000	/* add to quota, reject if would overrun */
+ #define KEY_ALLOC_QUOTA_OVERRUN	0x0001	/* add to quota, permit even if overrun */
+ #define KEY_ALLOC_NOT_IN_QUOTA	0x0002	/* not in quota */
++#define KEY_ALLOC_TRUSTED	0x0004	/* Key should be flagged as trusted */
  
--	desc = (void *)sig + sizeof(*sig);
--	desc->tfm	= tfm;
--	desc->flags	= CRYPTO_TFM_REQ_MAY_SLEEP;
-+	desc = digest + digest_size;
-+	desc->tfm = tfm;
-+	desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+ extern void key_revoke(struct key *key);
+ extern void key_invalidate(struct key *key);
+diff --git a/kernel/system_keyring.c b/kernel/system_keyring.c
+index 51c3514..5296721 100644
+--- a/kernel/system_keyring.c
++++ b/kernel/system_keyring.c
+@@ -40,6 +40,7 @@ static __init int system_trusted_keyring_init(void)
+ 	if (IS_ERR(system_trusted_keyring))
+ 		panic("Can't allocate system trusted keyring\n");
  
- 	ret = crypto_shash_init(desc);
- 	if (ret < 0)
- 		goto error;
-+	might_sleep();
-+	ret = crypto_shash_finup(desc, cert->tbs, cert->tbs_size, digest);
-+error:
-+	crypto_free_shash(tfm);
-+	pr_devel("<==%s() = %d\n", __func__, ret);
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(x509_get_sig_params);
++	set_bit(KEY_FLAG_TRUSTED_ONLY, &system_trusted_keyring->flags);
+ 	return 0;
+ }
  
--	ret = -ENOMEM;
--	sig->rsa.s = mpi_read_raw_data(cert->sig, cert->sig_size);
--	if (!sig->rsa.s)
--		goto error;
-+/*
-+ * Check the signature on a certificate using the provided public key
-+ */
-+int x509_check_signature(const struct public_key *pub,
-+			 struct x509_certificate *cert)
-+{
-+	int ret;
+@@ -82,7 +83,8 @@ static __init int load_system_certificate_list(void)
+ 					   plen,
+ 					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
+ 					   KEY_USR_VIEW,
+-					   KEY_ALLOC_NOT_IN_QUOTA);
++					   KEY_ALLOC_NOT_IN_QUOTA |
++					   KEY_ALLOC_TRUSTED);
+ 		if (IS_ERR(key)) {
+ 			pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
+ 			       PTR_ERR(key));
+diff --git a/security/keys/key.c b/security/keys/key.c
+index a819b5c..d331ea9 100644
+--- a/security/keys/key.c
++++ b/security/keys/key.c
+@@ -300,6 +300,8 @@ struct key *key_alloc(struct key_type *type, const char *desc,
  
--	ret = crypto_shash_finup(desc, cert->tbs, cert->tbs_size, sig->digest);
--	if (ret < 0)
--		goto error_mpi;
-+	pr_devel("==>%s()\n", __func__);
+ 	if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
+ 		key->flags |= 1 << KEY_FLAG_IN_QUOTA;
++	if (flags & KEY_ALLOC_TRUSTED)
++		key->flags |= 1 << KEY_FLAG_TRUSTED;
  
--	ret = public_key_verify_signature(pub, sig);
-+	ret = x509_get_sig_params(cert);
-+	if (ret < 0)
-+		return ret;
+ 	memset(&key->type_data, 0, sizeof(key->type_data));
  
-+	ret = public_key_verify_signature(pub, &cert->sig);
- 	pr_debug("Cert Verification: %d\n", ret);
--
--error_mpi:
--	mpi_free(sig->rsa.s);
--error:
--	kfree(sig);
--error_no_sig:
--	crypto_free_shash(tfm);
--
--	pr_devel("<==%s() = %d\n", __func__, ret);
- 	return ret;
- }
-+EXPORT_SYMBOL_GPL(x509_check_signature);
+@@ -813,6 +815,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
+ 	prep.data = payload;
+ 	prep.datalen = plen;
+ 	prep.quotalen = index_key.type->def_datalen;
++	prep.trusted = flags & KEY_ALLOC_TRUSTED;
+ 	if (index_key.type->preparse) {
+ 		ret = index_key.type->preparse(&prep);
+ 		if (ret < 0) {
+@@ -827,6 +830,11 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
+ 	}
+ 	index_key.desc_len = strlen(index_key.description);
  
- /*
-  * Attempt to parse a data blob for a key as an X509 certificate.
-@@ -118,8 +129,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 		 cert->valid_to.tm_mday, cert->valid_to.tm_hour,
- 		 cert->valid_to.tm_min,  cert->valid_to.tm_sec);
- 	pr_devel("Cert Signature: %s + %s\n",
--		 pkey_algo_name[cert->sig_pkey_algo],
--		 pkey_hash_algo_name[cert->sig_hash_algo]);
-+		 pkey_algo_name[cert->sig.pkey_algo],
-+		 pkey_hash_algo_name[cert->sig.pkey_hash_algo]);
++	key_ref = ERR_PTR(-EPERM);
++	if (!prep.trusted && test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags))
++		goto error_free_prep;
++	flags |= prep.trusted ? KEY_ALLOC_TRUSTED : 0;
++
+ 	ret = __key_link_begin(keyring, &index_key, &edit);
+ 	if (ret < 0) {
+ 		key_ref = ERR_PTR(ret);
+diff --git a/security/keys/keyring.c b/security/keys/keyring.c
+index f7cdea2..9b6f6e0 100644
+--- a/security/keys/keyring.c
++++ b/security/keys/keyring.c
+@@ -1183,6 +1183,10 @@ int key_link(struct key *keyring, struct key *key)
+ 	key_check(keyring);
+ 	key_check(key);
  
- 	if (!cert->fingerprint || !cert->authority) {
- 		pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",
++	if (test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags) &&
++	    !test_bit(KEY_FLAG_TRUSTED, &key->flags))
++		return -EPERM;
++
+ 	ret = __key_link_begin(keyring, &key->index_key, &edit);
+ 	if (ret == 0) {
+ 		kdebug("begun {%d,%d}", keyring->serial, atomic_read(&keyring->usage));
 -- 
 1.8.3.1
 
 
-From 650fdcb141f65f3a03dc7eba1179c823fd1a3a54 Mon Sep 17 00:00:00 2001
+From e8e9a6af1d2de6aca01751ccaf0475ed46f9bdb2 Mon Sep 17 00:00:00 2001
 From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:18:15 +0100
-Subject: [PATCH 12/14] X.509: Check the algorithm IDs obtained from parsing an
- X.509 certificate
+Date: Wed, 4 Sep 2013 19:28:03 +0100
+Subject: [PATCH 15/18] KEYS: Set the asymmetric-key type default search method
 
-Check that the algorithm IDs obtained from the ASN.1 parse by OID lookup
-corresponds to algorithms that are available to us.
+The keyring expansion patches introduces a new search method by which
+key_search() attempts to walk directly to the key that has exactly the same
+description as the requested one.
+
+However, this causes inexact matching of asymmetric keys to fail.  The
+solution to this is to select iterative rather than direct search as the
+default search type for asymmetric keys.
+
+As an example, the kernel might have a key like this:
+
+	Magrathea: Glacier signing key: 6a2a0f82bad7e396665f465e4e3e1f9bd24b1226
+
+and:
+
+	keyctl search <keyring-ID> asymmetric id:d24b1226
+
+should find the key, despite that not being its exact description.
 
-Reported-by: Kees Cook <keescook at chromium.org>
 Signed-off-by: David Howells <dhowells at redhat.com>
 ---
- crypto/asymmetric_keys/x509_public_key.c | 11 +++++++++++
- 1 file changed, 11 insertions(+)
+ crypto/asymmetric_keys/asymmetric_type.c | 1 +
+ 1 file changed, 1 insertion(+)
 
-diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index b7c81d8..eb368d4 100644
---- a/crypto/asymmetric_keys/x509_public_key.c
-+++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -119,6 +119,17 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+diff --git a/crypto/asymmetric_keys/asymmetric_type.c b/crypto/asymmetric_keys/asymmetric_type.c
+index cf80765..b77eb53 100644
+--- a/crypto/asymmetric_keys/asymmetric_type.c
++++ b/crypto/asymmetric_keys/asymmetric_type.c
+@@ -209,6 +209,7 @@ struct key_type key_type_asymmetric = {
+ 	.match		= asymmetric_key_match,
+ 	.destroy	= asymmetric_key_destroy,
+ 	.describe	= asymmetric_key_describe,
++	.def_lookup_type = KEYRING_SEARCH_LOOKUP_ITERATE,
+ };
+ EXPORT_SYMBOL_GPL(key_type_asymmetric);
  
- 	pr_devel("Cert Issuer: %s\n", cert->issuer);
- 	pr_devel("Cert Subject: %s\n", cert->subject);
-+
-+	if (cert->pub->pkey_algo >= PKEY_ALGO__LAST ||
-+	    cert->sig.pkey_algo >= PKEY_ALGO__LAST ||
-+	    cert->sig.pkey_hash_algo >= PKEY_HASH__LAST ||
-+	    !pkey_algo[cert->pub->pkey_algo] ||
-+	    !pkey_algo[cert->sig.pkey_algo] ||
-+	    !pkey_hash_algo_name[cert->sig.pkey_hash_algo]) {
-+		ret = -ENOPKG;
-+		goto error_free_cert;
-+	}
-+
- 	pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pub->pkey_algo]);
- 	pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
- 		 cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
 -- 
 1.8.3.1
 
 
-From 8671bdd55802c4b93b9205b6ecd02c7e351ac5c5 Mon Sep 17 00:00:00 2001
-From: David Howells <dhowells at redhat.com>
-Date: Fri, 30 Aug 2013 16:18:31 +0100
-Subject: [PATCH 13/14] X.509: Handle certificates that lack an
- authorityKeyIdentifier field
+From dfb7781ebba28004f95f7af4e039d8b44697c87c Mon Sep 17 00:00:00 2001
+From: Mimi Zohar <zohar at linux.vnet.ibm.com>
+Date: Tue, 20 Aug 2013 14:36:26 -0400
+Subject: [PATCH 16/18] KEYS: Make the system 'trusted' keyring viewable by
+ userspace
 
-Handle certificates that lack an authorityKeyIdentifier field by assuming
-they're self-signed and checking their signatures against themselves.
+Give the root user the ability to read the system keyring and put read
+permission on the trusted keys added during boot.  The latter is actually more
+theoretical than real for the moment as asymmetric keys do not currently
+provide a read operation.
 
+Signed-off-by: Mimi Zohar <zohar at us.ibm.com>
 Signed-off-by: David Howells <dhowells at redhat.com>
-Reviewed-by: Kees Cook <keescook at chromium.org>
-Reviewed-by: Josh Boyer <jwboyer at redhat.com>
 ---
- crypto/asymmetric_keys/x509_public_key.c | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
+ kernel/system_keyring.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/kernel/system_keyring.c b/kernel/system_keyring.c
+index 5296721..564dd93 100644
+--- a/kernel/system_keyring.c
++++ b/kernel/system_keyring.c
+@@ -35,7 +35,7 @@ static __init int system_trusted_keyring_init(void)
+ 		keyring_alloc(".system_keyring",
+ 			      KUIDT_INIT(0), KGIDT_INIT(0), current_cred(),
+ 			      ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
+-			       KEY_USR_VIEW | KEY_USR_READ),
++			      KEY_USR_VIEW | KEY_USR_READ | KEY_USR_SEARCH),
+ 			      KEY_ALLOC_NOT_IN_QUOTA, NULL);
+ 	if (IS_ERR(system_trusted_keyring))
+ 		panic("Can't allocate system trusted keyring\n");
+@@ -81,8 +81,8 @@ static __init int load_system_certificate_list(void)
+ 					   NULL,
+ 					   p,
+ 					   plen,
+-					   (KEY_POS_ALL & ~KEY_POS_SETATTR) |
+-					   KEY_USR_VIEW,
++					   ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
++					   KEY_USR_VIEW | KEY_USR_READ),
+ 					   KEY_ALLOC_NOT_IN_QUOTA |
+ 					   KEY_ALLOC_TRUSTED);
+ 		if (IS_ERR(key)) {
+-- 
+1.8.3.1
+
+
+From 052744b12209e66ede2a04ec31b9bb7ff40bbc9a Mon Sep 17 00:00:00 2001
+From: Mimi Zohar <zohar at linux.vnet.ibm.com>
+Date: Tue, 20 Aug 2013 14:36:27 -0400
+Subject: [PATCH 17/18] KEYS: verify a certificate is signed by a 'trusted' key
+
+Only public keys, with certificates signed by an existing
+'trusted' key on the system trusted keyring, should be added
+to a trusted keyring.  This patch adds support for verifying
+a certificate's signature.
+
+This is derived from David Howells pkcs7_request_asymmetric_key() patch.
+
+Signed-off-by: Mimi Zohar <zohar at linux.vnet.ibm.com>
+Signed-off-by: David Howells <dhowells at redhat.com>
+---
+ crypto/asymmetric_keys/x509_public_key.c | 81 +++++++++++++++++++++++++++++++-
+ 1 file changed, 80 insertions(+), 1 deletion(-)
 
 diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index eb368d4..0f55e3b 100644
+index c1540e8..8761264 100644
 --- a/crypto/asymmetric_keys/x509_public_key.c
 +++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -143,8 +143,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 		 pkey_algo_name[cert->sig.pkey_algo],
- 		 pkey_hash_algo_name[cert->sig.pkey_hash_algo]);
+@@ -18,12 +18,60 @@
+ #include <linux/asn1_decoder.h>
+ #include <keys/asymmetric-subtype.h>
+ #include <keys/asymmetric-parser.h>
++#include <keys/system_keyring.h>
+ #include <crypto/hash.h>
+ #include "asymmetric_keys.h"
+ #include "public_key.h"
+ #include "x509_parser.h"
  
--	if (!cert->fingerprint || !cert->authority) {
--		pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",
-+	if (!cert->fingerprint) {
-+		pr_warn("Cert for '%s' must have a SubjKeyId extension\n",
- 			cert->subject);
- 		ret = -EKEYREJECTED;
- 		goto error_free_cert;
-@@ -190,8 +190,9 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 	cert->pub->algo = pkey_algo[cert->pub->pkey_algo];
- 	cert->pub->id_type = PKEY_ID_X509;
+ /*
++ * Find a key in the given keyring by issuer and authority.
++ */
++static struct key *x509_request_asymmetric_key(
++	struct key *keyring,
++	const char *signer, size_t signer_len,
++	const char *authority, size_t auth_len)
++{
++	key_ref_t key;
++	char *id;
++
++	/* Construct an identifier. */
++	id = kmalloc(signer_len + 2 + auth_len + 1, GFP_KERNEL);
++	if (!id)
++		return ERR_PTR(-ENOMEM);
++
++	memcpy(id, signer, signer_len);
++	id[signer_len + 0] = ':';
++	id[signer_len + 1] = ' ';
++	memcpy(id + signer_len + 2, authority, auth_len);
++	id[signer_len + 2 + auth_len] = 0;
++
++	pr_debug("Look up: \"%s\"\n", id);
++
++	key = keyring_search(make_key_ref(keyring, 1),
++			     &key_type_asymmetric, id);
++	if (IS_ERR(key))
++		pr_debug("Request for module key '%s' err %ld\n",
++			 id, PTR_ERR(key));
++	kfree(id);
++
++	if (IS_ERR(key)) {
++		switch (PTR_ERR(key)) {
++			/* Hide some search errors */
++		case -EACCES:
++		case -ENOTDIR:
++		case -EAGAIN:
++			return ERR_PTR(-ENOKEY);
++		default:
++			return ERR_CAST(key);
++		}
++	}
++
++	pr_devel("<==%s() = 0 [%x]\n", __func__, key_serial(key_ref_to_ptr(key)));
++	return key_ref_to_ptr(key);
++}
++
++/*
+  * Set up the signature parameters in an X.509 certificate.  This involves
+  * digesting the signed data and extracting the signature.
+  */
+@@ -103,6 +151,33 @@ int x509_check_signature(const struct public_key *pub,
+ EXPORT_SYMBOL_GPL(x509_check_signature);
  
--	/* Check the signature on the key */
--	if (strcmp(cert->fingerprint, cert->authority) == 0) {
-+	/* Check the signature on the key if it appears to be self-signed */
-+	if (!cert->authority ||
-+	    strcmp(cert->fingerprint, cert->authority) == 0) {
- 		ret = x509_check_signature(cert->pub, cert);
+ /*
++ * Check the new certificate against the ones in the trust keyring.  If one of
++ * those is the signing key and validates the new certificate, then mark the
++ * new certificate as being trusted.
++ *
++ * Return 0 if the new certificate was successfully validated, 1 if we couldn't
++ * find a matching parent certificate in the trusted list and an error if there
++ * is a matching certificate but the signature check fails.
++ */
++static int x509_validate_trust(struct x509_certificate *cert,
++			       struct key *trust_keyring)
++{
++	const struct public_key *pk;
++	struct key *key;
++	int ret = 1;
++
++	key = x509_request_asymmetric_key(trust_keyring,
++					  cert->issuer, strlen(cert->issuer),
++					  cert->authority,
++					  strlen(cert->authority));
++	if (!IS_ERR(key))  {
++		pk = key->payload.data;
++		ret = x509_check_signature(pk, cert);
++	}
++	return ret;
++}
++
++/*
+  * Attempt to parse a data blob for a key as an X509 certificate.
+  */
+ static int x509_key_preparse(struct key_preparsed_payload *prep)
+@@ -155,9 +230,13 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
+ 	/* Check the signature on the key if it appears to be self-signed */
+ 	if (!cert->authority ||
+ 	    strcmp(cert->fingerprint, cert->authority) == 0) {
+-		ret = x509_check_signature(cert->pub, cert);
++		ret = x509_check_signature(cert->pub, cert); /* self-signed */
  		if (ret < 0)
  			goto error_free_cert;
++	} else {
++		ret = x509_validate_trust(cert, system_trusted_keyring);
++		if (!ret)
++			prep->trusted = 1;
+ 	}
+ 
+ 	/* Propose a description */
 -- 
 1.8.3.1
 
 
-From e2d665556f4b60ce76e880a62f98c81622271e71 Mon Sep 17 00:00:00 2001
-From: David Howells <dhowells at redhat.com>
-Date: Tue, 18 Jun 2013 17:40:44 +0100
-Subject: [PATCH 14/14] X.509: Remove certificate date checks
+From 8b39d9a6d9f805f6a2e837bf8b9595f701ea4a1c Mon Sep 17 00:00:00 2001
+From: Mimi Zohar <zohar at linux.vnet.ibm.com>
+Date: Wed, 4 Sep 2013 13:26:22 +0100
+Subject: [PATCH 18/18] KEYS: initialize root uid and session keyrings early
 
-Remove the certificate date checks that are performed when a certificate is
-parsed.  There are two checks: a valid from and a valid to.  The first check is
-causing a lot of problems with system clocks that don't keep good time and the
-second places an implicit expiry date upon the kernel when used for module
-signing, so do we really need them?
+In order to create the integrity keyrings (eg. _evm, _ima), root's
+uid and session keyrings need to be initialized early.
 
+Signed-off-by: Mimi Zohar <zohar at us.ibm.com>
 Signed-off-by: David Howells <dhowells at redhat.com>
-cc: David Woodhouse <dwmw2 at infradead.org>
-cc: Rusty Russell <rusty at rustcorp.com.au>
-cc: Josh Boyer <jwboyer at redhat.com>
-cc: Alexander Holler <holler at ahsoftware.de>
-cc: stable at vger.kernel.org
 ---
- crypto/asymmetric_keys/x509_public_key.c | 38 --------------------------------
- 1 file changed, 38 deletions(-)
+ security/keys/process_keys.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
 
-diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
-index 0f55e3b..c1540e8 100644
---- a/crypto/asymmetric_keys/x509_public_key.c
-+++ b/crypto/asymmetric_keys/x509_public_key.c
-@@ -108,7 +108,6 @@ EXPORT_SYMBOL_GPL(x509_check_signature);
- static int x509_key_preparse(struct key_preparsed_payload *prep)
- {
- 	struct x509_certificate *cert;
--	struct tm now;
- 	size_t srlen, sulen;
- 	char *desc = NULL;
- 	int ret;
-@@ -150,43 +149,6 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
- 		goto error_free_cert;
- 	}
- 
--	time_to_tm(CURRENT_TIME.tv_sec, 0, &now);
--	pr_devel("Now: %04ld-%02d-%02d %02d:%02d:%02d\n",
--		 now.tm_year + 1900, now.tm_mon + 1, now.tm_mday,
--		 now.tm_hour, now.tm_min,  now.tm_sec);
--	if (now.tm_year < cert->valid_from.tm_year ||
--	    (now.tm_year == cert->valid_from.tm_year &&
--	     (now.tm_mon < cert->valid_from.tm_mon ||
--	      (now.tm_mon == cert->valid_from.tm_mon &&
--	       (now.tm_mday < cert->valid_from.tm_mday ||
--		(now.tm_mday == cert->valid_from.tm_mday &&
--		 (now.tm_hour < cert->valid_from.tm_hour ||
--		  (now.tm_hour == cert->valid_from.tm_hour &&
--		   (now.tm_min < cert->valid_from.tm_min ||
--		    (now.tm_min == cert->valid_from.tm_min &&
--		     (now.tm_sec < cert->valid_from.tm_sec
--		      ))))))))))) {
--		pr_warn("Cert %s is not yet valid\n", cert->fingerprint);
--		ret = -EKEYREJECTED;
--		goto error_free_cert;
--	}
--	if (now.tm_year > cert->valid_to.tm_year ||
--	    (now.tm_year == cert->valid_to.tm_year &&
--	     (now.tm_mon > cert->valid_to.tm_mon ||
--	      (now.tm_mon == cert->valid_to.tm_mon &&
--	       (now.tm_mday > cert->valid_to.tm_mday ||
--		(now.tm_mday == cert->valid_to.tm_mday &&
--		 (now.tm_hour > cert->valid_to.tm_hour ||
--		  (now.tm_hour == cert->valid_to.tm_hour &&
--		   (now.tm_min > cert->valid_to.tm_min ||
--		    (now.tm_min == cert->valid_to.tm_min &&
--		     (now.tm_sec > cert->valid_to.tm_sec
--		      ))))))))))) {
--		pr_warn("Cert %s has expired\n", cert->fingerprint);
--		ret = -EKEYEXPIRED;
--		goto error_free_cert;
--	}
--
- 	cert->pub->algo = pkey_algo[cert->pub->pkey_algo];
- 	cert->pub->id_type = PKEY_ID_X509;
+diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
+index 68548ea..0cf8a13 100644
+--- a/security/keys/process_keys.c
++++ b/security/keys/process_keys.c
+@@ -857,3 +857,13 @@ void key_change_session_keyring(struct callback_head *twork)
  
+ 	commit_creds(new);
+ }
++
++/*
++ * Make sure that root's user and user-session keyrings exist.
++ */
++static int __init init_root_keyring(void)
++{
++	return install_user_keyrings();
++}
++
++late_initcall(init_root_keyring);
 -- 
 1.8.3.1
 
diff --git a/modsign-uefi.patch b/modsign-uefi.patch
index 836d0d1..17009c1 100644
--- a/modsign-uefi.patch
+++ b/modsign-uefi.patch
@@ -321,8 +321,8 @@ index 564dd93..389b50d 100644
 +struct key *system_blacklist_keyring;
 +#endif
  
- extern __initdata const u8 system_certificate_list[];
- extern __initdata const u8 system_certificate_list_end[];
+ extern __initconst const u8 system_certificate_list[];
+ extern __initconst const u8 system_certificate_list_end[];
 @@ -41,6 +44,20 @@ static __init int system_trusted_keyring_init(void)
  		panic("Can't allocate system trusted keyring\n");
  
diff --git a/silence-noise.patch b/silence-noise.patch
index 1e4d7c5..a803259 100644
--- a/silence-noise.patch
+++ b/silence-noise.patch
@@ -7,28 +7,20 @@ Some systems, such as EFI-based Apple systems, won't necessarily have an
 i8042 to initialize.  We shouldn't be printing an error message in this
 case, since not detecting the chip is the correct behavior.
 ---
- drivers/input/serio/i8042.c |    4 +---
- 1 files changed, 1 insertions(+), 3 deletions(-)
-
 diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
-index 170f71e..4f3e632 100644
+index 52c9ebf..c374a96 100644
 --- a/drivers/input/serio/i8042.c
 +++ b/drivers/input/serio/i8042.c
-@@ -701,10 +701,8 @@ static int __devinit i8042_check_aux(void)
- 
+@@ -855,7 +855,6 @@ static int __init i8042_check_aux(void)
  static int i8042_controller_check(void)
  {
--	if (i8042_flush() == I8042_BUFFER_SIZE) {
+ 	if (i8042_flush()) {
 -		pr_err("No controller found\n");
-+	if (i8042_flush() == I8042_BUFFER_SIZE)
  		return -ENODEV;
--	}
- 
- 	return 0;
- }
--- 
-1.6.0.1
+ 	}
 
+--
+ 
 Socket fuzzers like sfuzz will trigger this printk a lot, even though it's
 ratelimited. It isn't particularly useful, so just remove it.
 
diff --git a/sources b/sources
index c634d10..df0f7b6 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-fea363551ff45fbe4cb88497b863b261  linux-3.11.tar.xz
-c918da07cf5ad4240945ae56c4de3bc0  patch-3.11.10.xz
+cc6ee608854e0da4b64f6c1ff8b6398c  linux-3.12.tar.xz
+70e456d21f7e7c0dc2f9bd170f1ae4ee  patch-3.12.5.xz
diff --git a/sunrpc-replace-gssd_running-with-more-reliable-check.patch b/sunrpc-replace-gssd_running-with-more-reliable-check.patch
index f2ca185..8cd5c00 100644
--- a/sunrpc-replace-gssd_running-with-more-reliable-check.patch
+++ b/sunrpc-replace-gssd_running-with-more-reliable-check.patch
@@ -14,16 +14,19 @@ extraneous newline from the message.
 Signed-off-by: Jeff Layton <jlayton at redhat.com>
 Signed-off-by: Trond Myklebust <Trond.Myklebust at netapp.com>
 ---
+ Fixed up to apply to 3.12.1 by Josh Boyer <jwboyer at fedoraproject.org>
+
  include/linux/sunrpc/rpc_pipe_fs.h |    2 ++
  net/sunrpc/auth_gss/auth_gss.c     |   17 +++++++----------
  net/sunrpc/netns.h                 |    2 --
  net/sunrpc/rpc_pipe.c              |   14 ++++++++++----
  4 files changed, 19 insertions(+), 16 deletions(-)
 
-diff -up linux-3.11.9-200.fc19.x86_64/include/linux/sunrpc/rpc_pipe_fs.h.orig linux-3.11.9-200.fc19.x86_64/include/linux/sunrpc/rpc_pipe_fs.h
---- linux-3.11.9-200.fc19.x86_64/include/linux/sunrpc/rpc_pipe_fs.h.orig	2013-11-21 10:11:17.893026000 -0500
-+++ linux-3.11.9-200.fc19.x86_64/include/linux/sunrpc/rpc_pipe_fs.h	2013-11-21 10:14:17.709348000 -0500
-@@ -94,5 +94,7 @@ extern int rpc_unlink(struct dentry *);
+diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
+index 85f1342..7f490be 100644
+--- a/include/linux/sunrpc/rpc_pipe_fs.h
++++ b/include/linux/sunrpc/rpc_pipe_fs.h
+@@ -131,5 +131,7 @@ extern int rpc_unlink(struct dentry *);
  extern int register_rpc_pipefs(void);
  extern void unregister_rpc_pipefs(void);
  
@@ -31,10 +34,11 @@ diff -up linux-3.11.9-200.fc19.x86_64/include/linux/sunrpc/rpc_pipe_fs.h.orig li
 +
  #endif
  #endif
-diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c.orig linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c
---- linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c.orig	2013-09-02 16:46:10.000000000 -0400
-+++ linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c	2013-11-21 10:18:33.681923000 -0500
-@@ -507,8 +507,7 @@ static void warn_gssd(void)
+diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
+index 0846566..1ada878 100644
+--- a/net/sunrpc/auth_gss/auth_gss.c
++++ b/net/sunrpc/auth_gss/auth_gss.c
+@@ -517,8 +517,7 @@ static void warn_gssd(void)
  	unsigned long now = jiffies;
  
  	if (time_after(now, ratelimit)) {
@@ -44,7 +48,7 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c.orig linux-
  		ratelimit = now + 15*HZ;
  	}
  }
-@@ -571,7 +570,6 @@ gss_create_upcall(struct gss_auth *gss_a
+@@ -581,7 +580,6 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
  	struct rpc_pipe *pipe;
  	struct rpc_cred *cred = &gss_cred->gc_base;
  	struct gss_upcall_msg *gss_msg;
@@ -52,7 +56,7 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c.orig linux-
  	DEFINE_WAIT(wait);
  	int err;
  
-@@ -579,17 +577,16 @@ gss_create_upcall(struct gss_auth *gss_a
+@@ -589,17 +587,16 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
  		__func__, from_kuid(&init_user_ns, cred->cr_uid));
  retry:
  	err = 0;
@@ -65,7 +69,7 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c.orig linux-
 +		warn_gssd();
 +		return -EACCES;
 +	}
- 	gss_msg = gss_setup_upcall(gss_auth->client, gss_auth, cred);
+ 	gss_msg = gss_setup_upcall(gss_auth, cred);
  	if (PTR_ERR(gss_msg) == -EAGAIN) {
  		err = wait_event_interruptible_timeout(pipe_version_waitqueue,
 -				sn->pipe_version >= 0, timeout);
@@ -76,9 +80,10 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/auth_gss/auth_gss.c.orig linux-
  			warn_gssd();
  			err = -EACCES;
  		}
-diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/netns.h.orig linux-3.11.9-200.fc19.x86_64/net/sunrpc/netns.h
---- linux-3.11.9-200.fc19.x86_64/net/sunrpc/netns.h.orig	2013-11-21 10:11:17.897029000 -0500
-+++ linux-3.11.9-200.fc19.x86_64/net/sunrpc/netns.h	2013-11-21 10:14:17.722351000 -0500
+diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
+index 8a8e841..94e506f 100644
+--- a/net/sunrpc/netns.h
++++ b/net/sunrpc/netns.h
 @@ -33,8 +33,6 @@ struct sunrpc_net {
  	int pipe_version;
  	atomic_t pipe_users;
@@ -88,9 +93,10 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/netns.h.orig linux-3.11.9-200.f
  };
  
  extern int sunrpc_net_id;
-diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c.orig linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c
---- linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c.orig	2013-11-21 10:11:17.903026000 -0500
-+++ linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c	2013-11-21 10:14:17.727348000 -0500
+diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
+index 40aef18..ad444f3 100644
+--- a/net/sunrpc/rpc_pipe.c
++++ b/net/sunrpc/rpc_pipe.c
 @@ -216,14 +216,11 @@ rpc_destroy_inode(struct inode *inode)
  static int
  rpc_pipe_open(struct inode *inode, struct file *filp)
@@ -106,7 +112,7 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c.orig linux-3.11.9-20
  	pipe = RPC_I(inode)->pipe;
  	if (pipe == NULL)
  		goto out;
-@@ -1082,7 +1079,6 @@ int rpc_pipefs_init_net(struct net *net)
+@@ -1231,7 +1228,6 @@ int rpc_pipefs_init_net(struct net *net)
  		return PTR_ERR(sn->gssd_dummy);
  
  	mutex_init(&sn->pipefs_sb_lock);
@@ -114,7 +120,7 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c.orig linux-3.11.9-20
  	sn->pipe_version = -1;
  	return 0;
  }
-@@ -1236,6 +1232,16 @@ err_depopulate:
+@@ -1385,6 +1381,16 @@ err_depopulate:
  	return err;
  }
  
@@ -131,4 +137,3 @@ diff -up linux-3.11.9-200.fc19.x86_64/net/sunrpc/rpc_pipe.c.orig linux-3.11.9-20
  static struct dentry *
  rpc_mount(struct file_system_type *fs_type,
  		int flags, const char *dev_name, void *data)
-
diff --git a/x86-allow-1024-cpus.patch b/x86-allow-1024-cpus.patch
new file mode 100644
index 0000000..decafd6
--- /dev/null
+++ b/x86-allow-1024-cpus.patch
@@ -0,0 +1,13 @@
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
+index f67e839..d726b2d 100644
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -825,7 +825,7 @@ config MAXSMP
+ config NR_CPUS
+ 	int "Maximum number of CPUs" if SMP && !MAXSMP
+ 	range 2 8 if SMP && X86_32 && !X86_BIGSMP
+-	range 2 512 if SMP && !MAXSMP
++	range 2 1024 if SMP && !MAXSMP
+ 	default "1" if !SMP
+ 	default "4096" if MAXSMP
+ 	default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)


More information about the scm-commits mailing list