platform/kernel/linux-3.10.git
11 years agoMerge tag 'marvell-armadaxp-smp-for-3.8' of github.com:MISL-EBU-System-SW/mainline...
Thomas Petazzoni [Thu, 22 Nov 2012 09:55:09 +0000 (10:55 +0100)]
Merge tag 'marvell-armadaxp-smp-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public into mevbu-dt-additions

SMP support for Armada XP

The purpose of this series is to add the SMP support for the Armada XP
SoCs. Beside the SMP support itself brought by the last 3 commits,
this series also adds the support for the coherency fabric unit and
the power management service unit.

The coherency fabric is responsible for ensuring hardware coherency
between all CPUs and between CPUs and I/O masters. This unit is also
available for Armada 370 and will be used in an incoming patch set
for hardware I/O cache coherency.

The power management service unit is responsible for powering down and
waking up CPUs and other SOC units.

Conflicts:
arch/arm/mach-mvebu/armada-370-xp.c

11 years agoMerge branch 'for-jason-1/cleanup' into mevbu-dt-additions
Thomas Petazzoni [Thu, 22 Nov 2012 09:50:55 +0000 (10:50 +0100)]
Merge branch 'for-jason-1/cleanup' into mevbu-dt-additions

11 years agoARM: mvebu: update defconfig with I2C and RTC support
Thomas Petazzoni [Wed, 21 Nov 2012 22:12:54 +0000 (23:12 +0100)]
ARM: mvebu: update defconfig with I2C and RTC support

Now that we have support for the I2C busses on Armada 370/XP, and
support for the RTC on the OpenBlocks AX3-4 platform, include the
necessary options in mvebu_defconfig.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoARM: mvebu: Add SATA support for OpenBlocks AX3-4
Thomas Petazzoni [Wed, 21 Nov 2012 21:37:01 +0000 (22:37 +0100)]
ARM: mvebu: Add SATA support for OpenBlocks AX3-4

This patch enables SATA support on the OpenBlocks AX3-4. It has one
internal SATA port, and an external eSATA port.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoARM: mvebu: Add support for the RTC in OpenBlocks AX3-4
Nobuhiro Iwamatsu [Tue, 30 Oct 2012 10:41:25 +0000 (19:41 +0900)]
ARM: mvebu: Add support for the RTC in OpenBlocks AX3-4

The OpenBlocks AX3-4 has a Seiko Instruments S-35390A as the RTC
controller.  This patch enables this RTC device in the OpenBlocks
AX3-4 Device Tree.

[Thomas Petazzoni: updated with other OpenBlocks changes, rephrased
commit log.]
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoARM: mvebu: Add support for I2C on OpenBlocks AX3-4
Nobuhiro Iwamatsu [Tue, 30 Oct 2012 10:41:24 +0000 (19:41 +0900)]
ARM: mvebu: Add support for I2C on OpenBlocks AX3-4

The OpenBlocks AX3-4 board, based on the Armada XP SoC, has an I2C
bus. This patch enables this bus and sets the clock frequency of the
bus.

[Thomas Petazzoni: updated with other changes on OpenBlocks, rephrased
commit log.]
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoARM: mvebu: Add support for I2C controllers in Armada 370/XP
Nobuhiro Iwamatsu [Tue, 30 Oct 2012 10:41:23 +0000 (19:41 +0900)]
ARM: mvebu: Add support for I2C controllers in Armada 370/XP

The Armada 370 and Armada XP have the same I2C controllers as previous
Marvell SoCs, so the existing mv64xxx-i2c driver works fine.

[Thomas Petazzoni: updated on top of other Armada 370/XP changes,
rephrased the commit log].
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: Add SMP support for Armada XP
Gregory CLEMENT [Wed, 14 Nov 2012 21:51:08 +0000 (22:51 +0100)]
arm: mvebu: Add SMP support for Armada XP

This enables SMP support on the Armada XP processor. It adds the
mandatory functions to support SMP such as: the SMP initialization
functions in platsmp.c, the secondary CPU entry point in headsmp.S and
the CPU hotplug initial support in hotplug.c.

Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
11 years agoarm: mm: Add support for PJ4B cpu and init routines
Gregory CLEMENT [Wed, 3 Oct 2012 09:58:07 +0000 (11:58 +0200)]
arm: mm: Add support for PJ4B cpu and init routines

PJ4B is an implementation of the ARMv7 (such as the Cortex A9 for
example) released by Marvell. This CPU is currently found in
Armada 370 and Armada XP SoCs. This patch provides a support for the
specific initialization of this CPU.

Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
11 years agoarm: mvebu: Add IPI support via doorbells
Gregory CLEMENT [Thu, 2 Aug 2012 08:19:12 +0000 (11:19 +0300)]
arm: mvebu: Add IPI support via doorbells

This patch enhances the IRQ controller driver to add support for
Inter-Processor-Interrupts that are needed to enable SMP support.

Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
11 years agoarm: mvebu: Add initial support for power managmement service unit
Gregory CLEMENT [Thu, 2 Aug 2012 08:17:51 +0000 (11:17 +0300)]
arm: mvebu: Add initial support for power managmement service unit

The Armada 370 and Armada XP SOCs have a power management service unit
which is responsible for powering down and waking up CPUs and other
SOC units. This patch adds support for this unit.

Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
11 years agoarm: mvebu: Add support for coherency fabric in mach-mvebu
Gregory CLEMENT [Thu, 2 Aug 2012 08:16:29 +0000 (11:16 +0300)]
arm: mvebu: Add support for coherency fabric in mach-mvebu

The Armada 370 and Armada XP SOCs have a coherency fabric unit which
is responsible for ensuring hardware coherency between all CPUs and
between CPUs and I/O masters. This patch provides the basic support
needed for SMP.

Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
11 years agoMerge tag 'marvell-net-xor-defconfig-for-3.8' of github.com:MISL-EBU-System-SW/mainli...
Thomas Petazzoni [Tue, 20 Nov 2012 22:42:09 +0000 (23:42 +0100)]
Merge tag 'marvell-net-xor-defconfig-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell mvebu defconfig updates for 3.8

Conflicts:
arch/arm/configs/mvebu_defconfig

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoMerge tag 'marvell-xor-board-dt-changes-3.8-v2' of github.com:MISL-EBU-System-SW...
Thomas Petazzoni [Tue, 20 Nov 2012 22:40:29 +0000 (23:40 +0100)]
Merge tag 'marvell-xor-board-dt-changes-3.8-v2' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell XOR driver DT changes for 3.8

Conflicts:
arch/arm/boot/dts/armada-xp.dtsi

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoMerge tag 'marvell-xor-cleanup-dt-binding-3.8' of github.com:MISL-EBU-System-SW/mainl...
Thomas Petazzoni [Tue, 20 Nov 2012 22:38:47 +0000 (23:38 +0100)]
Merge tag 'marvell-xor-cleanup-dt-binding-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell XOR driver cleanup and DT binding for 3.8

