Commit Graph

89100 Commits

Author SHA1 Message Date
Christopher Friedt e8ba19e0ee docs: posix: aep: correct some typos
* use _POSIX_AEP_REALTIME_DEDICATED instead of CONTROLLER
* use _POSIX_AEP_REALTIME_DEDICATED instead of MINIMAL in
  comment

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 12:19:26 +00:00
Christopher Friedt ec69e64d4c posix: pthread_setspecific: fix for coverity issue cid 334906
* return EINVAL if pthread_self() is not a valid pthread

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 12:19:10 +00:00
Christopher Friedt 3458527a2c posix: pthread_getspecific: fix for coverity issue cid 334909
* remove unneeded line of code that duplicated the first part
  of the SYS_SLIST_FOR_EACH_NODE() expansion.
* return NULL if pthread_self() is not a valid pthread

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 12:19:10 +00:00
Krzysztof Chruściński c48d61a4b4 lib: os: cbprintf: Fix size miscalculation in cbprintf_convert
When package contained RO string positions and flag indicates that
they shall not be kept, length was miscalculated which could lead
to failures (e.g. memory corruption).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-12-28 12:18:50 +00:00
Krzysztof Chruściński b46d961abf tests: lib: cbprintf_package: Add test case for cbprintf_convert
Add test case for converting statically generated package which
contains RO and RW indexes. Converting shall append RW string
and discard RO index.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-12-28 12:18:50 +00:00
Gaetan Perrot 82cd7ad9b6 drivers: dac: sam: Add max value check
Add max size check to dac sam and sam0
There is no size check in dac_sam_write_value and dac_sam0_write_value.
Besides, the ret value should also be different.
Fixes #65021

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2023-12-28 12:08:27 +00:00
Andrei Emeltchenko fc8b53bf10 drivers: pcie: Read register before actual usage
Move reading PCIE_CONF_CMDSTAT before actual usage. There are four
return branches before value is used.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-28 12:07:30 +00:00
Andrei Emeltchenko 4a17446636 drivers: pcie: Remove magic number
Use definitions instead of magic numbers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-28 12:07:30 +00:00
Pieter De Gendt cc920696ed tests: unit: util: Add tests for IF_DISABLED
Add a testcase for the IF_DISABLED macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-28 12:06:28 +00:00
Pieter De Gendt b4cd9c462a sys: util_macro: Add IF_DISABLED
Add the opposite for IF_ENABLED macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-28 12:06:28 +00:00
Jaro Van Landschoot be6cf5c268 soc: arm: atmel_sam: Sys_arch_reboot using RSTC
The previous implementation of the sys_arch_reboot function
for the Atmel SAM series was using NVIC_SystemReset.
This caused a reboot time of around 20 seconds on a SAM4SA16CA,
which is now reduced by directly writing to the
reset controller control register (RSTC_CR).

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
Co-authored-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-28 12:05:53 +00:00
Christopher Friedt 6342aa3cc0 lib: support linking to POSIX API with 3rd-party libc
Previously it was not possible to link to Zephyr's
POSIX API under lib/posix when building with
`CONFIG_EXTERNAL_LIBC=y`.

