Commit graph

49649 commits

Author SHA1 Message Date
Daniel Leung
a1afe9be5e x86: ia32: do virtual address translation at boot
This adds virtual address translation to a few variables
used in crt0.S. This is needed as they are linked at
virtual addresses but before page table is loaded,
they are not available at virtual addresses and must be
referred via physical addresses.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-03 20:10:22 -05:00
Daniel Leung
bbe4b39f8d x86: mmu: cast to uintptr_t for page table using Z_X86_PHYS_ADDR
When feeding &z_shared_kernel_page_start directly to
Z_X86_PHYS_ADDR(), the compiler would complain array subscript
out of bound if linking in virtual address space. So cast it
into uintptr_t first before translation.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-03 20:10:22 -05:00
Peter Bigot
7aefa3d334 include: kernel: fix checkpatch line spacing warning
checkpatch misinterprets the macro that generates event data
structures as being code rather than more data.  This code has not
been changed, but rearrangement of code around it causes a false
positive when the aggregate changes are checked for style.

Add an extra line to eliminate the warning.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
b706a5e999 kernel: remove old work queue implementation
Now that the old API has been reimplemented with the new API remove
the old implementation and its tests.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
4e3b92609b kernel: provide functional equivalent to old userspace work queue API
The new API cannot be used from userspace because it is not merely a
wrapper around existing userspace-capable objects (threads and
queues), but instead requires much more complex and lower-level access
to memory that can't be touched from userspace.  The vast majority of
work queue users are operating from privileged mode, so there's little
motivation to go through the pain and complexity of converting all
functions to system calls.

Copy the necessary pieces of the existing userspace work queue API out
and expose them with new names and types:

* k_work_handler_t becomes k_work_user_handler_t
* k_work becomes k_work_user
* k_work_q becomes k_work_user_q

etc.  Because the replacement API cannot use the same types new API
names are also introduced to make it more clear that the userspace
work queue API is a separate functionality.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
571f9dbbd9 drivers: regulator: update to new delayable work API
Replace legacy API with new API.  Note that this driver uses the
schedule, not reschedule, API, since triggers for delay never overlap.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
d1affd9118 kernel: default to new work API implementation
Switch the default and clean up some test workarounds.  This will enable
final conversions necessary to transition to the new API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
753d56dd7b net: tcp2: work around limitations of legacy API
The tcp2 infrastructure is using the legacy delayed work API, and
relies heavily on the transient state indicated by an estimate of
delayed time remaining to determine whether a delayed work item is
still active.  While the wrappers for this work in most cases, one use
is unsanctioned: directly accessing the fields of k_delayed_work
structure to satisfy the calling parameters of the handler when
invoked directly.

The chosen solution for this specific need in the new API is to use a
schedule (rather than reschedule) operation, which leaves any previous
timer unchanged but allows immediate submission if the work is idle.
This changes behavior in that the resend is delegated to the work
queue, rather than done immediately.  The former behavior can be
supported by further refactoring that turns the work handler into a
wrapper around a function that takes a connection reference, and
invoking that here, while the handler invokes it after reconstructing
the connection from the contained work item.

For now put in a hack that also uses the non-public fields of the
delayed work structure to implement the required behavior.  The
complete fix if this solution is used requires replacing all use of
k_delayed_work in this module with k_work_delayable, leveraging the
new functionality of the API to avoid having to guess about the true
state of a work item based on its transient timer or flag states.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
06665f9652 tests: kernel: add test of new work queue API
Covers all lines that can be reached in controlled conditions.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
c064239c84 doc: kernel: workqueue: update for new workqueue API
Revise the description of queues, work items, and delayable work items
to reflect the terminology and API provided by the new implementation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
dc34e7c6f6 kernel: add new work queue implementation
This commit provides a complete reimplementation of the work queue
infrastructure intended to eliminate the race conditions and feature
gaps in the existing implementation.

Both bare and delayable work structures are supported.  Items can be
submitted; delayable items can be scheduled for submission at a future
time.  Items can be delayed, queued, and running all at the same time.
A running item can also be canceling.

The new implementation:
* replaces "pending" with "busy" which identifies the active states;
* supports canceling delayed and submitted items;
* prevents resubmission of a item being canceled until cancellation
  completes;
* supports waiting for cancellation to complete;
* supports flushing a work item (waiting for the last submission to
  complete without preventing resubmission);
* supports waiting for a queue to drain (only allows resubmission from
  the work thread);
* supports stopping a work queue in conjunction with draining it;
* prevents handler-reentrancy during resubmission.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
44539ed645 kernel: select work queue implementation
Attempts to reimplement the existing work API using a new work
implementation failed, primarily due to heavy use of whitebox testing
in validating the original API.  Add a temporary Kconfig that will
select between the two implementations so we can use the same
identifiers but select which implementation they reference.

This commit just adds the selection infrastructure and uses it to
conditionalize the existing implementation in anticipation of the new
one in the next commit.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
0259c864df kernel: add private scheduler APIs
These functions are a subset of proposed public APIs to clean up
several issues related to safely handling waking of threads.  They
have been made private as they interface may change, but their use
will simplify the reimplementation of the k_work functionality.