11 years agoMerge tag 'marvell-neta-dt-clk-updates-3.8' of github.com:MISL-EBU-System-SW/mainline...
Thomas Petazzoni [Tue, 20 Nov 2012 22:38:00 +0000 (23:38 +0100)]
Merge tag 'marvell-neta-dt-clk-updates-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell Ethernet DT update for clk support

11 years agoMerge tag 'marvell-mvneta-fix-and-clk-support-3.8' of github.com:MISL-EBU-System...
Thomas Petazzoni [Tue, 20 Nov 2012 22:37:28 +0000 (23:37 +0100)]
Merge tag 'marvell-mvneta-fix-and-clk-support-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell Ethernet driver fix + clk support

11 years agoMerge tag 'marvell-net-mdio-checkpatch-fixes-3.8' of github.com:MISL-EBU-System-SW...
Thomas Petazzoni [Tue, 20 Nov 2012 22:36:51 +0000 (23:36 +0100)]
Merge tag 'marvell-net-mdio-checkpatch-fixes-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell network/MDIO driver checkpatch fixes

Conflicts:
arch/arm/boot/dts/armada-xp-db.dts

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoMerge tag 'marvell-boards-net-for-3.8' of github.com:MISL-EBU-System-SW/mainline...
Thomas Petazzoni [Tue, 20 Nov 2012 22:35:16 +0000 (23:35 +0100)]
Merge tag 'marvell-boards-net-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell boards changes related to Ethernet, for 3.8

Conflicts:
arch/arm/boot/dts/armada-370-xp.dtsi
arch/arm/boot/dts/armada-xp-db.dts

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoMerge tag 'marvell-neta-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public...
Thomas Petazzoni [Tue, 20 Nov 2012 22:32:58 +0000 (23:32 +0100)]
Merge tag 'marvell-neta-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell mvneta network driver, for 3.8

11 years agoMerge tag 'marvell-sata-3.8' of github.com:MISL-EBU-System-SW/mainline-public into...
Thomas Petazzoni [Tue, 20 Nov 2012 22:30:08 +0000 (23:30 +0100)]
Merge tag 'marvell-sata-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell Armada 370/XP support for 3.8

11 years agoMerge tag 'marvell-mvebu-clk-3.8' of github.com:MISL-EBU-System-SW/mainline-public...
Thomas Petazzoni [Tue, 20 Nov 2012 22:29:27 +0000 (23:29 +0100)]
Merge tag 'marvell-mvebu-clk-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell MVEBU clk support, for 3.8

11 years agoarm: mvebu: update defconfig to include XOR driver
Thomas Petazzoni [Mon, 19 Nov 2012 11:10:54 +0000 (12:10 +0100)]
arm: mvebu: update defconfig to include XOR driver

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: update defconfig to include network driver
Thomas Petazzoni [Mon, 19 Nov 2012 11:10:25 +0000 (12:10 +0100)]
arm: mvebu: update defconfig to include network driver

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: remove 'clock-frequency' properties from Armada 370/XP Ethernet nodes
Thomas Petazzoni [Mon, 19 Nov 2012 13:19:29 +0000 (14:19 +0100)]
arm: mvebu: remove 'clock-frequency' properties from Armada 370/XP Ethernet nodes

The mvneta driver for the Marvell Armada 370/XP Ethernet devices has
gained proper clock framework integration, and the corresponding
Device Tree nodes now have a correct 'clocks' pointer.

The 'clock-frequency' properties in the various .dts files for Armada
370/XP boards have therefore become useless.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: add 'clocks' property to Ethernet nodes for Armada 370/XP SoCs
Thomas Petazzoni [Mon, 19 Nov 2012 13:18:09 +0000 (14:18 +0100)]
arm: mvebu: add 'clocks' property to Ethernet nodes for Armada 370/XP SoCs

The mvneta driver now understands a standard 'clocks' clock pointer
property in the Device Tree nodes for the Ethernet devices, so we add
the right clock reference for the different Ethernet ports of the
Armada 370/XP SoCs.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agonet: mvneta: fix section mismatch warning caused by mvneta_deinit()
Thomas Petazzoni [Mon, 19 Nov 2012 13:40:02 +0000 (14:40 +0100)]
net: mvneta: fix section mismatch warning caused by mvneta_deinit()

mvneta_deinit() can be called from the ->probe() hook in the error
path, so it shouldn't be marked as __devexit. It fixes the following
section mismatch warning:

WARNING: vmlinux.o(.devinit.text+0x239c): Section mismatch in reference
from the function mvneta_probe() to the function .devexit.text:mvneta_deinit()
The function __devinit mvneta_probe() references
a function __devexit mvneta_deinit().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agonet: mvneta: add clk support
Thomas Petazzoni [Mon, 19 Nov 2012 13:15:25 +0000 (14:15 +0100)]
net: mvneta: add clk support

Now that the Armada 370/XP platform has gained proper integration with
the clock framework, we add clk support in the Marvell Armada 370/XP
Ethernet driver.

Since the existing Device Tree binding that exposes a
'clock-frequency' property has never been exposed in any stable kernel
release, we take the freedom of removing this property to replace it
with the standard 'clocks' clock pointer property.

The Device Tree binding documentation is updated accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agonet: mvneta: adjust multiline comments to net/ style
Thomas Petazzoni [Mon, 19 Nov 2012 10:41:25 +0000 (11:41 +0100)]
net: mvneta: adjust multiline comments to net/ style

As reported by checkpatch, the multiline comments for net/ and
drivers/net/ have a slightly different format than the one used in the
rest of the kernel, so we adjust our multiline comments accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agonet: mvmdio: adjust multiline comment to net/ style
Thomas Petazzoni [Mon, 19 Nov 2012 10:40:15 +0000 (11:40 +0100)]
net: mvmdio: adjust multiline comment to net/ style

As reported by checkpatch, the multiline comments for net/ and
drivers/net/ have a slightly different format than the one used in the
rest of the kernel, so we adjust our multiline comment accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agonet: mvmdio: use <linux/delay.h> instead of <asm/delay.h>
Thomas Petazzoni [Mon, 19 Nov 2012 10:39:42 +0000 (11:39 +0100)]
net: mvmdio: use <linux/delay.h> instead of <asm/delay.h>

As suggested by checkpatch, using <linux/delay.h> instead of
<asm/delay.h> is appropriate.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoMerge tag 'marvell-boards-net-for-3.8' of github.com:MISL-EBU-System-SW/mainline...
Thomas Petazzoni [Tue, 20 Nov 2012 22:09:20 +0000 (23:09 +0100)]
Merge tag 'marvell-boards-net-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell boards changes related to Ethernet, for 3.8

Conflicts:
arch/arm/boot/dts/armada-370-xp.dtsi
arch/arm/boot/dts/armada-xp-db.dts

11 years agoMerge tag 'marvell-neta-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public...
Thomas Petazzoni [Tue, 20 Nov 2012 22:08:06 +0000 (23:08 +0100)]
Merge tag 'marvell-neta-for-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell mvneta network driver, for 3.8

