]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/processor-sdk-linux.git/log
processor-sdk/processor-sdk-linux.git
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor... PLSDK-RT-04.02.00.09
Jacob Stiffler [Fri, 22 Dec 2017 22:33:07 +0000 (17:33 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  prueth: reinitialize the node table if requested by node_table_clear flag
  net: ti: prueth: add node table
  prueth: move definitions to the header file

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #38 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1663 to proces... PLSDK-INT-04.02.00.09
Vivek Chengalvala [Fri, 22 Dec 2017 21:16:35 +0000 (15:16 -0600)]
Merge pull request #38 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1663 to processor-sdk-linux-int-4.9.y

* commit 'bad6ca109b1dc4ee063b1cfe70f0f38fba714a35':
  prueth: reinitialize the node table if requested by node_table_clear flag
  net: ti: prueth: add node table
  prueth: move definitions to the header file

6 years agoprueth: reinitialize the node table if requested by node_table_clear flag
Vitaly Andrianov [Fri, 22 Dec 2017 16:11:12 +0000 (11:11 -0500)]
prueth: reinitialize the node table if requested by node_table_clear flag

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agonet: ti: prueth: add node table
Vitaly Andrianov [Fri, 22 Dec 2017 15:44:00 +0000 (10:44 -0500)]
net: ti: prueth: add node table

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoprueth: move definitions to the header file
Vitaly Andrianov [Fri, 22 Dec 2017 13:00:27 +0000 (08:00 -0500)]
prueth: move definitions to the header file

The prueth.c is quite large file and we need to split it into logical
parts. This commit moves common definitions to the header file.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Thu, 21 Dec 2017 14:00:13 +0000 (09:00 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  net: ethernet: ti: iep: unregister from ptp boundary clock monitoring module
  net: ethernet: ti: iep: release iep pinctrl resource when prueth is removed
  net: ethernet: ti: prueth: modify IEP ptp clock info name

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #40 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1760 to proces...
WingMan Kwok [Wed, 20 Dec 2017 22:24:55 +0000 (16:24 -0600)]
Merge pull request #40 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1760 to processor-sdk-linux-int-4.9.y

* commit '7667aacc71feb5db2875e1dc5c6380adbf97f372':
  net: ethernet: ti: iep: unregister from ptp boundary clock monitoring module
  net: ethernet: ti: iep: release iep pinctrl resource when prueth is removed
  net: ethernet: ti: prueth: modify IEP ptp clock info name

6 years agonet: ethernet: ti: iep: unregister from ptp boundary clock monitoring module
WingMan Kwok [Wed, 20 Dec 2017 13:44:24 +0000 (08:44 -0500)]
net: ethernet: ti: iep: unregister from ptp boundary clock monitoring module

When iep is unregistered, it should unregister itself from
being part of a ptp boundary clock from the ptp boundary clock
monitoring module.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: iep: release iep pinctrl resource when prueth is removed
WingMan Kwok [Wed, 20 Dec 2017 07:54:18 +0000 (02:54 -0500)]
net: ethernet: ti: iep: release iep pinctrl resource when prueth is removed

Before this patch, iep pinctrl resource is released when a prueth port
is configured down. But IEP module is shared between prueth ports. Thus
IEP pinctrl resource should only be releaseed when prueth driver is removed.
This patch makes changes for that.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: prueth: modify IEP ptp clock info name
WingMan Kwok [Wed, 20 Dec 2017 07:37:58 +0000 (02:37 -0500)]
net: ethernet: ti: prueth: modify IEP ptp clock info name

On some platforms such as AM571x, there are two instances
of ICSS and hence two instances of IEP and IEP ptp clock
drivers. This patch modifies the IEP ptp clock name to be
ICSS instance specific so that when the clock_name being
looked up in driver sys class, one can distinguish which
IEP ptp clock instance is for which ICSS instance.

Example:

$ cat /sys/class/ptp/ptp2/clock_name
PRUSS1 timer

$ cat /sys/class/ptp/ptp1/clock_name
PRUSS2 timer

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Tue, 19 Dec 2017 14:02:24 +0000 (09:02 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  ti_config_fragments/dra7_only.cfg: enable TI_PTP_BC
  arm: dts: am57xx ptp boundary clock dt bindings
  net: ethernet: ti: cpts: add boundary clock internal sync control
  net: ethernet: ti: iep: add boundary clock internal sync control
  net: ethernet: ti: introduce ptp boundary clock internal sync monitor driver
  Documentation: dt: net: Add TI-PTP-BC bindings
  arm: dts: am571x: add off state for pru sync latch pinmux bindings
  arm: dts: am572x: add pru sync latch pinmux bindings
  net: ethernet: ti: iep: use pinmux control to configure iep sync latch
  net: ethernet: ti: iep: add support of pru iep latch
  net: ethernet: ti: iep: add support of pru iep n_per_out
  net: ethernet: ti: iep: add support of multiple pru iep pps signals
  net: ti: iep: rename function iep_enable to iep_ptp_feature_enable

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #37 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1748 to proces...
WingMan Kwok [Mon, 18 Dec 2017 23:16:00 +0000 (17:16 -0600)]
Merge pull request #37 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1748 to processor-sdk-linux-int-4.9.y

* commit 'e8b5ebb9783091647846e3bd52b9e9dd93548bbf':
  ti_config_fragments/dra7_only.cfg: enable TI_PTP_BC
  arm: dts: am57xx ptp boundary clock dt bindings
  net: ethernet: ti: cpts: add boundary clock internal sync control
  net: ethernet: ti: iep: add boundary clock internal sync control
  net: ethernet: ti: introduce ptp boundary clock internal sync monitor driver
  Documentation: dt: net: Add TI-PTP-BC bindings
  arm: dts: am571x: add off state for pru sync latch pinmux bindings
  arm: dts: am572x: add pru sync latch pinmux bindings
  net: ethernet: ti: iep: use pinmux control to configure iep sync latch
  net: ethernet: ti: iep: add support of pru iep latch
  net: ethernet: ti: iep: add support of pru iep n_per_out
  net: ethernet: ti: iep: add support of multiple pru iep pps signals
  net: ti: iep: rename function iep_enable to iep_ptp_feature_enable

6 years agoti_config_fragments/dra7_only.cfg: enable TI_PTP_BC
WingMan Kwok [Thu, 14 Dec 2017 23:41:00 +0000 (18:41 -0500)]
ti_config_fragments/dra7_only.cfg: enable TI_PTP_BC

Include PTP boundary clock kernel driver by default on AM57xx
platforms.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoarm: dts: am57xx ptp boundary clock dt bindings
WingMan Kwok [Thu, 14 Dec 2017 00:51:43 +0000 (19:51 -0500)]
arm: dts: am57xx ptp boundary clock dt bindings

Added PTP boundary clock default dt bindings for AM571x and AM572x.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: cpts: add boundary clock internal sync control
WingMan Kwok [Thu, 14 Dec 2017 23:28:59 +0000 (18:28 -0500)]
net: ethernet: ti: cpts: add boundary clock internal sync control

Enhanced CPTS driver so that if it is a "sub-clock" of a PTP
boundary clock on AM572x, it requests permission from the PTP
BC driver before it can enable 1PPS for sub-clock internal sync
purpose.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: iep: add boundary clock internal sync control
WingMan Kwok [Sun, 17 Dec 2017 03:06:35 +0000 (22:06 -0500)]
net: ethernet: ti: iep: add boundary clock internal sync control

Enhanced IEP driver so that if it is a "sub-clock" of a PTP
boundary clock on AM572x, it requests permission from the PTP
BC driver before it can enable 1PPS for sub-clock internal sync
purpose.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: introduce ptp boundary clock internal sync monitor driver
WingMan Kwok [Thu, 14 Dec 2017 01:40:19 +0000 (20:40 -0500)]
net: ethernet: ti: introduce ptp boundary clock internal sync monitor driver

On some of TI's platforms, more than one timing capable modules are
included. Consider, for example, the CPTS and the two IEP modules on
AM57xx platforms. When these timing modules participate in a PTP
boundary clock (BC) functionality, the PTP clocks implemented by these
modules need to be internally synchronized to the same PTP time of the
PTP domain in which the BC participates. If the internal sync is done
by using the 1PPS generated by the timing modules, it needs to make
sure that only one such module is generating 1PPS at any given
instant of time, for otherwise the SoC life may be damaged over time
when more than one timing module has output signal going against each
other. It is not suffice to rely on the application that implements
that PTP boundary clock software functionality to ensure the one
out-going PPS policy for user may "accidentally" issue PPS enablement
outside of the PTP BC application, for example, through sysfs.

This patch introduces a small driver so that the driver of each BC
participating timing module needs to get permission from this driver
before it can enable its PPS.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoDocumentation: dt: net: Add TI-PTP-BC bindings
WingMan Kwok [Fri, 15 Dec 2017 16:16:06 +0000 (11:16 -0500)]
Documentation: dt: net: Add TI-PTP-BC bindings

Add DT binding information for TI's PTP boundary
clock internal monitor driver.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoarm: dts: am571x: add off state for pru sync latch pinmux bindings
WingMan Kwok [Sun, 17 Dec 2017 03:21:01 +0000 (22:21 -0500)]
arm: dts: am571x: add off state for pru sync latch pinmux bindings

Prior commit allows only pinmux sync state for the pru sync pin.
Similarly, only latch state is allowed for latch pin.  This patch
adds off state for such pins.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoarm: dts: am572x: add pru sync latch pinmux bindings
WingMan Kwok [Thu, 14 Dec 2017 22:22:19 +0000 (17:22 -0500)]
arm: dts: am572x: add pru sync latch pinmux bindings

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: iep: use pinmux control to configure iep sync latch
WingMan Kwok [Sat, 18 Nov 2017 00:28:53 +0000 (19:28 -0500)]
net: ethernet: ti: iep: use pinmux control to configure iep sync latch

Previous commit hard coded the pru iep sync latch pinmux configurations.
Such approach is not scalable since different SoC, for example, AM571x
and AM572x, may have differnt number of supported sync latch pins. This
patch replaces the hard coded iep sync latch pinmux configurations by
using the pinctrl subsystem.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: iep: add support of pru iep latch
WingMan Kwok [Fri, 1 Dec 2017 01:27:47 +0000 (20:27 -0500)]
net: ethernet: ti: iep: add support of pru iep latch

Adds support of pru iep latch 0 & 1. PRU IEP latches are
supported by the iep capture 6 & 7 respoectively.

This patch only supports AM572x pad configuration
needed to bring in latch signals. Subsequent patch will add
support of AM571x latch as well.

IEP latch is enabled through Linux's PTP EXTTS request.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: iep: add support of pru iep n_per_out
WingMan Kwok [Fri, 1 Dec 2017 01:26:39 +0000 (20:26 -0500)]
net: ethernet: ti: iep: add support of pru iep n_per_out

This patch adds support of 1 periodic out pin.
This pin is used for external pps for measurement.
Thus period must be 1 sec and start time will be
ignored. The first 1 sec periodic pulse starts from
the next second boundary of iep time.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: iep: add support of multiple pru iep pps signals
WingMan Kwok [Thu, 9 Nov 2017 13:26:27 +0000 (08:26 -0500)]
net: ethernet: ti: iep: add support of multiple pru iep pps signals

Before this patch, only one pps signal enable/disable is supported
by the PRU IEP driver. Such pps signal is provided by the sync0
pin of the IEP HW module. Since in some applications the pps signal
is used for internal ptp phc synchronization with another timing
module of the same SoC and cannot be used for external phc jitter
measurement simultaneously, this patch enhances the iep driver to
support more than one pps signals. One (internal) will be for
internal ptp phc sync while the other one (exteral) will be for
measurement.

User can enable/disable the internal pps through sysfs

/sys/class/ptp/ptpX/pps_enable

or ptp phc's pps API.  This pps signal's hit events are reported to
upper pps layer. The X in ptpX is determined during runtime.

Remaining pps signals are provided by the remaining IEP sync pins
and are enabled/disabled through the ptp phc periodic out API with
period equal to 1 sec (other periods will not be supported).

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ti: iep: rename function iep_enable to iep_ptp_feature_enable
WingMan Kwok [Thu, 14 Dec 2017 23:51:11 +0000 (18:51 -0500)]
net: ti: iep: rename function iep_enable to iep_ptp_feature_enable

Renames function iep_enable to iep_ptp_feature_enable. The new
name better reflects the purpose of the function. No functionality
change.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Thu, 14 Dec 2017 00:14:21 +0000 (19:14 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  arm: dts: am571x-idk: add pruss_eth sync/latch control pins
  drivers: cpts: enable 1pps features per device tree
  arm: dts: add cpts 1pps latch input pins
  drivers: cpts: add ptp 1pps latch support
  arm: dts: add cpts 1pps reference output pins
  drivers: cpts: add 1pps reference pulse (ptp: period output)
  drivers: cpts: fix 1pps on/off threshold

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #36 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1381-v3 to...
Eric Ruei [Wed, 13 Dec 2017 18:47:41 +0000 (12:47 -0600)]
Merge pull request #36 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1381-v3 to processor-sdk-linux-int-4.9.y

* commit '0685785ec4446478c09283dd3ade0031f9ece077':
  arm: dts: am571x-idk: add pruss_eth sync/latch control pins
  drivers: cpts: enable 1pps features per device tree
  arm: dts: add cpts 1pps latch input pins
  drivers: cpts: add ptp 1pps latch support
  arm: dts: add cpts 1pps reference output pins
  drivers: cpts: add 1pps reference pulse (ptp: period output)
  drivers: cpts: fix 1pps on/off threshold

6 years agoarm: dts: am571x-idk: add pruss_eth sync/latch control pins
Eric Ruei [Tue, 12 Dec 2017 20:38:22 +0000 (15:38 -0500)]
arm: dts: am571x-idk: add pruss_eth sync/latch control pins

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agodrivers: cpts: enable 1pps features per device tree
Eric Ruei [Wed, 13 Dec 2017 16:36:00 +0000 (11:36 -0500)]
drivers: cpts: enable 1pps features per device tree

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agoarm: dts: add cpts 1pps latch input pins
Eric Ruei [Tue, 12 Dec 2017 18:39:08 +0000 (13:39 -0500)]
arm: dts: add cpts 1pps latch input pins

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agodrivers: cpts: add ptp 1pps latch support
Eric Ruei [Wed, 13 Dec 2017 16:33:03 +0000 (11:33 -0500)]
drivers: cpts: add ptp 1pps latch support

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agoarm: dts: add cpts 1pps reference output pins
Eric Ruei [Sat, 9 Dec 2017 15:50:02 +0000 (10:50 -0500)]
arm: dts: add cpts 1pps reference output pins

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agodrivers: cpts: add 1pps reference pulse (ptp: period output)
Eric Ruei [Tue, 12 Dec 2017 15:43:15 +0000 (10:43 -0500)]
drivers: cpts: add 1pps reference pulse (ptp: period output)

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agodrivers: cpts: fix 1pps on/off threshold
Eric Ruei [Tue, 12 Dec 2017 13:53:27 +0000 (08:53 -0500)]
drivers: cpts: fix 1pps on/off threshold

The original thresholds were designed for poll mode with up to
10 asynchronous polls every 100ms, but they are too big for interrupt mode
such that the 1pps PWM  may fail to be turned on if the task schedule
delay is short.

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Tue, 12 Dec 2017 11:23:53 +0000 (06:23 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  hsr: remove the unnecessary kernel trace when hsr is offloaded
  ARM: dts: am571x-idk: enable prp and ptp on ICSS1
  prueth: fix debugfs directory to include pruss id
  Keystone-2: XGE: Fix kernel crash issue when MTU size is greater than 1500

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #32 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1619 to proces...
Vivek Chengalvala [Tue, 12 Dec 2017 02:11:13 +0000 (20:11 -0600)]
Merge pull request #32 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1619 to processor-sdk-linux-int-4.9.y

* commit 'cfdeb0fb1f958c6180653fa81b2d5db11090c41f':
  Keystone-2: XGE: Fix kernel crash issue when MTU size is greater than 1500

6 years agoMerge pull request #34 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1727 to proces...
Muralidharan Karicheri [Mon, 11 Dec 2017 23:36:49 +0000 (17:36 -0600)]
Merge pull request #34 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1727 to processor-sdk-linux-int-4.9.y

* commit '63f69f96e227a48951abcd0f065f547e07ff54e6':
  hsr: remove the unnecessary kernel trace when hsr is offloaded
  ARM: dts: am571x-idk: enable prp and ptp on ICSS1
  prueth: fix debugfs directory to include pruss id

6 years agohsr: remove the unnecessary kernel trace when hsr is offloaded
Murali Karicheri [Mon, 11 Dec 2017 22:31:59 +0000 (17:31 -0500)]
hsr: remove the unnecessary kernel trace when hsr is offloaded

When hsr is offloaded, the offloaded h/w or f/w is expected to
consume the supervision frame. However there is no need for a
kernel trace here and frame should be silently discarded. Fix
this by removing the WARN_ONCE() and replace it with a comment
in the code.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoARM: dts: am571x-idk: enable prp and ptp on ICSS1
Murali Karicheri [Mon, 11 Dec 2017 21:42:32 +0000 (16:42 -0500)]
ARM: dts: am571x-idk: enable prp and ptp on ICSS1

This enables PRP and PTP on ICSS1 so that SAN PTP can be brought up
on ICSS1. The PRP firmware is used in EMAC mode to support SAN PTP
function.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoprueth: fix debugfs directory to include pruss id
Murali Karicheri [Mon, 11 Dec 2017 21:39:19 +0000 (16:39 -0500)]
prueth: fix debugfs directory to include pruss id

Current implementation of debugfs interface for hsr/prp breaks the
driver when the second instance of the driver is brought up on ICSS1.
This is because the path for hsr/prp debugfs directory doesn't take
into account the possibility of having a second instance. To allow
second instance and to keep backward compatibility with other
applications such as net-snmp that assumes the path, create the
ICSS2 instance with prueth-prp path and the ICSS1 instance with a
prueth-prp-0 path. This ensures existing application works fine.

Beware that currently the prueth driver works fine for eth4, but
not for eth5. As the SAN - PTP uses PRP in emac mode and BC requires
at least one Eth port functional, this should be fine.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoKeystone-2: XGE: Fix kernel crash issue when MTU size is greater than 1500
Rex Chang [Wed, 6 Dec 2017 23:30:06 +0000 (23:30 +0000)]
Keystone-2: XGE: Fix kernel crash issue when MTU size is greater than 1500

In the receive queue for 4096 bytes fragments, the page address
set in the SW data0 field of the descriptor is not the one we got
when doing the reassembly in receive. The page structure was retrieved
from the wrong descriptor into SW data0 which is then causing a
page fault when UDP checksum is accessing data above 1500.

6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Wed, 6 Dec 2017 15:27:26 +0000 (10:27 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  [HACK] prueth: prp: add emac mode support
  prueth: improve debugfs clean up code using existing API

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #31 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1704 to proces...
Muralidharan Karicheri [Tue, 5 Dec 2017 21:14:40 +0000 (15:14 -0600)]
Merge pull request #31 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1704 to processor-sdk-linux-int-4.9.y

* commit '979a9b70d7c0e3c4f4161603ab8a002864d88d9e':
  [HACK] prueth: prp: add emac mode support
  prueth: improve debugfs clean up code using existing API

6 years ago[HACK] prueth: prp: add emac mode support
Murali Karicheri [Wed, 29 Nov 2017 21:05:06 +0000 (16:05 -0500)]
[HACK] prueth: prp: add emac mode support

Currently PTP support is available only to PRP firmware. So to support
SAN with PTP, the PRP firmware is used in EMAC mode which is a HACK.
This hack is expected to be supported in the driver until PTP feature
becomes available in EMAC firmware. The present implementation in
PRP firmware doesn't strip last 6 bytes to support emac mode as the
assumption is that firmware receives frames without RCT in emac mode.
Though this is true for EMAC mode, with PRP mode, firmware receives
frames from Host with RCT and for SAN destination, the RCT needs to
be stripped. Since PRP firmware currently doesn't strip RCT to a
SAN destination, this fails conformance test as SAN destination is
expected to receive frame without RCT. This behavior is expected from
a DAN-P When Node Table is implemented and is used for frame routing
to SAN. So firmware needs to do

 1. If in EMAC mode, not strip RCT
 2. If in PRP mode, strip RCT if destination is SAN
 3. if in PRP mode, don't strip RCT if destination is DAN

To support this dual mode, introduce a prp_emac_mode flag which can be
used to configure a PRP firmware to operate in EMAC mode. Since this is a
HACK, currently this configuration is done through a debugfs interface
which can be configured by user in EMAC mode before the ethernet device
is brought up. PRUETH driver sets bit0 of the buffer descriptor to
indicate mode to firmware for each frame forwarded to firmware.

bit-0 - Set - EMAC mode, Clear - PRP mode

By default PRP firmware will operate in PRP mode and user has to
do following sequence to switch mode to emac :-

1. boot up the device as a PRP Ethernet device or switch to PRP mode
   from user space.
2. Switch to EMAC mode
   echo 1 > /sys/kernel/debug/prueth-eth2/prp_emac_mode
   echo 1 > /sys/kernel/debug/prueth-eth3/prp_emac_mode
3. ifconfig eth2 <ip address> up
4. ifconfig eth3 <ip address> up

Now both eth2 and eth3 will work as an emac Ethernet device.

While doing this change, add a minor improvement in the prueth_tx_enqueue()
by defining a prueth variable instead of retrieving the same from emac
at several places in the function.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Fri, 1 Dec 2017 20:08:45 +0000 (15:08 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  arm: cpts: enhance ts_adjustment algorithm to support 10ns ticks
  HACK: ARM: dts: dra7xx: program timer16 to run at 100MHz source clock
  arch: cpts: fix ks2 compilation bug
  arm: cpts: add use_1pps flag
  arm: dts: am571x: add 1pps definitions
  arm: cpts: reconstruct to ptp pps framework
  arm: dts: am572x: add 1pps pinmux definitions
  arm: dts: am572x: add timer16 to generate 1pps signal Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
  arm: cpts: use pinmux control to filter 9 out of 10 pulses
  arm: cpts: add ts_adjustment algorithm
  arm: cpts: add timer16 to cpts driver

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #30 in PROCESSOR-SDK/processor-sdk-linux from PLSDK-1381 to proces...
Jacob Stiffler [Fri, 1 Dec 2017 18:57:36 +0000 (12:57 -0600)]
Merge pull request #30 in PROCESSOR-SDK/processor-sdk-linux from PLSDK-1381 to processor-sdk-linux-int-4.9.y

* commit 'ce9fb9ef236027cc995a15b4e9df82c763158b1b':
  arm: cpts: enhance ts_adjustment algorithm to support 10ns ticks
  HACK: ARM: dts: dra7xx: program timer16 to run at 100MHz source clock

6 years agoarm: cpts: enhance ts_adjustment algorithm to support 10ns ticks
Eric Ruei [Wed, 22 Nov 2017 19:43:03 +0000 (14:43 -0500)]
arm: cpts: enhance ts_adjustment algorithm to support 10ns ticks

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agoHACK: ARM: dts: dra7xx: program timer16 to run at 100MHz source clock
Tero Kristo [Wed, 11 Oct 2017 07:56:19 +0000 (10:56 +0300)]
HACK: ARM: dts: dra7xx: program timer16 to run at 100MHz source clock

Re-program abe_dpll_ck to run at 50MHz, and select the source for
timer16 to be abe_giclk. This makes the timer run at 100MHz.

The patch should be applied under the board file which requires this
setup to be used, doing this under the generic dra7xx-clocks.dtsi is
only done for demonstration purposes.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
6 years agoMerge pull request #27 in PROCESSOR-SDK/processor-sdk-linux from vitaly-timers-int...
Jacob Stiffler [Fri, 1 Dec 2017 14:52:49 +0000 (08:52 -0600)]
Merge pull request #27 in PROCESSOR-SDK/processor-sdk-linux from vitaly-timers-int to processor-sdk-linux-int-4.9.y

* commit '00cfd9b5beeb56e8fc37f6e85e74282c1d216ed6':
  arch: cpts: fix ks2 compilation bug
  arm: cpts: add use_1pps flag
  arm: dts: am571x: add 1pps definitions
  arm: cpts: reconstruct to ptp pps framework
  arm: dts: am572x: add 1pps pinmux definitions
  arm: dts: am572x: add timer16 to generate 1pps signal Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
  arm: cpts: use pinmux control to filter 9 out of 10 pulses
  arm: cpts: add ts_adjustment algorithm
  arm: cpts: add timer16 to cpts driver

6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Wed, 29 Nov 2017 12:10:39 +0000 (07:10 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  [HACK] hsr/prp: fix duplicate discard mode handling for PRP

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoprueth: improve debugfs clean up code using existing API
Murali Karicheri [Tue, 28 Nov 2017 18:19:10 +0000 (13:19 -0500)]
prueth: improve debugfs clean up code using existing API

Use existing API, debugfs_remove_recursive(), to simplify clean up
code related to debugfs.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoMerge pull request #29 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1681 to proces...
Muralidharan Karicheri [Tue, 28 Nov 2017 22:17:41 +0000 (16:17 -0600)]
Merge pull request #29 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1681 to processor-sdk-linux-int-4.9.y

* commit '303b088ae55e9be86e030afe6f59643e15ed68a8':
  [HACK] hsr/prp: fix duplicate discard mode handling for PRP

6 years ago[HACK] hsr/prp: fix duplicate discard mode handling for PRP
Murali Karicheri [Mon, 20 Nov 2017 20:21:10 +0000 (15:21 -0500)]
[HACK] hsr/prp: fix duplicate discard mode handling for PRP

PRP has a duplicate discard mode that can be set to either
duplicate discard by default (0x20) or duplicate accept (0x21).
This causes the mode to be reflected in the SV frame TLV type value
to be either of these values. Currently this can't be changed. So add
a debugfs interface to change this at run time. Mark this as a HACK
since proper way to do this seems to be through the netlink socket
interface for which driver requires more enhancement.

While at it, fix a cut-n-paste error in comments for hsr_mode debugfs
code and also add range check for hsr mode parameter value when received
over debugfs interface.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoarch: cpts: fix ks2 compilation bug
Vitaly Andrianov [Fri, 17 Nov 2017 17:20:08 +0000 (12:20 -0500)]
arch: cpts: fix ks2 compilation bug

KS2 platforms don't have dmtimer driver. So, we cannot call its functions.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Fri, 17 Nov 2017 12:08:01 +0000 (07:08 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  net: ethernet: ti: prueth: add support of pps in pru ptp ordinary clock
  ARM: dts: am57xx-idk-common: add prueth ptp time stamping tx interrupts
  net: ethernet: ti: prueth: [HACK] configure ptp master mac addr to ptp firmware
  Documentation: dt: net: Add TI-PRUeth PRP PTP bindings
  net: ethenet: ti: prueth: introducing ptp time stamping for prueth

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #28 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1364-v2 to...
WingMan Kwok [Thu, 16 Nov 2017 20:29:48 +0000 (14:29 -0600)]
Merge pull request #28 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1364-v2 to processor-sdk-linux-int-4.9.y

The PRU OC-SAN and PPS has been verified with firmware commit ID aca5ac972eb8f25abba7ccb2de501836db6c2e62

* commit 'f53a26a8e69244ba13dd786cf72839d1e0867076':
  net: ethernet: ti: prueth: add support of pps in pru ptp ordinary clock
  ARM: dts: am57xx-idk-common: add prueth ptp time stamping tx interrupts
  net: ethernet: ti: prueth: [HACK] configure ptp master mac addr to ptp firmware
  Documentation: dt: net: Add TI-PRUeth PRP PTP bindings
  net: ethenet: ti: prueth: introducing ptp time stamping for prueth

6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Wed, 15 Nov 2017 20:08:37 +0000 (15:08 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  prueth: add per queue debug statistics for egress and ingress
  hsr: fix incorrect lsdu size in the tag of HSR frames for small frames
  prueth: hsr/prp: fix priority queue map configuration in shared memory
  prueth: hsr/prp: fix incorrect timeout for table check task

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agonet: ethernet: ti: prueth: add support of pps in pru ptp ordinary clock
WingMan Kwok [Tue, 14 Nov 2017 22:51:01 +0000 (17:51 -0500)]
net: ethernet: ti: prueth: add support of pps in pru ptp ordinary clock

This patch adds support of PPS in ICSS-PRU PTP ordinary clock.

To enable PPS after PRU-ICSS ordinary clock is started, issue the
command from linux prompt:

    $ echo 1 > /sys/devices/platform/pruss2_eth/ptp/ptp1/pps_enable

To read PTP clock timestamps at which PPS is generated, issue the
command:

    $ cat /sys/class/pps/pps0/assert

To disable PPS:

    $ echo 0 > /sys/devices/platform/pruss2_eth/ptp/ptp1/pps_enable

To observe PPS on AM572x IDK, a 0-ohm resistor needs to be populated
at R908 on the IDK. See schematic
http://www.ti.com/lit/df/tidrlh4/tidrlh4.pdf.

The PPS can then be probed at pin-17 of the Expansion Connector J21.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoARM: dts: am57xx-idk-common: add prueth ptp time stamping tx interrupts
WingMan Kwok [Tue, 3 Oct 2017 23:47:19 +0000 (19:47 -0400)]
ARM: dts: am57xx-idk-common: add prueth ptp time stamping tx interrupts

This patch adds the ptp tx interrupts required for the
support of IEEE-1588 PTP timestamping on the PRU-ICSS
ethernet ports.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethernet: ti: prueth: [HACK] configure ptp master mac addr to ptp firmware
WingMan Kwok [Tue, 3 Oct 2017 23:22:38 +0000 (19:22 -0400)]
net: ethernet: ti: prueth: [HACK] configure ptp master mac addr to ptp firmware

This is a HACK.

In order to support PTP time stamping using the PRU PRP firmware,
the firmware requires the Master clock (as result of the Best
Master Clock Algorithm) MAC address to be configured to a shared
memory location. The patch adds a hack that uses the set_dump
API in the struct ethtool_ops to let application to pass in the
MAC address of the Master clock.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoDocumentation: dt: net: Add TI-PRUeth PRP PTP bindings
WingMan Kwok [Wed, 15 Nov 2017 00:35:19 +0000 (19:35 -0500)]
Documentation: dt: net: Add TI-PRUeth PRP PTP bindings

Add PRP PTP tx interrupt DT binding information for TI's
PRUSS Ethernet device driver.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agonet: ethenet: ti: prueth: introducing ptp time stamping for prueth
WingMan Kwok [Wed, 15 Nov 2017 00:30:30 +0000 (19:30 -0500)]
net: ethenet: ti: prueth: introducing ptp time stamping for prueth

This patch adds the support of IEEE-1588 ordinary clock (OC) on the
PRU-ICSS ethernet ports of TI's AM572x devices. The PRU-ICSS
includes an Industrial Ethernet Peripheral (IEP) unit. This unit
is a simple 64-bit timer (counter) whose functionality, in
conjunction with TI's PRU-ICSS industrial PRP firmware, is leveraged
in the support of IEEE-1588 PTP time stamping on the PRU-ICSS
ethernet ports.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
6 years agoMerge pull request #23 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1629 to proces...
Muralidharan Karicheri [Wed, 15 Nov 2017 16:42:39 +0000 (10:42 -0600)]
Merge pull request #23 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1629 to processor-sdk-linux-int-4.9.y

* commit '018fccbffb0821386df76f6210cc1589c11ca153':
  hsr: fix incorrect lsdu size in the tag of HSR frames for small frames

6 years agoMerge pull request #21 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1647 to proces...
Muralidharan Karicheri [Wed, 15 Nov 2017 16:41:34 +0000 (10:41 -0600)]
Merge pull request #21 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1647 to processor-sdk-linux-int-4.9.y

* commit '43a2ee2e30d75c6b4796e615c780eb03f879e0c7':
  prueth: hsr/prp: fix incorrect timeout for table check task

6 years agoMerge pull request #25 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1600 to proces...
Muralidharan Karicheri [Wed, 15 Nov 2017 15:40:10 +0000 (09:40 -0600)]
Merge pull request #25 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1600 to processor-sdk-linux-int-4.9.y

* commit 'cd8933e4198914e6b61aac411f4a8dcfeb506933':
  prueth: add per queue debug statistics for egress and ingress
  prueth: hsr/prp: fix priority queue map configuration in shared memory

6 years agoarm: cpts: add use_1pps flag
Vitaly Andrianov [Wed, 15 Nov 2017 14:51:31 +0000 (09:51 -0500)]
arm: cpts: add use_1pps flag

If dts doesn't have 1pps definitions the drives exits with an error. But it
is not always necessary to have 1pps in the driver and not having its
definition is appropriate.
This commit adds the flag to control 1pps functionality depending on
presence 1pps nodes in the dts.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoarm: dts: am571x: add 1pps definitions
Vitaly Andrianov [Wed, 15 Nov 2017 13:12:21 +0000 (08:12 -0500)]
arm: dts: am571x: add 1pps definitions

This commit ads timer16 and pinmux definitions to generate 1pps signal

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoarm: cpts: reconstruct to ptp pps framework
Eric Ruei [Mon, 13 Nov 2017 23:02:31 +0000 (18:02 -0500)]
arm: cpts: reconstruct to ptp pps framework

- reconstruct pps init/start/stop/exit to ptp pps framework
- schedule dealyed work at timer ISR

Signed-off-by: Eric Ruei <e-ruei1@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Wed, 15 Nov 2017 12:19:46 +0000 (07:19 -0500)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  crypto: ks2: add KNAV_QUEUE-SHARED to tx queue

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoarm: dts: am572x: add 1pps pinmux definitions
Vitaly Andrianov [Thu, 2 Nov 2017 17:44:41 +0000 (13:44 -0400)]
arm: dts: am572x: add 1pps pinmux definitions

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoarm: dts: am572x: add timer16 to generate 1pps signal
Murali Karicheri [Mon, 6 Nov 2017 20:09:43 +0000 (15:09 -0500)]
arm: dts: am572x: add timer16 to generate 1pps signal
Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoarm: cpts: use pinmux control to filter 9 out of 10 pulses
Vitaly Andrianov [Thu, 2 Nov 2017 17:45:45 +0000 (13:45 -0400)]
arm: cpts: use pinmux control to filter 9 out of 10 pulses

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoarm: cpts: add ts_adjustment algorithm
Vitaly Andrianov [Thu, 2 Nov 2017 17:42:46 +0000 (13:42 -0400)]
arm: cpts: add ts_adjustment algorithm

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoarm: cpts: add timer16 to cpts driver
Vitaly Andrianov [Thu, 2 Nov 2017 17:49:07 +0000 (13:49 -0400)]
arm: cpts: add timer16 to cpts driver

We are going to use timer16 to generate 1pps sygnal.
This code adds timer16 initialization and empty interrupt handler for it.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoMerge pull request #26 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1662 to proces...
Muralidharan Karicheri [Tue, 14 Nov 2017 16:56:44 +0000 (10:56 -0600)]
Merge pull request #26 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1662 to processor-sdk-linux-int-4.9.y

* commit '3859d541563e6b4209d2266aca9e71f1c13d44bb':
  crypto: ks2: add KNAV_QUEUE-SHARED to tx queue

6 years agocrypto: ks2: add KNAV_QUEUE-SHARED to tx queue
Vitaly Andrianov [Tue, 14 Nov 2017 16:45:42 +0000 (11:45 -0500)]
crypto: ks2: add KNAV_QUEUE-SHARED to tx queue

The keystone side band crypto driver and inflow driver share the same
tx queue to push packets to the SA accelerator. This commit adds the
KNAV_QUEUE-SHARED flag for the queue. Without the flag the driver
cannot open the queue as it is already opened by the inflow driver.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
6 years agoprueth: add per queue debug statistics for egress and ingress
Murali Karicheri [Mon, 13 Nov 2017 22:11:46 +0000 (17:11 -0500)]
prueth: add per queue debug statistics for egress and ingress

For the ease of testing and debugging, introduce statistics per queue
in the driver at egress and ingress

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agohsr: fix incorrect lsdu size in the tag of HSR frames for small frames
Murali Karicheri [Mon, 30 Oct 2017 19:27:47 +0000 (15:27 -0400)]
hsr: fix incorrect lsdu size in the tag of HSR frames for small frames

For small Ethernet frames with size less than minimum size
66 for HSR/PRP vs 60 for regular Ethernet frames, hsr driver currently
doesn't pad the frame to make it minimum size. This results in incorrect
LSDU size being populated in the HSR tag for these frames. Fix this by
padding the frame to the minimum size applicable for HSR.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoprueth: hsr/prp: fix priority queue map configuration in shared memory
Murali Karicheri [Wed, 8 Nov 2017 18:55:20 +0000 (13:55 -0500)]
prueth: hsr/prp: fix priority queue map configuration in shared memory

Currently the priority queue map configuration in shared memory used
by hsr/prp firmware is incorrect. Firmware expects lower 4 bytes of
the map entry for PRU-1 and upper 4 bytes for PRU-0. Fix this in the
driver. While at it, remove emac_num_rx_queues variable and directly
use constant instead.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoprueth: hsr/prp: fix incorrect timeout for table check task
Murali Karicheri [Mon, 6 Nov 2017 17:10:14 +0000 (12:10 -0500)]
prueth: hsr/prp: fix incorrect timeout for table check task

prueth firmware for HSR/PRP expects a periodic task every 10 msec
to refresh the check flags which are used by firmware to do periodic
maintenance of host/port dupicate and node table. The regular timer
API used currently gives a resolution of minimum 20 msec instead of
10 msec. So switch to hrtimer to fix this issue.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Thu, 2 Nov 2017 14:13:08 +0000 (10:13 -0400)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  crypto:keystone:add support for ESN
  crypto:keystone:add support for SHA2
  crypto:keystone:add support for GMAC
  crypto:keystone:add support for AES-GCM
  crypto: keystone: Add support for authenc - hmac(sha1),ecb(cipher_null) algorithms

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #16 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1579 to proces...
Vitaly. Andrianov [Wed, 1 Nov 2017 19:43:35 +0000 (14:43 -0500)]
Merge pull request #16 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1579 to processor-sdk-linux-int-4.9.y

* commit '4214ffeceee946b7a15456f50c143586a203a3ef':
  crypto:keystone:add support for ESN
  crypto:keystone:add support for SHA2
  crypto:keystone:add support for GMAC
  crypto:keystone:add support for AES-GCM
  crypto: keystone: Add support for authenc - hmac(sha1),ecb(cipher_null) algorithms

6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Tue, 31 Oct 2017 12:05:02 +0000 (08:05 -0400)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux:
  prueth: emac: add a workaround to fix netdev watchdog issue
  mmc: omap_hsmmc: Workaround errata regarding SDR104/HS200 tuning failures (i929)
  ti_config_fragments/connectivity.cfg: Enable CONFIG_IWLMVM as module
  ARM: DTS: DRA76-EVM: Set powerhold property for tps65917
  mfd: palmas: Assign the right powerhold mask for tps65917

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge branch 'ti-linux-4.9.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel...
Jacob Stiffler [Tue, 31 Oct 2017 10:55:17 +0000 (06:55 -0400)]
Merge branch 'ti-linux-4.9.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into processor-sdk-linux-int-4.9.y

TI-Feature: ti_linux_base_int-4.9
TI-Tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
TI-Branch: ti-linux-4.9.y

* 'ti-linux-4.9.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel:
  mmc: omap_hsmmc: Workaround errata regarding SDR104/HS200 tuning failures (i929)
  ti_config_fragments/connectivity.cfg: Enable CONFIG_IWLMVM as module
  ARM: DTS: DRA76-EVM: Set powerhold property for tps65917
  mfd: palmas: Assign the right powerhold mask for tps65917

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge pull request #19 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1617-v1 to...
Jacob Stiffler [Mon, 30 Oct 2017 20:30:13 +0000 (15:30 -0500)]
Merge pull request #19 in PROCESSOR-SDK/processor-sdk-linux from plsdk-1617-v1 to processor-sdk-linux-int-4.9.y

* commit 'da02b27a57483e56dd363d08886a3847670c9cf5':
  prueth: emac: add a workaround to fix netdev watchdog issue

6 years agoprueth: emac: add a workaround to fix netdev watchdog issue
Murali Karicheri [Mon, 23 Oct 2017 19:02:16 +0000 (15:02 -0400)]
prueth: emac: add a workaround to fix netdev watchdog issue

When pru Ethernet interface is loaded, say at 95Mbps, NETDEV WATCHDOG
timer fires with following trace:-

[ 1642.085826] WARNING: CPU: 0 PID: 4 at net/sched/sch_generic.c:316
dev_watchdog+0x258/0x25c
[ 1642.094128] NETDEV WATCHDOG: eth2 (prueth): transmit queue 0 timed out

Currently driver stops the queue when buffer overflow is detected at
the egress and wake up the queue when a tx interrupt is received from
PRU. Watchdog is fired since queue is not woken up for an extended
period of time. This is suspected to be due to tx interrupt event being
lost. For now, add a workaround to fix this by not stopping the queue
when overflow happens.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
6 years agoMerge branch 'connectivity-ti-linux-4.9.y' of git://git.ti.com/connectivity-integrati...
Dan Murphy [Mon, 30 Oct 2017 19:13:48 +0000 (14:13 -0500)]
Merge branch 'connectivity-ti-linux-4.9.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel into ti-linux-4.9.y

TI-Feature: connectivity
TI-Tree: git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel.git
TI-Branch: connectivity-ti-linux-4.9.y

* 'connectivity-ti-linux-4.9.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel:
  mmc: omap_hsmmc: Workaround errata regarding SDR104/HS200 tuning failures (i929)
  ti_config_fragments/connectivity.cfg: Enable CONFIG_IWLMVM as module

Signed-off-by: Dan Murphy <dmurphy@ti.com>
6 years agommc: omap_hsmmc: Workaround errata regarding SDR104/HS200 tuning failures (i929)
Faiz Abbas [Mon, 30 Oct 2017 19:20:12 +0000 (19:20 +0000)]
mmc: omap_hsmmc: Workaround errata regarding SDR104/HS200 tuning failures (i929)

There is a silicon errata in DRA75x, DRA72x and OMAP5 platforms which
may result in unexpected tuning pattern errors. A small failure band
may be present in the tuning range which may be missed by the curent
algorithm. Furthermore, the failure bands vary with temperature leading
to different optimum tuning values for different temperatures.

As suggested in the silicon errata, tuning should be done in two stages.
In stage 1, assign the optimum tuning ratio in the maximum pass window
for the current temperature. In stage 2, if the chosen value is close
to the small failure band, move away from it in the appropriate direction.

Therefore, modify SDR104/HS200 DLL tuning algorithm as a workaround.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoMerge branch 'platform-ti-linux-4.9.y' of git://git.ti.com/~rrnayak/ti-linux-kernel...
LCPD Auto Merger [Mon, 30 Oct 2017 13:00:15 +0000 (08:00 -0500)]
Merge branch 'platform-ti-linux-4.9.y' of git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree into ti-linux-4.9.y

TI-Feature: platform_base
TI-Tree: git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree.git
TI-Branch: platform-ti-linux-4.9.y

* 'platform-ti-linux-4.9.y' of git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree:
  ARM: DTS: DRA76-EVM: Set powerhold property for tps65917
  mfd: palmas: Assign the right powerhold mask for tps65917

Signed-off-by: LCPD Auto Merger <lcpd_integration@list.ti.com>
6 years agoti_config_fragments/connectivity.cfg: Enable CONFIG_IWLMVM as module
Yan Liu [Fri, 27 Oct 2017 13:32:53 +0000 (09:32 -0400)]
ti_config_fragments/connectivity.cfg: Enable CONFIG_IWLMVM as module

Enable IWLMVM config as modules in connectivity.cfg. It is the
driver that supports the Intel Wireless MVM firmware.

It is used to test PCIe RC functionality with Intel wifi
card.

Signed-off-by: Yan Liu <yan-liu@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoARM: DTS: DRA76-EVM: Set powerhold property for tps65917
Keerthy [Wed, 25 Oct 2017 04:27:06 +0000 (09:57 +0530)]
ARM: DTS: DRA76-EVM: Set powerhold property for tps65917

Set powerhold property for tps65917. Powerhold has higher
priority than DEV_ON Bit. So during power off we need to
explicitly over ride the Powerhold to turn off the regulators.

Signed-off-by: Keerthy <j-keerthy@ti.com>
6 years agomfd: palmas: Assign the right powerhold mask for tps65917
Keerthy [Wed, 25 Oct 2017 04:27:05 +0000 (09:57 +0530)]
mfd: palmas: Assign the right powerhold mask for tps65917

The powerhold mask for TPS65917 is different when comapred to
the other palmas versions. Hence assign the right mask that enables
power off of tps65917 pmic correctly.

Signed-off-by: Keerthy <j-keerthy@ti.com>
6 years agoMerge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor...
Jacob Stiffler [Fri, 27 Oct 2017 19:01:39 +0000 (15:01 -0400)]
Merge branch 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux into processor-sdk-linux-rt-4.9.y

TI-Feature: ti_linux_base_plsdk_rt-4.9
TI-Tree: ssh://git@bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux.git
TI-Branch: processor-sdk-linux-int-4.9.y

* 'processor-sdk-linux-int-4.9.y' of ssh://bitbucket.itg.ti.com/processor-sdk/processor-sdk-linux: (52 commits)
  Linux 4.9.59
  FS-Cache: fix dereference of NULL user_key_payload
  KEYS: Fix race between updating and finding a negative key
  fscrypt: fix dereference of NULL user_key_payload
  xfs: trim writepage mapping to within eof
  xfs: cancel dirty pages on invalidation
  xfs: handle error if xfs_btree_get_bufs fails
  xfs: reinit btree pointer on attr tree inactivation walk
  xfs: don't change inode mode if ACL update fails
  xfs: move more RT specific code under CONFIG_XFS_RT
  xfs: Don't log uninitialised fields in inode structures
  xfs: handle racy AIO in xfs_reflink_end_cow
  xfs: always swap the cow forks when swapping extents
  xfs: Capture state of the right inode in xfs_iflush_done
  xfs: perag initialization should only touch m_ag_max_usable for AG 0
  xfs: update i_size after unwritten conversion in dio completion
  xfs: report zeroed or not correctly in xfs_zero_range()
  fs/xfs: Use %pS printk format for direct addresses
  xfs: evict CoW fork extents when performing finsert/fcollapse
  xfs: don't unconditionally clear the reflink flag on zero-block files
  ...

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge branch 'ti-linux-4.9.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel...
Jacob Stiffler [Fri, 27 Oct 2017 17:54:52 +0000 (13:54 -0400)]
Merge branch 'ti-linux-4.9.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into processor-sdk-linux-int-4.9.y

TI-Feature: ti_linux_base_int-4.9
TI-Tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
TI-Branch: ti-linux-4.9.y

* 'ti-linux-4.9.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel: (52 commits)
  Linux 4.9.59
  FS-Cache: fix dereference of NULL user_key_payload
  KEYS: Fix race between updating and finding a negative key
  fscrypt: fix dereference of NULL user_key_payload
  xfs: trim writepage mapping to within eof
  xfs: cancel dirty pages on invalidation
  xfs: handle error if xfs_btree_get_bufs fails
  xfs: reinit btree pointer on attr tree inactivation walk
  xfs: don't change inode mode if ACL update fails
  xfs: move more RT specific code under CONFIG_XFS_RT
  xfs: Don't log uninitialised fields in inode structures
  xfs: handle racy AIO in xfs_reflink_end_cow
  xfs: always swap the cow forks when swapping extents
  xfs: Capture state of the right inode in xfs_iflush_done
  xfs: perag initialization should only touch m_ag_max_usable for AG 0
  xfs: update i_size after unwritten conversion in dio completion
  xfs: report zeroed or not correctly in xfs_zero_range()
  fs/xfs: Use %pS printk format for direct addresses
  xfs: evict CoW fork extents when performing finsert/fcollapse
  xfs: don't unconditionally clear the reflink flag on zero-block files
  ...

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
6 years agoMerge tag 'v4.9.59' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux...
LCPD Auto Merger [Fri, 27 Oct 2017 10:25:00 +0000 (05:25 -0500)]
Merge tag 'v4.9.59' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into ti-linux-4.9.y

This is the 4.9.59 stable release

* tag 'v4.9.59' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable: (52 commits)
  Linux 4.9.59
  FS-Cache: fix dereference of NULL user_key_payload
  KEYS: Fix race between updating and finding a negative key
  fscrypt: fix dereference of NULL user_key_payload
  xfs: trim writepage mapping to within eof
  xfs: cancel dirty pages on invalidation
  xfs: handle error if xfs_btree_get_bufs fails
  xfs: reinit btree pointer on attr tree inactivation walk
  xfs: don't change inode mode if ACL update fails
  xfs: move more RT specific code under CONFIG_XFS_RT
  xfs: Don't log uninitialised fields in inode structures
  xfs: handle racy AIO in xfs_reflink_end_cow
  xfs: always swap the cow forks when swapping extents
  xfs: Capture state of the right inode in xfs_iflush_done
  xfs: perag initialization should only touch m_ag_max_usable for AG 0
  xfs: update i_size after unwritten conversion in dio completion
  xfs: report zeroed or not correctly in xfs_zero_range()
  fs/xfs: Use %pS printk format for direct addresses
  xfs: evict CoW fork extents when performing finsert/fcollapse
  xfs: don't unconditionally clear the reflink flag on zero-block files
  ...

Signed-off-by: LCPD Auto Merger <lcpd_integration@list.ti.com>
6 years agoLinux 4.9.59
Greg Kroah-Hartman [Fri, 27 Oct 2017 08:38:11 +0000 (10:38 +0200)]
Linux 4.9.59

6 years agoFS-Cache: fix dereference of NULL user_key_payload
Eric Biggers [Mon, 9 Oct 2017 19:40:00 +0000 (12:40 -0700)]
FS-Cache: fix dereference of NULL user_key_payload

commit d124b2c53c7bee6569d2a2d0b18b4a1afde00134 upstream.

When the file /proc/fs/fscache/objects (available with
CONFIG_FSCACHE_OBJECT_LIST=y) is opened, we request a user key with
description "fscache:objlist", then access its payload.  However, a
revoked key has a NULL payload, and we failed to check for this.
request_key() *does* skip revoked keys, but there is still a window
where the key can be revoked before we access its payload.

Fix it by checking for a NULL payload, treating it like a key which was
already revoked at the time it was requested.

Fixes: 4fbf4291aa15 ("FS-Cache: Allow the current state of all objects to be dumped")
Reviewed-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoKEYS: Fix race between updating and finding a negative key
David Howells [Wed, 4 Oct 2017 15:43:25 +0000 (16:43 +0100)]
KEYS: Fix race between updating and finding a negative key

commit 363b02dab09b3226f3bd1420dad9c72b79a42a76 upstream.

Consolidate KEY_FLAG_INSTANTIATED, KEY_FLAG_NEGATIVE and the rejection
error into one field such that:

 (1) The instantiation state can be modified/read atomically.

 (2) The error can be accessed atomically with the state.

 (3) The error isn't stored unioned with the payload pointers.

This deals with the problem that the state is spread over three different
objects (two bits and a separate variable) and reading or updating them
atomically isn't practical, given that not only can uninstantiated keys
change into instantiated or rejected keys, but rejected keys can also turn
into instantiated keys - and someone accessing the key might not be using
any locking.

The main side effect of this problem is that what was held in the payload
may change, depending on the state.  For instance, you might observe the
key to be in the rejected state.  You then read the cached error, but if
the key semaphore wasn't locked, the key might've become instantiated
between the two reads - and you might now have something in hand that isn't
actually an error code.

The state is now KEY_IS_UNINSTANTIATED, KEY_IS_POSITIVE or a negative error
code if the key is negatively instantiated.  The key_is_instantiated()
function is replaced with key_is_positive() to avoid confusion as negative
keys are also 'instantiated'.

Additionally, barriering is included:

 (1) Order payload-set before state-set during instantiation.

 (2) Order state-read before payload-read when using the key.

Further separate barriering is necessary if RCU is being used to access the
payload content after reading the payload pointers.

Fixes: 146aa8b1453b ("KEYS: Merge the type-specific data with the payload data")
Reported-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agofscrypt: fix dereference of NULL user_key_payload
Eric Biggers [Mon, 9 Oct 2017 19:46:18 +0000 (12:46 -0700)]
fscrypt: fix dereference of NULL user_key_payload

commit d60b5b7854c3d135b869f74fb93eaf63cbb1991a upstream.

When an fscrypt-encrypted file is opened, we request the file's master
key from the keyrings service as a logon key, then access its payload.
However, a revoked key has a NULL payload, and we failed to check for
this.  request_key() *does* skip revoked keys, but there is still a
window where the key can be revoked before we acquire its semaphore.

Fix it by checking for a NULL payload, treating it like a key which was
already revoked at the time it was requested.

Fixes: 88bd6ccdcdd6 ("ext4 crypto: add encryption key management facilities")
Reviewed-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxfs: trim writepage mapping to within eof
Brian Foster [Fri, 13 Oct 2017 16:47:46 +0000 (09:47 -0700)]
xfs: trim writepage mapping to within eof

commit 40214d128e07dd21bb07a8ed6a7fe2f911281ab2 upstream.

The writeback rework in commit fbcc02561359 ("xfs: Introduce
writeback context for writepages") introduced a subtle change in
behavior with regard to the block mapping used across the
->writepages() sequence. The previous xfs_cluster_write() code would
only flush pages up to EOF at the time of the writepage, thus
ensuring that any pages due to file-extending writes would be
handled on a separate cycle and with a new, updated block mapping.

The updated code establishes a block mapping in xfs_writepage_map()
that could extend beyond EOF if the file has post-eof preallocation.
Because we now use the generic writeback infrastructure and pass the
cached mapping to each writepage call, there is no implicit EOF
limit in place. If eofblocks trimming occurs during ->writepages(),
any post-eof portion of the cached mapping becomes invalid. The
eofblocks code has no means to serialize against writeback because
there are no pages associated with post-eof blocks. Therefore if an
eofblocks trim occurs and is followed by a file-extending buffered
write, not only has the mapping become invalid, but we could end up
writing a page to disk based on the invalid mapping.

Consider the following sequence of events:

- A buffered write creates a delalloc extent and post-eof
  speculative preallocation.
- Writeback starts and on the first writepage cycle, the delalloc
  extent is converted to real blocks (including the post-eof blocks)
  and the mapping is cached.
- The file is closed and xfs_release() trims post-eof blocks. The
  cached writeback mapping is now invalid.
- Another buffered write appends the file with a delalloc extent.
- The concurrent writeback cycle picks up the just written page
  because the writeback range end is LLONG_MAX. xfs_writepage_map()
  attributes it to the (now invalid) cached mapping and writes the
  data to an incorrect location on disk (and where the file offset is
  still backed by a delalloc extent).

This problem is reproduced by xfstests test generic/464, which
triggers racing writes, appends, open/closes and writeback requests.

To address this problem, trim the mapping used during writeback to
within EOF when the mapping is validated. This ensures the mapping
is revalidated for any pages encountered beyond EOF as of the time
the current mapping was cached or last validated.

Reported-by: Eryu Guan <eguan@redhat.com>
Diagnosed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>