Mike Rapoport [Wed, 2 Mar 2011 12:34:05 +0000 (14:34 +0200)]
ARM: tegra: add PCI Express power gating
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Colin Cross <ccross@android.com>
Mike Rapoport [Wed, 2 Mar 2011 12:34:04 +0000 (14:34 +0200)]
ARM: tegra: PCIE minor code refactoring
Move tegra_pcie_power_off before tegra_pcie_power_on for clean addition
of PCIE power gating
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Wed, 23 Feb 2011 21:49:30 +0000 (14:49 -0700)]
ARM: Tegra: DMA: Fail safe if initialization fails
tegra_dma_init currently simply bails out early if any initialization fails.
This skips various data-structure initialization. In turn, this means that
tegra_dma_allocate_channel can still hand out channels. In this case, when
tegra_dma_free_channel is called, which calls tegra_dma_cancel, the walking
on ch->list will OOPS since the list's next/prev pointers may still be
NULL.
To solve this, add an explicit "initialized" flag, only set this once _init
has fully completed successfully, and have _allocate_channel refuse to hand
out channels if this is not set.
While at it, simplify _init:
* Remove redundant memsets
* Use bitmap_fill to mark all channels as in-use up-front, and remove
some now-redundant bitmap initialization loops.
* Only mark a channel as free once all channel-related initialization has
completed.
Finally, the successful exit path from _init always has ret==0, so just
hard-code that return. The error path still returns ret.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Wed, 23 Feb 2011 18:58:50 +0000 (11:58 -0700)]
ARM: Tegra: Rename clk_dev1/2 to cdev1/2
The ASoC machine driver was written assuming my previous patch to add
complete support for these clocks, which named them cdev1/2. Rename
the clocks to match that, to avoid churn in the ASoC driver.
This rename also makes the clocks more consistent with other Tegra
clocks irrespective of any of that.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Wed, 23 Feb 2011 18:58:49 +0000 (11:58 -0700)]
ARM: Tegra: Rename I2S clocks to match driver name
The driver is tegra-i2s not just i2s. Rename the clocks to match, so that
clk_get_sys can look up by driver name.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Wed, 23 Feb 2011 17:41:29 +0000 (10:41 -0700)]
ARM: Tegra: Make tegra_dma_init a postcore_initcall
The following commit makes the Tegra APB DMA engine fail to initialize
correctly:
0cf6230af909a86f81907455eca2a5c9b8f68fe6
ARM: tegra: Move tegra_common_init to tegra_init_early
The reason is that tegra_init_early_ calls tegra_dma_init which calls
request_threaded_irq, which fails since the IRQ hasn't yet been marked
valid; that only happens in tegra_init_irq, which gets called after
tegra_init_early.
This used to work OK, since tegra_init_early was tegra_common_init, which
got called after tegra_init_irq, basically from the beginning of
tegra_harmony_init.
Solve this by converting tegra_dma_init to a postcore_initcall. This makes
it execute late enough that IRQs are marked valid, and avoids having to
add it back to every machine's init function.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 23 Feb 2011 21:58:00 +0000 (13:58 -0800)]
Merge branch 'boards-for-next' of git://git./linux/kernel/git/olof/tegra-2.6 into for-next
Olof Johansson [Sun, 20 Feb 2011 01:25:32 +0000 (17:25 -0800)]
ARM: tegra: add seaboard, wario and kaen boards
This adds board support for the Seaboard eval platform and some of the
derivatives that are very similar. Since they only differ in some very
minor ways, most of the code is shared.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Colin Cross <ccross@android.com>
Olof Johansson [Mon, 21 Feb 2011 00:20:26 +0000 (16:20 -0800)]
ARM: tegra: harmony: fix pinmux for MMC slot
Turns out MMC2 (the bayonet 4-lane port) wasn't enabled in the
original pinmux. Fix that.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Colin Cross <ccross@android.com>
Olof Johansson [Sun, 20 Feb 2011 00:39:37 +0000 (16:39 -0800)]
ARM: tegra: harmony: register sdhci devices
Add the 3 sdhci devices that are available on Harmony as
platform devices. Two go to slots (one 4-lane, one 8-lane),
and one goes to onboard wifi.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Colin Cross <ccross@android.com>
Olof Johansson [Sun, 20 Feb 2011 05:01:46 +0000 (21:01 -0800)]
ARM: tegra: remove stale nvidia atag handler
Remove dead atag handling code for nvidia-specific tags.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Colin Cross <ccross@android.com>
Olof Johansson [Sun, 20 Feb 2011 00:26:18 +0000 (16:26 -0800)]
ARM: tegra: common device resources
Add a common location to register resources for used on-chip devices
that are commonly configured on boards. Devices will be added to this file
as more drivers are added that can make use of them.
This is based on work contributed by several people, most of it from
Colin Cross and Erik Gilling.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Colin Cross <ccross@android.com>
Olof Johansson [Tue, 22 Feb 2011 19:29:23 +0000 (11:29 -0800)]
ARM: tegra: harmony: move over to tegra_gpio_config
Move harmony over to use the new gpio config table instead of having
separate settings in various parts of the code.
(The tegra sdhci driver should have the tegra_gpio_* ops removed, but
that will be done separately from this change.)
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Erik Gilling <konkers@android.com>
Olof Johansson [Mon, 14 Feb 2011 03:12:27 +0000 (19:12 -0800)]
ARM: tegra: add tegra_gpio_table and tegra_gpio_config
To give one place to setup the pins that are used as GPIOs instead
of as their pinmuxed functions. Specifying enabled as false explicitly
disables the gpio mode of that pin (if left on by firmware).
This should remove the need for calling these from specific drivers and
thus reduce tegra-specific code from them.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Erik Gilling <konkers@android.com>
Mark Brown [Tue, 22 Feb 2011 20:35:24 +0000 (20:35 +0000)]
ARM: tegra: Hide EMC scaling config behind ARCH_TEGRA
The option isn't terribly useful on other ARM platforms.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Sun, 20 Feb 2011 03:38:54 +0000 (20:38 -0700)]
ARM: tegra: Fix typo in TEGRA_IRQ_TO_GPIO
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 22 Feb 2011 01:05:36 +0000 (17:05 -0800)]
ARM: tegra: common: Enable core clocks
Enable the cpu, emc (memory controller) and csite (debug and
trace controller) clocks during init to prevent them from
being disabled by the bootloader clock disabling code.
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Colin Cross [Tue, 22 Feb 2011 01:04:37 +0000 (17:04 -0800)]
ARM: tegra: timer: Enable timer and rtc clocks
Enable the timer and rtc clocks to prevent them being
turned off by the bootloader clock disabling code.
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Colin Cross [Tue, 22 Feb 2011 01:10:14 +0000 (17:10 -0800)]
ARM: tegra: Move tegra_common_init to tegra_init_early
Move tegra_common_init to tegra_init_early, and set it
as the init_early entry in the machine struct.
Initializes the clocks earlier so that timers can enable
their clocks.
Also reorders the members in the Harmony and Trimslice
boards' machine structs to match the order they are
called in.
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Colin Cross [Tue, 22 Feb 2011 00:44:07 +0000 (16:44 -0800)]
ARM: tegra: clock: prevent accidental disables of cpu clock
Peripheral clocks that have no clock enable bit in the
enable registers have their clk_num set to 0. Bit 0
in the clock enable registers is the CPU clock.
Prevent disables on these peripheral clocks from
accidentally disabling the CPU clock.
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Colin Cross [Sun, 13 Feb 2011 02:21:47 +0000 (18:21 -0800)]
ARM: tegra: clock: Round rate before setting rate
Call the clock's round_rate op, if it exists, before calling
the set_rate op. This will help later when dvfs is added,
dvfs needs to know what the final rate will be before the
frequency changes.
Also requires fixes to the round rate functions to ensure
calling round rate and then set rate will not cause the
frequency to be rounded down twice. When picking clock
divider values, the clock framework picks the closest
frequency that is lower than the requested frequency. If
the new frequency calculated from the divider value is
rounded down, and then passed to set_rate, it will get
rounded down again, possibly resulting in a frequency two
steps lower than the original requested frequency.
Fix the problem by rounding up when calculating the frequency
coming out of a clock divider, so if that frequency is
requested again, the same divider value will be picked.
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Colin Cross [Thu, 21 Oct 2010 02:19:58 +0000 (19:19 -0700)]
ARM: tegra: clock: Refcount periph clock enables
Some peripheral clocks share enable bits. Refcount the enables so
that calling clk_disable on one clock will not turn off another
clock.
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Colin Cross [Sun, 13 Feb 2011 05:25:23 +0000 (21:25 -0800)]
ARM: tegra: clock: Miscellaneous clock updates
Correct max rates for pclk and sclk (Originally fixed by
Dima Zavin <dima@android.com>)
Correct max rate for plla (Originally fixed by
Stephen Warren <swarren@nvidia.com>)
Remove unnecessary no-op set_rate on audio clocks
Add clock lookup entries for grhost, bsea, and vde clocks
Update clock clookup entries for vcp, bsea, and vde clocks
Add shared clock entries for sclk and emc
Add a virtual cop clock to provide a reset op (Originally fixed by
Dima Zavin <dima@android.com>)
Pass set_rate on super clocks through to parent
Fix pllx frequency table entry for 608 MHz
Remove incorrect plla frequency table entries
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 27 Oct 2010 00:33:31 +0000 (17:33 -0700)]
ARM: tegra: clock: Fix clock issues in suspend
The PLLP registers are now being restored by the low-level resume code,
and the CPU may be running off PLLP, so don't touch them during clock
resume.
Save plld, plls, pllu, and audio clock during suspend (originally
fixed by Mayuresh Kulkarni <mkulkarni@nvidia.com>)
The lock time for plld is 1000 us, so increase the delay after
setting the PLLs.
Add a BUG_ON to ensure the size of the suspend context area is
correct.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sun, 13 Feb 2011 02:24:32 +0000 (18:24 -0800)]
ARM: tegra: clock: Add function to set SDMMC tap delay
The SDMMC controllers have extra bits in the clock source
register that adjust the delay between the clock and data
to compenstate for delays on the PCB. The values need to
be set from the clock code so the clock can be locked
during the read-modify-write on the clock source register.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 23 Nov 2010 02:54:36 +0000 (18:54 -0800)]
ARM: tegra: cpufreq: Adjust memory frequency with cpu frequency
Adjusts the minimum memory frequency when the cpu frequency
changes. The values are currently hardcoded to a reasonable
default. If memory frequency scaling is not enabled this
patch will have no effect.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 23 Nov 2010 02:37:54 +0000 (18:37 -0800)]
ARM: tegra: clocks: Add emc scaling
Add clock ops on the emc peripheral clock that call into the
emc driver to update the memory controller registers for the
new frequency. Tegra has an interlock between the clock
controller and the memory controller that prevents the new
register values from taking effect until the clock frequency
update occurs.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sun, 13 Feb 2011 02:22:49 +0000 (18:22 -0800)]
ARM: tegra: Add external memory controller driver
The frequency memory bus on Tegra can be adjusted without
disabling accesses to memory by updating the memory
configuration registers from a per-board table, and then
changing the clock frequency. The clock controller and
memory controller have an interlock that prevents the
new memory registers from taking effect until the
clock frequency change.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 21 Feb 2011 07:35:07 +0000 (23:35 -0800)]
ARM: tegra: clock: Minor cleanups
Remove unnecessary uses of #ifdef CONFIG_DEBUG_FS
Convert bool assignments from 1 to true
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sun, 13 Feb 2011 00:14:03 +0000 (16:14 -0800)]
ARM: tegra: clock: Add shared bus clock type
Some clocks may have multiple downstream users that need to request a
higher clock rate. Shared bus clocks provide a unique shared_bus_user
clock to each user. The frequency of the bus is set to the highest
enabled shared_bus_user clock, with a minimum value set by the
shared bus. Drivers can use clk_enable and clk_disable to enable
or disable their requirement, and clk_set_rate to set the minimum rate.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 21 Oct 2010 00:47:59 +0000 (17:47 -0700)]
ARM: tegra: cpufreq: Take an extra reference to pllx
During cpu frequency changes, take an extra reference to pllx so
that it doesn't turn off and on while the cpu is temporarily on
pllp. If the cpu is moved to pllp permanently, pllx will be
turned off.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sun, 13 Feb 2011 00:43:05 +0000 (16:43 -0800)]
ARM: tegra: clock: Convert global lock to a lock per clock
Give each clock its own lock, and remove all lock traversals from
parent to child clocks to prevent AB-BA deadlocks.
This brings the locking in line with the common struct clk
patches and should make conversion simple.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sun, 13 Feb 2011 00:05:31 +0000 (16:05 -0800)]
ARM: tegra: clock: Move unshared clk struct members into union
Creates a union of a struct for each type of clock to reduce memory
usage and clarify which members are used by all clocks and which are
used by a single type.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sat, 12 Feb 2011 23:52:56 +0000 (15:52 -0800)]
ARM: tegra: clock: Rearrange static clock tables
Make the static clocks look more like the array of clocks
so they can all be initalized with the same helper function.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sat, 12 Feb 2011 23:52:04 +0000 (15:52 -0800)]
ARM: tegra: clock: Drop CPU dvfs
The existing version did not extend well to core dvfs, drop it
for now until the new clk api with clk_prepare and clk_unprepare
is ready and non-atomic clocks are possible.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 14 Oct 2010 02:16:02 +0000 (19:16 -0700)]
ARM: tegra: clock: Initialize clocks that have no enable
Assume that any clock that has no enable op is always on.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 16 Sep 2010 21:59:49 +0000 (14:59 -0700)]
ARM: tegra: clock: Don't use PLL lock bits
The PLL lock bits are not reliable, use per-PLL timeouts instead.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 9 Sep 2010 03:01:04 +0000 (20:01 -0700)]
ARM: tegra: clock: Drop debugging
Drop the unnecessary pr_debug calls to avoid having to maintain them.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 9 Sep 2010 02:41:58 +0000 (19:41 -0700)]
ARM: tegra: clock: Don't BUG on changing an enabled PLL
When updating the CPU PLL frequency, keeping the PLL enabled avoids
ramping the PLL all the way down and back up again. Remove the BUG_ON
in tegra2_pll_clk_set_rate to allow the rate to change while the PLL
is enabled.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Dima Zavin [Fri, 3 Sep 2010 02:11:11 +0000 (19:11 -0700)]
ARM: tegra: clock: enable clk reset for non-peripheral clocks
Add a new 'reset' clk op. This can be provided for any clock,
not just peripherals.
Signed-off-by: Dima Zavin <dima@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Simon Glass [Thu, 17 Feb 2011 16:13:57 +0000 (08:13 -0800)]
ARM: tegra: Fix hang on reboot
This seems to be a regression in 2.6.37.
We cannot use writel() here since the resulting wmb() calls l2x0_cache_sync()
which uses a spinlock and L1 cache may be off at this point.
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-February/041909.html
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Wed, 5 Jan 2011 21:32:20 +0000 (14:32 -0700)]
ARM: tegra: APB DMA: Enable clock and remove reset.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Stephen Warren [Wed, 5 Jan 2011 21:24:12 +0000 (14:24 -0700)]
ARM: tegra: Prevent requeuing in-progress DMA requests
If a request already in the queue is passed to tegra_dma_enqueue_req,
tegra_dma_req.node->{next,prev} will end up pointing to itself instead
of at tegra_dma_channel.list, which is the way a the end-of-list
should be set up. When the DMA request completes and is list_del'd,
the list head will still point at it, yet the node's next/prev will
contain the list poison values. When the next DMA request completes,
a kernel panic will occur when those poison values are dereferenced.
This makes the DMA driver more robust in the face of buggy clients.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sat, 19 Feb 2011 22:35:16 +0000 (14:35 -0800)]
Merge branch 'tegra-arch' of git://git./linux/kernel/git/broonie/sound-2.6 into outside-for-next
Mike Rapoport [Mon, 7 Feb 2011 08:10:53 +0000 (10:10 +0200)]
ARM: tegra: add TrimSlice board
Add basic support for CompuLab TrimSlice platform
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sat, 22 Jan 2011 08:36:14 +0000 (00:36 -0800)]
ARM: tegra: Use writel_relaxed in tegra_init_cache
Signed-off-by: Colin Cross <ccross@android.com>
Olof Johansson [Wed, 5 Jan 2011 20:03:12 +0000 (14:03 -0600)]
ARM: tegra: add tegra_defconfig
Adding one single defconfig for the tegra family of boards, to over time
cover the superset of supported platform and drivers.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 18 Aug 2010 07:19:12 +0000 (00:19 -0700)]
ARM: tegra: dma: Fix critical data corruption bugs
Sometimes, due to high interrupt latency in the continuous mode
of DMA transfer, the half buffer complete interrupt is handled
after DMA has transferred the full buffer. When this is detected,
stop DMA immediately and restart with the next buffer if the next
buffer is ready.
originally fixed by Victor(Weiguo) Pan <wpan@nvidia.com>
In place of using the simple spin_lock()/spi_unlock() in the
interrupt thread, using the spin_lock_irqsave() and
spin_unlock_irqrestore(). The lock is shared between the normal
process context and interrupt context.
originally fixed by Laxman Dewangan (ldewangan@nvidia.com)
The use of shadow registers caused memory corruption at physical
address 0 because the enable bit was not shadowed, and assuming it
needed to be set would enable an unconfigured dma block. Most of the
register accesses don't need to know the previous state of the
registers, and the few places that do need to modify only a few bits
in the registers are the same ones that were sometimes incorrectly
setting the enable bit. This patch convert tegra_dma_update_hardware
to set the entire register, and the other users to read-modify-write,
and drops the shadow registers completely.
Also fixes missing locking in tegra_dma_allocate_channel
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 24 Aug 2010 01:37:25 +0000 (18:37 -0700)]
ARM: tegra: Allow overriding arch_reset
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Fri, 6 Aug 2010 00:40:39 +0000 (17:40 -0700)]
ARM: tegra: cpufreq: Disable cpufreq during suspend
On Tegra, calling clk_set_rate on the CPU clock may call into the
regulator API. If the regulator driver that controls the CPU
voltage rail has been suspended, this can lead to attempted
communication with a hardware block that has already been turned
off.
Adds a SUSPEND_PREPARE notification hook to drop the frequency to
the lowest possible during suspend.
Also adds 216MHz (off of PLLP) as the lowest CPU frequency, which
allows PLLX to be turned off.
Signed-off-by: Colin Cross <ccross@android.com>
Gary King [Tue, 3 Aug 2010 21:53:05 +0000 (14:53 -0700)]
ARM: tegra: iomap: Add missing devices
Adds gart, hdmi, avp, host1x, and pwm controllers to mach/iomap.h
Signed-off-by: Gary King <gking@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 10 Feb 2011 06:17:17 +0000 (22:17 -0800)]
ARM: tegra: irq: Implement retrigger
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 29 Nov 2010 06:23:55 +0000 (22:23 -0800)]
ARM: tegra: irq: Add support for suspend wake sources
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 29 Nov 2010 00:26:19 +0000 (16:26 -0800)]
ARM: tegra: timer: Add idle and suspend support to timers
Implement read_persistent_clock by reading the Tegra RTC
registers that stay running during suspend.
Save and restore the timer configuration register in
suspend.
Signed-off-by: Colin Cross <ccross@android.com>
Gary King [Wed, 18 Aug 2010 07:19:58 +0000 (00:19 -0700)]
ARM: tegra: pinmux: Add missing drive pingroups and fix suspend
Adds missing drive pingroups, saves all drive pingroups in
suspend, and restores the pinmux registers in the proper order.
Signed-off-by: Gary King <gking@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 4 Oct 2010 18:49:26 +0000 (11:49 -0700)]
ARM: tegra: clock: Suspend fixes, and add new clocks
Save and restore pll and osc state during suspend
Add digital audio clocks
Update clk dev associations
Correct max clock frequencies
Add pll_p as additional cpu clock state
Add values to plld table
Fix register offset for sdmmc4 clock
Add blink timer to tegra2_clocks
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 4 Oct 2010 15:49:49 +0000 (08:49 -0700)]
ARM: tegra: Add prototypes for subsystem suspend functions
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 4 Oct 2010 04:24:28 +0000 (21:24 -0700)]
ARM: tegra: irqs: Update irq list
Fixes typo in INT_CPU1_PMU_INTR (original fix from Will Deacon)
Adds board irqs
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 25 May 2010 00:07:46 +0000 (17:07 -0700)]
ARM: tegra: Add api to control internal powergating
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Fri, 6 Aug 2010 21:29:14 +0000 (14:29 -0700)]
ARM: tegra: Centralize macros to define debug uart base
Signed-off-by: Colin Cross <ccross@android.com>
Linus Torvalds [Tue, 8 Feb 2011 00:03:17 +0000 (16:03 -0800)]
Linux 2.6.38-rc4
Linus Torvalds [Mon, 7 Feb 2011 23:20:11 +0000 (15:20 -0800)]
Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm:
ALSA: AACI: allow writes to MAINCR to take effect
ARM: Update mach-types
ARM: 6652/1: ep93xx: correct the end address of the AC97 memory resource
ARM: mxs/imx28: remove now unused clock lookup "fec.0"
ARM: mxs: fix clock base address missing
ARM: mxs: acknowledge gpio irq
ARM: mach-imx/mach-mx25_3ds: Fix section type
ARM: imx: Add VPR200 and MX51_3DS entries to uncompress.h
ARM i.MX23: use correct register for setting the rate
ARM i.MX23/28: remove secondary field from struct clk. It's unused
ARM i.MX28: use correct register for setting the rate
ARM i.MX28: fix bit operation
Linus Torvalds [Mon, 7 Feb 2011 22:06:18 +0000 (14:06 -0800)]
Merge git://git./linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (33 commits)
Btrfs: Fix page count calculation
btrfs: Drop __exit attribute on btrfs_exit_compress
btrfs: cleanup error handling in btrfs_unlink_inode()
Btrfs: exclude super blocks when we read in block groups
Btrfs: make sure search_bitmap finds something in remove_from_bitmap
btrfs: fix return value check of btrfs_start_transaction()
btrfs: checking NULL or not in some functions
Btrfs: avoid uninit variable warnings in ordered-data.c
Btrfs: catch errors from btrfs_sync_log
Btrfs: make shrink_delalloc a little friendlier
Btrfs: handle no memory properly in prepare_pages
Btrfs: do error checking in btrfs_del_csums
Btrfs: use the global block reserve if we cannot reserve space
Btrfs: do not release more reserved bytes to the global_block_rsv than we need
Btrfs: fix check_path_shared so it returns the right value
btrfs: check return value of btrfs_start_ioctl_transaction() properly
btrfs: fix return value check of btrfs_join_transaction()
fs/btrfs/inode.c: Add missing IS_ERR test
btrfs: fix missing break in switch phrase
btrfs: fix several uncheck memory allocations
...
Linus Torvalds [Mon, 7 Feb 2011 22:05:38 +0000 (14:05 -0800)]
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
powerpc: Fix hcall tracepoint recursion
powerpc/numa: Fix bug in unmap_cpu_from_node
powerpc/numa: Disable VPHN on dedicated processor partitions
powerpc/numa: Add length when creating OF properties via VPHN
powerpc/numa: Check for all VPHN changes
powerpc/numa: Only use active VPHN count fields
powerpc/pseries: Remove unnecessary variable initializations in numa.c
powerpc/pseries: Fix brace placement in numa.c
powerpc/pseries: Fix typo in VPHN comments
powerpc: Fix some 6xx/7xxx CPU setup functions
powerpc: Pass the right cpu_spec to ->setup_cpu() on 64-bit
powerpc/book3e: Protect complex macro args in mmu-book3e.h
powerpc: Fix pfn_valid() when memory starts at a non-zero address
Linus Torvalds [Mon, 7 Feb 2011 22:05:24 +0000 (14:05 -0800)]
Merge branch 'omap-fixes-for-linus' of git://git./linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6:
arm: omap4: panda: remove usb_nop_xceiv_register(v1)
OMAP1: Fix non-working LCD on OMAP310
OMAP3: Devkit8000: Change lcd power pin
omap1: remove duplicated #include
arm: mach-omap2: mux: free allocated memory on error exit
arm: mach-omap2: board-rm680: fix rm680_vemmc regulator constraints
OMAP: PM: SmartReflex: Fix possible null pointer read access
OMAP: PM: SmartReflex: Fix possible memory leak
arm: mach-omap2: voltage: debugfs: fix memory leak
OMAP3: PM: fix save secure RAM to restore MPU power state
OMAP: PM: SmartReflex: Add missing IS_ERR test
Linus Torvalds [Mon, 7 Feb 2011 22:04:43 +0000 (14:04 -0800)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, nx: Mark the ACPI resume trampoline code as +x
Tetsuo Handa [Mon, 7 Feb 2011 13:36:16 +0000 (13:36 +0000)]
CRED: Fix memory and refcount leaks upon security_prepare_creds() failure
In prepare_kernel_cred() since 2.6.29, put_cred(new) is called without
assigning new->usage when security_prepare_creds() returned an error. As a
result, memory for new and refcount for new->{user,group_info,tgcred} are
leaked because put_cred(new) won't call __put_cred() unless old->usage == 1.
Fix these leaks by assigning new->usage (and new->subscribers which was added
in 2.6.32) before calling security_prepare_creds().
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Tetsuo Handa [Mon, 7 Feb 2011 13:36:10 +0000 (13:36 +0000)]
CRED: Fix BUG() upon security_cred_alloc_blank() failure
In cred_alloc_blank() since 2.6.32, abort_creds(new) is called with
new->security == NULL and new->magic == 0 when security_cred_alloc_blank()
returns an error. As a result, BUG() will be triggered if SELinux is enabled
or CONFIG_DEBUG_CREDENTIALS=y.
If CONFIG_DEBUG_CREDENTIALS=y, BUG() is called from __invalid_creds() because
cred->magic == 0. Failing that, BUG() is called from selinux_cred_free()
because selinux_cred_free() is not expecting cred->security == NULL. This does
not affect smack_cred_free(), tomoyo_cred_free() or apparmor_cred_free().
Fix these bugs by
(1) Set new->magic before calling security_cred_alloc_blank().
(2) Handle null cred->security in creds_are_invalid() and selinux_cred_free().
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Mon, 7 Feb 2011 22:02:06 +0000 (14:02 -0800)]
Merge git://git./linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
cifs: remove checks for ses->status == CifsExiting
cifs: add check for kmalloc in parse_dacl
cifs: don't send an echo request unless NegProt has been done
cifs: enable signing flag in SMB header when server has it on
cifs: Possible slab memory corruption while updating extended stats (repost)
CIFS: Fix variable types in cifs_iovec_read/write (try #2)
cifs: fix length vs. total_read confusion in cifs_demultiplex_thread
Yan, Zheng [Tue, 18 Jan 2011 05:34:40 +0000 (13:34 +0800)]
Btrfs: Fix page count calculation
take offset of start position into account when calculating page count.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Russell King [Mon, 7 Feb 2011 19:07:10 +0000 (19:07 +0000)]
Merge branch 'fixes'
Jeff Layton [Mon, 7 Feb 2011 13:54:35 +0000 (08:54 -0500)]
cifs: remove checks for ses->status == CifsExiting
ses->status is never set to CifsExiting, so these checks are
always false.
Tested-by: JG <jg@cms.ac>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Russell King [Mon, 7 Feb 2011 15:15:37 +0000 (15:15 +0000)]
Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into fixes
Russell King [Sat, 5 Feb 2011 10:41:55 +0000 (10:41 +0000)]
ALSA: AACI: allow writes to MAINCR to take effect
The AACI TRM requires the MAINCR enable bit to be held zero for two
bitclk cycles plus three apb_pclk cycles. Use a delay of 1us to
ensure this.
Ensure that writes to MAINCR to change the addressed codec only happen
when required, and that they take effect in a similar manner to the
above, otherwise we seem to occasionally have stuck slot busy bits.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Russell King [Mon, 7 Feb 2011 08:59:29 +0000 (08:59 +0000)]
ARM: Update mach-types
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
H. Peter Anvin [Mon, 7 Feb 2011 05:16:09 +0000 (21:16 -0800)]
x86, nx: Mark the ACPI resume trampoline code as +x
We reserve lowmem for the things that need it, like the ACPI
wakeup code, way early to guarantee availability. This happens
before we set up the proper pagetables, so set_memory_x() has no
effect.
Until we have a better solution, use an initcall to mark the
wakeup code executable.
Originally-by: Matthieu Castet <castet.matthieu@free.fr>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Matthias Hopf <mhopf@suse.de>
Cc: rjw@sisk.pl
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <
4D4F8019.
2090104@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Anton Blanchard [Thu, 21 Oct 2010 00:52:12 +0000 (00:52 +0000)]
powerpc: Fix hcall tracepoint recursion
Spinlocks on shared processor partitions use H_YIELD to notify the
hypervisor we are waiting on another virtual CPU. Unfortunately this means
the hcall tracepoints can recurse.
The patch below adds a percpu depth and checks it on both the entry and
exit hcall tracepoints.
Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: stable@kernel.org
Anton Blanchard [Sat, 29 Jan 2011 12:37:16 +0000 (12:37 +0000)]
powerpc/numa: Fix bug in unmap_cpu_from_node
When converting to the new cpumask code I screwed up:
- if (cpu_isset(cpu, numa_cpumask_lookup_table[node])) {
- cpu_clear(cpu, numa_cpumask_lookup_table[node]);
+ if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) {
+ cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
This was introduced in commit
25863de07af9 (powerpc/cpumask: Convert NUMA code
to new cpumask API)
Fix it.
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Anton Blanchard [Sat, 29 Jan 2011 12:35:22 +0000 (12:35 +0000)]
powerpc/numa: Disable VPHN on dedicated processor partitions
There is no need to start up the timer and monitor topology changes on a
dedicated processor partition, so disable it.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Anton Blanchard [Sat, 29 Jan 2011 12:28:04 +0000 (12:28 +0000)]
powerpc/numa: Add length when creating OF properties via VPHN
The rest of the NUMA code expects an OF associativity property with
the first cell containing the length. Without this fix all topology changes
cause us to misparse the property and put the cpu into node 0.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Anton Blanchard [Sat, 29 Jan 2011 12:26:19 +0000 (12:26 +0000)]
powerpc/numa: Check for all VPHN changes
The hypervisor uses unsigned 1 byte counters to signal topology changes to
the OS. Since they can wrap we need to check for any difference, not just if
the hypervisor count is greater than the previous count.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Anton Blanchard [Sat, 29 Jan 2011 12:24:34 +0000 (12:24 +0000)]
powerpc/numa: Only use active VPHN count fields
VPHN supports up to 8 distance fields but the number of entries in
ibm,associativity-reference-points signifies how many are in use.
Don't look at all the VPHN counts, only distance_ref_points_depth
worth.
Since we already cap our distance metrics at MAX_DISTANCE_REF_POINTS,
use that to size the VPHN arrays and add a BUILD_BUG_ON to avoid it growing
larger than the VPHN maximum of 8.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Jesse Larrew [Thu, 20 Jan 2011 19:01:35 +0000 (19:01 +0000)]
powerpc/pseries: Remove unnecessary variable initializations in numa.c
Remove unnecessary variable initializations in VPHN functions.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Jesse Larrew [Thu, 20 Jan 2011 19:01:13 +0000 (19:01 +0000)]
powerpc/pseries: Fix brace placement in numa.c
Fix brace placement in VPHN code.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Jesse Larrew [Thu, 20 Jan 2011 19:00:51 +0000 (19:00 +0000)]
powerpc/pseries: Fix typo in VPHN comments
Correct a spelling error in VPHN comments in numa.c.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Benjamin Herrenschmidt [Thu, 20 Jan 2011 20:35:23 +0000 (20:35 +0000)]
powerpc: Fix some 6xx/7xxx CPU setup functions
Some of those functions try to adjust the CPU features, for example
to remove NAP support on some revisions. However, they seem to use
r5 as an index into the CPU table entry, which might have been right
a long time ago but no longer is. r4 is the right register to use.
This probably caused some off behaviours on some PowerMac variants
using 750cx or 7455 processor revisions.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: stable@kernel.org
Benjamin Herrenschmidt [Thu, 20 Jan 2011 20:36:03 +0000 (20:36 +0000)]
powerpc: Pass the right cpu_spec to ->setup_cpu() on 64-bit
When calling setup_cpu() on 64-bit, we pass a pointer to the
cputable entry we have found. This used to be fine when cur_cpu_spec
was a pointer to that entry, but nowadays, we copy the entry into
a separate variable, and we do so before we call the setup_cpu()
callback. That means that any attempt by that callback at patching
the CPU table entry (to adjust CPU features for example) will patch
the wrong table.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Scott Wood [Thu, 27 Jan 2011 10:30:00 +0000 (10:30 +0000)]
powerpc/book3e: Protect complex macro args in mmu-book3e.h
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Scott Wood [Thu, 27 Jan 2011 10:31:38 +0000 (10:31 +0000)]
powerpc: Fix pfn_valid() when memory starts at a non-zero address
max_mapnr is a pfn, not an index innto mem_map[]. So don't add
ARCH_PFN_OFFSET a second time.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Linus Torvalds [Sun, 6 Feb 2011 20:05:58 +0000 (12:05 -0800)]
Merge branch 'ixp4xx' of git://git./linux/kernel/git/chris/linux-2.6
* 'ixp4xx' of git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6:
arm/ixp4xx: Rename FREQ macro to avoid collisions
IXP4xx: Fix qmgr_release_queue() flushing unexpected queue entries.
Linus Torvalds [Sun, 6 Feb 2011 20:05:15 +0000 (12:05 -0800)]
Merge branch 'timers-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
lockdep, timer: Fix del_timer_sync() annotation
RTC: Prevents a division by zero in kernel code.
Linus Torvalds [Sun, 6 Feb 2011 20:04:49 +0000 (12:04 -0800)]
Merge branch 'irq-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
m32r: Fixup last __do_IRQ leftover
genirq: Add missing status flags to modification mask
Linus Torvalds [Sun, 6 Feb 2011 20:04:16 +0000 (12:04 -0800)]
Merge branch 'perf-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
perf stat: Fix aggreate counter reading accounting
tracing: Replace syscall_meta_data struct array with pointer array
tracepoints: Fix section alignment using pointer array
tracing: Replace trace_event struct array with pointer array
Linus Torvalds [Sun, 6 Feb 2011 20:03:10 +0000 (12:03 -0800)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86-32: Make sure the stack is set up before we use it
x86, mtrr: Avoid MTRR reprogramming on BP during boot on UP platforms
x86, nx: Don't force pages RW when setting NX bits
Linus Torvalds [Sun, 6 Feb 2011 20:02:42 +0000 (12:02 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: use linux/io.h to fix compile warnings
ALSA: hda - Fix memory leaks in conexant jack arrays
ASoC: CX20442: fix NULL pointer dereference
ASoC: Amstrad Delta: fix const related build error
ALSA: oxygen: fix output routing on Xonar DG
sound: silent echo'ed messages in Makefile
ASoC: Fix mask/val_mask confusion snd_soc_dapm_put_volsw()
ASoC: DaVinci: fix kernel panic due to uninitialized platform_data
ALSA: HDA: Fix microphone(s) on Lenovo Edge 13
ASoC: Fix module refcount for auxiliary devices
ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output
ALSA: HDA: Add a new model "asus" for Conexant 5066/205xx
ALSA: HDA: Refactor some redundant code for Conexant 5066/205xx
Ben Hutchings [Sat, 11 Dec 2010 20:17:54 +0000 (20:17 +0000)]
arm/ixp4xx: Rename FREQ macro to avoid collisions
FREQ is a ridiculously short name for a platform-specific macro in a
generic header, and it now conflicts with an enumeration in the
gspca/ov519 driver.
Also delete conditional reference to ixp4xx_get_board_tick_rate()
which is not defined anywhere.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Krzysztof Hałasa [Mon, 3 May 2010 21:22:06 +0000 (23:22 +0200)]
IXP4xx: Fix qmgr_release_queue() flushing unexpected queue entries.
Queues should be empty when released, if not, there is a safety valve.
Make sure the queue is usable after it triggers.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Alexey Charkov [Wed, 2 Feb 2011 21:15:35 +0000 (21:15 +0000)]
btrfs: Drop __exit attribute on btrfs_exit_compress
As this function is called in some error paths while not
removing the module, the __exit attribute prevents the kernel
image from linking when btrfs is compiled in statically.
Signed-off-by: Alexey Charkov <alchark@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Tsutomu Itoh [Thu, 3 Feb 2011 03:16:25 +0000 (03:16 +0000)]
btrfs: cleanup error handling in btrfs_unlink_inode()
When btrfs_alloc_path() fails, btrfs_free_path() need not be called.
Therefore, it changes the branch ahead.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Josef Bacik [Wed, 2 Feb 2011 15:53:47 +0000 (15:53 +0000)]
Btrfs: exclude super blocks when we read in block groups
This has been resulting in a BUT_ON(ret) after btrfs_reserve_extent in
btrfs_cow_file_range. The reason is we don't actually calculate the bytes_super
for a block group until we go to cache it, which means that the space_info can
hand out reservations for space that it doesn't actually have, and we can run
out of data space. This is also a problem if you are using space caching since
we don't ever calculate bytes_super for the block groups. So instead everytime
we read a block group call exclude_super_stripes, which calculates the
bytes_super for the block group so it can be left out of the space_info. Then
whenever caching completes we just call free_excluded_extents so that the super
excluded extents are freed up. Also if we are unmounting and we hit any block
groups that haven't been cached we still need to call free_excluded_extents to
make sure things are cleaned up properly. Thanks,
Reported-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>