11 years agoMerge tag 'marvell-sata-3.8' of github.com:MISL-EBU-System-SW/mainline-public into...
Thomas Petazzoni [Tue, 20 Nov 2012 22:07:19 +0000 (23:07 +0100)]
Merge tag 'marvell-sata-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell Armada 370/XP support for 3.8

11 years agoMerge tag 'marvell-mvebu-clk-3.8' of github.com:MISL-EBU-System-SW/mainline-public...
Thomas Petazzoni [Tue, 20 Nov 2012 22:06:52 +0000 (23:06 +0100)]
Merge tag 'marvell-mvebu-clk-3.8' of github.com:MISL-EBU-System-SW/mainline-public into test-the-merge

Marvell MVEBU clk support, for 3.8

11 years agoarm: mvebu: add XOR engines to Armada XP .dtsi
Thomas Petazzoni [Tue, 20 Nov 2012 15:03:19 +0000 (16:03 +0100)]
arm: mvebu: add XOR engines to Armada XP .dtsi

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: add XOR engines to Armada 370 .dtsi
Thomas Petazzoni [Tue, 20 Nov 2012 15:03:12 +0000 (16:03 +0100)]
arm: mvebu: add XOR engines to Armada 370 .dtsi

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: dove: Convert Dove to DT XOR DMA engine
Sebastian Hesselbarth [Mon, 19 Nov 2012 08:37:24 +0000 (09:37 +0100)]
arm: dove: Convert Dove to DT XOR DMA engine

With DT support for Marvell XOR DMA engine, make use of it on Dove.
Also remove the now redundant code in DT board init for xor engines.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: kirkwood: Convert XOR instantiation to DT.
Andrew Lunn [Sun, 18 Nov 2012 10:44:57 +0000 (11:44 +0100)]
arm: kirkwood: Convert XOR instantiation to DT.

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the
C code initialization.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: Add a device_control function
Andrew Lunn [Sun, 18 Nov 2012 10:44:56 +0000 (11:44 +0100)]
dma: mv_xor: Add a device_control function

The dmatest module for DMA engines calls

device_control(dtc->chan, DMA_TERMINATE_ALL, 0);

after completing the tests. The documentation in
include/linux/dmaengine.h suggests this function is optional and
dma_async_device_register() also does not BUG_ON() when not passed a
function. However, dmatest is not the only code in the kernel
unconditionally calling device_control. So add an implementation
indicating all operations are not implemented.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: add missing __devinit and __devexit qualifiers on probe and remove
Thomas Petazzoni [Sun, 18 Nov 2012 17:25:12 +0000 (18:25 +0100)]
dma: mv_xor: add missing __devinit and __devexit qualifiers on probe and remove

The ->probe() and ->remove() functions were missing the usual
__devinit and __devexit qualifiers.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: add Device Tree binding
Thomas Petazzoni [Thu, 15 Nov 2012 15:47:58 +0000 (16:47 +0100)]
dma: mv_xor: add Device Tree binding

This patch finally adds a Device Tree binding to the mv_xor
driver. Thanks to the previous cleanup patches, the Device Tree
binding is relatively simply: one DT node per XOR engine, with
sub-nodes for each XOR channel of the XOR engine. The binding
obviously comes with the necessary documentation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: devicetree-discuss@lists.ozlabs.org
11 years agodma: mv_xor: add missing free_irq() call
Thomas Petazzoni [Thu, 15 Nov 2012 15:11:18 +0000 (16:11 +0100)]
dma: mv_xor: add missing free_irq() call

Even though the driver cannot be unloaded at the moment, it is still
good to properly free the IRQ handlers in the channel removal function.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove the pool_size from platform_data
Thomas Petazzoni [Thu, 15 Nov 2012 14:55:30 +0000 (15:55 +0100)]
dma: mv_xor: remove the pool_size from platform_data

The pool_size is always PAGE_SIZE, and since it is a software
configuration paramter (and not a hardware description parameter), we
cannot make it part of the Device Tree binding, so we'd better remove
it from the platform_data as well.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove hw_id field from platform_data
Thomas Petazzoni [Thu, 15 Nov 2012 14:36:37 +0000 (15:36 +0100)]
dma: mv_xor: remove hw_id field from platform_data

There is no need for the platform_data to give this ID, it is simply
the channel number, so we can compute it inside the driver when
registering the channels.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove useless backpointer from mv_xor_chan to mv_xor_device
Thomas Petazzoni [Thu, 15 Nov 2012 14:32:24 +0000 (15:32 +0100)]
dma: mv_xor: remove useless backpointer from mv_xor_chan to mv_xor_device

The backpointer from mv_xor_chan to mv_xor_device is now useless, get
rid of it.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: rename mv_xor_private to mv_xor_device
Thomas Petazzoni [Thu, 15 Nov 2012 14:29:53 +0000 (15:29 +0100)]
dma: mv_xor: rename mv_xor_private to mv_xor_device

Now that mv_xor_device is no longer used to designate the per-channel
DMA devices, use it know to designate the XOR engine themselves
(currently composed of two XOR channels).

So, now we have the nice organization where:

 - mv_xor_device represents each XOR engine in the system
 - mv_xor_chan   represents each XOR channel of a given XOR engine

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: merge mv_xor_device and mv_xor_chan
Thomas Petazzoni [Thu, 15 Nov 2012 14:17:05 +0000 (15:17 +0100)]
dma: mv_xor: merge mv_xor_device and mv_xor_chan

Even though the DMA engine infrastructure has support for multiple
channels per device, the mv_xor driver registers one DMA engine device
for each channel, because the mv_xor channels inside the same XOR
engine have different capabilities, and the DMA engine infrastructure
only allows to express capabilities at the DMA engine device level.

The mv_xor driver has therefore been registering one DMA engine device
and one DMA engine channel for each XOR channel since its introduction
in the kernel. However, it kept two separate internal structures,
mv_xor_device and mv_xor_channel, which didn't make a lot of sense
since there was a 1:1 mapping between those structures.

This patch gets rid of this duplication, and merges everything into
the mv_xor_chan structure.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: use mv_xor_chan pointers as arguments to self-test functions
Thomas Petazzoni [Thu, 15 Nov 2012 14:09:42 +0000 (15:09 +0100)]
dma: mv_xor: use mv_xor_chan pointers as arguments to self-test functions

In preparation for the removal of the mv_xor_device structure, we
directly pass mv_xor_chan pointers to the self-test functions included
in the driver. These functions were anyway selecting the first (and
only channel) available in each DMA device, so the behaviour is
unchanged.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: in mv_xor_device, rename 'common' to 'dmadev'
Thomas Petazzoni [Thu, 15 Nov 2012 14:00:25 +0000 (15:00 +0100)]
dma: mv_xor: in mv_xor_device, rename 'common' to 'dmadev'