This small change allows that to work as expected.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 06:14:22 -05:00
Flavio Ceolin 0bf5cbc1c8 syscall_handler: Fix warnings in K_SYSCALL_MEMORY
Put parenthesis around parameters in K_SYSCALL_MEMORY_SIZE_CHECK
to avoid possible warnings during the macro expansion.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-28 09:52:15 +01:00
Christopher Friedt 1f67dcbd89 posix: remove deprecated non-standard PTHREAD_MUTEX_DEFINE, etc
Remove the previously deprecated and non-standard macros
* PTHREAD_MUTEX_DEFINE()
* PTHREAD_COND_DEFINE()

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 03:40:57 -05:00
Flavio Ceolin 87d056bd31 syscall: Fix static analysis compalins
Since K_SYSCALL_MEMORY can be called with signed/unsigned size types, if
we check if size >= 0, static anlysis will complain about it when
size in unsigned.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-27 21:14:31 +01:00
Fabio Baltieri ff8970318d input: define optional functions when generating documentation
Add a defined(__DOXYGEN__) condition for the optional APIs so that they
get included in the documentation.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-27 16:50:21 +00:00
Fabio Baltieri 4307882dd1 input: kbd_matrix: add actual key mask runtime control
Add an option to enable a input_kbd_matrix_actual_key_mask_set API to
enable or disable keys dynamically in the mask. This can be useful if
the exact key mask is determined in runtime and the device is using a
single firmware for multiple matrix configurations.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-27 16:50:21 +00:00
Pisit Sawangvonganan 250d50e8b6 drivers: rtc: set 'rtc_driver_api' as 'static const'
This change marks each instance of the 'rtc_driver_api' as 'static const'.
The rationale is that 'rtc_driver_api' is used for declaring internal
module interfaces and is not intended to be modified at runtime.
By using 'static const', we ensure immutability, leading to usage of only
.rodata and a reduction in the .data area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2023-12-27 16:12:06 +00:00
Dmitrii Golovanov 7525cc7943 twister: coverage: Remove dead code at BinaryHandler
BinaryHandler.hanlde() method was trying to call GCOV and fails
silently because of incorrect call parameters. Moreover, even
being fixed, this call is not needed here as it attempts to
find and process .gcno and .gcna files (using wrong paths)
to create .gcov coverage text reports.
Currently the CoverageTool class does all data processing
and report generation using GCOVR or LCOV tools instead of
direct calls to GCOV.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-27 16:10:46 +00:00
Chekhov Ma d1c6bb5cb4 imx8m: auto generate mmu_regions array from dt compatiable
Adopt the "MMU_REGION_DT_FLAT_ENTRY" macro to automatically generate
elements in "mmu_regions" according to devicetree "compatible" and
"status".

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2023-12-27 16:09:42 +00:00
Chekhov Ma 81c5a093f3 imx93: auto generate mmu_regions array from dt compatiable
Adopt the "MMU_REGION_DT_FLAT_ENTRY" macro to automatically generate
elements in "mmu_regions" according to devicetree "compatible" and
"status".

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2023-12-27 16:09:42 +00:00
Chekhov Ma 3f148d6bb4 arch: arm: mmu: generate mmu region entry from devicetree
Many peripherals have multiple instances, whether each of them
are enabled are not known. Adding all available instances into
"mmu_regions" array may not be the best choice.
This commit adds a macro to generate mmu region entry in "mmu_regions"
from devicetree. Used with "DT_FOREACH_STATUS_OKAY_VARGS", it generates
mmu region entry for all nodes enabled and compatiable to a certain
driver.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2023-12-27 16:09:42 +00:00
Seppo Takalo dc6e7aa4b1 net: lwm2m: Add transmission state indicator to RX as well
Refactored the socket state indication into its own function
that checks the state of TX queues as well as number of
pending CoAP responses.
Check the state after receiving a packet, as it might
have been a last Ack packet we have been waiting.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-27 16:07:59 +00:00
Théo Battrel ba80bc7134 Tests: Bluetooth: Fix conn_stress compilation warn
On newer GCC version warnings were emitted because of a `memcpy`. The
size parameter was larger than the source's size because it was using
the size of the destination, which was a `bt_uuid_128` when the source
is a `bt_uuid_16`.

Fix the issue by creating a new variable for CCC UUID in both the
central and peripheral code. The variable need to be static because the
discover parameters must remain valid until the start of the discover
attribute callback.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-12-27 16:07:46 +00:00
Andrei Emeltchenko c771a66c6c boards: intel_rpl: Update documentation for Raptor Lake
Update documentation to include Raptor Lake P and update link to
the correct online datasheet.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-27 16:06:19 +00:00
Andrei Emeltchenko c62e371b3c samples: bme280: Fix indentation for ADL-N overlay
Fix indentation in the intel_adl_crb board overlay file.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-27 16:06:19 +00:00
Andrei Emeltchenko 5d0ba230b8 tests: samples: watchdog: Add intel_rpl_p_crb overlay
Add overlay to enable watchdog for build test and sample.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-27 16:06:19 +00:00
Bindu S f806c04abe samples: sensor: Enable bme280 sensor using I2C driver for RPL-P
Added overlay to enable bme280 sensor
using i2c on intel_rpl_p_crb board.

Signed-off-by: Bindu S <bindu.s@intel.com>
2023-12-27 16:06:19 +00:00
Bindu S 3974882b42 tests: drivers: spi: spi_loopback: Enabled SPI in RPL-P
Added overlay and conf to enable SPI tests on RPL-P board.

