Commit graph

389 commits

Author SHA1 Message Date
Nicolas Pitre e9a47d932c kernel: mmu: shrink and align struct z_page_frame
The struct z_page_frame is marked __packed to avoid extra padding as
such padding may represent significant memory waste when lots of page
frames are used. However this is a bad strategy.

The code contained this somewhat dubious comment and code in
free_page_frame_list_put():

	/* The structure is packed, which ensures that this is true */
	void *node = pf;
	sys_slist_append(&free_page_frame_list, node);

This is bad for many reasons:

- type checking is completely bypassed;

- if the sys_snode_t node member is no longer located at the front of
  struct z_page_frame then the code will still compile and possibly run
  but be broken with memory corruption as a likely outcome;

- the sys_slist_append() code is completely unaware of the packed
  attribute which breaks architectures with alignment restrictions.

Let's improve code efficiency as well as memory usage by removing the
packed attribute and manually packing the flags in the unused virtual
address bits. This way the page frame array remains naturally aligned,
data access becomes optimal and the actual array size gets even smaller.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-05-13 16:04:40 -04:00
Ederson de Souza 64a373f4ea doc/kernel/drivers: Mention deferred initialization
Add a section discussing device deferred initialization on the device
model documentation.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-10 20:24:44 -04:00
Glenn Andrews b3e42feaea Documentation: Update Polling API
Changes:
1. the number of events being checked did not equal those defined
in the `events` array.
2. Use `k_poll_signal_check()` instead of accessing fields directly.
3. Use `k_poll_signal_reset()` to reset the signal instead of
accessing fields directly.

I'm assuming the examples predate `k_poll_signal_check()` and
`k_poll_signal_reset()`

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
2024-05-07 09:32:13 +02:00
Grant Ramsay 0933cdec15 doc: kernel: code-relocation: Remove kernel example and add tips
The Kernel code relocation example does not work, as the kernel
contains early initialization code that executes before code
relocation takes place

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2024-05-02 09:56:11 +01:00
Daniel Leung 6ea749de52 arch: rename arch_start_cpu() to arch_cpu_start()
Rename arch_start_cpu() to arch_cpu_start() so it belongs to
the "cpu" namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-03-25 09:58:35 +00:00
TaiJu Wu 1f5f0cf838 sched: Remove multi-level queue priority limit
Modified bitmask to  bitmask array, it can make multilevel queue remove
32 bit prioriry limit.

We can scan bitmask array to find which queue have ready thread.

Only need the number of queues as priority because the priority
is checked on create_thread.

Signed-off-by: TaiJu Wu <tjwu1217@gmail.com>
2024-03-12 19:37:40 -04:00
Jason Hutchinson 650a59479c doc: kernel: services: mailboxes: remove extra '.'
removed extra period after 'k_mbox_data_get()'

Signed-off-by: Jason Hutchinson <Jason_Hutchinson@Outlook.com>
2024-02-27 19:15:27 -05:00
Håkon Amundsen 6e6f8ee846 doc: kernel: interrupts: remove concept of 'interrupt handler function'
This is an alias of ISR, which should be used instead.

Signed-off-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no>
2024-02-08 09:01:50 +01:00
Radoslaw Koppel 19bb21ef6d doc: kernel: interrupts: Description of the local isr declaration
This commit adds a documentation about the new parser of the
interrupt vectors tables that is using linker to construct
the arrays with all the runtime required data.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Radoslaw Koppel b0c83f328c arch: sw_isr_table: Update shared interrupts structures
This commit updates the definition of z_shared_isr_table_entry
to use _isr_table_entry instead of specially created z_shared_isr_client.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Ben Marsh 79bbe8f4b0 doc: kernel: Add message queue & pipe to poll docs
The polling API can be used to wait on data in a FIFO, message queue,
or pipe, but the docs were not clear that message queues and pipes
are supported.

Add to the docs to make it clear message queues and pipes
can be used with the polling API.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2024-02-02 13:20:00 +01:00
Pisit Sawangvonganan 512dc9ff38 doc: fix typo in multiple directories (build, hardware, kernel, project)
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the doc/build, hardware, kernel, project directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-26 13:16:18 +01:00
Yong Cong Sin d07d8082c9 doc: touch-up multi-level interrupt documentation
Some very minor touch-ups for multi-level interrupt
wordings and documentations to better reflects its current
state.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-26 11:47:36 +01:00
Grzegorz Swiderski 460b6ef122 code_relocation: Add NOKEEP option
When using the code and data relocation feature, every relocated symbol
would be marked with `KEEP()` in the generated linker script. Therefore,
if any input files contained unused code, then it wouldn't be discarded
by the linker, even when invoked with `--gc-sections`.

This can cause unexpected bloat, or other link-time issues stemming from
some symbols being discarded and others not.