The mv_xor_device structure embeds a 'struct dma_device', which is
named 'common', a not very meaningful name. Rename it to 'dmadev',
which will help avoid confusions later as we merge the mv_xor_device
and mv_xor_chan structures together.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: in mv_xor_chan, rename 'common' to 'dmachan'
Thomas Petazzoni [Thu, 15 Nov 2012 13:57:44 +0000 (14:57 +0100)]
dma: mv_xor: in mv_xor_chan, rename 'common' to 'dmachan'

The mv_xor_chan structure embeds a 'struct dma_chan', which is named
'common', a not very meaningful name. Rename it to 'dmachan', which
will help avoid confusions later as we merge the mv_xor_device and
mv_xor_chan structures together.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: get rid of the pdev pointer in mv_xor_device
Thomas Petazzoni [Thu, 15 Nov 2012 13:37:36 +0000 (14:37 +0100)]
dma: mv_xor: get rid of the pdev pointer in mv_xor_device

It was only used in places where we could get the 'struct device *'
pointer through a different way.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: introduce a mv_chan_to_devp() helper
Thomas Petazzoni [Thu, 15 Nov 2012 13:17:18 +0000 (14:17 +0100)]
dma: mv_xor: introduce a mv_chan_to_devp() helper

In many place, we need to get the 'struct device *' pointer from a
'struct mv_chan *', so we add a helper that makes this a bit
easier. It will also help reducing the change noise in further
patches.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: simplify dma_sync_single_for_cpu() calls
Thomas Petazzoni [Thu, 15 Nov 2012 12:01:59 +0000 (13:01 +0100)]
dma: mv_xor: simplify dma_sync_single_for_cpu() calls

In mv_xor_memcpy_self_test() and mv_xor_xor_self_test(), all DMA
functions are called by passing dma_chan->device->dev as the 'device
*', except the calls to dma_sync_single_for_cpu() which uselessly goes
through mv_chan->device->pdev->dev.

Simplify this by using dma_chan->device->dev direclty in
dma_sync_single_for_cpu() calls.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove unused to_mv_xor_device() macro
Thomas Petazzoni [Thu, 15 Nov 2012 12:01:34 +0000 (13:01 +0100)]
dma: mv_xor: remove unused to_mv_xor_device() macro

The to_mv_xor_device() macro is not being used by the driver, so we
can get rid of it.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove unused id field in mv_xor_device structure
Thomas Petazzoni [Tue, 30 Oct 2012 12:19:08 +0000 (13:19 +0100)]
dma: mv_xor: remove unused id field in mv_xor_device structure

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: rename many symbols to remove the 'shared' word
Thomas Petazzoni [Tue, 30 Oct 2012 11:05:40 +0000 (12:05 +0100)]
dma: mv_xor: rename many symbols to remove the 'shared' word

The 'shared' word no longer makes sense in a number of places as we
renamed the 'mv_xor_shared' driver to 'mv_xor'.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: change the driver name to 'mv_xor'
Thomas Petazzoni [Tue, 30 Oct 2012 10:59:42 +0000 (11:59 +0100)]
dma: mv_xor: change the driver name to 'mv_xor'

Since we got rid of the per-XOR channel 'mv_xor' driver, now the
per-XOR engine driver that used to be called 'mv_xor_shared' can
simply be named 'mv_xor'.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: rename mv_xor_shared_platform_data to mv_xor_platform_data
Thomas Petazzoni [Tue, 30 Oct 2012 10:58:14 +0000 (11:58 +0100)]
dma: mv_xor: rename mv_xor_shared_platform_data to mv_xor_platform_data

'struct mv_xor_shared_platform_data' used to be the platform_data
structure for the 'mv_xor_shared', but this driver is going to be
renamed simply 'mv_xor', so also rename its platform_data structure
accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: rename mv_xor_platform_data to mv_xor_channel_data
Thomas Petazzoni [Tue, 30 Oct 2012 10:56:26 +0000 (11:56 +0100)]
dma: mv_xor: rename mv_xor_platform_data to mv_xor_channel_data

mv_xor_platform_data used to be the platform_data structure associated
to the 'mv_xor' driver. This driver no longer exists, and this data
structure really contains the properties of each XOR channel part of a
given XOR engine. Therefore 'struct mv_xor_channel_data' is a more
appropriate name.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove 'shared' from mv_xor_platform_data
Thomas Petazzoni [Wed, 31 Oct 2012 12:24:41 +0000 (13:24 +0100)]
dma: mv_xor: remove 'shared' from mv_xor_platform_data

This member of the platform_data structure is no longer used, so get
rid of it.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: remove sub-driver 'mv_xor'
Thomas Petazzoni [Tue, 30 Oct 2012 10:54:34 +0000 (11:54 +0100)]
dma: mv_xor: remove sub-driver 'mv_xor'

Now that XOR channels are directly registered by the main
'mv_xor_shared' device ->probe() function and all users of the
'mv_xor' device have been removed, we can get rid of the latter.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: plat-orion: remove unused orion_xor_init_channels()
Thomas Petazzoni [Tue, 30 Oct 2012 10:12:46 +0000 (11:12 +0100)]
arm: plat-orion: remove unused orion_xor_init_channels()

Now that xor0 and xor1 are registered in a single driver manner, the
orion_xor_init_channels() function has become useless.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: plat-orion: convert the registration of the xor1 engine to the single driver
Thomas Petazzoni [Tue, 30 Oct 2012 10:11:36 +0000 (11:11 +0100)]
arm: plat-orion: convert the registration of the xor1 engine to the single driver

Instead of registering one 'mv_xor_shared' device for the XOR engine,
and then two 'mv_xor' devices for the XOR channels, pass the channels
properties as platform_data for the main 'mv_xor_shared' device.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: plat-orion: convert the registration of the xor0 engine to the single driver
Thomas Petazzoni [Mon, 29 Oct 2012 16:45:21 +0000 (17:45 +0100)]
arm: plat-orion: convert the registration of the xor0 engine to the single driver

Instead of registering one 'mv_xor_shared' device for the XOR engine,
and then two 'mv_xor' devices for the XOR channels, pass the channels
properties as platform_data for the main 'mv_xor_shared' device.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: allow channels to be registered directly from the main device
Thomas Petazzoni [Mon, 29 Oct 2012 15:54:49 +0000 (16:54 +0100)]
dma: mv_xor: allow channels to be registered directly from the main device

Extend the XOR engine driver (currently called "mv_xor_shared") so
that XOR channels can be passed in the platform_data structure, and be
registered from there.

This will allow the users of the driver to be converted to the single
platform_driver variant of the mv_xor driver.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: split initialization/cleanup of XOR channels
Thomas Petazzoni [Mon, 29 Oct 2012 15:45:46 +0000 (16:45 +0100)]
dma: mv_xor: split initialization/cleanup of XOR channels

Instead of doing the initialization/cleanup of the XOR channels
directly in the ->probe() and ->remove() hooks, we create separate
utility functions mv_xor_channel_add() and mv_xor_channel_remove().

