openwrt/staging/blogic.git
5 years agohabanalabs: remove redundant member from parser struct
Dalit Ben Zoor [Wed, 1 May 2019 10:16:18 +0000 (13:16 +0300)]
habanalabs: remove redundant member from parser struct

use_virt_addr member was used for telling whether to treat the
addresses in the CB as virtual during parsing. We disabled it only
when calling the parser from the driver memset device function,
and since this call had been removed, it should always be enabled.

Signed-off-by: Dalit Ben Zoor <dbenzoor@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: Manipulate DMA addresses in ASIC functions
Tomer Tayar [Wed, 1 May 2019 08:28:15 +0000 (11:28 +0300)]
habanalabs: Manipulate DMA addresses in ASIC functions

Routing device accesses to the host memory requires the usage of a base
offset, which is canceled by the iATU just before leaving the device.
The value of the base offset might be distinctive between different ASIC
types.
The manipulation of the addresses is currently used throughout the
driver code, and one should be aware to it whenever providing a host
memory address to the device.
This patch removes this manipulation from the driver common code, and
moves it to the ASIC specific functions that are responsible for
host memory allocation/mapping.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: rename functions to improve code readability
Oded Gabbay [Wed, 1 May 2019 08:47:04 +0000 (11:47 +0300)]
habanalabs: rename functions to improve code readability

This patch renames four functions in the ASIC-specific functions section,
so it will be easier to differentiate them from the generic kernel
functions with the same name.

This will help in future code reviews, to make sure we don't use the
kernel functions directly.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: remove call to cs_parser()
Dalit Ben Zoor [Tue, 30 Apr 2019 12:22:14 +0000 (15:22 +0300)]
habanalabs: remove call to cs_parser()

There is no need to parse the command submission when doing memset
of the device memory using the DMA engine because only the driver calls
the memset function and therefore, the CS is trusted and doesn't require
validation and patching.

Signed-off-by: Dalit Ben Zoor <dbenzoor@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: Use single pool for CPU accessible host memory
Tomer Tayar [Sun, 28 Apr 2019 16:17:38 +0000 (19:17 +0300)]
habanalabs: Use single pool for CPU accessible host memory

The device's CPU accessible memory on host is managed in a dedicated
pool, except for 2 regions - Primary Queue (PQ) and Event Queue (EQ) -
which are allocated from generic DMA pools.
Due to address length limitations of the CPU, the addresses of all these
memory regions must have the same MSBs starting at bit 40.
This patch modifies the allocation of the PQ and EQ to be also from the
dedicated pool, to ensure compliance with the limitation.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: return old dram bar address upon change
Oded Gabbay [Sun, 28 Apr 2019 07:18:35 +0000 (10:18 +0300)]
habanalabs: return old dram bar address upon change

This patch changes the ASIC interface function that changes the DRAM bar
window. The change is to return the old address that the DRAM bar pointed
to instead of an error code.

This simplifies the code that use this function (mainly in debugfs) to
restore the bar to the old setting.

This is also needed for easier support in future ASICs.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: rename restore to ctx_switch when appropriate
Oded Gabbay [Thu, 25 Apr 2019 17:15:42 +0000 (20:15 +0300)]
habanalabs: rename restore to ctx_switch when appropriate

This patch only does renaming of certain variables and structure members,
and their accompanied comments.

This is done to better reflect the actions these variables and members
represent.

There is no functional change in this patch.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: use ASIC functions interface for rreg/wreg
Oded Gabbay [Mon, 22 Apr 2019 08:49:06 +0000 (11:49 +0300)]
habanalabs: use ASIC functions interface for rreg/wreg

This patch slightly changes the macros of RREG32 and WREG32, which are
used when reading or writing from registers.

Instead of directly calling a function in the common code from these
macros, the new code calls a function from the ASIC functions interface.

This change allows us to share much more code between real ASICs and
simulators, which in turn reduces the maintenance burden and
the chances for forgetting to port code between the ASIC files.

The patch also implements the hl_poll_timeout macro, instead of calling
the generic readl_poll_timeout macro. This is required to allow use of
this macro in the simulator files.

As a result from this change, more functions in goya.c are shared with the
simulator and therefore, should not be defined as static.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agouapi/habanalabs: add missing fields in bmon params
Oded Gabbay [Sun, 21 Apr 2019 13:20:46 +0000 (16:20 +0300)]
uapi/habanalabs: add missing fields in bmon params

This patch adds missing fields of start address 0 and 1 in the bmon
parameter structure that is received from the user in the debug IOCTL.

Without these fields, the functionality of the bmon trace is broken,
because there is no configuration of the base address of the filter of the
bus monitor.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: re-factor goya_parse_cb_no_ext_queue()
Oded Gabbay [Sun, 21 Apr 2019 07:48:41 +0000 (10:48 +0300)]
habanalabs: re-factor goya_parse_cb_no_ext_queue()

This patch re-factors goya_parse_cb_no_ext_queue() to make it more
readable by inverting the check inside the first if statement so the bulk
of the function won't be inside an if statement.

