pandora-kernel.git
10 years agodrm/i915: kick firmware fbs even when i915 fbdev is disabled
Daniel Vetter [Tue, 17 Dec 2013 09:00:54 +0000 (10:00 +0100)]
drm/i915: kick firmware fbs even when i915 fbdev is disabled

Otherwise we don't kick out firmware framebuffers like vesafb and
efifb when CONFIG_DRM_I915_FBDEV=n but CONFIG_FB=y.

There's still the pesky issue with vgacon which we should somehow
replace with the dummy console at least. We have a similar issue at
module un/reload, since vgacon state is terminally botched after
i915.ko has loaded in modeset mode. But this gets us a step further at
least.

v2: Use IS_ENABLED - I always get this wrong for tristates. Spotted by
Jani.

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Use IS_VALLEYVIEW() to test the is_valleyview flag
Damien Lespiau [Thu, 12 Dec 2013 14:36:36 +0000 (14:36 +0000)]
drm/i915: Use IS_VALLEYVIEW() to test the is_valleyview flag

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Use symbolic names for booleans in i915_semaphore_is_enabled
Daniel Vetter [Tue, 17 Dec 2013 08:56:53 +0000 (09:56 +0100)]
drm/i915: Use symbolic names for booleans in i915_semaphore_is_enabled

Noticed while reviewing a patch and couldn't resist the OCD.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Don't emit mbox updates without semaphores
Ben Widawsky [Tue, 17 Dec 2013 04:50:38 +0000 (20:50 -0800)]
drm/i915: Don't emit mbox updates without semaphores

Aside from the fact that it leaves confusing dumps on error capture, it
is entirely unnecessary, and potentially harmful in cases like BDW,
where the instruction has changed.

In reality (seemingly), this will have no behavioral impact.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Reorder/respace MI instruction definition
Ben Widawsky [Tue, 17 Dec 2013 04:50:37 +0000 (20:50 -0800)]
drm/i915: Reorder/respace MI instruction definition

A few command were out of numerical order and had different spacing. Put
them back in numerical order, with proper spacing.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/vlv: split DPIO init and reset
Jesse Barnes [Tue, 17 Dec 2013 00:34:24 +0000 (16:34 -0800)]
drm/i915/vlv: split DPIO init and reset

We only need to init the reg offset for DPIO once, but we need to reset
DPIO at resume time and at init time.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/vlv: add early DPIO init v3
Jesse Barnes [Tue, 17 Dec 2013 00:34:23 +0000 (16:34 -0800)]
drm/i915/vlv: add early DPIO init v3

Just add an early init since we may need to access DPIO regs early on.
The init call in modeset_init_hw is also needed for the resume case,
when we need to reset DPIO to keep things happy.

v2: split reset and reg init
v3: split patches (Daniel)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: only build i915_debugfs.c when CONFIG_DEBUG_FS is enabled
Jani Nikula [Mon, 16 Dec 2013 11:10:36 +0000 (13:10 +0200)]
drm/i915: only build i915_debugfs.c when CONFIG_DEBUG_FS is enabled

The whole file is wrapped around in #if defined(CONFIG_DEBUG_FS) anyway,
so skip the file at the build level already.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: fix return value check of debugfs_create_file()
Wei Yongjun [Mon, 16 Dec 2013 06:13:25 +0000 (14:13 +0800)]
drm/i915: fix return value check of debugfs_create_file()

In case of error, the function debugfs_create_file() returns NULL
pointer not ERR_PTR() if debugfs is enabled. The IS_ERR() test in
the return value check should be replaced with NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: parse backlight modulation frequency from the BIOS VBT
Jani Nikula [Sat, 14 Dec 2013 22:38:29 +0000 (20:38 -0200)]
drm/i915: parse backlight modulation frequency from the BIOS VBT

We don't actually do anything with the information yet, but parse and
log what's in the VBT.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: add runtime PM support on Haswell
Paulo Zanoni [Fri, 13 Dec 2013 17:22:32 +0000 (15:22 -0200)]
drm/i915: add runtime PM support on Haswell

Now that all the infrastructure is in place and all the tests from
pm_pc8 pass, we can finally enable the feature.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: release the GTT mmaps when going into D3
Paulo Zanoni [Fri, 13 Dec 2013 17:22:31 +0000 (15:22 -0200)]
drm/i915: release the GTT mmaps when going into D3

So we'll get a fault when someone tries to access the mmap, then we'll
wake up from D3.

v2: - Rebase
v3: - Use gtt active/inactive