See: https://github.com/zephyrproject-rtos/zephyr/pull/29668

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Peter Bigot
3d58398c28 kernel: refactor to separate k_work_poll from k_work
The work poll API is defined in terms of the k_work API.  Shift a
structure definition around so it's not within the details of a
specific k_work API implementation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Torsten Rasmussen
a1e8456bfe tests: link settings_test_fs with kernel
This is needed because Zephyr libraries created after
`find_package(Zephyr)` are not pure Zephyr libraries, as they are not
in the `whole-archive` linking grouping.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Kumar Gala
295349afb1 dts: bindings: Fix duplicate description in ARM PL330 DMA bindings
The DMA bindings had duplicate description: keys.  Merge the two
descriptions into one to fix the issue.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 17:42:12 -06:00
Kumar Gala
f0f8d9f3b5 samples: eventfd: set integration_platforms to mps2_an385
Set integration_platforms on these samples to just mps2_an385.
This should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 18:15:02 -05:00
Kumar Gala
d49ae849c6 tests: application_development: set integration_platforms
Set integration_platforms on these samples to a single platform, we
prefer native_posix, than a qemu platform mps2_an385 and finally a
hardware platform.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 18:13:19 -05:00
Carlo Caione
fe0969c35a MAINTAINERS: Add AArch64 maintainer and collaborators
Add a new entry specifically for AArch64.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-03 17:55:42 -05:00
Ioannis Glaropoulos
d39aa58f10 boards: arduino due: add reset after load for Jlink flashing
Force the Arduino Due device to preform a reset after loading
the program using JLink, effectively allowing the program to
run after west flash.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-03-03 14:14:43 -06:00
James Harris
c7bb423f3e kernel: fix race conditions with z_ready_thread
Several internal APIs wrote thread attributes (return value, mainly)
_after_ calling `z_ready_thread`. This is unsafe, at least in SMP,
because another core could have already picked up and run the thread.

Fixes #32800.

Signed-off-by: James Harris <james.harris@intel.com>
2021-03-03 13:54:47 -05:00
Erwan Gouriou
bb014514e0 drivers/gpio: stm32: Use gpio device as gpio_stm32_configure arg
Now that pinmux driver holds a table of GPIO device pointers,
use gpio device as the single source of trust for gpio_base
and remove use of port_base and related code.
This way, gpio_stm32_configure could directly take gpio device
pointer as argument.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
8d97f67159 drivers/pinmux: stm32: Control GPIO clock with central function
Use new gpio_stm32_clock_request function for GPIO clocks control.
To do this a new table of GPIO devices is set up at build time.
It is then used to populate targeted device when calling
gpio_stm32_clock_request.

Clean up remaining clock handling related code in the file.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
6b2ccbb721 drivers/gpio: stm32: Add port clock handling function
As a preparation for GPIO ports clocks power management,
add a dedicated central function fog GPIO ports clock toggling.