The patch also fixes a spelling error in the name of the function.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agohabanalabs: Cancel pr_fmt() definition dependency on includes order
Tomer Tayar [Wed, 10 Apr 2019 12:18:46 +0000 (15:18 +0300)]
habanalabs: Cancel pr_fmt() definition dependency on includes order

pr_fmt() should be defined before including linux/printk.h, either
directly or indirectly, in order to avoid redefinition of the macro.
Currently the macro definition is in habanalabs.h, which is included in
many files, and that makes the addition/reorder of includes to be prone
to compilation errors.
This patch cancels this dependency by defining the macro only in the few
source files that use it.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
5 years agocoresight: funnel: Support static funnel
Leo Yan [Thu, 2 May 2019 16:54:05 +0000 (10:54 -0600)]
coresight: funnel: Support static funnel

Since CoreSight hardware topology can use a 'hidden' funnel in the
trace data path, this kind funnel doesn't have register for accessing
and is used by default from hardware design perspective.  Below is an
example for related hardware topology:

  +------+  +------+
  | cpu0 |->| ETM  |-\
  +------+  +------+  \-> +--------+  +-----+
   ......                 | Funnel |->| ETF |-\    Hidden funnel
  +------+  +------+  /-> +--------+  +-----+  \        |
  | cpu3 |->| ETM  |-/                          \       V
  +------+  +------+                             \-> +--------+
                                                     | Funnel |-> ...
  +------+  +------+                             /-> +--------+
  | cpu4 |->| ETM  |-\                          /
  +------+  +------+  \-> +--------+  +-----+  /
   ......                 | Funnel |->| ETF |-/
  +------+  +------+  /-> +--------+  +-----+
  | cpu7 |->| ETM  |-/
  +------+  +------+

The CoreSight funnel driver only supports dynamic funnel with
registration register resource, thus it cannot support for the static
funnel case and it's impossible to create trace data path for this case.

This patch is to extend CoreSight funnel driver to support both for
static funnel and dynamic funnel.  For the dynamic funnel it reuses the
code existed in the driver, for static funnel the driver will support
device probe if without providing register resource and the driver skips
registers accessing when detect the register base is NULL.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Wanglai Shi <shiwanglai@hisilicon.com>
Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodt-bindings: arm: coresight: Unify funnel DT binding
Leo Yan [Thu, 2 May 2019 16:54:04 +0000 (10:54 -0600)]
dt-bindings: arm: coresight: Unify funnel DT binding

Following the same fashion with replicator DT binding, this patch is to
unify the DT binding for funnel to support static and dynamic modes;
finally we get the funnel DT binding as below:

Before patch:

  Static funnel, aka. non-configurable funnel:
    Not supported;

  Dynamic funnel, aka. configurable funnel:
    "arm,coresight-funnel", "arm,primecell";

After patch:

  Static funnel:
    "arm,coresight-static-funnel";

  Dynamic funnel:
    "arm,coresight-dynamic-funnel", "arm,primecell";
    "arm,coresight-funnel", "arm,primecell"; (obsolete)

At the end of this patch, it gives an example for static funnel DT
binding, and updates the dynamic funnel example.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Wanglai Shi <shiwanglai@hisilicon.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: replicator: Add new device id for static replicator
Leo Yan [Thu, 2 May 2019 16:54:03 +0000 (10:54 -0600)]
coresight: replicator: Add new device id for static replicator

This patch adds a device id for the new static replicator compatible
string; it changes the driver name from "coresight-replicator" to
"coresight-static-replicator" as well.

This patch also gives warning when use the replicator obsolete DT
binding.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodt-bindings: arm: coresight: Add new compatible for static replicator
Leo Yan [Thu, 2 May 2019 16:54:02 +0000 (10:54 -0600)]
dt-bindings: arm: coresight: Add new compatible for static replicator

CoreSight uses below bindings for replicator:

  Dynamic replicator, aka. configurable replicator:
    "arm,coresight-dynamic-replicator", "arm,primecell";

  Static replicator, aka. non-configurable replicator:
    "arm,coresight-replicator";

The compatible string "arm,coresight-replicator" is not an explicit
naming to express the replicator is 'static'.  To unify the naming
convention, this patch introduces a new compatible string
"arm,coresight-static-replicator" for the static replicator; the
compatible string "arm,coresight-replicator" is kept for backward
compatibility, but tag it as obsolete and suggest to use the new
compatible string.

As result CoreSight replicator have below bindings:

  Dynamic replicator:
    "arm,coresight-dynamic-replicator", "arm,primecell";

  Static replicator:
    "arm,coresight-static-replicator";
    "arm,coresight-replicator"; (obsolete)

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: remove multiple blank lines
Vinod Koul [Thu, 2 May 2019 10:59:30 +0000 (16:29 +0530)]
soundwire: remove multiple blank lines

Multi-blank lines do not help readability so remove them

Checkpatch complains:
CHECK: Please don't use multiple blank lines

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: add a blank line between functions
Vinod Koul [Thu, 2 May 2019 10:59:29 +0000 (16:29 +0530)]
soundwire: add a blank line between functions