Testcase: igt/pm_pc8/gem-mmap-gtt
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[danvet: Add comment + WARN as discussed with Paulo on irc.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: cancel the hangcheck before runtime suspend
Paulo Zanoni [Fri, 13 Dec 2013 17:22:30 +0000 (15:22 -0200)]
drm/i915: cancel the hangcheck before runtime suspend

The hangcheck function requires the hardware to be working, and if
we're suspending we're going to put the HW in D3 state.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Implement ff workarounds
Ben Widawsky [Thu, 12 Dec 2013 23:28:04 +0000 (15:28 -0800)]
drm/i915/bdw: Implement ff workarounds

WaVSRefCountFullforceMissDisable and
WaDSRefCountFullforceMissDisable

VS is a carry-over from HSW, and DS is likely not used by anyone yet.

Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
[danvet: Line of 106 chars is too long. Really.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Force all Data Cache Data Port access to be Non-Coherent
Ben Widawsky [Fri, 13 Dec 2013 01:26:03 +0000 (17:26 -0800)]
drm/i915/bdw: Force all Data Cache Data Port access to be Non-Coherent

I stumbled on to some unimplemented errata. To be honest, I am not
really sure of the impact, just that the docs say to do.

No w/a name for this one.

v2: v1 was a stale thing which should have never seen the light of day.
(Haihao)

Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Don't use forcewake needlessly
Ville Syrjälä [Fri, 13 Dec 2013 11:26:20 +0000 (13:26 +0200)]
drm/i915/bdw: Don't use forcewake needlessly

Not all registers need forcewake even if they're not shadowed.
Add the missing check to gen8_writeX() to avoid needless forcewake
usage when writing eg. display registers.

v2: Use straight up <0x40000 check instead of NEEDS_FORCE_WAKE()

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Clear out old GT FIFO errors in intel_uncore_early_sanitize()
Ville Syrjälä [Tue, 3 Dec 2013 09:30:09 +0000 (11:30 +0200)]
drm/i915: Clear out old GT FIFO errors in intel_uncore_early_sanitize()

The BIOS or someone else might have done something bad and there
might be old GT FIFO erros reported in GTFIFODBG. Clear those out
in intel_uncore_early_sanitize() to make sure we don't mistake them
for our problems.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: dont call irq_put when irq test is on
Mika Kuoppala [Thu, 12 Dec 2013 15:54:42 +0000 (17:54 +0200)]
drm/i915: dont call irq_put when irq test is on

If test is running, irq_get was not called so we should gain
balance by not doing irq_put

"So the rule is: if you access unlocked values, you use ACCESS_ONCE().
You don't say "but it can't matter". Because you simply don't know."
-- Linus

v2: use local variable so it can't change during test (Chris)

v3: update commit msg and use ACCESS_ONCE (Ville)

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Rework the FBC interval/stall stuff a bit
Ville Syrjälä [Thu, 12 Dec 2013 15:27:40 +0000 (17:27 +0200)]
drm/i915: Rework the FBC interval/stall stuff a bit

Don't touch DPFC_RECOMP_CTL on FBC2, use RMW to update
the FBC_CONTROL on FBC1 to make it easier for people to
experiment with different numbers. Also fix the interval
mask for FBC1.

v2: Rebased

Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Enable FBC for all mobile gen2 and gen3 platforms
Ville Syrjälä [Thu, 28 Nov 2013 15:30:02 +0000 (17:30 +0200)]
drm/i915: Enable FBC for all mobile gen2 and gen3 platforms

All mobile gen2 and gen3 chipsets should have FBC1, and the code
should now handle them all. So just set has_fbc=true for all such
chipsets.

Note that fbc is still disabled by default for now.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: FBC_CONTROL2 is gen4 only
Ville Syrjälä [Thu, 28 Nov 2013 15:29:57 +0000 (17:29 +0200)]
drm/i915: FBC_CONTROL2 is gen4 only

Gen2 and gen3 don't have the FBC_CONTROL2 register, so don't
touch it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Gen2 FBC1 CFB pitch wants 32B units
Ville Syrjälä [Thu, 28 Nov 2013 15:29:56 +0000 (17:29 +0200)]
drm/i915: Gen2 FBC1 CFB pitch wants 32B units

On gen2 the compressed frame buffer pitch is specified in 32B units
rather than the 64B units used on gen3+.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: split intel_ddi_pll_mode_set in 2 pieces
Paulo Zanoni [Mon, 25 Nov 2013 17:27:08 +0000 (15:27 -0200)]
drm/i915: split intel_ddi_pll_mode_set in 2 pieces

The first piece, intel_ddi_pll_select, finds a PLL and assigns it to
the CRTC, but doesn't write any register. It can also fail in case it
doesn't find a PLL.

The second piece, intel_ddi_pll_enable, uses the information stored by
intel_ddi_pll_select to actually enable the PLL by writing to its
register. This function can't fail. We also have some refcount sanity
checks here.

The idea is that one day we'll remove all the functions that touch
registers from haswell_crtc_mode_set to haswell_crtc_enable, so we'll
call intel_ddi_pll_select at haswell_crtc_mode_set and then call
intel_ddi_pll_enable at haswell_crtc_enable. Since I'm already
touching this code, let's take care of this particular split today.

v2: - Clock on the debug message is in KHz
    - Add missing POSTING_READ

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
[danvet: Bikeshed comments.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Fix timeout with missed interrupts in __wait_seqno
Mika Kuoppala [Tue, 10 Dec 2013 15:02:43 +0000 (17:02 +0200)]
drm/i915: Fix timeout with missed interrupts in __wait_seqno

Commit 094f9a54e355 ("drm/i915: Fix __wait_seqno to use true infinite
timeouts") added support for __wait_seqno to detect missing interrupts and
go around them by polling. As there is also timeout detection in
__wait_seqno, the polling and timeout detection were done with the same
timer.

When there has been missed interrupts and polling is needed, the timer is
set to trigger in (now + 1) jiffies in future, instead of the caller
specified timeout.

Now when io_schedule() returns, we calculate the jiffies left to timeout
using the timer expiration value. As the current jiffies is now bound to be
always equal or greater than the expiration value, the timeout_jiffies will
become zero or negative and we return -ETIME to caller even tho the
timeout was never reached.

Fix this by decoupling timeout calculation from timer expiration.

v2: Commit message with some sense in it (Chris Wilson)

v3: add parenthesis on timeout_expire calculation

v4: don't read jiffies without timeout (Chris Wilson)

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: touch VGA MSR after we enable the power well
Paulo Zanoni [Wed, 11 Dec 2013 20:50:10 +0000 (18:50 -0200)]
drm/i915: touch VGA MSR after we enable the power well

Fixes regression introduced by:
    commit bf51d5e2cda5d36d98e4b46ac7fca9461e512c41
    Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Date:   Wed Jul 3 17:12:13 2013 -0300
        drm/i915: switch disable_power_well default value to 1

The bug I'm seeing can be reproduced with:
  - Have vgacon configured/enabled
  - Make sure the power well gets disabled, then enabled. You can
    check this by seeing the messages print by hsw_set_power_well
  - Stop your display manager
  - echo 0 > /sys/class/vtconsole/vtcon1/bind

I can easily reproduce this by blacklising snd_hda_intel and booting
with eDP+HDMI.

If you do this and then look at dmesg, you'll see we're printing
infinite "Unclaimed register" messages. This is happening because
we're stuck on an infinite loop inside console_unlock(), which is
calling many functions from vgacon.c. And the code that's triggering
the error messages is from vgacon_set_cursor_size().

After we re-enable the power well, every time we read/write the VGA
address 0x3d5 we get an "unclaimed register" interrupt (ERR_INT) and
print error messages. If we write anything to the VGA MSR register (it
doesn't really matter which value you write to bit 0), any
reads/writes to 0x3d5 _don't_ trigger the "unclaimed register" errors
anymore (even if MSR bit 0 is zero). So what happens with the current
code is that when we unbind i915 and bind vgacon, we call
console_unlock(). Function console_unlock() is responsible for
printing any messages that were supposed to be print when the console
was locked, so it calls the TTY layer, which calls the console layer,
which calls vgacon to print the messages. At this point, vgacon
eventually calls vgacon_set_cursor_size(), which touches 0x3d5, which
triggers unclaimed register interrupts. The problem is that when we
get these interrupts, we print the error messages, so we add more work
to console_unlock(), which will try to print it again, and then call
vgacon again, trigger a new interrupt, which will put more stuff to
the buffer, and then we'll be stuck at console_unlock() forever.

If you patch intel_uncore.c to not print anything when we detect
unclaimed registers, we won't get into the console_unlock() infinite
loop and the driver unbind will work just fine. We will still be
getting interrupts every time vgacon touches those registers, but we
will survive. This is a valid experiment, but IMHO it's not the real
fix: if we don't print any error messages we will still keep getting
the interrupts, and if we disable ERR_INT we won't get the interrupt
anymore, but we will also stop getting all the other error interrupts.

I talked about this problem with the HW engineer and his
recommendation is "So don't do any VGA I/O or memory access while the
power well is disabled, and make to re-program MSR after enabling the
power well and before using VGA I/O or memory accesses.".

Notice that this is just a partial fix to fd.o #67813. This fixes the
case where the power well is already enabled when we unbind, not when
it's disabled when we unbind.

V2: - Rebase (first version was sent in September).
V3: - Complete rewrite of the same fix: smaller implementation,
      improved commit message.

Testcase: igt/drv_module_reload
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: extract hsw_power_well_post_{enable, disable}
Paulo Zanoni [Wed, 11 Dec 2013 20:50:09 +0000 (18:50 -0200)]
drm/i915: extract hsw_power_well_post_{enable, disable}

I want to add more code to the post_enable function.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: remove i915_disable_vga_mem declaration
Paulo Zanoni [Wed, 11 Dec 2013 20:50:08 +0000 (18:50 -0200)]
drm/i915: remove i915_disable_vga_mem declaration

It was supposed to have been killed on the same commit that killed the
function, e1264ebe9ff48e1b3e1dd11805eec9f5b143ab7c, but I guess the
intel_drv.h reorganization accidentally brought it back.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Parametrize the dphy and other spec specific parameters
Shobhit Kumar [Tue, 10 Dec 2013 06:45:00 +0000 (12:15 +0530)]
drm/i915: Parametrize the dphy and other spec specific parameters

The values of these parameters will be different for differnet panel
based on dsi rate, lane count, etc. Remove the hardcodings and make
these as parameters whch will be initialized in panel specific
sub-encoder implementaion.

This will also form groundwork for planned generic panel sub-encoder
implemntation based on VBT design enhancments to support multiple panels

v2: Mask away the port_bits before use

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Remove redundant DSI PLL enabling
Shobhit Kumar [Tue, 10 Dec 2013 06:44:59 +0000 (12:14 +0530)]
drm/i915: Remove redundant DSI PLL enabling

DSI PLL will get configured during crtc_enable using ->pre_pll_enable
and no need to do in ->mode_set

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Reorganize the DSI enable/disable sequence
Shobhit Kumar [Wed, 11 Dec 2013 12:22:05 +0000 (17:52 +0530)]
drm/i915: Reorganize the DSI enable/disable sequence

Basically ULPS handling during enable/disable has been moved to
pre_enable and post_disable phases. PLL and panel power disable
also has been moved to post_disable phase. The ULPS entry/exit
sequneces as suggested by HW team is as follows -

During enable time -
set DEVICE_READY --> Clear DEVICE_READY --> set DEVICE_READY

And during disable time to flush all FIFOs -
set ENTER_SLEEP --> EXIT_SLEEP --> ENTER_SLEEP

Also during disbale sequnece sub-encoder disable is moved to the end
after port is disabled.

v2: Based on comments from Ville
    - Detailed epxlaination in the commit messgae
    - Moved parameter changes out into another patch
    - Backlight enabling will be a new patch

v3: Updated as per Jani's comments
    - Removed the I915_WRITE_BITS as it is not needed
    - Moved panel_reset and send_otp_cmds hooks to dsi_pre_enable
    - Moved disable_panel_power hook to dsi_post_disable
    - Replace hardcoding with AFE_LATCHOUT

v4: Make intel_dsi_device_ready and intel_dsi_clear_device_ready static

Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Try harder to get best m, n, p values with minimal error
Shobhit Kumar [Tue, 10 Dec 2013 06:44:57 +0000 (12:14 +0530)]
drm/i915: Try harder to get best m, n, p values with minimal error

Basically check for both +ive and -ive deviation from target clock and
pick the one with minimal error. If we get a direct match, break from
loop to acheive some optimization.

v2: Use signed variable for target and calculated dsi clock values

Signed-off-by: Vijayakumar Balakrishnan <vijayakumar.balakrishnan@intel.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Compute dsi_clk from pixel clock
Shobhit Kumar [Tue, 10 Dec 2013 06:44:56 +0000 (12:14 +0530)]
drm/i915: Compute dsi_clk from pixel clock

Pixel clock based calculation is recommended in the MIPI host controller
documentation

v2: Based on review comments from Jani and Ville
    - Use dsi_clk in KHz rather than converting in Hz and back to MHz
    - RR formula is retained though not used but return dsi_clk in KHz now
    - Moved the m-n-p changes into a separate patch
    - Removed the parameter check for intel_dsi->dsi_clock_freq. This will be
      bought back in if needed when appropriate panel drivers are done

v3: Removed the unused mnp calculation from static table

Signed-off-by: Vijayakumar Balakrishnan <vijayakumar.balakrishnan@intel.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Use FLISDSI interface for band gap reset
Shobhit Kumar [Tue, 10 Dec 2013 06:44:55 +0000 (12:14 +0530)]
drm/i915: Use FLISDSI interface for band gap reset

v2: Rebased on latest code

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com>
Reviewed-by: Jani Nikula<jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Add more dev ops for MIPI sub encoder
Shobhit Kumar [Tue, 10 Dec 2013 06:44:54 +0000 (12:14 +0530)]
drm/i915: Add more dev ops for MIPI sub encoder

Some panels require one time programming if they do not contain their
own eeprom for basic register initialization. The sequence is

Panel Reset --> Send OTP --> Enable Pixel Stream --> Enable the panel

v2: Based on review comments from Jani and Ville
    - Updated the commit message with more details
    - Move the new parameters out of this patch

Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Decrease gen2 vco frequency minimum to 908 MHz
Ville Syrjälä [Mon, 9 Dec 2013 16:54:17 +0000 (18:54 +0200)]
drm/i915: Decrease gen2 vco frequency minimum to 908 MHz

On my 855 machine the BIOS uses the following DPLL settings:
DPLL 0x90016000
FP0 = 0x61207
FP1 = 0x21207

With the 66MHz SSC refclock, that puts the BIOS generated VCO
frequency at ~908 MHz, which is lower than the 930 MHz limit
we have currently. This also results in the pixel clock coming
out significantly higher than the requested 65 MHz when we try
to recompute it.

Reduce the the VCO limit to 908 MHz. Combined with the earlier
SSC reference clock accuracy fix, this results in the pixel clock
coming out as 65.08 MHz which is quite close to the target. For
some reason the BIOS uses 64.881 MHz, which isn't quite as close.

This makes kms_flip wf_vblank-ts-check pass for the first time
on this machine \o/

Cc: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Fix 66 MHz LVDS SSC freq for gen2
Ville Syrjälä [Mon, 9 Dec 2013 16:54:16 +0000 (18:54 +0200)]
drm/i915: Fix 66 MHz LVDS SSC freq for gen2

Store the SSC refclock frequency in kHz to get more accuracy. Currently
we're pretending that 66 MHz is ~66000 kHz, when in fact it is actually
~66667 kHz. By storing the less rounded kHz value we get a much better
accuracy for out pixel clock calculations.

Cc: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Increase gen2 vco frequency limit to 1512 MHz
Ville Syrjälä [Mon, 9 Dec 2013 16:54:15 +0000 (18:54 +0200)]
drm/i915: Increase gen2 vco frequency limit to 1512 MHz

Bruno Prémont has a 855 machine with a 1400x1050 LVDS screen.

The VBT mode is as follows:
0:"1400x1050" 0 108000 1400 1416 1528 1688 1050 1051 1054 1066 0x8 0xa

The BIOS uses the following DPLL settings:
DPLL = 0x90020000
FP0 = 0x2140e
FP1 = 0x21207

That puts the BIOS generated VCO frequency at 1512 MHz, which is
higher than the 1400 MHz limit we have currently.

Let's bump the VCO limit to 1512 MHz and see what happens.

Cc: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Change N divider minimum from 3 to 2 for gen2
Ville Syrjälä [Mon, 9 Dec 2013 16:54:14 +0000 (18:54 +0200)]
drm/i915: Change N divider minimum from 3 to 2 for gen2

Bruno Prémont has a 855 machine with a 1400x1050 LVDS screen.

The VBT mode is as follows:
0:"1400x1050" 0 108000 1400 1416 1528 1688 1050 1051 1054 1066 0x8 0xa

The BIOS uses the following DPLL settings:
DPLL = 0x90020000
FP0 = 0x2140e
FP1 = 0x21207

We can't generate that pixel clock currently as we're limiting the N
divider to at least 3, whereas the BIOS uses a value of 2.

Let's reduce the N minimum to 2 and see what happens.

Cc: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Extract p2 divider correctly for gen2 LVDS dual channel
Ville Syrjälä [Mon, 9 Dec 2013 16:54:13 +0000 (18:54 +0200)]
drm/i915: Extract p2 divider correctly for gen2 LVDS dual channel

In order to determine the correct p2 divider for LVDS on gen2,
we need to check the CLKB mode from the LVDS port register to
determine if we're dealing with single or dual channel LVDS.

Cc: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Record BB_ADDR for every ring
Ville Syrjälä [Tue, 10 Dec 2013 19:44:43 +0000 (21:44 +0200)]
drm/i915: Record BB_ADDR for every ring

Every ring seems to have a BB_ADDR registers, so include them all in the
error state.

v2: Also include the _UDW on BDW

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Use 32bit read for BB_ADDR
Ville Syrjälä [Tue, 10 Dec 2013 18:47:44 +0000 (20:47 +0200)]
drm/i915: Use 32bit read for BB_ADDR

The BB_ADDR register is documented to be 32bits at least since SNB.
Prior to that the high 32bits were listed as MBZ, so using a 64bit read
doesn't seem worth anything. Also the simulator doesn't like the 64bit
read. So just switch to using a 32bit read instead.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: fix VDD override off wait
Paulo Zanoni [Fri, 6 Dec 2013 19:32:42 +0000 (17:32 -0200)]
drm/i915: fix VDD override off wait

If we're disabling the VDD override bit and the panel is enabled, we
don't need to wait for anything. If the panel is disabled, then we
need to actually wait for panel_power_cycle_delay, not
panel_power_down_delay, because the power down delay was already
respected when we disabled the panel.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: don't touch the VDD when disabling the panel
Paulo Zanoni [Fri, 6 Dec 2013 19:32:41 +0000 (17:32 -0200)]
drm/i915: don't touch the VDD when disabling the panel

I don't see a reason to touch VDD when we're disabling the panel:
since the panel is enabled, we don't need VDD. This saves a few sleep
calls from the vdd_on and vdd_off functions at every modeset.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69693
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
[danvet: Fix the patch mangle wiggle has done ... Spotted by Paulo.
Also drop the runtime_pm_put call which now has to go due to different
patch ordering. Also from Paul.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: don't enable VDD just to enable the panel
Paulo Zanoni [Fri, 6 Dec 2013 19:32:40 +0000 (17:32 -0200)]
drm/i915: don't enable VDD just to enable the panel

We just don't need this. This saves 250ms from every modeset on my
machine.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: add runtime PM support on Haswell
Paulo Zanoni [Thu, 21 Nov 2013 15:47:28 +0000 (13:47 -0200)]
drm/i915: add runtime PM support on Haswell

The code to enable/disable PC8 already takes care of saving and
restoring all the registers we need to save/restore, so do a put()
call when we enable PC8 and a get() call when we disable it.

Ideally, in order to make it easier to add runtime PM support to other
platforms, we should move some things from the PC8 code to the runtime
PM code, but let's do this later, since we can make Haswell work right
now.

V2: - Rebase

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[danvet: Don't actually enable runtime pm since I didn't merge all
patches.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: disable interrupts when enabling PC8
Paulo Zanoni [Thu, 21 Nov 2013 15:47:25 +0000 (13:47 -0200)]
drm/i915: disable interrupts when enabling PC8

The plan is to merge PC8 and D3 into a single feature, and when we're
in D3 we won't get any hotplug interrupt anyway, so leaving them
enable doesn't make sense, and it also brings us a problem. The
problem is that we get a hotplug interrupt right when we we wake up
from D3, when we're still waking up everything. If we fully disable
interrupts we won't get this hotplug interrupt, so we won't have
problems.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: do not assert DE_PCH_EVENT_IVB enabled
Paulo Zanoni [Thu, 21 Nov 2013 15:47:24 +0000 (13:47 -0200)]
drm/i915: do not assert DE_PCH_EVENT_IVB enabled

The current code was checking if all bits of "val" were enabled and
DE_PCH_EVENT_IVB was disabled. The new code doesn't care about the
state of DE_PCH_EVENT_IVB: it just checks if everything else is 1.

The goal is that future patches may completely disable interrupts, and
the LCPLL-disabling code shouldn't care about the state of
DE_PCH_EVENT_IVB.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[danvet: I think the commit message is actually wrong in it's
description of what the old test checked, but the new one seems sane.
So meh.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: get a runtime PM reference when the panel VDD is on
Paulo Zanoni [Thu, 21 Nov 2013 15:47:23 +0000 (13:47 -0200)]
drm/i915: get a runtime PM reference when the panel VDD is on

And put it when it's off. Otherwise, when you run pm_pc8 from
intel-gpu-tools, and the delayed function that disables VDD runs,
we'll get some messages saying we're touching registers while the HW
is suspended.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: add some runtime PM get/put calls
Paulo Zanoni [Wed, 27 Nov 2013 20:21:54 +0000 (18:21 -0200)]
drm/i915: add some runtime PM get/put calls

These are needed when we cat the debugfs and sysfs files.

V2: - Rebase
V3: - Rebase
V4: - Rebase

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: add runtime put/get calls at the basic places
Paulo Zanoni [Wed, 27 Nov 2013 20:20:34 +0000 (18:20 -0200)]
drm/i915: add runtime put/get calls at the basic places

If I add code to enable runtime PM on my Haswell machine, start a
desktop environment, then enable runtime PM, these functions will
complain that they're trying to read/write registers while the
graphics card is suspended.

v2: - Simplify i915_gem_fault changes.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[danvet: Drop the hunk in i915_hangcheck_elapsed, it's the wrong thing
to do.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: do adapter power state notification at runtime PM
Paulo Zanoni [Fri, 6 Dec 2013 22:34:21 +0000 (20:34 -0200)]
drm/i915: do adapter power state notification at runtime PM

Now that we are actually setting the device to the D3 state, we should
issue the notification.

The opregion spec says we should send the message before the adapter
is about to be placed in a lower power state, and after the adapter is
placed in a higher power state.

Jani originally wrote a similar patch for PC8, but then we discovered
that we were not really changing the PCI D states when
enabling/disabling PC8, so we had to postpone his patch.

v2: - Improve commit message, explaining the expected state.

v3: - Rebase.

Cc: Jani Nikula <jani.nikula@intel.com>
Credits-to: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> (v2)
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: add initial Runtime PM functions
Paulo Zanoni [Fri, 6 Dec 2013 22:32:13 +0000 (20:32 -0200)]
drm/i915: add initial Runtime PM functions

This patch adds the initial infrastructure to allow a Runtime PM
implementation that sets the device to its D3 state. The patch just
adds the necessary callbacks and the initial infrastructure.

We still don't have any platform that actually uses this
infrastructure, we still don't call get/put in all the places we need
to, and we don't have any function to save/restore the state of the
registers. This is not a problem since no platform uses the code added
by this patch. We have a few people simultaneously working on runtime
PM, so this initial code could help everybody make their plans.

V2: - Move some functions to intel_pm.c
    - Remove useless pm_runtime_allow() call at init
    - Remove useless pm_runtime_mark_last_busy() call at get
    - Use pm_runtime_get_sync() instead of 2 calls
    - Add a WARN to check if we're really awake

V3: - Rebase.

V4: - Don't need to call pci_{save,restore}_state and
      pci_set_power_sate, since they're already called by the PCI
      layer
    - Remove wrong pm_runtime_enable() call at init_runtime_pm

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: get a PC8 reference when enabling the power well
Paulo Zanoni [Wed, 27 Nov 2013 19:59:22 +0000 (17:59 -0200)]
drm/i915: get a PC8 reference when enabling the power well

In the current code, at haswell_modeset_global_resources, first we
decide if we want to enable/disable the power well, then we decide if
we want to enable/disable PC8. On the case where we're enabling PC8
this works fine, but on the case where we disable PC8 due to a non-eDP
monitor being enabled, we first enable the power well and then disable
PC8. Although wrong, this doesn't seem to be causing any problems now,
and we don't even see anything in dmesg. But the patches for runtime
D3 turn this problem into a real bug, so we need to fix it.

This fixes the "modeset-non-lpsp" subtest from the "pm_pc8" test from
intel-gpu-tools.

v2: - Rebase (i915_disable_power_well).
v3: - More reabase.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: WARN if !HAS_PC8 when enabling/disabling PC8
Paulo Zanoni [Thu, 21 Nov 2013 15:47:15 +0000 (13:47 -0200)]
drm/i915: WARN if !HAS_PC8 when enabling/disabling PC8

We already have some checks and shouldn't be reaching these places on
!HAS_PC8 platforms, but add a WARN,  just in case.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Move VLV PHY CRI clock enable into intel_init_dpio()
Ville Syrjälä [Tue, 10 Dec 2013 12:06:45 +0000 (14:06 +0200)]
drm/i915: Move VLV PHY CRI clock enable into intel_init_dpio()

The CRI clock is related to the display PHY, so the setup belongs
in intel_init_dpio().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Don't cast away const from infoframe buffer
Ville Syrjälä [Tue, 10 Dec 2013 13:19:08 +0000 (15:19 +0200)]
drm/i915: Don't cast away const from infoframe buffer

We don't modify the packed infoframe data, so we should keep the
const qualifier in place. Just pass the buffer as 'const void *'
instead of 'const uint8_t *' and we can drop the cast entirely.

v2: Do intel_sdvo_write_infoframe() as well

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Make downclock deduction common for all panels
Vandana Kannan [Tue, 10 Dec 2013 08:07:36 +0000 (13:37 +0530)]
drm/i915: Make downclock deduction common for all panels

If one mode of a internal panel has more than one refresh rate, then a reduced
clock is found for the LFP (LVDS/eDP). This enables switching between low
and high frequency dynamically. Moving downclock calculation to intel_panel
so that it is common for LVDS and eDP.

Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
Signed-off-by: Pradeep Bhat <pradeep.bhat@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Remove duplicate intel_uncore_forcewake_reset.
Deepak S [Sun, 8 Dec 2013 08:22:59 +0000 (13:52 +0530)]
drm/i915: Remove duplicate intel_uncore_forcewake_reset.

Since early sanitize and uncore sanitize are called one after the other,
I think, we can remove second forcewake reset which was are calling
twice in both the functions.

Note that this is merge fallout between

commit ef46e0d247da0a7a408573aa15870e231bbd4af2
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sat Nov 16 16:00:09 2013 +0100

    drm/i915: restore the early forcewake cleanup

and

commit 521198a2e7095c8c7daa8d7d3a76a110c346be6f
Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Date:   Fri Aug 23 16:52:30 2013 +0300

    drm/i915: sanitize forcewake registers on reset

Signed-off-by: Deepak S <deepak.s@intel.com>
[danvet: Explain how this came to be.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoMerge tag 'v3.13-rc3' into drm-intel-next-queued
Daniel Vetter [Mon, 9 Dec 2013 08:17:02 +0000 (09:17 +0100)]
Merge tag 'v3.13-rc3' into drm-intel-next-queued

Linux 3.13-rc3

I need a backmerge for two reasons:
- For merging the ppgtt patches from Ben I need to pull in the bdw
  support.
- We now have duplicated calls to intel_uncore_forcewake_reset in the
  setup code to due 2 different patches merged into -next and 3.13.
  The conflict is silen so I need the merge to be able to apply
  Deepak's fixup patch.

Conflicts:
drivers/gpu/drm/i915/intel_display.c

Trivial conflict, it doesn't even show up in the merge diff.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: change CRTC assertion on LCPLL disable
Paulo Zanoni [Fri, 6 Dec 2013 22:29:01 +0000 (20:29 -0200)]
drm/i915: change CRTC assertion on LCPLL disable

Currently, PC8 is enabled at modeset_global_resources, which is called
after intel_modeset_update_state. Due to this, there's a small race
condition on the case where we start enabling PC8, then do a modeset
while PC8 is still being enabled. The racing condition triggers a WARN
because intel_modeset_update_state will mark the CRTC as enabled, then
the thread that's still enabling PC8 might look at the data structure
and think that PC8 is being enabled while a pipe is enabled. Despite
the WARN, this is not really a bug since we'll wait for the
PC8-enabling thread to finish when we call modeset_global_resources.

The spec says the CRTC cannot be enabled when we disable LCPLL, so we
had a check for crtc->base.enabled. If we change to crtc->active we
will still prevent disabling LCPLL while the CRTC is enabled, and we
will also prevent the WARN above.

This is a replacement for the previous patch named
    "drm/i915: get/put PC8 when we get/put a CRTC"

Testcase: igt/pm_pc8/modeset-lpsp-stress-no-wait
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoLinux 3.13-rc3 v3.13-rc3
Linus Torvalds [Fri, 6 Dec 2013 17:34:04 +0000 (09:34 -0800)]
Linux 3.13-rc3

10 years agoMerge tag 'trace-fixes-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 6 Dec 2013 16:34:16 +0000 (08:34 -0800)]
Merge tag 'trace-fixes-3.13-rc2' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing fix from Steven Rostedt:
 "A regression showed up that there's a large delay when enabling all
  events.  This was prevalent when FTRACE_SELFTEST was enabled which
  enables all events several times, and caused the system bootup to
  pause for over a minute.

  This was tracked down to an addition of a synchronize_sched()
  performed when system call tracepoints are unregistered.

  The synchronize_sched() is needed between the unregistering of the
  system call tracepoint and a deletion of a tracing instance buffer.
  But placing the synchronize_sched() in the unreg of *every* system
  call tracepoint is a bit overboard.  A single synchronize_sched()
  before the deletion of the instance is sufficient"

* tag 'trace-fixes-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Only run synchronize_sched() at instance deletion time

10 years agoMerge git://git.kvack.org/~bcrl/aio-next
Linus Torvalds [Fri, 6 Dec 2013 16:32:59 +0000 (08:32 -0800)]
Merge git://git.kvack.org/~bcrl/aio-next

Pull aio fix from Benjamin LaHaise:
 "AIO fix from Gu Zheng that fixes a GPF that Dave Jones uncovered with
  trinity"

* git://git.kvack.org/~bcrl/aio-next:
  aio: clean up aio ring in the fail path

10 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Fri, 6 Dec 2013 16:30:18 +0000 (08:30 -0800)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is a set of nine fixes (and one author update).

  The libsas one should fix discovery in eSATA devices, the WRITE_SAME
  one is the largest, but it should fix a lot of problems we've been
  getting with the emulated RAID devices (they've been effectively lying
  about support and then firmware has been choking on the commands).

  The rest are various crash, hang or warn driver fixes"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  [SCSI] bfa: Fix crash when symb name set for offline vport
  [SCSI] enclosure: fix WARN_ON in dual path device removing
  [SCSI] pm80xx: Tasklets synchronization fix.
  [SCSI] pm80xx: Resetting the phy state.
  [SCSI] pm80xx: Fix for direct attached device.
  [SCSI] pm80xx: Module author addition
  [SCSI] hpsa: return 0 from driver probe function on success, not 1
  [SCSI] hpsa: do not discard scsi status on aborted commands
  [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers
  [SCSI] libsas: fix usage of ata_tf_to_fis

10 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Fri, 6 Dec 2013 16:28:35 +0000 (08:28 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jmorris/linux-security

Pull IMA fixes from James Morris:
 "Here are two more fixes for IMA"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  ima: properly free ima_template_entry structures
  ima: Do not free 'entry' before it is initialized

10 years agoMerge tag 'dt-fixes-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh...
Linus Torvalds [Fri, 6 Dec 2013 16:27:47 +0000 (08:27 -0800)]
Merge tag 'dt-fixes-for-3.13' of git://git./linux/kernel/git/robh/linux

Pull devicetree fixes from Rob Herring:
 - Various DT binding documentation updates
 - Add Kumar Gala and remove Stephen Warren as DT binding maintainers

* tag 'dt-fixes-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  dt: binding: reword PowerPC 8xxx GPIO documentation
  ARM: tegra: delete nvidia,tegra20-spi.txt binding
  hwmon: ntc_thermistor: Fix typo (pullup-uV -> pullup-uv)
  of: add vendor prefix for GMT
  clk: exynos: Fix typos in DT bindings documentation
  of: Add vendor prefix for LG Corporation
  Documentation: net: fsl-fec.txt: Add phy-supply entry
  ARM: dts: doc: Document missing binding for omap5-mpu
  dt-bindings: add ARMv8 PMU binding
  MAINTAINERS: remove swarren from DT bindings
  MAINTAINERS: Add Kumar to Device Tree Binding maintainers group

10 years agoaio: clean up aio ring in the fail path
Gu Zheng [Wed, 4 Dec 2013 10:19:06 +0000 (18:19 +0800)]
aio: clean up aio ring in the fail path

Clean up the aio ring file in the fail path of aio_setup_ring
and ioctx_alloc. And maybe it can fix the GPF issue reported by
Dave Jones:
https://lkml.org/lkml/2013/11/25/898

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
10 years agoMerge branch 'free-memory' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar...
James Morris [Fri, 6 Dec 2013 14:21:02 +0000 (01:21 +1100)]
Merge branch 'free-memory' of git://git./linux/kernel/git/zohar/linux-integrity into for-linus

10 years agoMerge tag 'pm-3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Linus Torvalds [Fri, 6 Dec 2013 02:26:40 +0000 (18:26 -0800)]
Merge tag 'pm-3.13-rc3' of git://git./linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:

 - cpufreq regression fix from Bjørn Mork restoring the pre-3.12
   behavior of the framework during system suspend/hibernation to avoid
   garbage sysfs files from being left behind in case of a suspend error

 - PNP regression fix to restore the correct states of devices after
   resume from hibernation broken in 3.12.  From Dmitry Torokhov.

 - cpuidle fix to prevent cpuidle device unregistration from crashing
   due to a NULL pointer dereference if cpuidle has been disabled from
   the kernel command line.  From Konrad Rzeszutek Wilk.

 - intel_idle fix for the C6 state definition on Intel Avoton/Rangeley
   processors from Arne Bockholdt.

 - Power capping framework fix to make the energy_uj sysfs attribute
   work in accordance with the documentation.  From Srinivas Pandruvada.

 - epoll fix to make it ignore the EPOLLWAKEUP flag if the kernel has
   been compiled with CONFIG_PM_SLEEP unset (in which case that flag
   should not have any effect).  From Amit Pundir.

 - cpufreq fix to prevent governor sysfs files from being lost over
   system suspend/resume in some (arguably unusual) situations.  From
   Viresh Kumar.

* tag 'pm-3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PowerCap: Fix mode for energy counter
  PNP: fix restoring devices after hibernation
  cpuidle: Check for dev before deregistering it.
  epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled
  cpufreq: fix garbage kobjects on errors during suspend/resume
  cpufreq: suspend governors on system suspend/hibernate
  intel_idle: Fixed C6 state on Avoton/Rangeley processors

10 years agoMerge branches 'pm-epoll', 'pnp' and 'powercap'
Rafael J. Wysocki [Fri, 6 Dec 2013 01:18:28 +0000 (02:18 +0100)]
Merge branches 'pm-epoll', 'pnp' and 'powercap'

* pm-epoll:
  epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled

* pnp:
  PNP: fix restoring devices after hibernation

* powercap:
  PowerCap: Fix mode for energy counter

10 years agoMerge branches 'pm-cpuidle' and 'pm-cpufreq'
Rafael J. Wysocki [Fri, 6 Dec 2013 01:17:59 +0000 (02:17 +0100)]
Merge branches 'pm-cpuidle' and 'pm-cpufreq'

* pm-cpuidle:
  cpuidle: Check for dev before deregistering it.
  intel_idle: Fixed C6 state on Avoton/Rangeley processors

* pm-cpufreq:
  cpufreq: fix garbage kobjects on errors during suspend/resume
  cpufreq: suspend governors on system suspend/hibernate

10 years agoMerge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
Linus Torvalds [Thu, 5 Dec 2013 23:37:44 +0000 (15:37 -0800)]
Merge branch 'stable' of git://git./linux/kernel/git/cmetcalf/linux-tile

Pull arch/tile ftrace bug fix from Chris Metcalf:
 "This fixes a build failure with allyesconfig reported by Fengguang Wu
  and fixed by Tony Lu"

* 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
  ftrace: default to tilegx if ARCH=tile is specified

10 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Thu, 5 Dec 2013 23:33:27 +0000 (15:33 -0800)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block layer fixes from Jens Axboe:
 "A small collection of fixes for the current series. It contains:

   - A fix for a use-after-free of a request in blk-mq.  From Ming Lei

   - A fix for a blk-mq bug that could attempt to dereference a NULL rq
     if allocation failed

   - Two xen-blkfront small fixes

   - Cleanup of submit_bio_wait() type uses in the kernel, unifying
     that.  From Kent

   - A fix for 32-bit blkg_rwstat reading.  I apologize for this one
     looking mangled in the shortlog, it's entirely my fault for missing
     an empty line between the description and body of the text"

* 'for-linus' of git://git.kernel.dk/linux-block:
  blk-mq: fix use-after-free of request
  blk-mq: fix dereference of rq->mq_ctx if allocation fails
  block: xen-blkfront: Fix possible NULL ptr dereference
  xen-blkfront: Silence pfn maybe-uninitialized warning
  block: submit_bio_wait() conversions
  Update of blkg_stat and blkg_rwstat may happen in bh context

10 years agoMerge tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Linus Torvalds [Thu, 5 Dec 2013 21:05:48 +0000 (13:05 -0800)]
Merge tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
 - Stable fix for a NFSv4.1 delegation and state recovery deadlock
 - Stable fix for a loop on irrecoverable errors when returning
   delegations
 - Fix a 3-way deadlock between layoutreturn, open, and state recovery
 - Update the MAINTAINERS file with contact information for Trond
   Myklebust
 - Close needs to handle NFS4ERR_ADMIN_REVOKED
 - Enabling v4.2 should not recompile nfsd and lockd
 - Fix a couple of compile warnings

* tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  nfs: fix do_div() warning by instead using sector_div()
  MAINTAINERS: Update contact information for Trond Myklebust
  NFSv4.1: Prevent a 3-way deadlock between layoutreturn, open and state recovery
  SUNRPC: do not fail gss proc NULL calls with EACCES
  NFSv4: close needs to handle NFS4ERR_ADMIN_REVOKED
  NFSv4: Update list of irrecoverable errors on DELEGRETURN
  NFSv4 wait on recovery for async session errors
  NFS: Fix a warning in nfs_setsecurity
  NFS: Enabling v4.2 should not recompile nfsd and lockd

10 years agoftrace: default to tilegx if ARCH=tile is specified
Tony Lu [Thu, 5 Dec 2013 20:36:54 +0000 (15:36 -0500)]
ftrace: default to tilegx if ARCH=tile is specified

This matches the existing behavior in arch/tile/Makefile for defconfig.

Reported-by: fengguang.wu@intel.com
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Tony Lu <zlu@tilera.com>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
10 years agotracing: Only run synchronize_sched() at instance deletion time
Steven Rostedt [Tue, 3 Dec 2013 17:41:20 +0000 (12:41 -0500)]
tracing: Only run synchronize_sched() at instance deletion time

It has been reported that boot up with FTRACE_SELFTEST enabled can take a
very long time. There can be stalls of over a minute.

This was tracked down to the synchronize_sched() called when a system call
event is disabled. As the self tests enable and disable thousands of events,
this makes the synchronize_sched() get called thousands of times.

The synchornize_sched() was added with d562aff93bfb53 "tracing: Add support
for SOFT_DISABLE to syscall events" which caused this regression (added
in 3.13-rc1).

The synchronize_sched() is to protect against the events being accessed
when a tracer instance is being deleted. When an instance is being deleted
all the events associated to it are unregistered. The synchronize_sched()
makes sure that no more users are running when it finishes.

Instead of calling synchronize_sched() for all syscall events, we only
need to call it once, after the events are unregistered and before the
instance is deleted. The event_mutex is held during this action to
prevent new users from enabling events.

Link: http://lkml.kernel.org/r/20131203124120.427b9661@gandalf.local.home
Reported-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Acked-by: Petr Mladek <pmladek@suse.cz>
Tested-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
10 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
Linus Torvalds [Thu, 5 Dec 2013 18:48:40 +0000 (10:48 -0800)]
Merge tag 'for-linus' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs MAINTAINERS file update:
 "I'm still getting settled into new devel hardware etc, but I do have
  one commit for the next rc.

  This changes my email over to fb.com, and adds a MAINTAINERS entry for
  Josef as well"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: update the MAINTAINERS file

10 years agoMerge tag 'fbdev-fixes-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba...
Linus Torvalds [Thu, 5 Dec 2013 17:55:20 +0000 (09:55 -0800)]
Merge tag 'fbdev-fixes-3.13' of git://git./linux/kernel/git/tomba/linux

Pull minor fbdev fixes from Tomi Valkeinen.

* tag 'fbdev-fixes-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  video: vt8500: fix error handling in probe()
  atmel_lcdfb: fix module autoload
  fbdev: sh_mobile_meram: Fix defined but not used compiler warnings
  video: kyro: fix incorrect sizes when copying to userspace
  ARM: OMAPFB: panel-sony-acx565akm: fix bad unlock balance

10 years agoMerge tag 'sound-3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
Linus Torvalds [Thu, 5 Dec 2013 17:54:35 +0000 (09:54 -0800)]
Merge tag 'sound-3.13-rc3' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A usual pattern of half ASoC and half HD-audio fixes, although
  HD-audio fixups have more volumes, in addition to a couple of trivial
  fixes.  Nothing to worry much is found here.

  For ASoC side: a few fixes for PCM rate constraints calculations,
  regmap byte-order fix, the rest driver specific fixes (atmel, fsl,
  omap, kirkwood, wm codecs).

  For HD-audio: Dell headset and mono out fix, ELD update in polling
  mode, ALC283 Chromebook fixes, a few fixes for old AD codecs and
  MBA2, one regression fix"

* tag 'sound-3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (30 commits)
  ALSA: hda - Fix silent output on MacBook Air 2,1
  ALSA: hda - Fix missing ELD info when using jackpoll_ms parameter
  ALSA: hda/realtek - remove hp_automute_hook from alc283_fixup_chromebook
  ASoC: wm8731: fix dsp mode configuration
  ALSA: hda/realtek - Independent of model for HP
  ALSA: hda - Fix headset mic input after muted internal mic (Dell/Realtek)
  ALSA: hda - Use always amps for auto-mute on AD1986A codec
  ALSA: hda/analog - Handle inverted EAPD properly in vmaster hook
  ALSA: hda - Another fixup for ASUS laptop with ALC660 codec
  ALSA: atmel: Fix possible array overflow
  ALSA: hda - Fix complete_all() timing in deferred probes
  ALSA: hda - Fix bad EAPD setup for HP machines with AD1984A
  ASoC: core: fix devres parameter in devm_snd_soc_register_card()
  ASoC: omap: n810: Convert to clk_prepare_enable/clk_disable_unprepare
  ASoC: fsl: set correct platform drvdata in pcm030_fabric_probe()
  ASoC: fsl: imx-pcm-fiq: Remove unused 'runtime' variable
  ASoC: fsl: imx-pcm-fiq: remove bogus period delta calculation
  ALSA: hda - Fix silent output on ASUS W7J laptop
  ASoC: core: Use consistent byte ordering in snd_soc_bytes_get
  ALSA: dice: fix array limits in dice_proc_read()
  ...

10 years agoMerge tag 'pinctrl-v3.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
Linus Torvalds [Thu, 5 Dec 2013 17:53:59 +0000 (09:53 -0800)]
Merge tag 'pinctrl-v3.13-2' of git://git./linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:

 - Minor bug fixes for the Rockchip, ST-Ericsson abx500, Renesas PFC
   r8a7740 and sh7372.

 - Compilation warning fixes.

* tag 'pinctrl-v3.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  sh-pfc: sh7372: Fix pin bias setup
  sh-pfc: r8a7740: Fix pin bias setup
  pinctrl: abx500: Fix header file include guard
  pinctrl: rockchip: missing unlock on error in rockchip_set_pull()
  pinctrl: abx500: fix some more bitwise AND tests
  pinctrl: rockchip: testing the wrong variable

10 years agoblk-mq: fix use-after-free of request
Ming Lei [Thu, 5 Dec 2013 17:50:39 +0000 (10:50 -0700)]
blk-mq: fix use-after-free of request

If accounting is on, we will do the IO completion accounting after
we have freed the request. Fix that by moving it sooner instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
10 years agodrm/i915: Do hw quiescing first during unload
Chris Wilson [Mon, 2 Dec 2013 13:26:07 +0000 (11:26 -0200)]
drm/i915: Do hw quiescing first during unload

If we force the hw to idle as our first step during unload, we can abort
the unload upon failure. Later we can probe whether the hardware remain
active even after we try to shut it down.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoMerge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Linus Torvalds [Thu, 5 Dec 2013 05:45:21 +0000 (21:45 -0800)]
Merge branch 'x86/urgent' of git://git./linux/kernel/git/tip/tip

Pull x86 and EFI fixes from Peter Anvin:
 "Half of these are EFI-related:

  The by far biggest change is the change to hold off the deletion of a
  sysfs entry while a backend scan is in progress.  This is to avoid
  calling kmemdup() while under a spinlock.

  The other major change is for each entry in the EFI pstore backend to
  get a unique identifier, as required by the pstore filesystem proper.

  The other changes are:

  A fix to the recent consolidation and optimization of using "asm goto"
  with read-modify-write operation, which broke the bitops; specifically
  in such a way that we could end up generating invalid code.

  A build hack to make sure we compile with -mno-sse.  icc, and most
  likely future versions of gcc, can generate SSE instructions unless we
  tell it not to.

  A comment-only patch to a change the was due in part to an unpublished
  erratum; now when the erratum is published we want to add a comment
  explaining why"

* 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apic, doc: Justification for disabling IO APIC before Local APIC
  x86, bitops: Correct the assembly constraints to testing bitops
  x86-64, build: Always pass in -mno-sse
  efi-pstore: Make efi-pstore return a unique id
  x86/efi: Fix earlyprintk off-by-one bug
  efivars, efi-pstore: Hold off deletion of sysfs entry until the scan is completed

10 years agox86/apic, doc: Justification for disabling IO APIC before Local APIC
Fenghua Yu [Thu, 5 Dec 2013 00:07:49 +0000 (16:07 -0800)]
x86/apic, doc: Justification for disabling IO APIC before Local APIC

Since erratum AVR31 in "Intel Atom Processor C2000 Product Family
Specification Update" is now published, I added a justification
comment for disabling IO APIC before Local APIC, as changed in commit:

522e66464467 x86/apic: Disable I/O APIC before shutdown of the local APIC

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Link: http://lkml.kernel.org/r/1386202069-51515-1-git-send-email-fenghua.yu@intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
10 years agoPowerCap: Fix mode for energy counter
Srinivas Pandruvada [Wed, 4 Dec 2013 19:12:59 +0000 (11:12 -0800)]
PowerCap: Fix mode for energy counter

As per the documentation of powercap sysfs, energy_uj field is read only,
if it can't be reset. Currently it always allows write but will fail,
if there is no reset callback.
Changing mode field, to read only if there is no reset callback.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
10 years agoPNP: fix restoring devices after hibernation
Dmitry Torokhov [Thu, 5 Dec 2013 01:01:55 +0000 (02:01 +0100)]
PNP: fix restoring devices after hibernation

On returning from hibernation 'restore' callback is called,
not 'resume'.  Fix it.

Fixes: eaf140b60ec9 (PNP: convert PNP driver bus legacy pm_ops to dev_pm_ops)
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: 3.12+ <stable@vger.kernel.org> # 3.12+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
10 years agox86, bitops: Correct the assembly constraints to testing bitops
H. Peter Anvin [Wed, 4 Dec 2013 22:31:28 +0000 (14:31 -0800)]
x86, bitops: Correct the assembly constraints to testing bitops

In checkin:

0c44c2d0f459 x86: Use asm goto to implement better modify_and_test() functions

the various functions which do modify and test were unified and
optimized using "asm goto".  However, this change missed the detail
that the bitops require an "Ir" constraint rather than an "er"
constraint ("I" = integer constant from 0-31, "e" = signed 32-bit
integer constant).  This would cause code to miscompile if these
functions were used on constant bit positions 32-255 and the build to
fail if used on constant bit positions above 255.

Add the constraints as a parameter to the GEN_BINARY_RMWcc() macro to
avoid this problem.

Reported-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/529E8719.4070202@zytor.com
10 years agonfs: fix do_div() warning by instead using sector_div()
Helge Deller [Mon, 2 Dec 2013 18:59:31 +0000 (19:59 +0100)]
nfs: fix do_div() warning by instead using sector_div()

When compiling a 32bit kernel with CONFIG_LBDAF=n the compiler complains like
shown below.  Fix this warning by instead using sector_div() which is provided
by the kernel.h header file.

fs/nfs/blocklayout/extents.c: In function ‘normalize’:
include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
fs/nfs/blocklayout/extents.c:47:13: note: in expansion of macro ‘do_div’
nfs/blocklayout/extents.c:47:2: warning: right shift count >= width of type [enabled by default]
fs/nfs/blocklayout/extents.c:47:2: warning: passing argument 1 of ‘__div64_32’ from incompatible pointer type [enabled by default]
include/asm-generic/div64.h:35:17: note: expected ‘uint64_t *’ but argument is of type ‘sector_t *’
 extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
10 years agoMAINTAINERS: Update contact information for Trond Myklebust
Trond Myklebust [Wed, 4 Dec 2013 17:29:49 +0000 (12:29 -0500)]
MAINTAINERS: Update contact information for Trond Myklebust

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
10 years agoNFSv4.1: Prevent a 3-way deadlock between layoutreturn, open and state recovery
Trond Myklebust [Wed, 4 Dec 2013 17:09:45 +0000 (12:09 -0500)]
NFSv4.1: Prevent a 3-way deadlock between layoutreturn, open and state recovery

Andy Adamson reports:

The state manager is recovering expired state and recovery OPENs are being
processed. If kswapd is pruning inodes at the same time, a deadlock can occur
when kswapd calls evict_inode on an NFSv4.1 inode with a layout, and the
resultant layoutreturn gets an error that the state mangager is to handle,
causing the layoutreturn to wait on the (NFS client) cl_rpcwaitq.

At the same time an open is waiting for the inode deletion to complete in
__wait_on_freeing_inode.

If the open is either the open called by the state manager, or an open from
the same open owner that is holding the NFSv4 sequence id which causes the
OPEN from the state manager to wait for the sequence id on the Seqid_waitqueue,
then the state is deadlocked with kswapd.

The fix is simply to have layoutreturn ignore all errors except NFS4ERR_DELAY.
We already know that layouts are dropped on all server reboots, and that
it has to be coded to deal with the "forgetful client model" that doesn't
send layoutreturns.

Reported-by: Andy Adamson <andros@netapp.com>
Link: http://lkml.kernel.org/r/1385402270-14284-1-git-send-email-andros@netapp.com
Signed-off-by: Trond Myklebust <Trond.Myklebust@primarydata.com>
10 years agoMerge tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
Linus Torvalds [Wed, 4 Dec 2013 16:59:33 +0000 (08:59 -0800)]
Merge tag 'gpio-v3.13-3' of git://git./linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "Here are a few more GPIO patches, we're a bit noisy for being the GPIO
  subsystem, mostly due to the new descriptor API, but all is getting
  into shape.

   - Fix compile warnings

   - Fix overly talkative diagnostic messages from usual use cases wrt
     GPIO descriptors

   - Add a documentation 00-INDEX

   - Use platform GPIOs as fallback when ACPI or device tree is used as
     the primary means to get GPIO lines

   - A bug fix for the MPC8572/MPC8536 fixing erroneous input data"

* tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpiolib: change a warning to debug message when failing to get gpio
  powerpc/gpio: Fix the wrong GPIO input data on MPC8572/MPC8536
  gpiolib: use platform GPIO mappings as fallback
  Documentation: gpiolib: add 00-INDEX file
  gpiolib: fix lookup of platform-mapped GPIOs
  gpiolib: add missing declarations

10 years agoMerge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
Linus Torvalds [Wed, 4 Dec 2013 16:56:18 +0000 (08:56 -0800)]
Merge tag 'fixes-for-linus' of git://git./linux/kernel/git/arm/arm-soc

Pull ARM SoC fixes from Olof Johansson:
 "Another batch of fixes for ARM SoCs for 3.13.  The diffstat is large,
  mostly because of:

   - Another set of fixes to fix regressions caused by moving OMAP from
     board files to DT.  Tony thinks this was the last major set of
     fixes, with maybe just a few small patches to follow.
   - More fixes for Marvell platforms, most dealing with misdescribed
     PCIe hardware, i.e.  incorrect number of busses on some SoCs, etc.
     The line delta adds up due to various ranges moving around when
     this is fixed.

  But there's also:

   - Some smaller tweaks to defconfigs to make more boards bootable in
     my test setup for better coverage.
   - There are also a few other smaller fixes, a short series for at91,
     a couple of reverts for ux500, etc"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (39 commits)
  arm: dts: socfpga: Change some clocks of gate-clk type to perip-clk
  arm: socfpga: Enable ARM_TWD for socfpga
  ARM: multi_v7_defconfig: enable SDHCI_BCM_KONA and MMC_BLOCK_MINORS=16
  ARM: sunxi_defconfig: enable NFS, TMPFS, PRINTK_TIME and nfsroot support
  ARM: multi_v7_defconfig: enable network for BeagleBone Black
  ARM: dts: Fix the name of supplies for smsc911x shared by OMAP
  ARM: OMAP2+: Powerdomain: Fix unchecked dereference of arch_pwrdm
  ARM: dts: omap3-beagle: Add omap-twl4030 audio support
  ARM: dts: omap4-sdp: Fix pin muxing for wl12xx
  ARM: dts: omap4-panda-common: Fix pin muxing for wl12xx
  ARM: at91: fixed unresolved symbol "at91_pm_set_standby" when built without CONFIG_PM
  ARM: at91: add usart3 alias to dtsi
  ARM: at91: sama5d3: reduce TWI internal clock frequency
  mmc: omap: Fix I2C dependency and make driver usable with device tree
  mmc: omap: Fix DMA configuration to not rely on device id
  ARM: dts: omap3-beagle: Fix USB host on beagle boards (for 3.13)
  ARM: dts: omap3-igep0020: name twl4030 VPLL2 regulator as vdds_dsi
  ARM: dts: AM33XX IGEP0033: add USB support
  ARM: dts: AM33XX BASE0033: add 32KBit EEPROM support
  ARM: dts: AM33XX BASE0033: add pinmux and user led support
  ...

10 years agoMerge branch 'parisc-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Wed, 4 Dec 2013 16:54:36 +0000 (08:54 -0800)]
Merge branch 'parisc-3.13' of git://git./linux/kernel/git/deller/parisc-linux

Pull parsic updates from Helge Deller:
 - a fix for the mmap(MAP_FIXED|MAP_SHARED) syscall to the same address
   which was already given in a previous call (fixes locale-gen on
   debian)
 - change the memory layout of the kernel to avoid the need for the
   -mlong-calls compiler option (depends on commit 5ecbe3c3c690 -
   "kernel/extable: fix address-checks for core_kernel and init areas")
 - defconfig updates, e.g.  use the SIL680 driver instead of the SIIMAGE
   driver
 - add more parisc machine names to the machine database

* 'parisc-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: update 64bit defconfigs and use SIL680 instead of SIIMAGE driver
  parisc: remove CONFIG_MLONGCALLS=y from defconfigs
  parisc: fix kernel memory layout in vmlinux.ld.S
  parisc: use kernel_text_address() in unwind functions
  parisc: remove empty SERIAL_PORT_DFNS in serial.h
  parisc: add some more machine names to hardware database
  parisc: fix mmap(MAP_FIXED|MAP_SHARED) to already mmapped address

10 years agoMerge tag 'squashfs-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squas...
Linus Torvalds [Wed, 4 Dec 2013 16:54:00 +0000 (08:54 -0800)]
Merge tag 'squashfs-fixes' of git://git./linux/kernel/git/pkl/squashfs-next

Pull squashfs bugfix from Phillip Lougher:
 "Just a single bug fix to the new "directly decompress into the page
  cache" code"

* tag 'squashfs-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next:
  Squashfs: fix failure to unlock pages on decompress error

10 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Wed, 4 Dec 2013 16:53:09 +0000 (08:53 -0800)]
Merge git://git./linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
 "This push fixes a number of crashes triggered by a previous crypto
  self-test update.  It also fixes a build problem in the caam driver,
  as well as a concurrency issue in s390.

  Finally there is a pair of fixes to bugs in the crypto scatterwalk
  code and authenc that may lead to crashes"

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: testmgr - fix sglen in test_aead for case 'dst != src'
  crypto: talitos - fix aead sglen for case 'dst != src'
  crypto: caam - fix aead sglen for case 'dst != src'
  crypto: ccm - Fix handling of zero plaintext when computing mac
  crypto: s390 - Fix aes-xts parameter corruption
  crypto: talitos - corrrectly handle zero-length assoc data
  crypto: scatterwalk - Set the chain pointer indication bit
  crypto: authenc - Find proper IV address in ablkcipher callback
  crypto: caam - Add missing Job Ring include

10 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Wed, 4 Dec 2013 16:52:09 +0000 (08:52 -0800)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:

 - timekeeping: Cure a subtle drift issue on GENERIC_TIME_VSYSCALL_OLD

 - nohz: Make CONFIG_NO_HZ=n and nohz=off command line option behave the
   same way.  Fixes a long standing load accounting wreckage.

 - clocksource/ARM: Kconfig update to avoid ARM=n wreckage

 - clocksource/ARM: Fixlets for the AT91 and SH clocksource/clockevents

 - Trivial documentation update and kzalloc conversion from akpms pile

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  nohz: Fix another inconsistency between CONFIG_NO_HZ=n and nohz=off
  time: Fix 1ns/tick drift w/ GENERIC_TIME_VSYSCALL_OLD
  clocksource: arm_arch_timer: Hide eventstream Kconfig on non-ARM
  clocksource: sh_tmu: Add clk_prepare/unprepare support
  clocksource: sh_tmu: Release clock when sh_tmu_register() fails
  clocksource: sh_mtu2: Add clk_prepare/unprepare support
  clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails
  ARM: at91: rm9200: switch back to clockevents_config_and_register
  tick: Document tick_do_timer_cpu
  timer: Convert kmalloc_node(...GFP_ZERO...) to kzalloc_node(...)
  NOHZ: Check for nohz active instead of nohz enabled

10 years agoALSA: hda - Fix silent output on MacBook Air 2,1
Takashi Iwai [Wed, 4 Dec 2013 12:59:45 +0000 (13:59 +0100)]
ALSA: hda - Fix silent output on MacBook Air 2,1

MacBook Air 2,1 has a fairly different pin assignment from its brother
MBA 1,1, and yet another quirks are needed for pin 0x18 and 0x19,
similarly like what iMac 9,1 requires, in order to make the sound
working on it.

Reported-and-tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agodrm/i915: check context reset stats before relocations
Mika Kuoppala [Tue, 26 Nov 2013 14:14:33 +0000 (16:14 +0200)]
drm/i915: check context reset stats before relocations

Doing it early prevents moving and relocating objects in vain
for contexts that won't get any GPU time.

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoMerge tag 'asoc-v3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Wed, 4 Dec 2013 11:40:59 +0000 (12:40 +0100)]
Merge tag 'asoc-v3.13-rc2' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v3.13

A smattering of fixes here, some core ones for the rate combination
issues for things other than simple bitmasks, for readback of byte
controls and for updating the power of value muxes plus a bunch of
driver fixes of varying severity.

The warning fix in the i.MX FIQ driver is fixing a warning introduced
by a previous fix.

10 years agodrm/i915: Fix ordering of unbind vs unpin pages
Chris Wilson [Wed, 4 Dec 2013 09:59:09 +0000 (09:59 +0000)]
drm/i915: Fix ordering of unbind vs unpin pages

It is useful to assert that if the object is bound, then it must have
its pages pinned to prevent the shrinker from reaping its backing store.
This is even more useful with the introduction of real-ppgtt whereupon
we may have the object bound into several vma, with each instance
pinning the backing store. This assertion breaks down during unbind
where we unpinned the backing store before decoupling the vma binding.
This can be fixed with a trivial reording of the unbind sequence, which
reinforces the

   pin pages
   bind to vma
   ...
   unbind from vma
   unpin pages

concept.

v2: Bonus comment

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>