Signed-off-by: Bindu S <bindu.s@intel.com>
2023-12-27 16:06:19 +00:00
Anisetti Avinash Krishna b14feec6c4 boards: x86: rpl_crb: rpl_p_crb: Enabled GPIO in RPL-p
Enabled GPIO basic api test for RPL-P platform

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-12-27 16:06:19 +00:00
Anisetti Avinash Krishna b7609ff5a8 soc: x86: raptor_lake: soc_gpio : Modified to support RPL-P
Added Modifications to support RPL-P platform.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-12-27 16:06:19 +00:00
Andrei Emeltchenko 465c34ef58 boards: Add Raptor Lake P board configuration
Add board configuration for Intel Raptor Lake P board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-27 16:06:19 +00:00
Andrei Emeltchenko 0bbd834e14 raptor_lake: Rename raptor_lake.dts to raptor_lake_s
Rename old rpl_crb to rpl_s_crb, which is needed for adding other
Raptor Lake boards. Main changes should be in the board device tree
configuration raptor_lake_p vs raptor_lake_s.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-27 16:06:19 +00:00
Ian Wakely 2a647c81cf board: Fixing ADC API tests for W5500_EVB_PICO.
When duplicating the rpi_pico board, I had missed this test file.

Signed-off-by: Ian Wakely <raveious.irw@gmail.com>
2023-12-27 16:04:26 +00:00
Ian Wakely c2266dd3a0 board: Adding support for W5500 Eval Board.
The W5500_EVB_PICO is an evaluation board for the Wiznet W5500
ethernet mac/phy based on the Raspberry Pi Pico.

Signed-off-by: Ian Wakely <raveious.irw@gmail.com>
2023-12-27 16:04:26 +00:00
Dawid Niedzwiecki d64ce2531d mgmt: ec_host_cmd: add PM for SPI STM32 backend
The SPI STM32 Host Command backend doesn't use general SPI driver, so it
has to implement Power Management on its own.

The suspend procedure includes: setting pins to the sleep state,
disabling device clock and disabling CS pin interrupt.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-12-27 15:59:32 +00:00
Daniel Leung debb9f6352 xtensa: dc233c: force invalidating TLBs during page table swap
QEMU MMU tracing showed that there might be something wrong with
its Xtensa MMU implementation, which result in access violation
when running samples/userspace/hello_world_user.

Here is the MMU trace from QEMU from failed runs:

  get_pte: autorefill(00109020): PTE va = 20000424, pa = 0010c424
  get_physical_addr_mmu: autorefill(00109020): 00109000 -> 00109006
  xtensa_cpu_tlb_fill(00109020, 1, 0) -> 00109020, ret = 0
  xtensa_cpu_tlb_fill(00109028, 1, 0) -> 00109028, ret = 0
  xtensa_cpu_tlb_fill(00109014, 0, 2) -> 00103050, ret = 26

The place where it fails is during reading from 0x109014.
From the trace above, the auto-refill maps 0x109000 correctly
with ring 0 and RW access with WB cache (which should be correct
the first time under kernel mode). The page 0x109000 is the libc
partition which needs to be accessible from user thread.
However, when accessing that page, the returned physical address
became 0x103050 (and resulting in load/store access violation).
We always identity map memory pages so it should never return
a different physical address.

After forcing TLB invalidation during page table swaps, the MMU
trace is:

  get_pte: autorefill(00109020): PTE va = 20000424, pa = 0010c424
  get_physical_addr_mmu: autorefill(00109020): 00109000 -> 00109006
  xtensa_cpu_tlb_fill(00109020, 1, 0) -> 00109020, ret = 0
  get_pte: autorefill(00109028): PTE va = 21000424, pa = 0010e424
  get_physical_addr_mmu: autorefill(00109028): 00109000 -> 00109022
  xtensa_cpu_tlb_fill(00109028, 1, 0) -> 00109028, ret = 0
  get_pte: autorefill(00109014): PTE va = 21000424, pa = 0010e424
  get_physical_addr_mmu: autorefill(00109014): 00109000 -> 00109022
  xtensa_cpu_tlb_fill(00109014, 0, 2) -> 00109014, ret = 0
  xtensa_cpu_tlb_fill(00109020, 0, 0) -> 00109020, ret = 0