For improving code readability it helps to have a blank line between
function so add when missing.

Checkpatch complains:
CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: wrap macro argument in parenthesis
Vinod Koul [Thu, 2 May 2019 10:59:28 +0000 (16:29 +0530)]
soundwire: wrap macro argument in parenthesis

macro argument should be inside a parenthesis to avoid precedence
issues

checkpatch complains:
CHECK: Macro argument 'n' may be better as '(n)' to avoid
precedence issues

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: fix more typos
Vinod Koul [Thu, 2 May 2019 10:59:27 +0000 (16:29 +0530)]
soundwire: fix more typos

Found few more typos in the code, fix them

CHECK: 'and and' may be misspelled - perhaps 'and'?
CHECK: 'smaple' may be misspelled - perhaps 'sample'?

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: avoid multiple assignments
Vinod Koul [Thu, 2 May 2019 10:59:26 +0000 (16:29 +0530)]
soundwire: avoid multiple assignments

Modify the code to avoid multiple assignments by assigning to variable
after error checks in soundwire bus.

CHECK: multiple assignments should be avoided

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel: more alignment fixes
Vinod Koul [Thu, 2 May 2019 10:59:25 +0000 (16:29 +0530)]
soundwire: intel: more alignment fixes

Found few more issues reported checkpatch on code alignment so fix those
as well in the intel module.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: more alignment fixes
Vinod Koul [Thu, 2 May 2019 10:59:24 +0000 (16:29 +0530)]
soundwire: more alignment fixes

Found few more issues reported checkpatch on code alignment so fix those
as well in the soundwire core.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: add argument to function definition
Vinod Koul [Thu, 2 May 2019 10:59:23 +0000 (16:29 +0530)]
soundwire: add argument to function definition

Checkpatch warns that function definition of __sdw_register_driver
misses argument, so add it

WARNING: function definition argument 'struct module *' should also have
an identifier name

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel: remove empty line after braces
Vinod Koul [Thu, 2 May 2019 10:59:22 +0000 (16:29 +0530)]
soundwire: intel: remove empty line after braces

Linux code style doesn't expect empty lines after braces and
gives warning:

CHECK: Blank lines aren't necessary after an open brace '{'

Remove the empty line in intel module

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: cadence: remove empty line after braces
Vinod Koul [Thu, 2 May 2019 10:59:21 +0000 (16:29 +0530)]
soundwire: cadence: remove empty line after braces

Linux code style doesn't expect empty lines after braces and
gives warning:

CHECK: Blank lines aren't necessary after an open brace '{'

Remove the empty line in cadence lib

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: remove empty line before/after braces
Vinod Koul [Thu, 2 May 2019 10:59:20 +0000 (16:29 +0530)]
soundwire: remove empty line before/after braces

Linux code style doesn't expect empty lines before or after braces and
gives warning:

CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Blank lines aren't necessary before a close brace '}'

Fix these instances in soundwire core

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: fix SPDX license for header files
Vinod Koul [Thu, 2 May 2019 10:59:18 +0000 (16:29 +0530)]
soundwire: fix SPDX license for header files

Some more headers had C++ style SDPX line, fix that and change copyright
so that it is consistent with rest of the code in subsystem

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: fix kconfig help format
Vinod Koul [Thu, 2 May 2019 10:59:17 +0000 (16:29 +0530)]
soundwire: fix kconfig help format

Move to help format instead of --help-- as that is not recommended and
this makes file consistent with other instance

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: add missing newlines in dynamic debug logs
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:45 +0000 (10:57 -0500)]
soundwire: add missing newlines in dynamic debug logs

For some reason the newlines are not used everywhere. Fix as needed.

Reported-by: Joe Perches <joe@perches.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: cadence_master: remove spurious newline
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:44 +0000 (10:57 -0500)]
soundwire: cadence_master: remove spurious newline

Extra newline does not improve readability.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: cadence_master: fix boolean comparisons
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:43 +0000 (10:57 -0500)]
soundwire: cadence_master: fix boolean comparisons

No need for explicit test against true

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: cadence_master: balance parentheses
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:42 +0000 (10:57 -0500)]
soundwire: cadence_master: balance parentheses

While not strictly necessary, balanced parentheses help with code
readability.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: cadence_master: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:41 +0000 (10:57 -0500)]
soundwire: cadence_master: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel: fix boolean comparison
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:40 +0000 (10:57 -0500)]
soundwire: intel: fix boolean comparison

No need for explicit test against true

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel: protect macro parameters
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:39 +0000 (10:57 -0500)]
soundwire: intel: protect macro parameters

Extra parentheses required here

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:38 +0000 (10:57 -0500)]
soundwire: intel: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel_init: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:37 +0000 (10:57 -0500)]
soundwire: intel_init: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: slave: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:36 +0000 (10:57 -0500)]
soundwire: slave: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: stream: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:35 +0000 (10:57 -0500)]
soundwire: stream: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: mipi_disco: fix boolean comparisons
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:34 +0000 (10:57 -0500)]
soundwire: mipi_disco: fix boolean comparisons