This will allow to easily introduce in a future patch a different way
of registering XOR channels: instead of having one platform_device per
channel, we'll trigger the registration of all XOR channels of a given
XOR engine directly from the XOR engine ->probe() function.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: do not use pool_size from platform_data within the driver
Thomas Petazzoni [Mon, 29 Oct 2012 15:27:34 +0000 (16:27 +0100)]
dma: mv_xor: do not use pool_size from platform_data within the driver

The driver currently pokes into the platform_data structure during its
normal operation to get the pool_size value. Poking into the
platform_data structure is not nice when moving to the Device Tree, so
this commit adds a new pool_size field in the mv_xor_device structure,
which gets initialized at ->probe() time. The driver then uses this
field instead of the platform_data.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: use dev_(err|info|notice) instead of dev_printk
Thomas Petazzoni [Thu, 15 Nov 2012 11:50:27 +0000 (12:50 +0100)]
dma: mv_xor: use dev_(err|info|notice) instead of dev_printk

The usage of dev_printk() is deprecated, and the dev_err(), dev_info()
and dev_notice() functions should be used instead.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: SATA support: board-level DT data for Armada 370/XP boards
Gregory CLEMENT [Fri, 26 Oct 2012 12:30:49 +0000 (14:30 +0200)]
arm: mvebu: SATA support: board-level DT data for Armada 370/XP boards

Add the SATA device tree bindings for
- Armada XP evaluation board (DB-78460-BP)
- Armada 370 evaluation board (DB-88F6710-BP-DDR3)

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: SATA support: mvebu_defconfig update
Gregory CLEMENT [Fri, 26 Oct 2012 12:30:48 +0000 (14:30 +0200)]
arm: mvebu: SATA support: mvebu_defconfig update

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: SATA support: SoC-level DT data for Armada 370/XP
Gregory CLEMENT [Fri, 26 Oct 2012 12:30:47 +0000 (14:30 +0200)]
arm: mvebu: SATA support: SoC-level DT data for Armada 370/XP

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: increase atomic coherent pool size for armada 370/XP
Gregory CLEMENT [Fri, 26 Oct 2012 12:30:46 +0000 (14:30 +0200)]
arm: mvebu: increase atomic coherent pool size for armada 370/XP

For Armada 370/XP we have the same problem that for the commit
cb01b63, so we applied the same solution: "The default 256 KiB
coherent pool may be too small for some of the Kirkwood devices, so
increase it to make sure that devices will be able to allocate their
buffers with GFP_ATOMIC flag"

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
11 years agoARM: Kirkwood: switch to DT clock providers
Andrew Lunn [Sat, 17 Nov 2012 14:22:28 +0000 (15:22 +0100)]
ARM: Kirkwood: switch to DT clock providers

With true DT clock providers available switch Kirkwood clock setup in
DT- enabled boards. While AUXDATA can be removed completely from bus
probing, some devices still don't know about DT. Therefore, some clkdev
aliases are created until these devices also move to DT.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
11 years agoARM: dove: switch to DT clock providers
Sebastian Hesselbarth [Sat, 17 Nov 2012 14:22:27 +0000 (15:22 +0100)]
ARM: dove: switch to DT clock providers

With true DT clock providers available switch Dove clock setup in DT-
enabled boards. While AUXDATA can be removed completely from bus probing,
some devices still don't know about DT at all. Therefore, some clock
aliases are created until the devices also move to DT.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
11 years agoclocksource: convert time-armada-370-xp to clk framework
Gregory CLEMENT [Sat, 17 Nov 2012 14:22:25 +0000 (15:22 +0100)]
clocksource: convert time-armada-370-xp to clk framework

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by Gregory CLEMENT <gregory.clement@free-electrons.com>

11 years agoclk: armada-370-xp: add support for clock framework
Gregory CLEMENT [Sat, 17 Nov 2012 14:22:24 +0000 (15:22 +0100)]
clk: armada-370-xp: add support for clock framework

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by Gregory CLEMENT <gregory.clement@free-electrons.com>

11 years agoclk: mvebu: armada 370/XP add clock gating control provider for DT
Gregory CLEMENT [Sat, 17 Nov 2012 14:22:29 +0000 (15:22 +0100)]
clk: mvebu: armada 370/XP add clock gating control provider for DT

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoclk: mvebu: add clock gating control provider for DT
Sebastian Hesselbarth [Sat, 17 Nov 2012 14:22:26 +0000 (15:22 +0100)]
clk: mvebu: add clock gating control provider for DT

This driver allows to provide DT clocks for clock gates found on
Marvell Dove and Kirkwood SoCs. The clock gates are referenced by
the phandle index of the corresponding bit in the clock gating control
register to ease lookup in the datasheet.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
11 years agoclk: mvebu: add armada-370-xp CPU specific clocks
Gregory CLEMENT [Sat, 17 Nov 2012 14:22:23 +0000 (15:22 +0100)]
clk: mvebu: add armada-370-xp CPU specific clocks

Add Armada 370/XP specific CPU clocks

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
11 years agoclk: mvebu: add mvebu core clocks.
Sebastian Hesselbarth [Sat, 17 Nov 2012 14:22:22 +0000 (15:22 +0100)]
clk: mvebu: add mvebu core clocks.

This driver allows to provide DT clocks for core clocks found on
Marvell Kirkwood, Dove & 370/XP SoCs. The core clock frequencies and
ratios are determined by decoding the Sample-At-Reset registers.

Although technically correct, using a divider of 0 will lead to
div_by_zero panic. Let's use a ratio of 0/1 instead to fail later
with a zero clock.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by Gregory CLEMENT <gregory.clement@free-electrons.com>

11 years agoLinux 3.7-rc6 v3.7-rc6
Linus Torvalds [Sat, 17 Nov 2012 01:42:40 +0000 (17:42 -0800)]
Linux 3.7-rc6

11 years agoMerge git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sat, 17 Nov 2012 00:49:10 +0000 (16:49 -0800)]
Merge git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fix from Marcelo Tosatti:
 "A correction for oops on module init with older Intel hosts."

* git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: x86: Fix invalid secondary exec controls in vmx_cpuid_update()

11 years agoMerge branch 'akpm' (Fixes from Andrew)
Linus Torvalds [Fri, 16 Nov 2012 23:26:38 +0000 (15:26 -0800)]
Merge branch 'akpm' (Fixes from Andrew)

Merge misc fixes from Andrew Morton.

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (12 patches)
  revert "mm: fix-up zone present pages"
  tmpfs: change final i_blocks BUG to WARNING
  tmpfs: fix shmem_getpage_gfp() VM_BUG_ON
  mm: highmem: don't treat PKMAP_ADDR(LAST_PKMAP) as a highmem address
  mm: revert "mm: vmscan: scale number of pages reclaimed by reclaim/compaction based on failures"
  rapidio: fix kernel-doc warnings
  swapfile: fix name leak in swapoff
  memcg: fix hotplugged memory zone oops
  mips, arc: fix build failure
  memcg: oom: fix totalpages calculation for memory.swappiness==0
  mm: fix build warning for uninitialized value
  mm: add anon_vma_lock to validate_mm()