On the other hand, this behavior has been present since the feature's
introduction, so it should remain default for the users who rely on it.

This patch introduces support for `zephyr_code_relocate(... NOKEEP)`.
This will suppress the generation of `KEEP()` statements for all symbols
in a particular library or set of files.

Much like `NOCOPY`, the `NOKEEP` flag is passed to `gen_relocate_app.py`
in string form. The script is now equipped to handle multiple such flags
when passed from CMake as a semicolon-separated list, like so:

   "SRAM2:NOCOPY;NOKEEP:/path/to/file1.c;/path/to/file2.c"

Documentation and tests are updated here as well.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-01-15 13:20:17 +01:00
Reto Schneider 698f3b1a58 doc: Fix sentence
Before this commit, the sentence did not make sense.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-01-08 14:06:40 -05:00
Johan Hedberg 3fbf12487c kernel: Introduce a way to specify minimum system heap size
There are several subsystems and boards which require a relatively large
system heap (used by k_malloc()) to function properly. This became even
more notable with the recent introduction of the ACPICA library, which
causes ACPI-using boards to require a system heap of up to several
megabytes in size.

Until now, subsystems and boards have tried to solve this by having
Kconfig overlays which modify the default value of HEAP_MEM_POOL_SIZE.
This works ok, except when applications start explicitly setting values
in their prj.conf files:

$ git grep CONFIG_HEAP_MEM_POOL_SIZE= tests samples|wc -l
     157

The vast majority of values set by current sample or test applications
is much too small for subsystems like ACPI, which results in the
application not being able to run on such boards.

To solve this situation, we introduce support for subsystems to specify
their own custom system heap size requirement. Subsystems do
this by defining Kconfig options with the prefix HEAP_MEM_POOL_ADD_SIZE_.
The final value of the system heap is the sum of the custom
minimum requirements, or the value existing HEAP_MEM_POOL_SIZE option,
whichever is greater.

We also introduce a new HEAP_MEM_POOL_IGNORE_MIN Kconfig option which
applications can use to force a lower value than what subsystems have
specficied, however this behavior is disabled by default.

Whenever the minimum is greater than the requested value a CMake warning
will be issued in the build output.

This patch ends up modifying several places outside of kernel code,
since the presence of the system heap is no longer detected using a
non-zero CONFIG_HEAP_MEM_POOL_SIZE value, rather it's now detected using
a new K_HEAP_MEM_POOL_SIZE value that's evaluated at build.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-12-20 11:01:42 +01:00
Simon Hein 47ec4359b9 doc: Clean up wrong c function links
Resolve wrong documentation c function links for
irq: z_shared_isr, rtio: rtio_cqe_get_mempool_buffer
and sensor: sensor_read

Signed-off-by: Simon Hein <Shein@baumer.com>
2023-12-15 08:51:34 -06:00
Simon Hein 64462657c9 doc: irq: fix function link
fix not correct shown function link for irq_connect_dynamic.

Signed-off-by: Simon Hein <Shein@baumer.com>
2023-12-13 20:13:46 +01:00
Daniel Leung 6421c7a5fe os: timing: polish doxygen
() Moves the architecture specific timing measurement APIs
   under the timing measurement APIs group.
() Add SoC and board specific API groups.
() Document each SoC and board specific API so the doc shows up
   for them.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-12 19:10:33 +01:00
Daniel Leung 397c001181 doc: kernel/mm: add a page about virtual memory
This adds a page about virtual memory under kernel's memory
management.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-08 08:31:15 -05:00
Mia Koen 0bcad09392 bluetooth: mesh: Doc fix Bluetooth mesh to Mesh
SIG has changed Bluetooth mesh to Bluetooth Mesh
Updating zephyr docs accordingly
Leaving out old release notes

Signed-off-by: Mia Koen <mia.koen@nordicsemi.no>
2023-12-01 10:56:18 +00:00
Børre A. Opedal Lunde 6c6712d104 doc: timers: correct grammar and typos
Minor grammatical errors and mistyped words were
corrected to improve clarity.

Signed-off-by: Børre A. Opedal Lunde <borre97@live.no>
2023-11-28 17:17:58 -05:00
Benjamin Cabé 155420522b doc: Fix occurrences of repeated words
Another round of repeated words cleanup. This commit tries to keep the
diff minimal and line wrapping was mostly left intact in the touched
files, as having them consistent across the documentation is probably
the topic of a future tree-wide cleanup (or not)

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-11-15 17:34:39 -05:00
Andrej Butok 287b30eb78 doc: Fix double 'the'
Fix double 'the' in all .rst documentation.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-11-15 14:25:11 +00:00
Andrej Butok 2e97e5daa8 doc: mpsc: Add missed 'end'
Adds missed 'end' in the 'Internals' chapter.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-11-15 10:05:27 +01:00
Thien Nguyen a0b746ed74 doc: drivers: deprecate driver init levels
Remove deprecated driver initialization levels in the docs.