No need for explicit test against true

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: mipi_disco: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:33 +0000 (10:57 -0500)]
soundwire: mipi_disco: fix alignment issues

Use Linux style. In some cases parenthesis alignment is modified to
keep the code readable.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: bus_type: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:32 +0000 (10:57 -0500)]
soundwire: bus_type: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: bus: remove spurious newline
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:31 +0000 (10:57 -0500)]
soundwire: bus: remove spurious newline

tools complain here and the location of the newline does not improve
readability.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: bus: fix boolean comparisons
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:30 +0000 (10:57 -0500)]
soundwire: bus: fix boolean comparisons

no need for an explicit test against false
reported by Coccinelle

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: bus: remove useless parentheses
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:29 +0000 (10:57 -0500)]
soundwire: bus: remove useless parentheses

and make the code more readable

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: bus: fix typos in comments
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:28 +0000 (10:57 -0500)]
soundwire: bus: fix typos in comments

spelling mistakes

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: bus: fix alignment issues
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:27 +0000 (10:57 -0500)]
soundwire: bus: fix alignment issues

Use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: fix alignment issues in header files
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:26 +0000 (10:57 -0500)]
soundwire: fix alignment issues in header files

use Linux style

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: intel: fix SPDX license for header file
Vinod Koul [Thu, 2 May 2019 10:59:19 +0000 (16:29 +0530)]
soundwire: intel: fix SPDX license for header file

Some more headers had C++ style SDPX line, fix that and change copyright
so that it is consistent with rest of the code in subsystem

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: fix SPDX license for header files
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:25 +0000 (10:57 -0500)]
soundwire: fix SPDX license for header files

No C++ comments in .h files

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosoundwire: Kconfig: fix help format
Pierre-Louis Bossart [Wed, 1 May 2019 15:57:24 +0000 (10:57 -0500)]
soundwire: Kconfig: fix help format

Move to the regular help format, --help-- is no longer recommended.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMerge tag 'soundwire-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
Greg Kroah-Hartman [Mon, 29 Apr 2019 11:42:37 +0000 (13:42 +0200)]
Merge tag 'soundwire-5.2-rc1' of git://git./linux/kernel/git/vkoul/soundwire into char-misc-next

Vinod writes:

soundwire updates for v5.2-rc1

This round saw interest from Intel, Linaro and Cadence in
Soundwire. More patches are in pipeline (maybe next cycle)

 - removal of useless initialzation in core
 - couple of header and kcalloc inversion fixes on Intel driver

* tag 'soundwire-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: intel: fix implicit header use of module.h/export.h
  soundwire: stream: remove useless initialization of local variable
  soundwire: remove useless initializations
  soundwire: intel: fix inversion in devm_kcalloc parameters

5 years agoMerge tag 'thunderbolt-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Sat, 27 Apr 2019 13:36:16 +0000 (15:36 +0200)]
Merge tag 'thunderbolt-for-v5.2' of git://git./linux/kernel/git/westeri/thunderbolt into char-misc-next

Mika writes:

thunderbolt: Changes for v5.2 merge window

This improves software connection manager on older Apple systems with
Thunderbolt 1 and 2 controller to support full PCIe daisy chains,
Display Port tunneling and P2P networking. There are also fixes for
potential NULL pointer dereferences at various places in the driver.

* tag 'thunderbolt-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (44 commits)
  thunderbolt: Make priority unsigned in struct tb_path
  thunderbolt: Start firmware on Titan Ridge Apple systems
  thunderbolt: Reword output of tb_dump_hop()
  thunderbolt: Make rest of the logging to happen at debug level
  thunderbolt: Make __TB_[SW|PORT]_PRINT take const parameters
  thunderbolt: Add support for XDomain connections
  thunderbolt: Make tb_switch_alloc() return ERR_PTR()
  thunderbolt: Add support for DMA tunnels
  thunderbolt: Add XDomain UUID exchange support
  thunderbolt: Run tb_xdp_handle_request() in system workqueue
  thunderbolt: Do not tear down tunnels when driver is unloaded
  thunderbolt: Add support for Display Port tunnels
  thunderbolt: Rework NFC credits handling
  thunderbolt: Generalize port finding routines to support all port types
  thunderbolt: Scan only valid NULL adapter ports in hotplug
  thunderbolt: Add support for full PCIe daisy chains
  thunderbolt: Discover preboot PCIe paths the boot firmware established
  thunderbolt: Deactivate all paths before restarting them
  thunderbolt: Extend tunnel creation to more than 2 adjacent switches
  thunderbolt: Add helper function to iterate from one port to another
  ...

5 years agow1: fix the resume command API
Mariusz Bialonczyk [Thu, 21 Mar 2019 10:52:55 +0000 (11:52 +0100)]
w1: fix the resume command API

>From the DS2408 datasheet [1]:
"Resume Command function checks the status of the RC flag and, if it is set,
 directly transfers control to the control functions, similar to a Skip ROM
 command. The only way to set the RC flag is through successfully executing
 the Match ROM, Search ROM, Conditional Search ROM, or Overdrive-Match ROM
 command"

