deliverable/linux.git
11 years agodma: mv_xor: fix error handling path
Thomas Petazzoni [Thu, 22 Nov 2012 17:22:59 +0000 (18:22 +0100)] 
dma: mv_xor: fix error handling path

The ->probe() function of the mv_xor function contains in its error
handling code a loop to cleanup the XOR channels that had been
successfully initialized if some other XOR channel fails to be
initialized. It does that by traveling the list of XOR channels, and
cleanup those for which the pointer is not NULL.

However, since the mv_xor_channel_add() function return a PTR_ERR
style value, the pointer is not NULL on error. So, when handling the
error of a given channel initialization, we cleanup this channel
initialization and mark this channel entry as NULL in the array. This
allows the remaining of the cleanup (for other channels) to work
properly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: fix error checking of irq_of_parse_and_map()
Thomas Petazzoni [Thu, 22 Nov 2012 17:22:12 +0000 (18:22 +0100)] 
dma: mv_xor: fix error checking of irq_of_parse_and_map()

The irq_of_parse_and_map() function returns 0 on failure, and does not
return an error code, so we fix the calling site of
irq_of_parse_and_map() in the mv_xor driver.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: use request_irq() instead of devm_request_irq()
Thomas Petazzoni [Thu, 22 Nov 2012 17:19:09 +0000 (18:19 +0100)] 
dma: mv_xor: use request_irq() instead of devm_request_irq()

Even through the usage of devm_*() functions is generally recommended
over their classic variants, in the case of devm_request_irq()
combined with irq_of_parse_and_map(), it doesn't work nicely.

We have the following scenario:

 irq_of_parse_and_map(...)
 devm_request_irq(...)

For some reason, the driver initialization fails at a later
point. Since irq_of_parse_and_map() is no device-managed, we do a:

 irq_dispose_mapping(...)

Unfortunately, this doesn't work, because the free_irq() must be done
prior to calling irq_dispose_mapping(). But with the devm mechanism,
the automatic free_irq() would happen only after we get out of the
->probe() function.

So basically, we revert to using request_irq() with traditional error
handling, so that in case of error, free_irq() gets called before
irq_dispose_mapping().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agodma: mv_xor: clear the window override control registers
Thomas Petazzoni [Thu, 22 Nov 2012 17:16:37 +0000 (18:16 +0100)] 
dma: mv_xor: clear the window override control registers

The XOR channels on Marvell SoCs have a Window Override Control
register that allow to do some fancy things with addresses. Those
features are not used by the driver, but some U-Boot versions anyway
modify those registers.

For some reason, the U-Boot on OpenBlocks AX3-4 was setting an invalid
value in those registers when the addition 2 GB DRAM chip was plugged
into the board, causing the XOR driver to fail in using the XOR
engines.

By setting those registers to 0 during the driver initialization, we
ensure that the registers are configured according with the driver
operation model.

Thanks to Lior Amsalem <alior@marvell.com> for his help in debugging
this problem.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 years agoarm: mvebu: fix address decoding armada_cfg_base() function
Thomas Petazzoni [Thu, 22 Nov 2012 17:09:53 +0000 (18:09 +0100)] 
arm: mvebu: fix address decoding armada_cfg_base() function

The armada_cfg_base() function returns the base address of the
registers that allow to configure the decoding for a particular
address window. On Armada 370/XP, the lower windows have more
configuration registers (4 registers) than the higher windows (2
registers). This armada_cfg_base() takes this into account by doing a
different offset calculation depending on the window number, but this
offset calculation was wrong for the higher windows.

Even though we were not using high window numbers until now (only
window 0 is used to map the BootROM, needed for SMP), we use this
function at boot time to disable all windows to ensure that nothing
remains intialized from what the bootloader has done.

Unfortunately, the U-Boot on the OpenBlocks AX3-4 uses a window with a
high number (above 8) to remap the BootROM. And then when the kernel
boots, it remaps the BootROM in window 0. Normally, this is not a
problem, because all windows have previously been disabled. Except
that due to our wrong offset calculation, the windows with high
numbers were not properly disabled, leading to the BootROM being
mapped twice. The visible result of this bug was that the kernel was
unable to get the second CPU started on the OpenBlocks AX3-4
platform. With this fix, all windows are properly cleared at boot
time, the BootROM is remapped only once in window 0, and the second
CPU boots fine.

Thanks a lot to Lior Amsamlen <alior@marvell.com> for his help in
debugging this problem.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Strictly speaking, this bug was introduced in 3.7, but since the only
platforms supported in 3.7 were Armada 370 and Armada XP, and there
was anyway no SMP support at this time, it isn't really worth the
effort to push this patch in 3.7.

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
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>
This page took 0.051174 seconds and 5 git commands to generate.