Here, when the same page is accessed, it got the correct PTE
entry, which is ring 2 with RW access mode (but no cache).
Actually accessing the variable via virtual address returns
the correct physical address: 0x109014.

So workaround that by forcing TLB invalidation during page swap.

Fixes #66029

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-27 15:59:05 +00:00
Daniel Leung fa25c0b0b8 xtensa: mmu: invalidate mem domain TLBs during page table swap
This adds a kconfig to enable invalidating the TLBs related to
the incoming thread's memory domain during page table swaps.
It provides a workaround, if needed, to clear out stale TLB
entries used by the thread being swapped out. Those stale
entries may contain incorrect permissions and rings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-27 15:59:05 +00:00
Mateusz Junkier 949e5120d3 pm: increase coverage - add missing api tests
add missing api tests reported by codecov

Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2023-12-27 15:57:39 +00:00
Mateusz Junkier 501e67acd2 pm: increase coverage - add missing test assert
cover missing lines reported by codecov

Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2023-12-27 15:57:39 +00:00
Jerzy Kasenberg 4e7950e4bd drivers: hwinfo: implemented hardware info support for Smartbond
Only reset cause is supported as there is no common unique id
present on those chips.
Unique ID can be put in OTP but there is no single specification for this.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-12-27 15:56:44 +00:00
Hang Fan 915f0fd74c Bluetooth: Shell: Fix coverity issue in cmd_adv_data
Fix wrong parameter type to avoid Unsigned compared against 0

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/65578

Signed-off-by: Hang Fan <fanhang8@gmail.com>
2023-12-27 12:36:23 +02:00
Lucas Tamborrino ff62faac07 soc: xtensa: esp32s2/s3: remove HEAP_MEM_POOL_ADD_SIZE_SOC
There is no need for this config here and it is messing
with total sys heap calculation.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-12-27 10:08:47 +02:00
Rodrigo Peixoto 2312897055 Build System: clang-format: add K_SPINLOCK to FOR_EACH
The K_SPINLOCK is been indented wrongly by clang-format. It fixes that
adding the K_SPINLOCK to the FOR_EACH section rule tells the formatter
to follow the rule to indent the code.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2023-12-26 19:36:01 +00:00
Christopher Friedt b702c8e8f0 tests: posix: pthread: test that big stacks can be allocated
In some cases, users want to allocate (comparatively) massive
thread stacks.

Add a test to ensure we can allocate such a stack by default.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-23 22:29:41 -05:00
Christopher Friedt fcd139d7af posix: pthread: support stack sizes larger than 65k
A previous size optimization capped the pthread_attr_t stacksize
property at 65536. Some Zephyr users felt that was not large
enough for specific use cases.

Modify struct pthread_attr to support large stack sizes by
default with the flexibility to allow users to vary the number
of bits used for both stacksizes and guardsizes.

The default guardsize remains zero sinze Zephyr's stack
allocators already pad stacks with a guard area based on other
config parameters, and since Zephyr is already designed to
support both SW and HW stack protection at the kernel layer.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-23 22:29:41 -05:00
Daniel DeGrasse beb43bdf20 soc: arm: nxp: add MK22F12 definition
Add SOC definition for MK22F12 series, larger LQFP-144 K22 series
parts that feature additional peripheral instances.

Additionally, these parts differ from the standard MK22 in the following
ways:
- SYSMPU peripheral is present, so an MPU definition is required
- No external oscillator divider is present

This commit also updates the NXP HAL to include pin control files for
these SOCs.

Signed-off-by: Daniel DeGrasse <daniel@degrasse.com>
2023-12-23 10:00:36 +00:00
Fabio Baltieri 66a06d955a input: use K_KERNEL_STACK_SIZEOF to set the thread stack size
Use K_KERNEL_STACK_SIZEOF instead of the config directly to set the
stack size in k_thread_create() calls.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-23 09:59:28 +00:00
Keith Short f6a7895496 twister: Fix exception when running coverage
Fix an exception when running coverage using gcov or llvm-cov.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/66897

Signed-off-by: Keith Short <keithshort@google.com>
2023-12-22 16:36:40 -05:00
Anas Nashif 8ad22f7df4 twister: coverage: verify existence of tools before trying to use them
Verify we have the coverage tool we want to use, otherwise we will end
up with many warnings and errors during coverage data collection.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-22 14:30:18 -05:00