The function currently works perfectly fine in a multidrop bus, but when we
have only a single slave connected, then only a Skip ROM is used and Match
ROM is not called at all. This is leading to problems e.g. with single one
DS2408 connected, as the Resume Command is not working properly and the
device is responding with failing results after the Resume Command.

This commit is fixing this by using a Skip ROM instead in those cases.
The bandwidth / performance advantage is exactly the same.

Refs:
[1] https://datasheets.maximintegrated.com/en/ds/DS2408.pdf

Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net>
Reviewed-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomisc: aspeed-p2a-ctrl: fix mixed declarations
Patrick Venture [Fri, 26 Apr 2019 16:56:55 +0000 (09:56 -0700)]
misc: aspeed-p2a-ctrl: fix mixed declarations

Fix up mixed declarations and code in aspeed_p2a_mmap.

Tested: Verified the build had the error and that this patch resolved it
and there were no other warnings or build errors associated with
compilation of this driver.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrivers/misc: Add Aspeed P2A control driver
Patrick Venture [Thu, 25 Apr 2019 20:23:47 +0000 (13:23 -0700)]
drivers/misc: Add Aspeed P2A control driver

Fixup compiler warnings:
 - 108 warning: ISO C90 forbids mixed declarations and code
 - 264 warning: unused variable 'value'
 - 335 warning: unused variable 'res'

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoslimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register
Kangjie Lu [Sat, 13 Apr 2019 10:34:47 +0000 (11:34 +0100)]
slimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register

In case platform_device_alloc fails, the fix returns an error
code to avoid the NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoDrivers: misc: fix out-of-bounds access in function param_set_kgdbts_var
Young Xiao [Fri, 12 Apr 2019 07:45:06 +0000 (15:45 +0800)]
Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var

There is an out-of-bounds access to "config[len - 1]" array when the
variable "len" is zero.