This function is made accessible to other users (pinmux).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
888a24f76d drivers/gpio: stm32: Review code for Port G clock on L4/L5
On L4/L5 device, GPIO port G benefits from a dedicated supply
rail that should be enabled independently.
Review the code around this:
-Compile only when port G is enabled
-Assume that PWR clock is ON, as it is enabled as part of clock init

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Martí Bolívar
2a4ac9ac02 boards: nrf: fix deprecated I2C properties
Commit 821c03a14a ("i2c: nordic: switch
to phandle arrays for pinmux") deprecated some Nordic devicetree
properties.

When boards get merged with stale CI results (i.e. if CI results are
from a mainline commit earlier than 821c03a1), we will get deprecation
warnings, which twister treats as errors.

Play whack-a-mole with the ones that are in tree.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 12:04:15 -06:00
Kumar Gala
403e6e3517 drivers: i2c: nios2: get IRQ and IRQ priority from DTS
Move the I2C IRQ information to devicetree similar to what most all
other drivers are doing.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 11:55:03 -06:00
Kumar Gala
444a2d19a8 cmake: dtc: Validate EXTRA_DTC_FLAGS flags
Make sure the flags in EXTRA_DTC_FLAGS are valid for the version of dtc
we have and only invoke dtc with flags it supports.

Fixes #32644

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 17:29:29 +01:00
Martí Bolívar
fbd34dca1e twisterlib: add deprecated DT props to warnings_as_errors
Use EXTRA_GEN_DEFINES_ARGS to error out on deprecated devicetree
properties when warnings are treated as errors.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 10:22:36 -06:00
Martí Bolívar
2a52fa3eab cmake: dts: pass EXTRA_GEN_DEFINES_ARGS to gen_defines.py
Users can now set this CMake variable to pass additional arguments to
gen_defines.py.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 10:22:36 -06:00
Martí Bolívar
df5a55c638 dts: gen_defines: add CLI option to error out on deprecated props
Allow users to set the new EDT constructor argument which errors out
on deprecated properties via a command line argument.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 10:22:36 -06:00
Martí Bolívar
40c4f0048e dts: edtlib: add EDT kwarg to error out on deprecated props
We'd like to start eliminating deprecated properties from upstream
Zephyr devicetrees. To make that possible in the build system, add an
EDT kwarg that does just that.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 10:22:36 -06:00
Gerson Fernando Budke
bc9b9a0689 dts: pinctrl: atmel: sam-pinctrl: Switch to pincfg-node
Add pincfg-node compatibility.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-03 10:12:57 -06:00
Gerson Fernando Budke
2e15665cad dts: pinctrl: Introduce pincfg-node
Many data items that are represented in a pin configuration node are
common and generic.  Pin control bindings should use the properties
defined on a standard way when are applicable; not all of these
properties are relevant or useful for all hardware or binding
structures.  Each individual binding document should state which of
these generic properties, if any, are used, and the structure of the
DT nodes that contain these properties.

This is based on Linux, documentation:
https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-03 10:12:57 -06:00
Kumar Gala
97bca832d1 samples: crypto: set integration_platforms to native_posix
Set integration_platforms on these samples to just native_posix.  This
should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:22:24 -06:00
Kumar Gala
4bc8e4203d tests: logging: set integration_platforms to native_posix
Set integration_platforms on these tests to just native_posix.  This
should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:19:45 -06:00
Kumar Gala
a27751eca5 tests: uart_basic_api: set integration_platforms to mps2_an385
Set integration_platforms on these tests to just mps2_an385.  This
should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:19:24 -06:00
Kumar Gala
dd8de28c6d samples: userspace: set integration_platforms to mps2_an385
Set integration_platforms on these samples to just mps2_an385.
This should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:14:33 -06:00
Kumar Gala
e65c84e5bd samples: logging: set integration_platforms
Set integration_platforms on these samples to a single platform, we
prefer native_posix, than a qemu platform mps2_an385 and finally a
hardware platform.

For the 'basic' sample we use native_posix, for the 'rtt' we use
frdm_k64f ad we need a hardware platform that supports 'rtt', and for
the 'usermode' we utilize 'mps2_an385' as we can run in QEMU.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:12:59 -06:00
Kumar Gala
6eb6c88554 samples: console: set integration_platforms to mps2_an385
Set integration_platforms on these samples to just mps2_an385.
This should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:12:30 -06:00
Kumar Gala
59fd4bfdfd samples: app_dev: set integration_platforms to native_posix
Set integration_platforms on these samples to just native_posix.  This
should be sufficient to make sure these tests build and run.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 09:11:53 -06:00
Martí Bolívar
563a46c7d4 dts: clean up binding syntax checks
Commit 6bf761fc0a ("dts: Remove support
for deprecated DTS binding syntax") removed most of the support for
the 'legacy' bindings syntax.

A few straggler keys are still around in the bindings check code,
though. This allows some legacy keys which should cause errors to pass
silently instead.

Fix the error handling and print good errors for cases which are
removed, just in case someone is still using them somewhere.

Clean up some other error messages in the same function while we're
here.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 08:18:10 -06:00
Martí Bolívar
e54ac1d9fe doc: devicetree: bindings: fix outdated info
Inferred bindings (already mentioned above) make some text lower down
a bit inaccurate. Fix it up.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-03 08:18:10 -06:00
Jim Paris
ffec5aa7f7 ppp: add net events for PPP dead and running
This lets an application detect when a PPP connection fails to establish
or terminates, so that the connection can be reattempted (for example,
by setting carrier off and on).

Signed-off-by: Jim Paris <jim@jim.sh>
2021-03-03 15:56:13 +02:00
Nicolas Pitre
0c45b548e2 aarch64: rationalize exception entry/exit code
Each vector slot has room for 32 instructions. The exception context
saving needs 15 instructions already. Rather than duplicating those
instructions in each out-of-line exception routines, let's store
them directly in the vector table. That vector space is otherwise
wasted anyway. Move the z_arm64_enter_exc macro into vector_table.S
as this is the only place where it should be used.

To further reduce code size, let's make z_arm64_exit_exc into a
function of its own to avoid code duplication again. It is put in
vector_table.S as this is the most logical location to go with its
z_arm64_enter_exc counterpart.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-03-03 16:26:40 +03:00
Piotr Mienkowski
b22df38d30 drivers: i2s_sam_ssc.c: store *dev_dma in flash
The DMA module the i2s_sam_ssc relies on cannot change during the
runtime. Store pointer to dev_dma in flash, not in RAM. The new
implementation saves 40 bytes of flash and 32 bytes of RAM.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-03-03 16:16:33 +03:00
Erwan Gouriou
d19741f1ec drivers/flash: stm32 qspi: Use new DT_DMA helper macro
New DT_DMA helper macros to directly access dma device.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Erwan Gouriou
13c2351524 drivers/serial: stm32: convert dma to new DT_DMA helper macros
New DT_DMA helper macors are available to access DMA node
identifier. Use them

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Erwan Gouriou
d8348b0e5e drivers/spi: stm32: Minor init code refactoring
Minor changes to init code indentation.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Erwan Gouriou
375db6e080 drivers/spi: stm32 convert dma to new DT_DMA helper macros
New DT_DMA helper macors are available to access DMA node
identifier. Use them

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00