Signed-off-by: Thien Nguyen <nguyenmthien@live.com>
2023-11-14 10:20:53 -05:00
Andrej Butok 583fd8a79e doc: slist: fix duplicated sys_sfnode_flags_get()
Replace duplicated sys_sfnode_flags_get() by sys_sfnode_flags_set().

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-11-08 10:10:27 +01:00
Andrej Butok 5730dd6fb7 doc: fix typos
Add missed "space".
Add missed "been".

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-11-08 10:09:44 +01:00
Andrej Butok 95a5f5178f doc: memory: Fix SYS_MEM_BLOCKS_DEFINE_STATIC description
Fix SYS_MEM_BLOCKS_DEFINE_STATIC() description.
Use a "memory blocks allocator" instead of "slab",
which is most probably was copy-pasted from
the previous "slab" chapter by mistake.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-11-06 19:03:29 -05:00
Anas Nashif a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif ee9f278323 syscall: rename Z_SYSCALL_VERIFY -> K_SYSCALL_VERIFY
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 1a9de05767 syscall: rename Z_SYSCALL_DRIVER_ -> K_SYSCALL_DRIVER_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 9c4d881183 syscall: rename Z_SYSCALL_ to K_SYSCALL_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 9c1aeb5fd3 syscall: rename z_user_ to k_usermode_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 56fddd805a syscall: rename z_user_from_copy -> k_usermode_from_copy
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 21254b2f40 syscall: rename z_object_validate -> k_object_validate
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif df9428991a syscall: Z_SYSCALL_MEMORY_ARRAY -> K_SYSCALL_MEMORY_ARRAY
Rename macros and do not use Z_ for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 684b8fcdd0 syscall: Z_SYSCALL_VERIFY_MSG -> K_SYSCALL_VERIFY_MSG
Rename macros and do not use Z_ for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif c91cad735a kernel: object: rename z_object_init to k_object_init
Do not use z_ for internal API and rename to k_object_init.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Fabio Baltieri bc43e890fd doc: drivers: add a paragraph mentioning the initlevels target
Add a paragraph mentioning the initlevels target for inspecting the
DEVICE_DEFINE and SYS_INIT sequence.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-28 23:19:59 +02:00
Andrej Butok 3fab7624eb doc: pipes: Fix the pipe read example.
Replaces sizeof(header) which is equal to the size of the pointer,
by sizeof (*header), which is equal to the size of struct message_header.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-10-26 10:29:37 -04:00
Benjamin Cabé 32918ddd92 doc: Fix broken references to Kconfig options
Fixed a few occurrences of incorrect references to Kconfig options
(missing the CONFIG_ prefix)

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-17 19:50:39 +01:00
Andrei Hutanu 9fcc609237 docs: mem: slabs: fix for mem_slab docs snippets
Attempting to run the memory slab docs snippets will
result in build issues. This PR is an attempt to fix
those.

Signed-off-by: Andrei Hutanu <andrei.hutanu.i@gmail.com>
2023-10-17 13:17:56 +03:00
Benjamin Cabé 8ec1a27920 doc: ring_buffer: fix typos and incoherences
Fixed an incorrect mention of buffer size being expressed in 32-byte
words for data item mode when it's in fact 32-bit.
Fixed a few broken references to C functions and structs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-14 18:42:34 +03:00
Peter Mitsis e9987aabbc kernel: Remove legacy mem block from mailbox
Memory blocks are a legacy feature and are to be removed from
mailboxes.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-10-13 09:56:02 +03:00
Daniel Leung 04a0cf7d79 kernel: deprecate K_THREAD_STACK_MEMBER
The macro K_THREAD_STACK_MEMBER has actually been deprecated
since v2.4.0 in the macro doxygen description, but it was
never marked with __DEPRECATED_MACRO. Since this was being
used in various drivers, make it follow the deprecation
process.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-12 11:07:00 +01:00
Marcin Gasiorek 47822586e4 doc: Remove two redundant characters in rst file
Remove additional dot and bracket.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-10-11 11:10:05 +02:00
Peter Mitsis d66cf91706 doc: Add missing threads references to object cores
Two references to the integration of object cores with threads were
missing from the documentation. This fixes that.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-10-09 10:16:46 +02:00
Flavio Ceolin 15aa3acaf6 kconfig: Remove MP_NUM_CPUS usage
Zephyr's code base uses MP_MAX_NUM_CPUS to
know how many cores exists in the target. It is
also expected that both symbols MP_MAX_NUM_CPUS
and MP_NUM_CPUS have the same value, so lets
just use MP_MAX_NUM_CPUS and simplify it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-03 17:45:53 +01:00