See commit dada6a43b040 ("kgdboc: fix KASAN global-out-of-bounds bug
in param_set_kgdboc_var()") for details.

Signed-off-by: Young Xiao <YangX92@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodt-bindings: imx-ocotp: Add i.MX8MQ compatible
Lucas Stach [Sat, 13 Apr 2019 10:32:46 +0000 (11:32 +0100)]
dt-bindings: imx-ocotp: Add i.MX8MQ compatible

Add compatible for i.MX8MQ and add i.MX7D/S, i.MX7ULP and i.M8MQ
to the description.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: etb10: Add support for CPU-wide trace scenarios
Mathieu Poirier [Thu, 25 Apr 2019 19:53:10 +0000 (13:53 -0600)]
coresight: etb10: Add support for CPU-wide trace scenarios

This patch adds support for CPU-wide trace scenarios by making sure that
only the sources monitoring the same process have access to a common sink.
Because the sink is shared between sources, the first source to use the
sink switches it on while the last one does the cleanup.  Any attempt to
modify the HW is overlooked for as long as more than one source is using
a sink.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etf: Add support for CPU-wide trace scenarios
Mathieu Poirier [Thu, 25 Apr 2019 19:53:09 +0000 (13:53 -0600)]
coresight: tmc-etf: Add support for CPU-wide trace scenarios

This patch adds support for CPU-wide trace scenarios by making sure that
only the sources monitoring the same process have access to a common sink.
Because the sink is shared between sources, the first source to use the
sink switches it on while the last one does the cleanup.  Any attempt to
modify the HW is overlooked for as long as more than one source is using
a sink.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Add support for CPU-wide trace scenarios
Mathieu Poirier [Thu, 25 Apr 2019 19:53:08 +0000 (13:53 -0600)]
coresight: tmc-etr: Add support for CPU-wide trace scenarios

This patch adds support for CPU-wide trace scenarios by making sure that
only the sources monitoring the same process have access to a common sink.
Because the sink is shared between sources, the first source to use the
sink switches it on while the last one does the cleanup.  Any attempt to
modify the HW is overlooked for as long as more than one source is using
a sink.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios
Mathieu Poirier [Thu, 25 Apr 2019 19:53:07 +0000 (13:53 -0600)]
coresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios

This patch uses the PID of the process being traced to allocate and free
ETR memory buffers for CPU-wide scenarios.  The implementation is tailored
to handle both N:1 and 1:1 source/sink HW topologies.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Introduce the notion of IDR to ETR devices
Mathieu Poirier [Thu, 25 Apr 2019 19:53:06 +0000 (13:53 -0600)]
coresight: tmc-etr: Introduce the notion of IDR to ETR devices

In CPU-wide scenarios with an N:1 source/sink topology, sources share
the same sink.  In order to reuse the same sink for all sources an
IDR is needed to archive events that have already been accounted for.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Introduce the notion of reference counting to ETR devices
Mathieu Poirier [Thu, 25 Apr 2019 19:53:05 +0000 (13:53 -0600)]
coresight: tmc-etr: Introduce the notion of reference counting to ETR devices

This patch adds reference counting to struct etr_buf so that, in CPU-wide
trace scenarios, shared buffers can be disposed of when no longer used.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Introduce the notion of process ID to ETR devices
Mathieu Poirier [Thu, 25 Apr 2019 19:53:04 +0000 (13:53 -0600)]
coresight: tmc-etr: Introduce the notion of process ID to ETR devices

In preparation to support CPU-wide trace scenarios, introduce the notion
of process ID to ETR devices.  That way events monitoring the same process
can use the same etr_buf, allowing multiple CPUs to use the same sink.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Create per-thread buffer allocation function
Mathieu Poirier [Thu, 25 Apr 2019 19:53:03 +0000 (13:53 -0600)]
coresight: tmc-etr: Create per-thread buffer allocation function

Buffer allocation is different when dealing with per-thread and
CPU-wide sessions.  In preparation to support CPU-wide trace scenarios
simplify things by keeping allocation functions for both type separate.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf()
Mathieu Poirier [Thu, 25 Apr 2019 19:53:02 +0000 (13:53 -0600)]
coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf()

Refactoring function tmc_etr_setup_perf_buf() so that it only deals
with the high level etr_perf_buffer, leaving the allocation of the
backend buffer (i.e etr_buf) to another function.

That way the backend buffer allocation function can decide if it wants
to reuse an existing buffer (CPU-wide trace scenarios) or simply create
a new one.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Communicate perf event to sink buffer allocation functions
Mathieu Poirier [Thu, 25 Apr 2019 19:53:01 +0000 (13:53 -0600)]
coresight: Communicate perf event to sink buffer allocation functions

Make struct perf_event available to sink buffer allocation functions in
order to use the pid they carry to allocate and free buffer memory along
with regimenting access to what source a sink can collect data for.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: perf: Refactor function free_event_data()
Mathieu Poirier [Thu, 25 Apr 2019 19:53:00 +0000 (13:53 -0600)]
coresight: perf: Refactor function free_event_data()

Function free_event_data() is already busy and is bound to become
worse with the addition of CPU-wide trace scenarios.  As such spin
off a new function to strickly take care of the sink buffers.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: perf: Clean up function etm_setup_aux()
Mathieu Poirier [Thu, 25 Apr 2019 19:52:59 +0000 (13:52 -0600)]
coresight: perf: Clean up function etm_setup_aux()

There is no point in allocating sink memory for a trace session if
there is not a way to free it once it is no longer needed.  As such make
sure the sink API function to allocate and free memory have been
implemented before moving ahead with the establishment of a trace
session.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Properly address concurrency in sink::update() functions
Mathieu Poirier [Thu, 25 Apr 2019 19:52:58 +0000 (13:52 -0600)]
coresight: Properly address concurrency in sink::update() functions

When operating in CPU-wide trace scenarios and working with an N:1
source/sink HW topology, update() functions need to be made atomic
in order to avoid racing with start and stop operations.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Properly address errors in sink::disable() functions
Mathieu Poirier [Thu, 25 Apr 2019 19:52:57 +0000 (13:52 -0600)]
coresight: Properly address errors in sink::disable() functions

When disabling a sink the reference counter ensures the operation goes
through if nobody else is using it.  As such if drvdata::mode is already
set do CS_MODE_DISABLED, it is an error and should be reported as such.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Move reference counting inside sink drivers
Mathieu Poirier [Thu, 25 Apr 2019 19:52:56 +0000 (13:52 -0600)]
coresight: Move reference counting inside sink drivers

When operating in CPU-wide mode with an N:1 source/sink HW topology,
multiple CPUs can access a sink concurrently.  As such reference counting
needs to happen when the device's spinlock is held to avoid racing with
other operations (start(), update(), stop()), such as:

session A Session B
----- -------

enable_sink
atomic_inc(refcount)  = 1

...

atomic_dec(refcount) = 0 enable_sink
if (refcount == 0) disable_sink
atomic_inc()

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Adding return code to sink::disable() operation
Mathieu Poirier [Thu, 25 Apr 2019 19:52:55 +0000 (13:52 -0600)]
coresight: Adding return code to sink::disable() operation

In preparation to handle device reference counting inside of the sink
drivers, add a return code to the sink::disable() operation so that
proper action can be taken if a sink has not been disabled.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: etm4x: Configure tracers to emit timestamps
Mathieu Poirier [Thu, 25 Apr 2019 19:52:54 +0000 (13:52 -0600)]
coresight: etm4x: Configure tracers to emit timestamps

Configure timestamps to be emitted at regular intervals in the trace
stream to temporally correlate instructions executed on different CPUs.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: etm4x: Skip selector pair 0
Mathieu Poirier [Thu, 25 Apr 2019 19:52:53 +0000 (13:52 -0600)]
coresight: etm4x: Skip selector pair 0

Resource selector pair 0 is always implemented and reserved.  As such
it should not be explicitly programmed.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: etm4x: Add kernel configuration for CONTEXTID
Mathieu Poirier [Thu, 25 Apr 2019 19:52:52 +0000 (13:52 -0600)]
coresight: etm4x: Add kernel configuration for CONTEXTID

Set the proper bit in the configuration register when contextID tracing
has been requested by user space.  That way PE_CONTEXT elements are
generated by the tracers when a process is installed on a CPU.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: pmu: Adding ITRACE property to cs_etm PMU
Mathieu Poirier [Thu, 25 Apr 2019 19:52:51 +0000 (13:52 -0600)]
coresight: pmu: Adding ITRACE property to cs_etm PMU

Add to the capabilities the ITRACE property so that ITRACE START events
are generated when the PMU is switched on by the core.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc: Cleanup power management
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:50 +0000 (13:52 -0600)]
coresight: tmc: Cleanup power management