11 years agorevert "mm: fix-up zone present pages"
Andrew Morton [Fri, 16 Nov 2012 22:15:06 +0000 (14:15 -0800)]
revert "mm: fix-up zone present pages"

Revert commit 7f1290f2f2a4 ("mm: fix-up zone present pages")

That patch tried to fix a issue when calculating zone->present_pages,
but it caused a regression on 32bit systems with HIGHMEM.  With that
change, reset_zone_present_pages() resets all zone->present_pages to
zero, and fixup_zone_present_pages() is called to recalculate
zone->present_pages when the boot allocator frees core memory pages into
buddy allocator.  Because highmem pages are not freed by bootmem
allocator, all highmem zones' present_pages becomes zero.

Various options for improving the situation are being discussed but for
now, let's return to the 3.6 code.

Cc: Jianguo Wu <wujianguo@huawei.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Petr Tesarik <ptesarik@suse.cz>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: David Rientjes <rientjes@google.com>
Tested-by: Chris Clayton <chris2553@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agotmpfs: change final i_blocks BUG to WARNING
Hugh Dickins [Fri, 16 Nov 2012 22:15:04 +0000 (14:15 -0800)]
tmpfs: change final i_blocks BUG to WARNING

Under a particular load on one machine, I have hit shmem_evict_inode()'s
BUG_ON(inode->i_blocks), enough times to narrow it down to a particular
race between swapout and eviction.

It comes from the "if (freed > 0)" asymmetry in shmem_recalc_inode(),
and the lack of coherent locking between mapping's nrpages and shmem's
swapped count.  There's a window in shmem_writepage(), between lowering
nrpages in shmem_delete_from_page_cache() and then raising swapped
count, when the freed count appears to be +1 when it should be 0, and
then the asymmetry stops it from being corrected with -1 before hitting
the BUG.

One answer is coherent locking: using tree_lock throughout, without
info->lock; reasonable, but the raw_spin_lock in percpu_counter_add() on
used_blocks makes that messier than expected.  Another answer may be a
further effort to eliminate the weird shmem_recalc_inode() altogether,
but previous attempts at that failed.

So far undecided, but for now change the BUG_ON to WARN_ON: in usual
circumstances it remains a useful consistency check.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agotmpfs: fix shmem_getpage_gfp() VM_BUG_ON
Hugh Dickins [Fri, 16 Nov 2012 22:15:03 +0000 (14:15 -0800)]
tmpfs: fix shmem_getpage_gfp() VM_BUG_ON

Fuzzing with trinity hit the "impossible" VM_BUG_ON(error) (which Fedora
has converted to WARNING) in shmem_getpage_gfp():

  WARNING: at mm/shmem.c:1151 shmem_getpage_gfp+0xa5c/0xa70()
  Pid: 29795, comm: trinity-child4 Not tainted 3.7.0-rc2+ #49
  Call Trace:
    warn_slowpath_common+0x7f/0xc0
    warn_slowpath_null+0x1a/0x20
    shmem_getpage_gfp+0xa5c/0xa70
    shmem_fault+0x4f/0xa0
    __do_fault+0x71/0x5c0
    handle_pte_fault+0x97/0xae0
    handle_mm_fault+0x289/0x350
    __do_page_fault+0x18e/0x530
    do_page_fault+0x2b/0x50
    page_fault+0x28/0x30
    tracesys+0xe1/0xe6

Thanks to Johannes for pointing to truncation: free_swap_and_cache()
only does a trylock on the page, so the page lock we've held since
before confirming swap is not enough to protect against truncation.

What cleanup is needed in this case? Just delete_from_swap_cache(),
which takes care of the memcg uncharge.

Signed-off-by: Hugh Dickins <hughd@google.com>
Reported-by: Dave Jones <davej@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomm: highmem: don't treat PKMAP_ADDR(LAST_PKMAP) as a highmem address
Will Deacon [Fri, 16 Nov 2012 22:15:00 +0000 (14:15 -0800)]
mm: highmem: don't treat PKMAP_ADDR(LAST_PKMAP) as a highmem address

kmap_to_page returns the corresponding struct page for a virtual address
of an arbitrary mapping.  This works by checking whether the address
falls in the pkmap region and using the pkmap page tables instead of the
linear mapping if appropriate.

Unfortunately, the bounds checking means that PKMAP_ADDR(LAST_PKMAP) is
incorrectly treated as a highmem address and we can end up walking off
the end of pkmap_page_table and subsequently passing junk to pte_page.

This patch fixes the bound check to stay within the pkmap tables.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomm: revert "mm: vmscan: scale number of pages reclaimed by reclaim/compaction based...
Mel Gorman [Fri, 16 Nov 2012 22:14:59 +0000 (14:14 -0800)]
mm: revert "mm: vmscan: scale number of pages reclaimed by reclaim/compaction based on failures"

Jiri Slaby reported the following:

