30 Jun, 2019
5 commits
-
Add the 'in_atomic' mode which can be called from an atomic context.
This mode relies on the existing 'raw' mode (no lock, no preemption/irq
disabling) with the difference that the timeout is not based on jiffies
(jiffies won't increase when irq are disabled) but handled with
busy-waiting udelay() calls.Signed-off-by: Fabien Dessenne
Signed-off-by: Bjorn Andersson -
Implement this optional ops, called by hwspinlock core while spinning on
a lock, between two successive invocations of trylock().Reviewed-by: Benjamin Gaignard
Signed-off-by: Fabien Dessenne
Signed-off-by: Bjorn Andersson -
Do not wait for hwspinlock device registration if it is not available
for use.Acked-by: Suman Anna
Signed-off-by: Fabien Dessenne
Signed-off-by: Bjorn Andersson -
Add a debug level trace statement in the OMAP HwSpinlock driver
probe function to print the number of hwlocks on a successful
registration.Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson -
A HwSpinlock IP is also present on the newer TI K3 AM65x and J721E
family of SoCs within the Main NavSS sub-module. Reuse the existing
OMAP Hwspinlock driver to extend the support for this IP on K3 AM65x
SoCs as well. The IP has slightly different bit-fields in the
SYSCONFIG and SYSSTATUS registers.Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson
04 Jan, 2019
1 commit
-
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().Fixes: f24fcff1d267 ("hwspinlock: add STM32 hwspinlock device")
Acked-by: Benjamin Gaignard
Signed-off-by: Wei Yongjun
Signed-off-by: Bjorn Andersson
06 Dec, 2018
1 commit
-
This patch adds support of hardware semaphores for stm32mp1 SoC.
The hardware block provides 32 semaphores.Signed-off-by: Benjamin Gaignard
Signed-off-by: Benjamin Gaignard
Signed-off-by: Bjorn Andersson
31 Jul, 2018
1 commit
-
The commit 4f1acd758b08 ("hwspinlock: Add devm_xxx() APIs to request/free
hwlock") introduces one bug, that will return one error pointer if failed
to request one hwlock, but we expect NULL pointer on error for consumers.
This patch will fix this issue.Reported-by: Dan Carpenter
Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson
27 Jun, 2018
4 commits
-
Fix one comment mistake with correct function names.
Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
This patch introduces devm_hwspin_lock_register() and devm_hwspin_lock_unregister()
interfaces to help to register or unregister one hardware spinlock controller, that
will help to simplify the cleanup code for hwspinlock drivers.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
This patch introduces some devm_xxx() APIs to help to request or free
the hwlocks, which will help to simplify the cleanup code for drivers
requesting one hwlock, ensuring that the hwlock is automatically freed
whenever the device is unbound.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
The hardware spinlock binding already supplied the 'hwlock-names' property
to match and get a specific hwlock, but did not supply one API for users
to get a specific hwlock by the hwlock name. So this patch introduces one
API to support this requirement.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson
12 Jun, 2018
1 commit
-
Pull hwspinlock updates from Bjorn Andersson:
"In addition to migrating the files to use SPDX license headers this
introduces the ability for clients to operate a hwlock without the
framework taking any additional locks"* tag 'hwlock-v4.18' of git://github.com/andersson/remoteproc:
hwspinlock/u8500: Switch to SPDX license identifier
hwspinlock: sprd: Switch to SPDX license identifier
hwspinlock/sirf: Switch to SPDX license identifier
hwspinlock: qcom: Switch to SPDX license identifier
hwspinlock/omap: Switch to SPDX license identifier
hwspinlock/core: Switch to SPDX license identifier
hwspinlock: Introduce one new mode for hwspinlock
hwspinlock: Convert to use 'switch' statement
07 Jun, 2018
2 commits
-
Replaces open-coded struct size calculations with struct_size() for
devm_*, f2fs_*, and sock_* allocations. Automatically generated (and
manually adjusted) from the following Coccinelle script:// Direct reference to struct field.
@@
identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
expression HANDLE;
expression GFP;
identifier VAR, ELEMENT;
expression COUNT;
@@- alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
+ alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)// mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
@@
identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
expression HANDLE;
expression GFP;
identifier VAR, ELEMENT;
expression COUNT;
@@- alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
+ alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)// Same pattern, but can't trivially locate the trailing element name,
// or variable name.
@@
identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
expression HANDLE;
expression GFP;
expression SOMETHING, COUNT, ELEMENT;
@@- alloc(HANDLE, sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
+ alloc(HANDLE, CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)Signed-off-by: Kees Cook
-
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:struct foo {
int stuff;
void *entry[];
};instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);
This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
uses. It was done via automatic conversion with manual review for the
"CHECKME" non-standard cases noted below, using the following Coccinelle
script:// pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
// sizeof *pkey_cache->table, GFP_KERNEL);
@@
identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
expression GFP;
identifier VAR, ELEMENT;
expression COUNT;
@@- alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
+ alloc(struct_size(VAR, ELEMENT, COUNT), GFP)// mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
@@
identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
expression GFP;
identifier VAR, ELEMENT;
expression COUNT;
@@- alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
+ alloc(struct_size(VAR, ELEMENT, COUNT), GFP)// Same pattern, but can't trivially locate the trailing element name,
// or variable name.
@@
identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
expression GFP;
expression SOMETHING, COUNT, ELEMENT;
@@- alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
+ alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)Signed-off-by: Kees Cook
25 May, 2018
6 commits
-
Use the appropriate SPDX license identifier in the U8500 HWSEM
driver source file and drop the previous boilerplate license text.Cc: Mathieu J. Poirier
Reviewed-by: Linus Walleij
Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson -
Use the appropriate SPDX license identifiers in the Spreadtrum hardware
spinlock driver source file and drop the previous boilerplate license text.Cc: Baolin Wang
Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson -
Use the appropriate SPDX license identifier in the CSR's SIRF hardware
spinlock driver source file and drop the previous boilerplate license text.Cc: Wei Chen
Cc: Barry Song
Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson -
Use the appropriate SPDX license identifier in the Qualcomm Hwspinlock
driver source file and drop the previous boilerplate license text.Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson -
Use the appropriate SPDX license identifier in the OMAP hwspinlock
driver source file and drop the previous boilerplate license text.Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson -
Use the appropriate SPDX license identifier in the Hwspinlock core
driver source files and drop the previous boilerplate license text.Signed-off-by: Suman Anna
Signed-off-by: Bjorn Andersson
18 Apr, 2018
2 commits
-
In some scenarios, user need do some time-consuming or sleepable
operations under the hardware spinlock protection for synchronization
between the multiple subsystems.For example, there is one PMIC efuse on Spreadtrum platform, which
need to be accessed under one hardware lock. But during the hardware
lock protection, the efuse operation is time-consuming to almost 5 ms,
so we can not disable the interrupts or preemption so long in this case.Thus we can introduce one new mode to indicate that we just acquire the
hardware lock and do not disable interrupts or preemption, meanwhile we
should force user to protect the hardware lock with mutex or spinlock to
avoid dead-lock.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
We have different hwspinlock modes to select, thus it will be more
readable to handle different modes with using 'switch' statement
instead of 'if' statement.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson
18 Nov, 2017
1 commit
-
Pull hwspinlock update from Bjorn Andersson:
"This changes the HWSPINLOCK core Kconfig option to bool, to aid when
other core code depends on it"* tag 'hwlock-v4.15' of git://github.com/andersson/remoteproc:
hwspinlock: Change hwspinlock to a bool
07 Nov, 2017
1 commit
-
Change hwspinlock to a bool in case some drivers will meet dependency
issue when hwspinlock is built as a module.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson
02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
18 May, 2017
2 commits
-
The Spreadtrum hardware spinlock device can provide hardware assistance
for synchronization between the multiple subsystems.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
So that there's no need to get into the submenu to disable all related config
entries.Signed-off-by: Vincent Legoll
Signed-off-by: Bjorn Andersson
07 Jul, 2016
1 commit
-
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Peter Chen
Signed-off-by: Bjorn Andersson
21 May, 2016
1 commit
-
radix_tree_is_indirect_ptr() is an internal API. The correct call to
use is radix_tree_deref_retry() which has the appropriate unlikely()
annotation.Fixes: c6400ba7e13a ("drivers/hwspinlock: fix race between radix tree insertion and lookup")
Signed-off-by: Matthew Wilcox
Cc: Konstantin Khlebnikov
Cc: Kirill Shutemov
Cc: Jan Kara
Cc: Neil Brown
Cc: Ross Zwisler
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
04 Feb, 2016
1 commit
-
of_hwspin_lock_get_id() is protected by the RCU lock, which means that
insertions can occur simultaneously with the lookup. If the radix tree
transitions from a height of 0, we can see a slot with the indirect_ptr
bit set, which will cause us to at least read random memory, and could
cause other havoc.Fix this by using the newly introduced radix_tree_iter_retry().
Signed-off-by: Matthew Wilcox
Cc: Hugh Dickins
Cc: Ohad Ben-Cohen
Cc: Konstantin Khlebnikov
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
01 Jul, 2015
1 commit
-
msb of the regmap_field was mistakenly given the value 32, to set all bits
in the regmap update mask; although incorrect this worked until 921cc294,
where the mask calculation was corrected.Signed-off-by: Bjorn Andersson
Signed-off-by: Ohad Ben-Cohen
12 Jun, 2015
1 commit
-
Add hwspinlock support for the CSR atlas7 SoC.
The Hardware Spinlock device on atlas7 provides hardware assistance
for synchronization between the multiple processors in the system
(dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).Reviewed-by: Suman Anna
Reviewed-by: Bjorn Andersson
Signed-off-by: Wei Chen
Signed-off-by: Barry Song
Signed-off-by: Ohad Ben-Cohen
02 May, 2015
3 commits
-
Add driver for Qualcomm Hardware Mutex block found in many Qualcomm
SoCs.Based on initial effort by Kumar Gala
Signed-off-by: Bjorn Andersson
Reviewed-by: Andy Gross
Reviewed-by: Jeffrey Hugo
Signed-off-by: Ohad Ben-Cohen -
HwSpinlock IP is present only on OMAP4 and other newer SoCs,
which are all device-tree boot only. This patch adds the
base support for parsing the DT nodes, and removes the code
dealing with the traditional platform device instantiation.Signed-off-by: Suman Anna
[tony@atomide.com: ack for legacy file removal]
Acked-by: Tony Lindgren
[comment on the imperfect always-zero base_id]
Signed-off-by: Ohad Ben-Cohen -
This patch adds a new OF-friendly API of_hwspin_lock_get_id()
for hwspinlock clients to use/request locks from a hwspinlock
device instantiated through a device-tree blob. This new API
can be used by hwspinlock clients to get the id for a specific
lock using the phandle + args specifier, so that it can be
requested using the available hwspin_lock_request_specific()
API.Signed-off-by: Suman Anna
Reviewed-by: Bjorn Andersson
[small comment clarification]
Signed-off-by: Ohad Ben-Cohen
20 Oct, 2014
1 commit
-
A platform_driver does not need to set an owner, it will be populated by the
driver core.Signed-off-by: Wolfram Sang
29 Jul, 2014
2 commits
-
HwSpinlocks are supported on TI's AM33xx, AM43xx and DRA7xx SoC
device families as well. The IPs are identical to that of
OMAP4/OMAP5, except for the number of locks.Add a depends on to the above family of SoCs to enable the
build support for OMAP hwspinlock driver for any of the above
SoC configs.Signed-off-by: Suman Anna
[small commit log changes]
Signed-off-by: Ohad Ben-Cohen -
The number of hwspinlocks are determined based on the value read
from the IP block's SYSSTATUS register. However, the module may
not be enabled and clocked, and the read may result in a bus error.This particular issue is seen rather easily on AM33XX, since the
module wakeup is software controlled, and it is disabled out of
reset. Make sure the module is enabled and clocked before reading
the SYSSTATUS register.Signed-off-by: Suman Anna
[replace pm_runtime_put_sync with lenient pm_runtime_put]
Signed-off-by: Ohad Ben-Cohen
08 May, 2013
1 commit
-
Pullhwspinlock update from Ohad Ben-Cohen:
"A single patch from Vincent extending OMAP's hwspinlock support to
OMAP5"* tag 'hwspinlock-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/hwspinlock:
hwspinlock/omap: support OMAP5 as well