Drop the power only if we were successful in probing the device.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: catu: Cleanup power management
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:49 +0000 (13:52 -0600)]
coresight: catu: Cleanup power management

Drop the power handle only if we were successful. Otherwise
the AMBA bus code would do the rest.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tpiu: Cleanup power management
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:48 +0000 (13:52 -0600)]
coresight: tpiu: Cleanup power management

Drop the power only when we have successfully probed. Otherwise
leave it to the amba probe to do the rest.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[Removed extra newline left after original modification]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: etb10: Cleanup power management
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:47 +0000 (13:52 -0600)]
coresight: etb10: Cleanup power management

We drop the power before we complete the probe successfully. We
are supposed to drop it only when we are successful. Also, probing
the etb_buffer_length happens with the power turned up. So we don't
need to do that again in the helper.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Fix freeing up the coresight connections
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:46 +0000 (13:52 -0600)]
coresight: Fix freeing up the coresight connections

With commit c2c729415b2d2132 ("coresight: platform: Cleanup coresight
connection handling"), we switched to re-using coresight_connections
for the coresight_device. However, that introduced a mismatch in the
alloc/free of the connections. The allocation is made using devm_*,
while we use kfree() to release the memory when a device is released
(even though we don't support this at the moment). Fix this by leaving
it to the automatic freeing of the memory.

Fixes: c2c729415b2d2132 ("coresight: platform: Cleanup coresight connection handling")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: Merge the static and dynamic replicator drivers
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:45 +0000 (13:52 -0600)]
coresight: Merge the static and dynamic replicator drivers

Merge the drivers for the two varieties of replicators into
a singel one. The dynamic replicator has programming base
which can be programmed to filter the trace data. The driver
detects the type based on the "base" address value of the
device, which is NULL for the static device.

Also, while at it, remove the now obsolete DYNAMIC_REPLICATOR
config entry.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: dynamic-replicator: Prepare for merging with static replicator
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:44 +0000 (13:52 -0600)]
coresight: dynamic-replicator: Prepare for merging with static replicator

Rename the dynamic replicator specific routines for merging with the
replicator driver. Also re-arrange the probe routine to make it easier
to merge.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: replicator: Prepare for merging with dynamic-replicator
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:43 +0000 (13:52 -0600)]
coresight: replicator: Prepare for merging with dynamic-replicator

As a preparatory step to merge the separate drivers for static and
dynamic replicators, annotate the static replicator specific details.
Also refactor the probe routine to make it generic in order to merge
the drivers easily.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: dynamic-replicator: Clean up error handling
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:42 +0000 (13:52 -0600)]
coresight: dynamic-replicator: Clean up error handling

We fail to disable the clock in case of a failure during the
probe. Clean this up. Also, we are supposed to drop the pm reference
only when the probing is successful.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: tmc: Report DMA setup failures
Suzuki K Poulose [Thu, 25 Apr 2019 19:52:41 +0000 (13:52 -0600)]
coresight: tmc: Report DMA setup failures

If we failed to setup the DMA mask for TMC-ETR, report the
error before failing the probe.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: catu: Make catu_helper_ops and catu_ops static
YueHaibing [Thu, 25 Apr 2019 19:52:40 +0000 (13:52 -0600)]
coresight: catu: Make catu_helper_ops and catu_ops static

Fix sparse warnings:

drivers/hwtracing/coresight/coresight-catu.c:488:35: warning:
 symbol 'catu_helper_ops' was not declared. Should it be static?
drivers/hwtracing/coresight/coresight-catu.c:493:28: warning:
 symbol 'catu_ops' was not declared. Should it be static?

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocoresight: catu: fix clang build warning
Arnd Bergmann [Thu, 25 Apr 2019 19:52:39 +0000 (13:52 -0600)]
coresight: catu: fix clang build warning

Clang points out a syntax error, as the etr_catu_buf_ops structure is
declared 'static' before the type is known:

In file included from drivers/hwtracing/coresight/coresight-tmc-etr.c:12:
drivers/hwtracing/coresight/coresight-catu.h:116:40: warning: tentative definition of variable with internal linkage has incomplete non-array type 'const struct etr_buf_operations' [-Wtentative-definition-incomplete-type]
static const struct etr_buf_operations etr_catu_buf_ops;
                                       ^
drivers/hwtracing/coresight/coresight-catu.h:116:21: note: forward declaration of 'struct etr_buf_operations'
static const struct etr_buf_operations etr_catu_buf_ops;