(It's an effective revert of "mm: vmscan: scale number of pages
reclaimed by reclaim/compaction based on failures".) Given kswapd
had hours of runtime in ps/top output yesterday in the morning
and after the revert it's now 2 minutes in sum for the last 24h,
I would say, it's gone.

The intention of the patch in question was to compensate for the loss of
lumpy reclaim.  Part of the reason lumpy reclaim worked is because it
aggressively reclaimed pages and this patch was meant to be a sane
compromise.

When compaction fails, it gets deferred and both compaction and
reclaim/compaction is deferred avoid excessive reclaim.  However, since
commit c654345924f7 ("mm: remove __GFP_NO_KSWAPD"), kswapd is woken up
each time and continues reclaiming which was not taken into account when
the patch was developed.

Attempts to address the problem ended up just changing the shape of the
problem instead of fixing it.  The release window gets closer and while
a THP allocation failing is not a major problem, kswapd chewing up a lot
of CPU is.

This patch reverts commit 83fde0f22872 ("mm: vmscan: scale number of
pages reclaimed by reclaim/compaction based on failures") and will be
revisited in the future.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Cc: Zdenek Kabelac <zkabelac@redhat.com>
Tested-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Johannes Hirte <johannes.hirte@fem.tu-ilmenau.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agorapidio: fix kernel-doc warnings
Randy Dunlap [Fri, 16 Nov 2012 22:14:56 +0000 (14:14 -0800)]
rapidio: fix kernel-doc warnings

Fix rapidio kernel-doc warnings:

  Warning(drivers/rapidio/rio.c:415): No description found for parameter 'local'
  Warning(drivers/rapidio/rio.c:415): Excess function parameter 'lstart' description in 'rio_map_inb_region'
  Warning(include/linux/rio.h:290): No description found for parameter 'switches'
  Warning(include/linux/rio.h:290): No description found for parameter 'destid_table'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoswapfile: fix name leak in swapoff
Xiaotian Feng [Fri, 16 Nov 2012 22:14:55 +0000 (14:14 -0800)]
swapfile: fix name leak in swapoff

There's a name leak introduced by commit 91a27b2a7567 ("vfs: define
struct filename and have getname() return it").  Add the missing
putname.

[akpm@linux-foundation.org: cleanup]
Signed-off-by: Xiaotian Feng <dannyfeng@tencent.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomemcg: fix hotplugged memory zone oops
Hugh Dickins [Fri, 16 Nov 2012 22:14:54 +0000 (14:14 -0800)]
memcg: fix hotplugged memory zone oops

When MEMCG is configured on (even when it's disabled by boot option),
when adding or removing a page to/from its lru list, the zone pointer
used for stats updates is nowadays taken from the struct lruvec.  (On
many configurations, calculating zone from page is slower.)

But we have no code to update all the lruvecs (per zone, per memcg) when
a memory node is hotadded.  Here's an extract from the oops which
results when running numactl to bind a program to a newly onlined node:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000f60
  IP:  __mod_zone_page_state+0x9/0x60
  Pid: 1219, comm: numactl Not tainted 3.6.0-rc5+ #180 Bochs Bochs
  Process numactl (pid: 1219, threadinfo ffff880039abc000, task ffff8800383c4ce0)
  Call Trace:
    __pagevec_lru_add_fn+0xdf/0x140
    pagevec_lru_move_fn+0xb1/0x100
    __pagevec_lru_add+0x1c/0x30
    lru_add_drain_cpu+0xa3/0x130
    lru_add_drain+0x2f/0x40
   ...

The natural solution might be to use a memcg callback whenever memory is
hotadded; but that solution has not been scoped out, and it happens that
we do have an easy location at which to update lruvec->zone.  The lruvec
pointer is discovered either by mem_cgroup_zone_lruvec() or by
mem_cgroup_page_lruvec(), and both of those do know the right zone.

So check and set lruvec->zone in those; and remove the inadequate
attempt to set lruvec->zone from lruvec_init(), which is called before
NODE_DATA(node) has been allocated in such cases.

Ah, there was one exceptionr.  For no particularly good reason,
mem_cgroup_force_empty_list() has its own code for deciding lruvec.
Change it to use the standard mem_cgroup_zone_lruvec() and
mem_cgroup_get_lru_size() too.  In fact it was already safe against such
an oops (the lru lists in danger could only be empty), but we're better
proofed against future changes this way.

I've marked this for stable (3.6) since we introduced the problem in 3.5
(now closed to stable); but I have no idea if this is the only fix
needed to get memory hotadd working with memcg in 3.6, and received no
answer when I enquired twice before.

Reported-by: Tang Chen <tangchen@cn.fujitsu.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomips, arc: fix build failure
David Rientjes [Fri, 16 Nov 2012 22:14:52 +0000 (14:14 -0800)]
mips, arc: fix build failure

Using a cross-compiler to fix another issue, the following build error
occurred for mips defconfig:

  arch/mips/fw/arc/misc.c: In function 'ArcHalt':
  arch/mips/fw/arc/misc.c:25:2: error: implicit declaration of function 'local_irq_disable'

Fix it up by including irqflags.h.

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomemcg: oom: fix totalpages calculation for memory.swappiness==0
Michal Hocko [Fri, 16 Nov 2012 22:14:49 +0000 (14:14 -0800)]
memcg: oom: fix totalpages calculation for memory.swappiness==0

oom_badness() takes a totalpages argument which says how many pages are
available and it uses it as a base for the score calculation.  The value
is calculated by mem_cgroup_get_limit which considers both limit and
total_swap_pages (resp.  memsw portion of it).

This is usually correct but since fe35004fbf9e ("mm: avoid swapping out
with swappiness==0") we do not swap when swappiness is 0 which means
that we cannot really use up all the totalpages pages.  This in turn
confuses oom score calculation if the memcg limit is much smaller than
the available swap because the used memory (capped by the limit) is
negligible comparing to totalpages so the resulting score is too small
if adj!=0 (typically task with CAP_SYS_ADMIN or non zero oom_score_adj).
A wrong process might be selected as result.

The problem can be worked around by checking mem_cgroup_swappiness==0
and not considering swap at all in such a case.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomm: fix build warning for uninitialized value
David Rientjes [Fri, 16 Nov 2012 22:14:48 +0000 (14:14 -0800)]
mm: fix build warning for uninitialized value

do_wp_page() sets mmun_called if mmun_start and mmun_end were
initialized and, if so, may call mmu_notifier_invalidate_range_end()
with these values.  This doesn't prevent gcc from emitting a build
warning though:

  mm/memory.c: In function `do_wp_page':
  mm/memory.c:2530: warning: `mmun_start' may be used uninitialized in this function
  mm/memory.c:2531: warning: `mmun_end' may be used uninitialized in this function

It's much easier to initialize the variables to impossible values and do
a simple comparison to determine if they were initialized to remove the
bool entirely.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomm: add anon_vma_lock to validate_mm()
Michel Lespinasse [Fri, 16 Nov 2012 22:14:47 +0000 (14:14 -0800)]
mm: add anon_vma_lock to validate_mm()

Iterating over the vma->anon_vma_chain without anon_vma_lock may cause
NULL ptr deref in anon_vma_interval_tree_verify(), because the node in the
chain might have been removed.

  BUG: unable to handle kernel paging request at fffffffffffffff0
  IP: [<ffffffff8122c29c>] anon_vma_interval_tree_verify+0xc/0xa0
  PGD 4e28067 PUD 4e29067 PMD 0
  Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
  CPU 0
  Pid: 9050, comm: trinity-child64 Tainted: G        W    3.7.0-rc2-next-20121025-sasha-00001-g673f98e-dirty #77
  RIP: 0010: anon_vma_interval_tree_verify+0xc/0xa0
  Process trinity-child64 (pid: 9050, threadinfo ffff880045f80000, task ffff880048eb0000)
  Call Trace:
    validate_mm+0x58/0x1e0
    vma_adjust+0x635/0x6b0
    __split_vma.isra.22+0x161/0x220
    split_vma+0x24/0x30
    sys_madvise+0x5da/0x7b0
    tracesys+0xe1/0xe6
  RIP  anon_vma_interval_tree_verify+0xc/0xa0
  CR2: fffffffffffffff0

Figured out by Bob Liu.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Michel Lespinasse <walken@google.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoKVM: x86: Fix invalid secondary exec controls in vmx_cpuid_update()
Takashi Iwai [Fri, 9 Nov 2012 14:20:17 +0000 (15:20 +0100)]
KVM: x86: Fix invalid secondary exec controls in vmx_cpuid_update()

The commit [ad756a16: KVM: VMX: Implement PCID/INVPCID for guests with
EPT] introduced the unconditional access to SECONDARY_VM_EXEC_CONTROL,
and this triggers kernel warnings like below on old CPUs:

    vmwrite error: reg 401e value a0568000 (err 12)
    Pid: 13649, comm: qemu-kvm Not tainted 3.7.0-rc4-test2+ #154
    Call Trace:
     [<ffffffffa0558d86>] vmwrite_error+0x27/0x29 [kvm_intel]
     [<ffffffffa054e8cb>] vmcs_writel+0x1b/0x20 [kvm_intel]
     [<ffffffffa054f114>] vmx_cpuid_update+0x74/0x170 [kvm_intel]
     [<ffffffffa03629b6>] kvm_vcpu_ioctl_set_cpuid2+0x76/0x90 [kvm]
     [<ffffffffa0341c67>] kvm_arch_vcpu_ioctl+0xc37/0xed0 [kvm]
     [<ffffffff81143f7c>] ? __vunmap+0x9c/0x110
     [<ffffffffa0551489>] ? vmx_vcpu_load+0x39/0x1a0 [kvm_intel]
     [<ffffffffa0340ee2>] ? kvm_arch_vcpu_load+0x52/0x1a0 [kvm]
     [<ffffffffa032dcd4>] ? vcpu_load+0x74/0xd0 [kvm]
     [<ffffffffa032deb0>] kvm_vcpu_ioctl+0x110/0x5e0 [kvm]
     [<ffffffffa032e93d>] ? kvm_dev_ioctl+0x4d/0x4a0 [kvm]
     [<ffffffff8117dc6f>] do_vfs_ioctl+0x8f/0x530
     [<ffffffff81139d76>] ? remove_vma+0x56/0x60
     [<ffffffff8113b708>] ? do_munmap+0x328/0x400
     [<ffffffff81187c8c>] ? fget_light+0x4c/0x100
     [<ffffffff8117e1a1>] sys_ioctl+0x91/0xb0
     [<ffffffff815a942d>] system_call_fastpath+0x1a/0x1f

This patch adds a check for the availability of secondary exec
control to avoid these warnings.

Cc: <stable@vger.kernel.org> [v3.6+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Fri, 16 Nov 2012 22:10:15 +0000 (14:10 -0800)]
Merge git://git./linux/kernel/git/davem/net

Pull networking updates from David Miller:

 1) tx_filtered/ps_tx_buf queues need to be accessed with the SKB queue
    lock, from Arik Nemtsov.

 2) Don't call 802.11 driver's filter configure method until it's
    actually open, from Felix Fietkau.

 3) Use ieee80211_free_txskb otherwise we leak control information.
    From Johannes Berg.

 4) Fix memory leak in bluetooth UUID removal,f rom Johan Hedberg.

 5) The shift mask trick doesn't work properly when 'optname' is out of
    range in do_ip_setsockopt().  Use a straightforward switch statement
    instead, the compiler emits essentially the same code but without
    the missing range check.  From Xi Wang.

 6) Fix when we call tcp_replace_ts_recent() otherwise we can
    erroneously accept a too-high tsval.  From Eric Dumazet.

 7) VXLAN bug fixes, mostly to do with VLAN header length handling, from
    Alexander Duyck.

 8) Missing return value initialization for IPV6_MINHOPCOUNT socket
    option handling.  From Hannes Frederic.

 9) Fix regression in tasklet handling in jme/ksz884x/xilinx drivers,
    from Xiaotian Feng.

10) At smsc911x driver init time, we don't know if the chip is in word
    swap mode or not.  However we do need to wait for the control
    register's ready bit to be set before we program any other part of
    the chip.  Adjust the wait loop to account for this.  From Kamlakant
    Patel.

11) Revert erroneous MDIO bus unregister change to mdio-bitbang.c

12) Fix memory leak in /proc/net/sctp/, from Tommi Rantala.

13) tilegx driver registers IRQ with NULL name, oops, from Simon Marchi.

14) TCP metrics hash table kzalloc() based allocation can fail, back
    down to using vmalloc() if it does.  From Eric Dumazet.

15) Fix packet steering out-of-order delivery regression, from Tom
    Herbert.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (40 commits)
  net-rps: Fix brokeness causing OOO packets
  tcp: handle tcp_net_metrics_init() order-5 memory allocation failures
  batman-adv: process broadcast packets in BLA earlier
  batman-adv: don't add TEMP clients belonging to other backbone nodes
  batman-adv: correctly pass the client flag on tt_response
  batman-adv: fix tt_global_entries flags update
  tilegx: request_irq with a non-null device name
  net: correct check in dev_addr_del()
  tcp: fix retransmission in repair mode
  sctp: fix /proc/net/sctp/ memory leak
  Revert "drivers/net/phy/mdio-bitbang.c: Call mdiobus_unregister before mdiobus_free"
  net/smsc911x: Fix ready check in cases where WORD_SWAP is needed
  drivers/net: fix tasklet misuse issue
  ipv4/ip_vti.c: VTI fix post-decryption forwarding
  brcmfmac: fix typo in CONFIG_BRCMISCAN
  vxlan: Update hard_header_len based on lowerdev when instantiating VXLAN
  vxlan: fix a typo.
  ipv6: setsockopt(IPIPPROTO_IPV6, IPV6_MINHOPCOUNT) forgot to set return value
  doc/net: Fix typo in netdev-features.txt
  vxlan: Fix error that was resulting in VXLAN MTU size being 10 bytes too large
  ...

12 years agoMerge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
David S. Miller [Fri, 16 Nov 2012 19:37:18 +0000 (14:37 -0500)]
Merge branch 'for-davem' of git://git./linux/kernel/git/linville/wireless

John W. Linville says:

====================
This batch of fixes is intended for the 3.7 stream...

This includes a pull of the Bluetooth tree.  Gustavo says:

"A few important fixes to go into 3.7. There is a new hw support by Marcos
Chaparro. Johan added a memory leak fix and hci device index list fix.
Also Marcel fixed a race condition in the device set up that was prevent the
bt monitor to work properly. Last, Paulo Sérgio added a fix to the error
status when pairing for LE fails. This was prevent userspace to work to handle
the failure properly."

Regarding the mac80211 pull, Johannes says:

"I have a locking fix for some SKB queues, a variable initialization to
avoid crashes in a certain failure case, another free_txskb fix from
Felix and another fix from him to avoid calling a stopped driver, a fix
for a (very unlikely) memory leak and a fix to not send null data
packets when resuming while not associated."

Regarding the iwlwifi pull, Johannes says:

"Two more fixes for iwlwifi ... one to use ieee80211_free_txskb(), and
one to check DMA mapping errors, please pull."

On top of that, Johannes also included a wireless regulatory fix
to allow 40 MHz on channels 12 and 13 in world roaming mode.  Also,
Hauke Mehrtens fixes a #ifdef typo in brcmfmac.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agonet-rps: Fix brokeness causing OOO packets
Tom Herbert [Fri, 16 Nov 2012 09:04:15 +0000 (09:04 +0000)]
net-rps: Fix brokeness causing OOO packets

In commit c445477d74ab3779 which adds aRFS to the kernel, the CPU
selected for RFS is not set correctly when CPU is changing.
This is causing OOO packets and probably other issues.

Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>