android-sdk/kernel-video.git
4 years agoEnable late-attach on IPU2 and DSP2 p-ti-linux-3.14.y-android-rvc rvc-2.0
Buddy Liong [Mon, 1 Aug 2016 18:34:49 +0000 (13:34 -0500)]
Enable late-attach on IPU2 and DSP2

Modifying dts file to add late attach for IPU2 and DSP2

Change-Id: Ic6f305511d72d9f2efd0494fced4a7c371cefb97
Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoEnable Robust RVC on IPU2 and DSP2
Buddy Liong [Mon, 1 Aug 2016 18:33:42 +0000 (13:33 -0500)]
Enable Robust RVC on IPU2 and DSP2

Modify the configuration to run Robust RVC on IPU2 and DSP2.
The configuration is without late-attach.

Change-Id: I00f186e7f35e37efe5e54dd9d819a7eec239550b
Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoUpdate memory reserve for Vision SDK 2.10
Buddy Liong [Mon, 1 Aug 2016 18:32:31 +0000 (13:32 -0500)]
Update memory reserve for Vision SDK 2.10

On Vision SDK 2.9, the NDK_START_ADDR is started at 0x85800000
NDK_MEM_SIZE + SR1_FRAME_BUFFER_SIZE is 2MB + 250MB = 252MB (0xFC00000)
So, it reserves the memory from 0x85800000 of size 0xFC00000

On Vision SDK 2.10, the NDK_START_ADDR is changed to start at
0x84000000 of size 0xFC00000

This change is needed due to the changes in
mem_segment_definition_1024mb_rvc.xs on Vision SDK 2.10

Change-Id: I34ef2ba9c78e378cd13259bbf5d297cfb9c6ffe8
Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoEnabling late-attach on dsp2 and ipu1 to get printout rvc-1.0
Buddy Liong [Mon, 1 Aug 2016 18:29:23 +0000 (13:29 -0500)]
Enabling late-attach on dsp2 and ipu1 to get printout
 from A15

By enabling late-attach on dsp2 and ipu1, A15 is able to read
and print the content of REMOTE_LOG_MEM to get the printout of remote
core IPU1 and DSP2.

Change-Id: Iccdb8c09bbadb96ef3794f21b11846b09a3a8126
Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoEnabling USB1, USB2, WLAN with RVC
Buddy Liong [Wed, 18 May 2016 23:12:05 +0000 (18:12 -0500)]
Enabling USB1, USB2, WLAN with RVC

Enabling omap_dwc3_1, omap_dwc3_2, uart3, and evm_3v3_sd
which requires for Android USB1, USB2, and wlan.
RVC based on vision sdk 2.8 is still functional with
those enabled.

Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoRemove mailbox5 from dra7-evm-robust-rvc.dts
Buddy Liong [Wed, 18 May 2016 16:36:44 +0000 (11:36 -0500)]
Remove mailbox5 from dra7-evm-robust-rvc.dts

By disabling mailbox5, it disables the radio because
mailbox5 is used for ipu1 and dsp1.
Disabling mbox_ipu1_legacy should be sufficient instead
of disabling the whole mailbox5.
Android Radio is using dsp1.

Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoRemove mailbox6 from dra7-evm-robust-rvc.dts
Buddy Liong [Tue, 17 May 2016 17:28:07 +0000 (12:28 -0500)]
Remove mailbox6 from dra7-evm-robust-rvc.dts

By disabling mailbox6, it disables the video because
mailbox6 is used for ipu2 and dsp2.
Disabling mbox_dsp2_legacy should be sufficient instead
of disabling the whole mailbox6.

Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoReserved the memory address used by Vision SDK
Sunita Nadampalli [Fri, 13 May 2016 16:32:10 +0000 (11:32 -0500)]
Reserved the memory address used by Vision SDK

Reserving memory used by Vision SDK configured at
\vision_sdk\build\tda2xx\mem_segment_definition_1024mb_rvc.xs
  Address 0x85800000 - 0x95400000 of size 0xFC00000 for NDK_MEM and SR1_FRAME_BUFFER_MEM
  Address 0xA0000000 - 0xA2000000 of size 0x2000000 for SR0, REMOTE_LOG_MEM, LINK_STATS_MEM,
                      SYSTEM_IPC_SHM_MEM, HDVPSS_DESC_MEM, TRACE_BUF, EXC_DATA, and PM_DATA
Since Robust RVC doesn't use EVE, we do not need to reserve the memory address range
0xA2000000 - 0xA6000000 of size 0x4000000.

Change-Id: I1ddf39b2eae68520938f80e7838ca015d3528d87
Signed-off-by: Buddy Liong <a0270631@ti.com>
4 years agoandroid config: Disable A15 WatchDog timer
Sunita Nadampalli [Mon, 9 May 2016 19:08:10 +0000 (14:08 -0500)]
android config: Disable A15 WatchDog timer

This is for A15 crash to not to interfere with
SW running on the other remote cores.

Change-Id: Iea881b4a6f51af3539eb18b119eb0da65403658b
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
5 years agoARM: DTS: Added logic to exlude DSP2 nodes from Robust RVC DTS for DRA7 Platform
Sunita Nadampalli [Wed, 4 May 2016 19:30:50 +0000 (14:30 -0500)]
ARM: DTS: Added logic to exlude DSP2 nodes from Robust RVC DTS for DRA7 Platform

Change-Id: Icb7f48c4044ef77269dcd976c19d73991cfcffe4
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
5 years agoDSS: Changes to share Display subsystem with remotecores on DRA7
Sunita Nadampalli [Wed, 4 May 2016 17:00:58 +0000 (12:00 -0500)]
DSS: Changes to share Display subsystem with remotecores on DRA7

1. Added DT property parsing and populating the subsystem share property
2. Defined A15 Interrupt masking to not to conflict with DSS interrupts
   dedicated to remotecore
3. DRM irq handler changes to handle only interrupts assigned to A15 and
   ignore other interrupts assigned to remotecore.

Note: The scenario considered here is:
1. Primary LCD is the display used
2. Both A15 and remotecore (eg.IPU) are using the same Display
3. VID2 and VID3 DSS pipes are used from the remotecore
   and enables EOW interrupt
4. GFX and VID1 pipes are used on A15 and enables LCD VSYNC interrupt

Change-Id: I0dfeeaeb11c5893982efb55d49bb9a4176dfb8b7
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
5 years agoDRA7: HWMOD: WORKAROUND to Exclude unsed clock gating and parent hwmod controls for DSS
Sunita Nadampalli [Wed, 4 May 2016 15:58:40 +0000 (10:58 -0500)]
DRA7: HWMOD: WORKAROUND to Exclude unsed clock gating and parent hwmod controls for DSS

This patch needs revisit to handle it in a better way

Change-Id: Ie1dfaf62d8aecebec7aa5771cd30d006f601191a
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
5 years agoARM: DTS: add Robust RVC DTS for DRA7 Platform
Sunita Nadampalli [Wed, 4 May 2016 15:56:02 +0000 (10:56 -0500)]
ARM: DTS: add Robust RVC DTS for DRA7 Platform

Change-Id: Id70df2d474c8bf38964e6bdb265c8e84e4b38c4f
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
5 years agoARM: DTSi and DRA7 EVM DTS: changes to define few nodes as variable nodes
Sunita Nadampalli [Wed, 4 May 2016 15:10:09 +0000 (10:10 -0500)]
ARM: DTSi and DRA7 EVM DTS: changes to define few nodes as variable nodes