This seems worth fixing in the code, so replace pointer to the empty
constant structure with a NULL pointer. We need an extra NULL pointer
check here, but the result should be better object code otherwise,
avoiding the silly empty structure.

Fixes: 434d611cddef ("coresight: catu: Plug in CATU as a backend for ETR buffer")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[Fixed line over 80 characters]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agovirt: vbox: Sanity-check parameter types for hgcm-calls coming from userspace
Hans de Goede [Thu, 4 Apr 2019 12:39:09 +0000 (14:39 +0200)]
virt: vbox: Sanity-check parameter types for hgcm-calls coming from userspace

Userspace can make host function calls, called hgcm-calls through the
/dev/vboxguest device.

In this case we should not accept all hgcm-function-parameter-types, some
are only valid for in kernel calls.

This commit adds proper hgcm-function-parameter-type validation to the
ioctl for doing a hgcm-call from userspace.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agobinder: check for overflow when alloc for security context
Todd Kjos [Wed, 24 Apr 2019 19:31:18 +0000 (12:31 -0700)]
binder: check for overflow when alloc for security context

When allocating space in the target buffer for the security context,
make sure the extra_buffers_size doesn't overflow. This can only
happen if the given size is invalid, but an overflow can turn it
into a valid size. Fail the transaction if an overflow is detected.

Signed-off-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomisc: genwqe: Fix misuse of %x
Fuqian Huang [Sun, 21 Apr 2019 11:47:48 +0000 (19:47 +0800)]
misc: genwqe: Fix misuse of %x

The pointer should be printed with %p or %px rather than
cast to long long type and printed with %016llx.
Change %x to %p to print the pointer.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMerge tag 'extcon-next-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Thu, 25 Apr 2019 17:50:22 +0000 (19:50 +0200)]
Merge tag 'extcon-next-for-5.2' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for v5.2

Detailed description for this pull request:
1. Add new extcon-intel-mrfld.c extcon provider driver
- On Intel Merrifield the Basin Cove PMIC provides a feature to detect
the USB connection type. This driver utilizes the feature in order
to support the USB dual role detection.

2. Update the extcon provider drivers
- For extcon-intel-cht-wc.c, make charger detection co-existed
  with OTG host mode and enable external charger.
- For intel extcon driver, add common header file (extcon-intel.h)
  in order to remove the duplicate definitions.
- For extcon-arizonal.c, disable microphone detection on driver removal.

3.
- Edit comment of extcon_unregister_notifer() to fix a build warning
- Add CONFIG_ACPI dependency to Kconfig to fix a build error for extcon-axp.c

* tag 'extcon-next-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
  extcon: arizona: Disable mic detect if running when driver is removed
  extcon: axp288: Add a depends on ACPI to the Kconfig entry
  extcon: mrfld: Introduce extcon driver for Basin Cove PMIC
  extcon: intel: Split out some definitions to a common header
  extcon: Fix build warning for extcon_unregister_notifier comment
  extcon: intel-cht-wc: Enable external charger
  extcon: intel-cht-wc: Make charger detection co-existed with OTG host mode

5 years agolib/siphash.c: mark expected switch fall-throughs
Stephen Rothwell [Tue, 16 Apr 2019 07:27:20 +0000 (17:27 +1000)]
lib/siphash.c: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch aims to suppress up to 18 missing-break-in-switch false
positives on some architectures.

Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonvmem: core: add NVMEM_SYSFS Kconfig
Srinivas Kandagatla [Tue, 16 Apr 2019 09:59:24 +0000 (10:59 +0100)]
nvmem: core: add NVMEM_SYSFS Kconfig

Many nvmem providers are not very keen on having default sysfs
nvmem entry, as most of the usecases for them are inside kernel
itself. And in some cases read/writes to some areas in nvmem are
restricted and trapped at secure monitor level, so accessing them
from userspace would result in board reboots.

This patch adds new NVMEM_SYSFS Kconfig to make binary sysfs entry
an optional one. This provision will give more flexibility to users.
This patch also moves existing sysfs code to a new file so that its
not compiled in when its not really required.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Gaurav Kohli <gkohli@codeaurora.org>
Tested-by: Gaurav Kohli <gkohli@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonvmem: sunxi_sid: Support SID on H6
Yangtao Li [Sat, 13 Apr 2019 10:33:05 +0000 (11:33 +0100)]
nvmem: sunxi_sid: Support SID on H6

Add support for H6's SID controller. It supports 4K-bit
EFUSE, bigger than before.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonvmem: sunxi-sid: convert to SPDX license tags
Yangtao Li [Sat, 13 Apr 2019 10:33:04 +0000 (11:33 +0100)]
nvmem: sunxi-sid: convert to SPDX license tags

Updates license to use SPDX-License-Identifier.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonvmem: sunxi-sid: add binding for H6's SID controller
Yangtao Li [Sat, 13 Apr 2019 10:33:03 +0000 (11:33 +0100)]
nvmem: sunxi-sid: add binding for H6's SID controller

Add a binding for H6's SID controller.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>