Change-Id: I61aaf4a51f3b02eb58d90fb1b34dd0edc367c8e4
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android android-3.14-6AM.1.0
Praneeth Bajjuri [Fri, 18 Mar 2016 22:45:56 +0000 (17:45 -0500)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  pm: dra7: Restrict vip/vpe power domain state to INA
  pm: dra7: Update power domain states as per new spec
  ARM: OMAP: DRA7: powerdomain data: Remove CSWR with the exception of MPU
  ARM: OMAP: DRA7: powerdomain data: Fix "ON" state for memories
  ARM: OMAP: DRA7: powerdomain data: Remove wrong OSWR capability
  ARM: dts: dra7-evm: mmc: fix typos in register names and values

Change-Id: I3a327104320949e44fd891d790f145e3d27ff0b1
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agopm: dra7: Restrict vip/vpe power domain state to INA
Ravikumar Kattekola [Thu, 17 Mar 2016 18:41:34 +0000 (00:11 +0530)]
pm: dra7: Restrict vip/vpe power domain state to INA

VIP/VPE drivers do not support context save/restore.
Restrict PD state to Inactive till support is added.
This also enables quick resume of camera on wake up.

Change-Id: I62911e268639568b9d4b58c855eca430bb896e89
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
5 years agopm: dra7: Update power domain states as per new spec
Ravikumar Kattekola [Thu, 17 Mar 2016 17:57:59 +0000 (23:27 +0530)]
pm: dra7: Update power domain states as per new spec

As per updated TRM, DOc update :TBD

EMU and Custefuse do not support any low power states.

Change-Id: Ifdc4c146d972b1a03bbcec49d897ad7e168b6045
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
5 years agoARM: OMAP: DRA7: powerdomain data: Remove CSWR with the exception of MPU
Nishanth Menon [Thu, 4 Feb 2016 23:35:49 +0000 (17:35 -0600)]
ARM: OMAP: DRA7: powerdomain data: Remove CSWR with the exception of MPU

As per the latest definitions for DRA7/AM57xx SoCs, the internal
memories of SoC do not support retention mode any longer (with the
exception of MPU), as a result of the same, we also end up losing CSWR
(where powerdomain state can be programmed to retention state).

This implies that, with the exception of MPU power domain, all other
power domains can either operate in "ON" mode OR where possible "OFF"
mode (when permitted by lack of silicon errata).

Change-Id: I34dbf9b2b5732cdf57172728859bce405f1d739b
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
5 years agoARM: OMAP: DRA7: powerdomain data: Fix "ON" state for memories
Nishanth Menon [Thu, 4 Feb 2016 23:35:48 +0000 (17:35 -0600)]
ARM: OMAP: DRA7: powerdomain data: Fix "ON" state for memories

When the power domain is in "ON" state, the memories should be always
in "ON", even though the hardware register allows other states to be
written, wrong states may confuse certain hardware blocks.

Change-Id: Idcaedaf8cd97b5be78c44315126b6d1a1779aaa9
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
5 years agoARM: OMAP: DRA7: powerdomain data: Remove wrong OSWR capability
Nishanth Menon [Thu, 4 Feb 2016 23:35:47 +0000 (17:35 -0600)]
ARM: OMAP: DRA7: powerdomain data: Remove wrong OSWR capability

Open Switch Retention(OSWR) is a retention state which is unsupported
in DRA7 SoC. This state is achieved when power state is set to
retention and logic power state is set to OFF.

Even though DRA7 architecture is a OMAP5 derivative, none of the
powerdomains are actually designed to achieve OSWR in the SoC.

Change-Id: I7f2ac011502e90a6b5da2afd9a1826193ca26cfe
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
5 years agoARM: dts: dra7-evm: mmc: fix typos in register names and values
Vishal Mahaveer [Fri, 18 Mar 2016 16:47:14 +0000 (11:47 -0500)]
ARM: dts: dra7-evm: mmc: fix typos in register names and values

Fix typos in register names and values used for mmc1 and mmc4
manual mode values.

Change-Id: I7294e95580e0622b552d896aff78bbab4d8464a9
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoOMAPDRM: android: Removed HDMI HPD IRQ Registration
Marcus Cooksey [Thu, 17 Mar 2016 21:11:42 +0000 (16:11 -0500)]
OMAPDRM: android: Removed HDMI HPD IRQ Registration

Android doesn't require IRQ based HPD notification, since
HPD notification are sent via uevents.

Change-Id: I50e6f978cd1639a55c2ff37abdca11dfcb4a82a9
Signed-off-by: Marcus Cooksey <mcooksey@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Thu, 17 Mar 2016 19:41:33 +0000 (14:41 -0500)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  ARM: DRA722: OPP: reuse OPP information for Silicon Rev 2.0
  ARM: DRA722: Add ID detect for Silicon Rev 2.0
  ARM: DRA722: remove redundant definition of 1.0 device

Change-Id: I0c0f7f5dd7c30b442dfdc4c3851e4b0150a9c369
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoARM: DRA722: OPP: reuse OPP information for Silicon Rev 2.0
Vishal Mahaveer [Fri, 26 Feb 2016 16:17:30 +0000 (10:17 -0600)]
ARM: DRA722: OPP: reuse OPP information for Silicon Rev 2.0

Silicon Rev 2.0 variant of DRA722 reuses the same OPP information as Rev 1.0

Change-Id: I39a068d8d2146fc3a09c04fcba7421096eaaec7b
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoARM: DRA722: Add ID detect for Silicon Rev 2.0
Vishal Mahaveer [Fri, 26 Feb 2016 16:13:47 +0000 (10:13 -0600)]
ARM: DRA722: Add ID detect for Silicon Rev 2.0

Silicon Rev 2.0 is a minor variant of Rev 1.0. Rev 2.0 is an incremental revision
with various fixes including the following:
    - Reset logic fixes
    - Few asymetric aging logic fixes
    - Ethernet speed fixes
    - EDMA fixes for McASP

Change-Id: Ifb0619dbf55d4108a2cb181c09c3408bfb167d62
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoARM: DRA722: remove redundant definition of 1.0 device
Vishal Mahaveer [Fri, 26 Feb 2016 16:04:06 +0000 (10:04 -0600)]
ARM: DRA722: remove redundant definition of 1.0 device

Remove duplicate definition of Rev 1.0 device.
Fixes: 81032e34e184 ("ARM: DRA752: Add ID detect for ES2.0")

Change-Id: If0f4c47c9f67c5273526cf72180afbb0fac8748e
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Wed, 16 Mar 2016 21:57:51 +0000 (16:57 -0500)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  ARM: dtsi: jamr3: Update SR0 range for UIO

Change-Id: I45f60e708d807bf8ccbebc6e5e022fb91cdc2c4d
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoARM: dtsi: jamr3: Update SR0 range for UIO
Misael Lopez Cruz [Mon, 14 Mar 2016 22:07:47 +0000 (17:07 -0500)]
ARM: dtsi: jamr3: Update SR0 range for UIO

The SharedRegion 0 range was recently changed by commit:

"c22b04c arm: dtsi: jamr3: Adjusting DSP SR0 range"

But the update was only for the 'reserved_mem' node and
a similar change is also required for the UIO node.

Change-Id: I56cb30d0146032dcbaaf296af5283ba22c3064ad
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
5 years agoOMAPDRM: Force HDMI WP ON to recieve HPD events
Marcus Cooksey [Wed, 9 Mar 2016 21:06:17 +0000 (15:06 -0600)]
OMAPDRM: Force HDMI WP ON to recieve HPD events

Forces the HDMI WP core on, otherwise the core will not generate
a HPD interrupt since the module is off.  The side effect of
forcing the module on is that default display modes are selected.

A reprobe, accomplished by software disconnect and reconnect
of the monitor, occurs upon HPD.

Change-Id: Ib25d9257f98aaf054d7629f91aaac826abb58f3b
Signed-off-by: Marcus Cooksey <mcooksey@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Wed, 16 Mar 2016 21:55:02 +0000 (16:55 -0500)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  OMAPDRM: Register HDMI HPD Callback for HDMI HPD Interrupts
  OMAPDSS: Added New API to Register Callback for Notification of HPD

Conflicts:
drivers/video/fbdev/omap2/dss/hdmi5.c

Change-Id: If661df80907b1c5e3f4944c55ea0494c4f3c35d0
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoOMAPDRM: Register HDMI HPD Callback for HDMI HPD Interrupts
Marcus Cooksey [Mon, 29 Feb 2016 23:32:02 +0000 (17:32 -0600)]
OMAPDRM: Register HDMI HPD Callback for HDMI HPD Interrupts

HDMI hotplug detection is now achieved by registering
a DRM callback with the display driver.  The display driver
will invoke this callback function when an HPD event occurs.
The HPD Poll worker task is used to reconfigure the display
mode based on monitor preferences.

Signed-off-by: Marcus Cooksey <mcooksey@ti.com>
Change-Id: I5c098bfdedffb83eab97b70c95c04c325140342c

5 years agoOMAPDSS: Added New API to Register Callback for Notification of HPD
Marcus Cooksey [Mon, 29 Feb 2016 23:25:37 +0000 (17:25 -0600)]
OMAPDSS: Added New API to Register Callback for Notification of HPD

An additional DSS API was added for registering a callback function
to be invoked when a display HPD detect event occurs.

Change-Id: I13d126826c0c2bde4b8f542ecb64d9cf65606444
Signed-off-by: Marcus Cooksey <mcooksey@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Vishal Mahaveer [Tue, 15 Mar 2016 22:16:42 +0000 (17:16 -0500)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  Revert "dts: Add DTS files for HS parts/platforms"

Change-Id: Idd73b8e5df9383ca8ec96906d9d053fd241739df
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoRevert "dts: Add DTS files for HS parts/platforms"
Vishal Mahaveer [Tue, 15 Mar 2016 18:40:56 +0000 (13:40 -0500)]
Revert "dts: Add DTS files for HS parts/platforms"

This reverts commit 636f93205f2cee0531b21b74773ce333983dd02b.

With the latest u-boot patch that got merged, we no longer
need seperate dtbs for HS parts.

u-boot commit (faa8b78 u-boot: security: Update fdt on HS devices)

Conflicts:

arch/arm/boot/dts/Makefile

Change-Id: Id208802d0ffd3e594080248574753f8b65f773ad
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoRevert "Revert "ti: config: android: disable kdevtmpfs""
Vishal Mahaveer [Fri, 11 Mar 2016 23:49:01 +0000 (17:49 -0600)]
Revert "Revert "ti: config: android: disable kdevtmpfs""

This reverts commit 257a0dce34ee508158f916a3aab015b3649dba5a.

Enable kdevtmpfs for avoiding SELinux denials related to tmpfs.
Android does not need this feature and hence disabling it.

Change-Id: I61b81e7bf0ce79c817ddcf1e60681d1150cb33b7
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoti: config: android: enable cgroups/cpusets
Vishal Mahaveer [Fri, 11 Mar 2016 23:34:45 +0000 (17:34 -0600)]
ti: config: android: enable cgroups/cpusets

Enable cgroups/cpuset config for Android

Change-Id: I65ebc437c2d7933b38bb7fd9680b2ab85b5b2c89
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Vishal Mahaveer [Fri, 11 Mar 2016 20:02:35 +0000 (14:02 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  arm: dtsi: jamr3: Adjusting DSP SR0 range
  remoteproc/omap: Fix DSP recovery issues with EDMA

Change-Id: I2d1d6f6124643a4a8d81cd1077e8e4bbe10574bd
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoarm: dtsi: jamr3: Adjusting DSP SR0 range p-ti-linux-3.14.y-common-rvc glsdk-7.04.00.03
Stephen Molfetta [Thu, 10 Mar 2016 20:52:54 +0000 (14:52 -0600)]
arm: dtsi: jamr3: Adjusting DSP SR0 range

Moving reservation for DSP SharedRegion0 base address from 0xbfd00000
to 0xbfb00000.  This is made in order to match the corresponding
changes to the memory map of DSP Radio/APPE application.

Change-Id: Ic74fd484bacc5a2c6be00e2de28735afc188f280
Signed-off-by: Stephen Molfetta <sjmolfetta@ti.com>
5 years agoremoteproc/omap: Fix DSP recovery issues with EDMA
Stephen Molfetta [Wed, 9 Dec 2015 21:41:54 +0000 (15:41 -0600)]
remoteproc/omap: Fix DSP recovery issues with EDMA

Resetting the DSP subsystem while there are pending DSP EDMA transfers
or while the DSP EDMA is receiving DMA events from various peripherals
(e.g. McASP) can cause various issues in the recovery process:

- L3 errors which create a complete system lockup
- DSPSS does not reset properly and put TPTCs into an unusable state

Prior to shutdown of a DSP core, two cleanup/checks are required in
order to mitigate these issues:

1. Clear DSP EDMA crossbar routings

  Upon remoteproc reset of the DSP, DMA events may continue to
  arrive to the DSPs EDMA instance after the reset sequence has completed.
  Clearing the crossbar ensures that no unexpected events arrive to the
  DSP's EDMA after reset

2. Wait for DSP EDMA traffic completion

  After clearing DSP EDMA crossbar routings, we disable all future
  events and poll the various active bits of the TPCC and both TPTCs
  of the DSP's EDMA and wait for any pending transfers to complete
  prior to issuing the reset.

Change-Id: I4ba7c414c8f38f95cc2a4a60f63bd7095f73788c
Signed-off-by: Stephen Molfetta <sjmolfetta@ti.com>
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Vishal Mahaveer [Fri, 4 Mar 2016 19:29:15 +0000 (13:29 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  ARM: dts: dra72-evm: fix touchscreen on OSD LCD

Change-Id: If8299df49a85f544fc11d88e68520f1214b277f6
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoARM: dts: dra72-evm: fix touchscreen on OSD LCD
Sekhar Nori [Fri, 4 Mar 2016 17:37:46 +0000 (11:37 -0600)]
ARM: dts: dra72-evm: fix touchscreen on OSD LCD

dra7x-evm-lcd-osd.dtsi has touchscreen interrupt set
to line #2 of GPIO1. However, this is incorrect for
DRA72 EVM. Since the irq line differs between different
boards, move it from the generic OSD LCD device-tree
include file to board specific .dts file.

This fixes touchscreen working on DRA72x EVM.

Change-Id: I15f0ab58e8d343876ba73ff768af9dc033f2a5ef
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
[Back ported from LCPD Kernel 4.1]
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoMerge remote-tracking branch 'origin/p-ti-linux-3.14.y-common' into p-ti-linux-3...
Praneeth Bajjuri [Fri, 4 Mar 2016 17:11:03 +0000 (11:11 -0600)]
Merge remote-tracking branch 'origin/p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* origin/p-ti-linux-3.14.y-common:
  ARM: dts: dra72-evm-lcd-osd: disable ldc3001 node

Change-Id: I56671f24c64494f2b591ef81bd947a3ba51a40fa
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoARM: dts: dra72-evm-lcd-osd: disable ldc3001 node
Vishal Mahaveer [Fri, 4 Mar 2016 16:16:06 +0000 (10:16 -0600)]
ARM: dts: dra72-evm-lcd-osd: disable ldc3001 node

Disable ldc3001 node to avoid IRQ flooding from this device.
This is similar to change done in dra7-evm-lcd-osd dts.

Change-Id: I1368dcfff1aeb054622e04055e4c1fd948aea672
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
5 years agoMerge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel...
Praneeth Bajjuri [Fri, 4 Mar 2016 16:41:41 +0000 (10:41 -0600)]
Merge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into p-ti-linux-3.14.y-common

* 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel: (131 commits)
  Linux 3.14.63
  iwlwifi: update and fix 7265 series PCI IDs
  xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
  do_last(): don't let a bogus return value from ->open() et.al. to confuse us
  kernel/resource.c: fix muxed resource handling in __request_region()
  sunrpc/cache: fix off-by-one in qword_get()
  tracing: Fix showing function event in available_events
  KVM: async_pf: do not warn on page allocation failures
  NFSv4: Fix a dentry leak on alias use
  nfs: fix nfs_size_to_loff_t
  PCI/AER: Flush workqueue on device remove to avoid use-after-free
  libata: fix sff host state machine locking while polling
  Revert "workqueue: make sure delayed work run in local cpu"
  rfkill: fix rfkill_fop_read wait_event usage
  cdc-acm:exclude Samsung phone 04e8:685d
  libceph: don't bail early from try_read() when skipping a message
  hwmon: (ads1015) Handle negative conversion values correctly
  IB/qib: fix mcast detach when qp not attached
  ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
  drm/radeon/pm: adjust display configuration after powerstate
  ...

Change-Id: I52ede6200ce63cfaab1be52fd472481653776bc4
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoMerge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel...
Praneeth Bajjuri [Fri, 4 Mar 2016 16:31:04 +0000 (10:31 -0600)]
Merge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into p-ti-linux-3.14.y-android

* 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel: (131 commits)
  Linux 3.14.63
  iwlwifi: update and fix 7265 series PCI IDs
  xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
  do_last(): don't let a bogus return value from ->open() et.al. to confuse us
  kernel/resource.c: fix muxed resource handling in __request_region()
  sunrpc/cache: fix off-by-one in qword_get()
  tracing: Fix showing function event in available_events
  KVM: async_pf: do not warn on page allocation failures
  NFSv4: Fix a dentry leak on alias use
  nfs: fix nfs_size_to_loff_t
  PCI/AER: Flush workqueue on device remove to avoid use-after-free
  libata: fix sff host state machine locking while polling
  Revert "workqueue: make sure delayed work run in local cpu"
  rfkill: fix rfkill_fop_read wait_event usage
  cdc-acm:exclude Samsung phone 04e8:685d
  libceph: don't bail early from try_read() when skipping a message
  hwmon: (ads1015) Handle negative conversion values correctly
  IB/qib: fix mcast detach when qp not attached
  ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
  drm/radeon/pm: adjust display configuration after powerstate
  ...

Change-Id: I59459637400f0f2bcb910f2fc1bcfb933b4e8542
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoMerge tag 'v3.14.63' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux...
LCPD Auto Merger [Fri, 4 Mar 2016 05:47:07 +0000 (23:47 -0600)]
Merge tag 'v3.14.63' of git./linux/kernel/git/stable/linux-stable into ti-linux-3.14.y

This is the 3.14.63 stable release

* tag 'v3.14.63' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable: (131 commits)
  Linux 3.14.63
  iwlwifi: update and fix 7265 series PCI IDs
  xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
  do_last(): don't let a bogus return value from ->open() et.al. to confuse us
  kernel/resource.c: fix muxed resource handling in __request_region()
  sunrpc/cache: fix off-by-one in qword_get()
  tracing: Fix showing function event in available_events
  KVM: async_pf: do not warn on page allocation failures
  NFSv4: Fix a dentry leak on alias use
  nfs: fix nfs_size_to_loff_t
  PCI/AER: Flush workqueue on device remove to avoid use-after-free
  libata: fix sff host state machine locking while polling
  Revert "workqueue: make sure delayed work run in local cpu"
  rfkill: fix rfkill_fop_read wait_event usage
  cdc-acm:exclude Samsung phone 04e8:685d
  libceph: don't bail early from try_read() when skipping a message
  hwmon: (ads1015) Handle negative conversion values correctly
  IB/qib: fix mcast detach when qp not attached
  ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
  drm/radeon/pm: adjust display configuration after powerstate
  ...

Signed-off-by: LCPD Auto Merger <lcpd_integration@list.ti.com>
5 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Thu, 3 Mar 2016 23:20:40 +0000 (17:20 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  arm: dtsi: dra7: Create example dts file for using DMA pool for late attach
  iommu/omap: Update iommu to work with ioremap pagetable
  ARM: dma-mapping: Call the non-zeroing dma-coherent alloc from malloc function
  drivers: dma-coherent: Add Non-Zeroing Alloc Function

Change-Id: I752dce5bdd3463f9d09537e3f31bb75aed7cf6c0
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoarm: dtsi: dra7: Create example dts file for using DMA pool for late attach
Angela Stegmaier [Tue, 22 Sep 2015 21:27:05 +0000 (16:27 -0500)]
arm: dtsi: dra7: Create example dts file for using DMA pool for late attach

For late attach case, it is desireable to make the memory
as "no-map" so that it is not used by the kernel for
any other purpose. When the reserved mem is defined as
"reusable", then it is possible that the kernel may
allocate that memory before the remoteproc is probed
and allocates the memory. In this case, the memory can
be corrupted. Making the memory as "no-map" removes
this possibility.

Also use the "ti,late-attach-dma-pool" flag for the mmu
node so that the iommu module knows that the dma-pool
is being used and can take certain actions based on this
related to the page table address.

Please note that when using DMA pools, the allocation scheme
is different than with CMA pools, and the size of the carveout
may need to be increased or alignment changed depending on the
memory needs of the image being loaded. Also, the vmalloc size
may need increasing, depending on system configuration, number
of remote cores using a DMA pool, and the sizes of the DMA pools.
This is because the DMA pool is not accessible in kernel linear
memory and needs to be mapped to be accessed.

Change-Id: I3a2f16e15980b7939f7fd7543b3ad924410d42fe
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
5 years agoiommu/omap: Update iommu to work with ioremap pagetable
Angela Stegmaier [Mon, 5 Oct 2015 19:01:42 +0000 (14:01 -0500)]
iommu/omap: Update iommu to work with ioremap pagetable

In the late attach case, the page table is taken from the end
of the reserved memory instead of the usual method of allocating.
In the case where the reserved mem is a DMA pool rather than a
CMA pool, the usual method of translating physical addresses to
virtual addresses and vice-versa does not work. The virtual address
retrieved in that case would be inaccessible. So, in this case, it
is required to ioremap the page table so that it is accessible
in the kernel. As a result of this, the phys_to_virt that is used
during iommu_enable will not work, because phys_to_virt doesn't
work for ioremap memory. So, at the point where the ioremap is
performed, we are now saving the physical address, which is later
used during iommu_enable rather than doing a virt_to_phys.

A new property "ti,late-attach-dma-pool" is added to let the iommu
know that a dma pool is being used so that the proper method of
address translation can be used.

This patch makes the changes to ioremap the pagetable in the case
of late attach with a dma pool, save the physical address of the
pagetable during the attach phase, and then use the saved physical
address during iommu_enable. With these changes, the iommu works
properly with late attach using a DMA pool.

Change-Id: I40ad5c74ba2a27dd9c5141128c2386ae2c5fe52d
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
5 years agoARM: dma-mapping: Call the non-zeroing dma-coherent alloc from malloc function
Angela Stegmaier [Tue, 22 Sep 2015 21:53:59 +0000 (16:53 -0500)]
ARM: dma-mapping: Call the non-zeroing dma-coherent alloc from malloc function

The malloc call, which is intented to be the same as alloc,
except that the memory is not zero-ed, should also not
zero memory that is allocated using dma_alloc_from_coherent().
This patch changes the call to dma_alloc_from_coherent() to
dma_malloc_from_coherent() with the zero flag set to false
in order to prevent zero-ing of the memory.

Change-Id: I4b7fea40d7dcd4443a5a3b1c9476b67da40998ff
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
5 years agodrivers: dma-coherent: Add Non-Zeroing Alloc Function
Angela Stegmaier [Tue, 22 Sep 2015 21:51:08 +0000 (16:51 -0500)]
drivers: dma-coherent: Add Non-Zeroing Alloc Function

Add a new function, dma_malloc_from_coherent(), which
takes a parameter that specifies if the allocated memory
should be zero-ed or not. Modify dma_alloc_from_coherent
to call dma_malloc_from_coherent with the flag set to
true in order to zero the memory. In this way
dma_alloc_from_coherent behaves the same as before.

Change-Id: I7c497fc88739116e233736e9d9a95ecbd849ec8f
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
5 years agoLinux 3.14.63
Greg Kroah-Hartman [Thu, 3 Mar 2016 23:09:05 +0000 (15:09 -0800)]
Linux 3.14.63

5 years agoiwlwifi: update and fix 7265 series PCI IDs
Oren Givon [Thu, 17 Dec 2015 12:17:00 +0000 (14:17 +0200)]
iwlwifi: update and fix 7265 series PCI IDs

commit 006bda75d81fd27a583a3b310e9444fea2aa6ef2 upstream.

Update and fix some 7265 PCI IDs entries.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoxen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
Konrad Rzeszutek Wilk [Thu, 11 Feb 2016 21:10:26 +0000 (16:10 -0500)]
xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.

commit 4d8c8bd6f2062c9988817183a91fe2e623c8aa5e upstream.

Occasionaly PV guests would crash with:

pciback 0000:00:00.1: Xen PCI mapped GSI0 to IRQ16
BUG: unable to handle kernel paging request at 0000000d1a8c0be0
.. snip..
  <ffffffff8139ce1b>] find_next_bit+0xb/0x10
  [<ffffffff81387f22>] cpumask_next_and+0x22/0x40
  [<ffffffff813c1ef8>] pci_device_probe+0xb8/0x120
  [<ffffffff81529097>] ? driver_sysfs_add+0x77/0xa0
  [<ffffffff815293e4>] driver_probe_device+0x1a4/0x2d0
  [<ffffffff813c1ddd>] ? pci_match_device+0xdd/0x110
  [<ffffffff81529657>] __device_attach_driver+0xa7/0xb0
  [<ffffffff815295b0>] ? __driver_attach+0xa0/0xa0
  [<ffffffff81527622>] bus_for_each_drv+0x62/0x90
  [<ffffffff8152978d>] __device_attach+0xbd/0x110
  [<ffffffff815297fb>] device_attach+0xb/0x10
  [<ffffffff813b75ac>] pci_bus_add_device+0x3c/0x70
  [<ffffffff813b7618>] pci_bus_add_devices+0x38/0x80
  [<ffffffff813dc34e>] pcifront_scan_root+0x13e/0x1a0
  [<ffffffff817a0692>] pcifront_backend_changed+0x262/0x60b
  [<ffffffff814644c6>] ? xenbus_gather+0xd6/0x160
  [<ffffffff8120900f>] ? put_object+0x2f/0x50
  [<ffffffff81465c1d>] xenbus_otherend_changed+0x9d/0xa0
  [<ffffffff814678ee>] backend_changed+0xe/0x10
  [<ffffffff81463a28>] xenwatch_thread+0xc8/0x190
  [<ffffffff810f22f0>] ? woken_wake_function+0x10/0x10

which was the result of two things:

When we call pci_scan_root_bus we would pass in 'sd' (sysdata)
pointer which was an 'pcifront_sd' structure. However in the
pci_device_add it expects that the 'sd' is 'struct sysdata' and
sets the dev->node to what is in sd->node (offset 4):

set_dev_node(&dev->dev, pcibus_to_node(bus));

 __pcibus_to_node(const struct pci_bus *bus)
{
        const struct pci_sysdata *sd = bus->sysdata;

        return sd->node;
}

However our structure was pcifront_sd which had nothing at that
offset:

struct pcifront_sd {
        int                        domain;    /*     0     4 */
        /* XXX 4 bytes hole, try to pack */
        struct pcifront_device *   pdev;      /*     8     8 */
}

That is an hole - filled with garbage as we used kmalloc instead of
kzalloc (the second problem).

This patch fixes the issue by:
 1) Use kzalloc to initialize to a well known state.
 2) Put 'struct pci_sysdata' at the start of 'pcifront_sd'. That
    way access to the 'node' will access the right offset.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodo_last(): don't let a bogus return value from ->open() et.al. to confuse us
Al Viro [Sun, 28 Feb 2016 00:17:33 +0000 (19:17 -0500)]
do_last(): don't let a bogus return value from ->open() et.al. to confuse us

commit c80567c82ae4814a41287618e315a60ecf513be6 upstream.

... into returning a positive to path_openat(), which would interpret that
as "symlink had been encountered" and proceed to corrupt memory, etc.
It can only happen due to a bug in some ->open() instance or in some LSM
hook, etc., so we report any such event *and* make sure it doesn't trick
us into further unpleasantness.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agokernel/resource.c: fix muxed resource handling in __request_region()
Simon Guinot [Wed, 9 Sep 2015 22:15:18 +0000 (00:15 +0200)]
kernel/resource.c: fix muxed resource handling in __request_region()

commit 59ceeaaf355fa0fb16558ef7c24413c804932ada upstream.

In __request_region, if a conflict with a BUSY and MUXED resource is
detected, then the caller goes to sleep and waits for the resource to be
released.  A pointer on the conflicting resource is kept.  At wake-up
this pointer is used as a parent to retry to request the region.

A first problem is that this pointer might well be invalid (if for
example the conflicting resource have already been freed).  Another
problem is that the next call to __request_region() fails to detect a
remaining conflict.  The previously conflicting resource is passed as a
parameter and __request_region() will look for a conflict among the
children of this resource and not at the resource itself.  It is likely
to succeed anyway, even if there is still a conflict.

Instead, the parent of the conflicting resource should be passed to
__request_region().

As a fix, this patch doesn't update the parent resource pointer in the
case we have to wait for a muxed region right after.

Reported-and-tested-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Tested-by: Vincent Donnefort <vdonnefort@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosunrpc/cache: fix off-by-one in qword_get()
Stefan Hajnoczi [Thu, 18 Feb 2016 18:55:54 +0000 (18:55 +0000)]
sunrpc/cache: fix off-by-one in qword_get()

commit b7052cd7bcf3c1478796e93e3dff2b44c9e82943 upstream.

The qword_get() function NUL-terminates its output buffer.  If the input
string is in hex format \xXXXX... and the same length as the output
buffer, there is an off-by-one:

  int qword_get(char **bpp, char *dest, int bufsize)
  {
      ...
      while (len < bufsize) {
          ...
          *dest++ = (h << 4) | l;
          len++;
      }
      ...
      *dest = '\0';
      return len;
  }

This patch ensures the NUL terminator doesn't fall outside the output
buffer.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotracing: Fix showing function event in available_events
Steven Rostedt (Red Hat) [Wed, 24 Feb 2016 14:04:24 +0000 (09:04 -0500)]
tracing: Fix showing function event in available_events

commit d045437a169f899dfb0f6f7ede24cc042543ced9 upstream.

The ftrace:function event is only displayed for parsing the function tracer
data. It is not used to enable function tracing, and does not include an
"enable" file in its event directory.

Originally, this event was kept separate from other events because it did
not have a ->reg parameter. But perf added a "reg" parameter for its use
which caused issues, because it made the event available to functions where
it was not compatible for.

Commit 9b63776fa3ca9 "tracing: Do not enable function event with enable"
added a TRACE_EVENT_FL_IGNORE_ENABLE flag that prevented the function event
from being enabled by normal trace events. But this commit missed keeping
the function event from being displayed by the "available_events" directory,
which is used to show what events can be enabled by set_event.

One documented way to enable all events is to:

 cat available_events > set_event

But because the function event is displayed in the available_events, this
now causes an INVALID error:

 cat: write error: Invalid argument

Reported-by: Chunyu Hu <chuhu@redhat.com>
Fixes: 9b63776fa3ca9 "tracing: Do not enable function event with enable"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoKVM: async_pf: do not warn on page allocation failures
Christian Borntraeger [Fri, 19 Feb 2016 12:11:46 +0000 (13:11 +0100)]
KVM: async_pf: do not warn on page allocation failures

commit d7444794a02ff655eda87e3cc54e86b940e7736f upstream.

In async_pf we try to allocate with NOWAIT to get an element quickly
or fail. This code also handle failures gracefully. Lets silence
potential page allocation failures under load.

qemu-system-s39: page allocation failure: order:0,mode:0x2200000
[...]
Call Trace:
([<00000000001146b8>] show_trace+0xf8/0x148)
[<000000000011476a>] show_stack+0x62/0xe8
[<00000000004a36b8>] dump_stack+0x70/0x98
[<0000000000272c3a>] warn_alloc_failed+0xd2/0x148
[<000000000027709e>] __alloc_pages_nodemask+0x94e/0xb38
[<00000000002cd36a>] new_slab+0x382/0x400
[<00000000002cf7ac>] ___slab_alloc.constprop.30+0x2dc/0x378
[<00000000002d03d0>] kmem_cache_alloc+0x160/0x1d0
[<0000000000133db4>] kvm_setup_async_pf+0x6c/0x198
[<000000000013dee8>] kvm_arch_vcpu_ioctl_run+0xd48/0xd58
[<000000000012fcaa>] kvm_vcpu_ioctl+0x372/0x690
[<00000000002f66f6>] do_vfs_ioctl+0x3be/0x510
[<00000000002f68ec>] SyS_ioctl+0xa4/0xb8
[<0000000000781c5e>] system_call+0xd6/0x264
[<000003ffa24fa06a>] 0x3ffa24fa06a

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoNFSv4: Fix a dentry leak on alias use
Benjamin Coddington [Wed, 17 Feb 2016 15:41:41 +0000 (10:41 -0500)]
NFSv4: Fix a dentry leak on alias use

commit d9dfd8d741683347ee159d25f5b50c346a0df557 upstream.

In the case where d_add_unique() finds an appropriate alias to use it will
have already incremented the reference count.  An additional dget() to swap
the open context's dentry is unnecessary and will leak a reference.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Fixes: 275bb307865a3 ("NFSv4: Move dentry instantiation into the NFSv4-...")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonfs: fix nfs_size_to_loff_t
Christoph Hellwig [Mon, 8 Feb 2016 20:11:50 +0000 (21:11 +0100)]
nfs: fix nfs_size_to_loff_t

commit 50ab8ec74a153eb30db26529088bc57dd700b24c upstream.

See http: //www.infradead.org/rpr.html
X-Evolution-Source: 1451162204.2173.11@leira.trondhjem.org
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0

We support OFFSET_MAX just fine, so don't round down below it.  Also
switch to using min_t to make the helper more readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Fixes: 433c92379d9c ("NFS: Clean up nfs_size_to_loff_t()")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoPCI/AER: Flush workqueue on device remove to avoid use-after-free
Sebastian Andrzej Siewior [Mon, 25 Jan 2016 16:08:00 +0000 (10:08 -0600)]
PCI/AER: Flush workqueue on device remove to avoid use-after-free

commit 4ae2182b1e3407de369f8c5d799543b7db74221b upstream.

A Root Port's AER structure (rpc) contains a queue of events.  aer_irq()
enqueues AER status information and schedules aer_isr() to dequeue and
process it.  When we remove a device, aer_remove() waits for the queue to
be empty, then frees the rpc struct.

But aer_isr() references the rpc struct after dequeueing and possibly
emptying the queue, which can cause a use-after-free error as in the
following scenario with two threads, aer_isr() on the left and a
concurrent aer_remove() on the right:

  Thread A                      Thread B
  --------                      --------
  aer_irq():
    rpc->prod_idx++
                                aer_remove():
                                  wait_event(rpc->prod_idx == rpc->cons_idx)
                                  # now blocked until queue becomes empty
  aer_isr():                      # ...
    rpc->cons_idx++               # unblocked because queue is now empty
    ...                           kfree(rpc)
    mutex_unlock(&rpc->rpc_mutex)

To prevent this problem, use flush_work() to wait until the last scheduled
instance of aer_isr() has completed before freeing the rpc struct in
aer_remove().

I reproduced this use-after-free by flashing a device FPGA and
re-enumerating the bus to find the new device.  With SLUB debug, this
crashes with 0x6b bytes (POISON_FREE, the use-after-free magic number) in
GPR25:

  pcieport 0000:00:00.0: AER: Multiple Corrected error received: id=0000
  Unable to handle kernel paging request for data at address 0x27ef9e3e
  Workqueue: events aer_isr
  GPR24: dd6aa000 6b6b6b6b 605f8378 605f8360 d99b12c0 604fc674 606b1704 d99b12c0
  NIP [602f5328] pci_walk_bus+0xd4/0x104

[bhelgaas: changelog, stable tag]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agolibata: fix sff host state machine locking while polling
Tejun Heo [Mon, 1 Feb 2016 16:33:21 +0000 (11:33 -0500)]
libata: fix sff host state machine locking while polling

commit 8eee1d3ed5b6fc8e14389567c9a6f53f82bb7224 upstream.

The bulk of ATA host state machine is implemented by
ata_sff_hsm_move().  The function is called from either the interrupt
handler or, if polling, a work item.  Unlike from the interrupt path,
the polling path calls the function without holding the host lock and
ata_sff_hsm_move() selectively grabs the lock.

This is completely broken.  If an IRQ triggers while polling is in
progress, the two can easily race and end up accessing the hardware
and updating state machine state at the same time.  This can put the
state machine in an illegal state and lead to a crash like the
following.

  kernel BUG at drivers/ata/libata-sff.c:1302!
  invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN
  Modules linked in:
  CPU: 1 PID: 10679 Comm: syz-executor Not tainted 4.5.0-rc1+ #300
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  task: ffff88002bd00000 ti: ffff88002e048000 task.ti: ffff88002e048000
  RIP: 0010:[<ffffffff83a83409>]  [<ffffffff83a83409>] ata_sff_hsm_move+0x619/0x1c60
  ...
  Call Trace:
   <IRQ>
   [<ffffffff83a84c31>] __ata_sff_port_intr+0x1e1/0x3a0 drivers/ata/libata-sff.c:1584
   [<ffffffff83a85611>] ata_bmdma_port_intr+0x71/0x400 drivers/ata/libata-sff.c:2877
   [<     inline     >] __ata_sff_interrupt drivers/ata/libata-sff.c:1629
   [<ffffffff83a85bf3>] ata_bmdma_interrupt+0x253/0x580 drivers/ata/libata-sff.c:2902
   [<ffffffff81479f98>] handle_irq_event_percpu+0x108/0x7e0 kernel/irq/handle.c:157
   [<ffffffff8147a717>] handle_irq_event+0xa7/0x140 kernel/irq/handle.c:205
   [<ffffffff81484573>] handle_edge_irq+0x1e3/0x8d0 kernel/irq/chip.c:623
   [<     inline     >] generic_handle_irq_desc include/linux/irqdesc.h:146
   [<ffffffff811a92bc>] handle_irq+0x10c/0x2a0 arch/x86/kernel/irq_64.c:78
   [<ffffffff811a7e4d>] do_IRQ+0x7d/0x1a0 arch/x86/kernel/irq.c:240
   [<ffffffff86653d4c>] common_interrupt+0x8c/0x8c arch/x86/entry/entry_64.S:520
   <EOI>
   [<     inline     >] rcu_lock_acquire include/linux/rcupdate.h:490
   [<     inline     >] rcu_read_lock include/linux/rcupdate.h:874
   [<ffffffff8164b4a1>] filemap_map_pages+0x131/0xba0 mm/filemap.c:2145
   [<     inline     >] do_fault_around mm/memory.c:2943
   [<     inline     >] do_read_fault mm/memory.c:2962
   [<     inline     >] do_fault mm/memory.c:3133
   [<     inline     >] handle_pte_fault mm/memory.c:3308
   [<     inline     >] __handle_mm_fault mm/memory.c:3418
   [<ffffffff816efb16>] handle_mm_fault+0x2516/0x49a0 mm/memory.c:3447
   [<ffffffff8127dc16>] __do_page_fault+0x376/0x960 arch/x86/mm/fault.c:1238
   [<ffffffff8127e358>] trace_do_page_fault+0xe8/0x420 arch/x86/mm/fault.c:1331
   [<ffffffff8126f514>] do_async_page_fault+0x14/0xd0 arch/x86/kernel/kvm.c:264
   [<ffffffff86655578>] async_page_fault+0x28/0x30 arch/x86/entry/entry_64.S:986

Fix it by ensuring that the polling path is holding the host lock
before entering ata_sff_hsm_move() so that all hardware accesses and
state updates are performed under the host lock.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Link: http://lkml.kernel.org/g/CACT4Y+b_JsOxJu2EZyEf+mOXORc_zid5V1-pLZSroJVxyWdSpw@mail.gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "workqueue: make sure delayed work run in local cpu"
Tejun Heo [Tue, 9 Feb 2016 21:11:26 +0000 (16:11 -0500)]
Revert "workqueue: make sure delayed work run in local cpu"

commit 041bd12e272c53a35c54c13875839bcb98c999ce upstream.

This reverts commit 874bbfe600a660cba9c776b3957b1ce393151b76.

Workqueue used to implicity guarantee that work items queued without
explicit CPU specified are put on the local CPU.  Recent changes in
timer broke the guarantee and led to vmstat breakage which was fixed
by 176bed1de5bf ("vmstat: explicitly schedule per-cpu work on the CPU
we need it to run on").

vmstat is the most likely to expose the issue and it's quite possible
that there are other similar problems which are a lot more difficult
to trigger.  As a preventive measure, 874bbfe600a6 ("workqueue: make
sure delayed work run in local cpu") was applied to restore the local
CPU guarnatee.  Unfortunately, the change exposed a bug in timer code
which got fixed by 22b886dd1018 ("timers: Use proper base migration in
add_timer_on()").  Due to code restructuring, the commit couldn't be
backported beyond certain point and stable kernels which only had
874bbfe600a6 started crashing.

The local CPU guarantee was accidental more than anything else and we
want to get rid of it anyway.  As, with the vmstat case fixed,
874bbfe600a6 is causing more problems than it's fixing, it has been
decided to take the chance and officially break the guarantee by
reverting the commit.  A debug feature will be added to force foreign
CPU assignment to expose cases relying on the guarantee and fixes for
the individual cases will be backported to stable as necessary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 874bbfe600a6 ("workqueue: make sure delayed work run in local cpu")
Link: http://lkml.kernel.org/g/20160120211926.GJ10810@quack.suse.cz
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Daniel Bilik <daniel.bilik@neosystem.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Shaohua Li <shli@fb.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Bilik <daniel.bilik@neosystem.cz>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agorfkill: fix rfkill_fop_read wait_event usage
Johannes Berg [Tue, 26 Jan 2016 10:29:03 +0000 (11:29 +0100)]
rfkill: fix rfkill_fop_read wait_event usage

commit 6736fde9672ff6717ac576e9bba2fd5f3dfec822 upstream.

The code within wait_event_interruptible() is called with
!TASK_RUNNING, so mustn't call any functions that can sleep,
like mutex_lock().

Since we re-check the list_empty() in a loop after the wait,
it's safe to simply use list_empty() without locking.

This bug has existed forever, but was only discovered now
because all userspace implementations, including the default
'rfkill' tool, use poll() or select() to get a readable fd
before attempting to read.

Fixes: c64fb01627e24 ("rfkill: create useful userspace interface")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocdc-acm:exclude Samsung phone 04e8:685d
Oliver Neukum [Mon, 18 Jan 2016 14:45:18 +0000 (15:45 +0100)]
cdc-acm:exclude Samsung phone 04e8:685d

commit e912e685f372ab62a2405a1acd923597f524e94a upstream.

This phone needs to be handled by a specialised firmware tool
and is reported to crash irrevocably if cdc-acm takes it.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agolibceph: don't bail early from try_read() when skipping a message
Ilya Dryomov [Wed, 17 Feb 2016 19:04:08 +0000 (20:04 +0100)]
libceph: don't bail early from try_read() when skipping a message

commit e7a88e82fe380459b864e05b372638aeacb0f52d upstream.

The contract between try_read() and try_write() is that when called
each processes as much data as possible.  When instructed by osd_client
to skip a message, try_read() is violating this contract by returning
after receiving and discarding a single message instead of checking for
more.  try_write() then gets a chance to write out more requests,
generating more replies/skips for try_read() to handle, forcing the
messenger into a starvation loop.

Reported-by: Varada Kari <Varada.Kari@sandisk.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Tested-by: Varada Kari <Varada.Kari@sandisk.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agohwmon: (ads1015) Handle negative conversion values correctly
Peter Rosin [Thu, 18 Feb 2016 13:07:52 +0000 (14:07 +0100)]
hwmon: (ads1015) Handle negative conversion values correctly

commit acc146943957d7418a6846f06e029b2c5e87e0d5 upstream.

Make the divisor signed as DIV_ROUND_CLOSEST is undefined for negative
dividends when the divisor is unsigned.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoIB/qib: fix mcast detach when qp not attached
Mike Marciniszyn [Thu, 7 Jan 2016 21:44:10 +0000 (16:44 -0500)]
IB/qib: fix mcast detach when qp not attached

commit 09dc9cd6528f5b52bcbd3292a6312e762c85260f upstream.

The code produces the following trace:

[1750924.419007] general protection fault: 0000 [#3] SMP
[1750924.420364] Modules linked in: nfnetlink autofs4 rpcsec_gss_krb5 nfsv4
dcdbas rfcomm bnep bluetooth nfsd auth_rpcgss nfs_acl dm_multipath nfs lockd
scsi_dh sunrpc fscache radeon ttm drm_kms_helper drm serio_raw parport_pc
ppdev i2c_algo_bit lpc_ich ipmi_si ib_mthca ib_qib dca lp parport ib_ipoib
mac_hid ib_cm i3000_edac ib_sa ib_uverbs edac_core ib_umad ib_mad ib_core
ib_addr tg3 ptp dm_mirror dm_region_hash dm_log psmouse pps_core
[1750924.420364] CPU: 1 PID: 8401 Comm: python Tainted: G D
3.13.0-39-generic #66-Ubuntu
[1750924.420364] Hardware name: Dell Computer Corporation PowerEdge
860/0XM089, BIOS A04 07/24/2007
[1750924.420364] task: ffff8800366a9800 ti: ffff88007af1c000 task.ti:
ffff88007af1c000
[1750924.420364] RIP: 0010:[<ffffffffa0131d51>] [<ffffffffa0131d51>]
qib_mcast_qp_free+0x11/0x50 [ib_qib]
[1750924.420364] RSP: 0018:ffff88007af1dd70  EFLAGS: 00010246
[1750924.420364] RAX: 0000000000000001 RBX: ffff88007b822688 RCX:
000000000000000f
[1750924.420364] RDX: ffff88007b822688 RSI: ffff8800366c15a0 RDI:
6764697200000000
[1750924.420364] RBP: ffff88007af1dd78 R08: 0000000000000001 R09:
0000000000000000
[1750924.420364] R10: 0000000000000011 R11: 0000000000000246 R12:
ffff88007baa1d98
[1750924.420364] R13: ffff88003ecab000 R14: ffff88007b822660 R15:
0000000000000000
[1750924.420364] FS:  00007ffff7fd8740(0000) GS:ffff88007fc80000(0000)
knlGS:0000000000000000
[1750924.420364] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[1750924.420364] CR2: 00007ffff597c750 CR3: 000000006860b000 CR4:
00000000000007e0
[1750924.420364] Stack:
[1750924.420364]  ffff88007b822688 ffff88007af1ddf0 ffffffffa0132429
000000007af1de20
[1750924.420364]  ffff88007baa1dc8 ffff88007baa0000 ffff88007af1de70
ffffffffa00cb313
[1750924.420364]  00007fffffffde88 0000000000000000 0000000000000008
ffff88003ecab000
[1750924.420364] Call Trace:
[1750924.420364]  [<ffffffffa0132429>] qib_multicast_detach+0x1e9/0x350
[ib_qib]
[1750924.568035]  [<ffffffffa00cb313>] ? ib_uverbs_modify_qp+0x323/0x3d0
[ib_uverbs]
[1750924.568035]  [<ffffffffa0092d61>] ib_detach_mcast+0x31/0x50 [ib_core]
[1750924.568035]  [<ffffffffa00cc213>] ib_uverbs_detach_mcast+0x93/0x170
[ib_uverbs]
[1750924.568035]  [<ffffffffa00c61f6>] ib_uverbs_write+0xc6/0x2c0 [ib_uverbs]
[1750924.568035]  [<ffffffff81312e68>] ? apparmor_file_permission+0x18/0x20
[1750924.568035]  [<ffffffff812d4cd3>] ? security_file_permission+0x23/0xa0
[1750924.568035]  [<ffffffff811bd214>] vfs_write+0xb4/0x1f0
[1750924.568035]  [<ffffffff811bdc49>] SyS_write+0x49/0xa0
[1750924.568035]  [<ffffffff8172f7ed>] system_call_fastpath+0x1a/0x1f
[1750924.568035] Code: 66 2e 0f 1f 84 00 00 00 00 00 31 c0 5d c3 66 2e 0f 1f
84 00 00 00 00 00 66 90 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb 48 8b 7f 10
<f0> ff 8f 40 01 00 00 74 0e 48 89 df e8 8e f8 06 e1 5b 5d c3 0f
[1750924.568035] RIP  [<ffffffffa0131d51>] qib_mcast_qp_free+0x11/0x50
[ib_qib]
[1750924.568035]  RSP <ffff88007af1dd70>
[1750924.650439] ---[ end trace 73d5d4b3f8ad4851 ]

The fix is to note the qib_mcast_qp that was found.   If none is found, then
return EINVAL indicating the error.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reported-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
Insu Yun [Sat, 23 Jan 2016 20:44:19 +0000 (15:44 -0500)]
ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()

commit 2c3033a0664dfae91e1dee7fabac10f24354b958 upstream.

In acpiphp_enable_slot(), there is a missing unlock path
when error occurred.  It needs to be unlocked before returning
an error.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/radeon/pm: adjust display configuration after powerstate
Alex Deucher [Fri, 19 Feb 2016 23:05:10 +0000 (18:05 -0500)]
drm/radeon/pm: adjust display configuration after powerstate

commit 39d4275058baf53e89203407bf3841ff2c74fa32 upstream.

set_power_state defaults to no displays, so we need to update
the display configuration after setting up the powerstate on the
first call. In most cases this is not an issue since ends up
getting called multiple times at any given modeset and the proper
order is achieved in the display changed handling at the top of
the function.

Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Jordan Lazare <Jordan.Lazare@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/radeon: use post-decrement in error handling
Rasmus Villemoes [Mon, 15 Feb 2016 18:41:47 +0000 (19:41 +0100)]
drm/radeon: use post-decrement in error handling

commit bc3f5d8c4ca01555820617eb3b6c0857e4df710d upstream.

We need to use post-decrement to get the pci_map_page undone also for
i==0, and to avoid some very unpleasant behaviour if pci_map_page
failed already at i==0.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command
Gerd Hoffmann [Tue, 16 Feb 2016 13:25:00 +0000 (14:25 +0100)]
drm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command

commit 34855706c30d52b0a744da44348b5d1cc39fbe51 upstream.

This avoids integer overflows on 32bit machines when calculating
reloc_info size, as reported by Alan Cox.

Cc: gnomes@lxorguk.ukuu.org.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/i915/dp: fall back to 18 bpp when sink capability is unknown
Jani Nikula [Wed, 13 Jan 2016 14:35:20 +0000 (16:35 +0200)]
drm/i915/dp: fall back to 18 bpp when sink capability is unknown

commit 5efd407674068dede403551bea3b0b134c32513a upstream.

Per DP spec, the source device should fall back to 18 bpp, VESA range
RGB when the sink capability is unknown. Fix the color depth
clamping. 18 bpp color depth should ensure full color range in automatic
mode.

The clamping has been HDMI specific since its introduction in

commit 996a2239f93b03c5972923f04b097f65565c5bed
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Apr 19 11:24:34 2013 +0200

    drm/i915: Disable high-bpc on pre-1.4 EDID screens

Reported-and-tested-by: Dihan Wickremasuriya <nayomal@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=105331
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452695720-7076-1-git-send-email-jani.nikula@intel.com
(cherry picked from commit 013dd9e038723bbd2aa67be51847384b75be8253)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/radeon: hold reference to fences in radeon_sa_bo_new
Nicolai Hähnle [Fri, 5 Feb 2016 19:35:53 +0000 (14:35 -0500)]
drm/radeon: hold reference to fences in radeon_sa_bo_new

commit f6ff4f67cdf8455d0a4226eeeaf5af17c37d05eb upstream.

An arbitrary amount of time can pass between spin_unlock and
radeon_fence_wait_any, so we need to ensure that nobody frees the
fences from under us.

Based on the analogous fix for amdgpu.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/radeon: clean up fujitsu quirks
Alex Deucher [Thu, 17 Dec 2015 17:52:17 +0000 (12:52 -0500)]
drm/radeon: clean up fujitsu quirks

commit 0eb1c3d4084eeb6fb3a703f88d6ce1521f8fcdd1 upstream.

Combine the two quirks.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=109481

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/vmwgfx: respect 'nomodeset'
Rob Clark [Wed, 15 Oct 2014 19:00:47 +0000 (15:00 -0400)]
drm/vmwgfx: respect 'nomodeset'

commit 96c5d076f0a5e2023ecdb44d8261f87641ee71e0 upstream.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosparc64: fix incorrect sign extension in sys_sparc64_personality
Dmitry V. Levin [Sat, 26 Dec 2015 23:13:27 +0000 (02:13 +0300)]
sparc64: fix incorrect sign extension in sys_sparc64_personality

commit 525fd5a94e1be0776fa652df5c687697db508c91 upstream.

The value returned by sys_personality has type "long int".
It is saved to a variable of type "int", which is not a problem
yet because the type of task_struct->pesonality is "unsigned int".
The problem is the sign extension from "int" to "long int"
that happens on return from sys_sparc64_personality.

For example, a userspace call personality((unsigned) -EINVAL) will
result to any subsequent personality call, including absolutely
harmless read-only personality(0xffffffff) call, failing with
errno set to EINVAL.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoEDAC: Robustify workqueues destruction
Borislav Petkov [Fri, 27 Nov 2015 09:38:38 +0000 (10:38 +0100)]
EDAC: Robustify workqueues destruction

commit fcd5c4dd8201595d4c598c9cca5e54760277d687 upstream.

EDAC workqueue destruction is really fragile. We cancel delayed work
but if it is still running and requeues itself, we still go ahead and
destroy the workqueue and the queued work explodes when workqueue core
attempts to run it.

Make the destruction more robust by switching op_state to offline so
that requeuing stops. Cancel any pending work *synchronously* too.

  EDAC i7core: Driver loaded.
  general protection fault: 0000 [#1] SMP
  CPU 12
  Modules linked in:
  Supported: Yes
  Pid: 0, comm: kworker/0:1 Tainted: G          IE   3.0.101-0-default #1 HP ProLiant DL380 G7
  RIP: 0010:[<ffffffff8107dcd7>]  [<ffffffff8107dcd7>] __queue_work+0x17/0x3f0
  < ... regs ...>
  Process kworker/0:1 (pid: 0, threadinfo ffff88019def6000, task ffff88019def4600)
  Stack:
   ...
  Call Trace:
   call_timer_fn
   run_timer_softirq
   __do_softirq
   call_softirq
   do_softirq
   irq_exit
   smp_apic_timer_interrupt
   apic_timer_interrupt
   intel_idle
   cpuidle_idle_call
   cpu_idle
  Code: ...
  RIP  __queue_work
   RSP <...>

Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
zengtao [Tue, 2 Feb 2016 03:38:34 +0000 (11:38 +0800)]
cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()

commit 0f26922fe5dc5724b1adbbd54b21bad03590b4f3 upstream.

The datatype __kernel_time_t is u32 on 32bit platform, so its subject to
overflows in the timeval/timespec to cputime conversion.

Currently the following functions are affected:
1. setitimer()
2. timer_create/timer_settime()
3. sys_clock_nanosleep

This can happen on MIPS32 and ARM32 with "Full dynticks CPU time accounting"
enabled, which is required for CONFIG_NO_HZ_FULL.

Enforce u64 conversion to prevent the overflow.

Fixes: 31c1fc818715 ("ARM: Kconfig: allow full nohz CPU accounting")
Signed-off-by: zengtao <prime.zeng@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1454384314-154784-1-git-send-email-prime.zeng@huawei.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agommc: mmci: fix an ages old detection error
Linus Walleij [Mon, 4 Jan 2016 01:21:55 +0000 (02:21 +0100)]
mmc: mmci: fix an ages old detection error

commit 0bcb7efdff63564e80fe84dd36a9fbdfbf6697a4 upstream.

commit 4956e10903fd ("ARM: 6244/1: mmci: add variant data and default
MCICLOCK support") added variant data for ARM, U300 and Ux500 variants.
The Nomadik NHK8815/8820 variant was erroneously labeled as a U300
variant, and when the proper Nomadik variant was later introduced in
commit 34fd421349ff ("ARM: 7378/1: mmci: add support for the Nomadik MMCI
variant") this was not fixes. Let's say this fixes the latter commit as
there was no proper Nomadik support until then.

Fixes: 34fd421349ff ("ARM: 7378/1: mmci: add support for the Nomadik...")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agommc: sdhci: Fix sdhci_runtime_pm_bus_on/off()
Adrian Hunter [Thu, 26 Nov 2015 12:00:50 +0000 (14:00 +0200)]
mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off()

commit 5c671c410c8704800f4f1673b6f572137e7e6ddd upstream.

sdhci has a legacy facility to prevent runtime suspend if the
bus power is on.  This is needed in cases where the power to
the card is dependent on the bus power.  It is controlled by
a pair of functions: sdhci_runtime_pm_bus_on() and
sdhci_runtime_pm_bus_off().  These functions use a boolean
variable 'bus_on' to ensure changes are always paired.
There is an additional check for 'runtime_suspended' which is
the problem.  In fact, its use is ill-conceived as the only
requirement for the logic is that 'on' and 'off' are paired,
which is actually broken by the check, for example if the bus
power is turned on during runtime resume.  So remove  the check.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agommc: sdio: Fix invalid vdd in voltage switch power cycle
Adrian Hunter [Thu, 26 Nov 2015 12:00:47 +0000 (14:00 +0200)]
mmc: sdio: Fix invalid vdd in voltage switch power cycle

commit d9bfbb95ed598a09cf336adb0f190ee0ff802f0d upstream.

The 'ocr' parameter passed to mmc_set_signal_voltage()
defines the power-on voltage used when power cycling
after a failure to set the voltage.  However, in the
case of mmc_sdio_init_card(), the value passed has the
R4_18V_PRESENT flag set which is not valid for power-on
and results in an invalid vdd.  Fix by passing the card's
ocr value which does not have the flag.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoposix-clock: Fix return code on the poll method's error path
Richard Cochran [Tue, 22 Dec 2015 21:19:58 +0000 (22:19 +0100)]
posix-clock: Fix return code on the poll method's error path

commit 1b9f23727abb92c5e58f139e7d180befcaa06fe0 upstream.

The posix_clock_poll function is supposed to return a bit mask of
POLLxxx values.  However, in case the hardware has disappeared (due to
hot plugging for example) this code returns -ENODEV in a futile
attempt to throw an error at the file descriptor level.  The kernel's
file_operations interface does not accept such error codes from the
poll method.  Instead, this function aught to return POLLERR.

The value -ENODEV does, in fact, contain the POLLERR bit (and almost
all the other POLLxxx bits as well), but only by chance.  This patch
fixes code to return a proper bit mask.

Credit goes to Markus Elfring for pointing out the suspicious
signed/unsigned mismatch.

Reported-by: Markus Elfring <elfring@users.sourceforge.net>
igned-off-by: Richard Cochran <richardcochran@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Link: http://lkml.kernel.org/r/1450819198-17420-1-git-send-email-richardcochran@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodm snapshot: fix hung bios when copy error occurs
Mikulas Patocka [Sat, 9 Jan 2016 00:07:55 +0000 (19:07 -0500)]
dm snapshot: fix hung bios when copy error occurs

commit 385277bfb57faac44e92497104ba542cdd82d5fe upstream.

When there is an error copying a chunk dm-snapshot can incorrectly hold
associated bios indefinitely, resulting in hung IO.

The function copy_callback sets pe->error if there was error copying the
chunk, and then calls complete_exception.  complete_exception calls
pending_complete on error, otherwise it calls commit_exception with
commit_callback (and commit_callback calls complete_exception).

The persistent exception store (dm-snap-persistent.c) assumes that calls
to prepare_exception and commit_exception are paired.
persistent_prepare_exception increases ps->pending_count and
persistent_commit_exception decreases it.

If there is a copy error, persistent_prepare_exception is called but
persistent_commit_exception is not.  This results in the variable
ps->pending_count never returning to zero and that causes some pending
exceptions (and their associated bios) to be held forever.

Fix this by unconditionally calling commit_exception regardless of
whether the copy was successful.  A new "valid" parameter is added to
commit_exception -- when the copy fails this parameter is set to zero so
that the chunk that failed to copy (and all following chunks) is not
recorded in the snapshot store.  Also, remove commit_callback now that
it is merely a wrapper around pending_complete.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodm space map metadata: remove unused variable in brb_pop()
Mike Snitzer [Mon, 14 Dec 2015 14:26:01 +0000 (09:26 -0500)]
dm space map metadata: remove unused variable in brb_pop()

commit 512167788a6fe9481a33a3cce5f80b684631a1bb upstream.

Remove the unused struct block_op pointer that was inadvertantly
introduced, via cut-and-paste of previous brb_op() code, as part of
commit 50dd842ad.

(Cc'ing stable@ because commit 50dd842ad did)

Fixes: 50dd842ad ("dm space map metadata: fix ref counting bug when bootstrapping a new space map")
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotda1004x: only update the frontend properties if locked
Mauro Carvalho Chehab [Wed, 3 Feb 2016 19:33:48 +0000 (17:33 -0200)]
tda1004x: only update the frontend properties if locked

commit e8beb02343e7582980c6705816cd957cf4f74c7a upstream.

The tda1004x was updating the properties cache before locking.
If the device is not locked, the data at the registers are just
random values with no real meaning.

This caused the driver to fail with libdvbv5, as such library
calls GET_PROPERTY from time to time, in order to return the
DVB stats.

Tested with a saa7134 card 78:
ASUSTeK P7131 Dual, vendor PCI ID: 1043:4862

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agogspca: ov534/topro: prevent a division by 0
Antonio Ospite [Fri, 2 Oct 2015 20:33:13 +0000 (17:33 -0300)]
gspca: ov534/topro: prevent a division by 0

commit dcc7fdbec53a960588f2c40232db2c6466c09917 upstream.

v4l2-compliance sends a zeroed struct v4l2_streamparm in
v4l2-test-formats.cpp::testParmType(), and this results in a division by
0 in some gspca subdrivers:

  divide error: 0000 [#1] SMP
  Modules linked in: gspca_ov534 gspca_main ...
  CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
  Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
    ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
  task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
  RIP: 0010:[<ffffffffa079bd62>]  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
  RSP: 0018:ffff880095c4fce8  EFLAGS: 00010296
  RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
  RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
  RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
  R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
  R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
  FS:  00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
  Stack:
   ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
   ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
   ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
  Call Trace:
   [<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
   [<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
   [<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
   [<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
   [<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
   [<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
   [<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
   [<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
   [<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
   [<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
   [<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
   [<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
  Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
    00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
    76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
  RIP  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
   RSP <ffff880095c4fce8>
  ---[ end trace 279710c2c6c72080 ]---

Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):

  ...
  To reset manually applications can just set this field to zero.

fix the issue by resetting the frame rate to a default value in case of
an unusable timeperframe.

The fix is done in the subdrivers instead of gspca.c because only the
subdrivers have notion of a default frame rate to reset the camera to.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomedia: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode
Malcolm Priestley [Mon, 31 Aug 2015 09:13:45 +0000 (06:13 -0300)]
media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode

commit c9d57de6103e343f2d4e04ea8d9e417e10a24da7 upstream.

When in FE_TUNE_MODE_ONESHOT the frontend must report
the actual capabilities so user can take appropriate
action.

With frontends that can't do auto inversion this is done
by dvb-core automatically so CAN_INVERSION_AUTO is valid.

However, when in FE_TUNE_MODE_ONESHOT this is not true.

So only set FE_CAN_INVERSION_AUTO in modes other than
FE_TUNE_MODE_ONESHOT

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agouml: fix hostfs mknod()
Vegard Nossum [Wed, 16 Dec 2015 20:59:56 +0000 (21:59 +0100)]
uml: fix hostfs mknod()

commit 9f2dfda2f2f1c6181c3732c16b85c59ab2d195e0 upstream.

An inverted return value check in hostfs_mknod() caused the function
to return success after handling it as an error (and cleaning up).

It resulted in the following segfault when trying to bind() a named
unix socket:

  Pid: 198, comm: a.out Not tainted 4.4.0-rc4
  RIP: 0033:[<0000000061077df6>]
  RSP: 00000000daae5d60  EFLAGS: 00010202
  RAX: 0000000000000000 RBX: 000000006092a460 RCX: 00000000dfc54208
  RDX: 0000000061073ef1 RSI: 0000000000000070 RDI: 00000000e027d600
  RBP: 00000000daae5de0 R08: 00000000da980ac0 R09: 0000000000000000
  R10: 0000000000000003 R11: 00007fb1ae08f72a R12: 0000000000000000
  R13: 000000006092a460 R14: 00000000daaa97c0 R15: 00000000daaa9a88
  Kernel panic - not syncing: Kernel mode fault at addr 0x40, ip 0x61077df6
  CPU: 0 PID: 198 Comm: a.out Not tainted 4.4.0-rc4 #1
  Stack:
   e027d620 dfc54208 0000006f da981398
   61bee000 0000c1ed daae5de0 0000006e
   e027d620 dfcd4208 00000005 6092a460
  Call Trace:
   [<60dedc67>] SyS_bind+0xf7/0x110
   [<600587be>] handle_syscall+0x7e/0x80
   [<60066ad7>] userspace+0x3e7/0x4e0
   [<6006321f>] ? save_registers+0x1f/0x40
   [<6006c88e>] ? arch_prctl+0x1be/0x1f0
   [<60054985>] fork_handler+0x85/0x90

Let's also get rid of the "cosmic ray protection" while we're at it.

Fixes: e9193059b1b3 "hostfs: fix races in dentry_name() and inode_name()"
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agouml: flush stdout before forking
Vegard Nossum [Fri, 18 Dec 2015 20:28:53 +0000 (21:28 +0100)]
uml: flush stdout before forking

commit 0754fb298f2f2719f0393491d010d46cfb25d043 upstream.

I was seeing some really weird behaviour where piping UML's output
somewhere would cause output to get duplicated:

  $ ./vmlinux | head -n 40
  Checking that ptrace can change system call numbers...Core dump limits :
          soft - 0
          hard - NONE
  OK
  Checking syscall emulation patch for ptrace...Core dump limits :
          soft - 0
          hard - NONE
  OK
  Checking advanced syscall emulation patch for ptrace...Core dump limits :
          soft - 0
          hard - NONE
  OK
  Core dump limits :
          soft - 0
          hard - NONE

This is because these tests do a fork() which duplicates the non-empty
stdout buffer, then glibc flushes the duplicated buffer as each child
exits.

A simple workaround is to flush before forking.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agos390/dasd: fix refcount for PAV reassignment
Stefan Haberland [Tue, 15 Dec 2015 09:45:05 +0000 (10:45 +0100)]
s390/dasd: fix refcount for PAV reassignment

commit 9d862ababb609439c5d6987f6d3ddd09e703aa0b upstream.

Add refcount to the DASD device when a summary unit check worker is
scheduled. This prevents that the device is set offline with worker
in place.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agos390/dasd: prevent incorrect length error under z/VM after PAV changes
Stefan Haberland [Tue, 15 Dec 2015 09:16:43 +0000 (10:16 +0100)]
s390/dasd: prevent incorrect length error under z/VM after PAV changes

commit 020bf042e5b397479c1174081b935d0ff15d1a64 upstream.

The channel checks the specified length and the provided amount of
data for CCWs and provides an incorrect length error if the size does
not match. Under z/VM with simulation activated the length may get
changed. Having the suppress length indication bit set is stated as
good CCW coding practice and avoids errors under z/VM.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agos390: fix normalization bug in exception table sorting
Ard Biesheuvel [Fri, 1 Jan 2016 12:39:22 +0000 (13:39 +0100)]
s390: fix normalization bug in exception table sorting

commit bcb7825a77f41c7dd91da6f7ac10b928156a322e upstream.

The normalization pass in the sorting routine of the relative exception
table serves two purposes:
- it ensures that the address fields of the exception table entries are
  fully ordered, so that no ambiguities arise between entries with
  identical instruction offsets (i.e., when two instructions that are
  exactly 8 bytes apart each have an exception table entry associated with
  them)
- it ensures that the offsets of both the instruction and the fixup fields
  of each entry are relative to their final location after sorting.

Commit eb608fb366de ("s390/exceptions: switch to relative exception table
entries") ported the relative exception table format from x86, but modified
the sorting routine to only normalize the instruction offset field and not
the fixup offset field. The result is that the fixup offset of each entry
will be relative to the original location of the entry before sorting,
likely leading to crashes when those entries are dereferenced.

Fixes: eb608fb366de ("s390/exceptions: switch to relative exception table entries")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoBtrfs: fix number of transaction units required to create symlink
Filipe Manana [Thu, 31 Dec 2015 18:16:29 +0000 (18:16 +0000)]
Btrfs: fix number of transaction units required to create symlink

commit 9269d12b2d57d9e3d13036bb750762d1110d425c upstream.

We weren't accounting for the insertion of an inline extent item for the
symlink inode nor that we need to update the parent inode item (through
the call to btrfs_add_nondir()). So fix this by including two more
transaction units.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoBtrfs: send, don't BUG_ON() when an empty symlink is found
Filipe Manana [Thu, 31 Dec 2015 18:07:59 +0000 (18:07 +0000)]
Btrfs: send, don't BUG_ON() when an empty symlink is found

commit a879719b8c90e15c9e7fa7266d5e3c0ca962f9df upstream.

When a symlink is successfully created it always has an inline extent
containing the source path. However if an error happens when creating
the symlink, we can leave in the subvolume's tree a symlink inode without
any such inline extent item - this happens if after btrfs_symlink() calls
btrfs_end_transaction() and before it calls the inode eviction handler
(through the final iput() call), the transaction gets committed and a
crash happens before the eviction handler gets called, or if a snapshot
of the subvolume is made before the eviction handler gets called. Sadly
we can't just avoid this by making btrfs_symlink() call
btrfs_end_transaction() after it calls the eviction handler, because the
later can commit the current transaction before it removes any items from
the subvolume tree (if it encounters ENOSPC errors while reserving space
for removing all the items).

So make send fail more gracefully, with an -EIO error, and print a
message to dmesg/syslog informing that there's an empty symlink inode,
so that the user can delete the empty symlink or do something else
about it.

Reported-by: Stephen R. van den Berg <srb@cuci.nl>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoBtrfs: igrab inode in writepage
Josef Bacik [Thu, 22 Oct 2015 19:05:09 +0000 (15:05 -0400)]
Btrfs: igrab inode in writepage

commit be7bd730841e69fe8f70120098596f648cd1f3ff upstream.

We hit this panic on a few of our boxes this week where we have an
ordered_extent with an NULL inode.  We do an igrab() of the inode in writepages,
but weren't doing it in writepage which can be called directly from the VM on
dirty pages.  If the inode has been unlinked then we could have I_FREEING set
which means igrab() would return NULL and we get this panic.  Fix this by trying
to igrab in btrfs_writepage, and if it returns NULL then just redirty the page
and return AOP_WRITEPAGE_ACTIVATE; so the VM knows it wasn't successful.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoBtrfs: add missing brelse when superblock checksum fails
Anand Jain [Wed, 7 Oct 2015 09:23:23 +0000 (17:23 +0800)]
Btrfs: add missing brelse when superblock checksum fails

commit b2acdddfad13c38a1e8b927d83c3cf321f63601a upstream.

Looks like oversight, call brelse() when checksum fails. Further down the
code, in the non error path, we do call brelse() and so we don't see
brelse() in the goto error paths.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoscripts: recordmcount: break hardlinks
Russell King [Fri, 11 Dec 2015 12:09:03 +0000 (12:09 +0000)]
scripts: recordmcount: break hardlinks

commit dd39a26538e37f6c6131e829a4a510787e43c783 upstream.

recordmcount edits the file in-place, which can cause problems when
using ccache in hardlink mode.  Arrange for recordmcount to break a
hardlinked object.

Link: http://lkml.kernel.org/r/E1a7MVT-0000et-62@rmk-PC.arm.linux.org.uk
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agopowercap / RAPL: fix BIOS lock check
Prarit Bhargava [Wed, 9 Dec 2015 13:31:12 +0000 (08:31 -0500)]
powercap / RAPL: fix BIOS lock check

commit 79a21dbfae3cd40d5a801778071a9967b79c2c20 upstream.

Intel RAPL initialized on several systems where the BIOS lock bit (msr
0x610, bit 63) was set.  This occured because the return value of
rapl_read_data_raw() was being checked, rather than the value of the variable
passed in, locked.

This patch properly implments the rapl_read_data_raw() call to check the
variable locked, and now the Intel RAPL driver outputs the warning:

intel_rapl: RAPL package 0 domain package locked by BIOS

and does not initialize for the package.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>