Commit graph

59231 commits

Author SHA1 Message Date
Tomasz Bursztyka
edef8e6b0d drivers/interrupt_controller: Expanding VT-D public API
Adding a way to pre-install the irg/vector on an irte and a way to get
an irte based on irq/vector.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
1a1bc0d242 drivers/interrupt_controller: Make VT-D remap generic and handle flags
This will not only be used by MSI remapping but by all relevant
interrupts.

Fix also IRTE settings:
- handle x2apic for destination id
- destination mode is always logical (as for IOAPIC)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2b1cbcbddc drivers/interrupt_controller: Fix VT-D remap destination on XAPIC
CPU-ID is written in a different format in case of XAPIC.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
e2b4f7e50f drivers/interrupt_controller: Fix VT-D EIME value
It's the 11th bit and not 11.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
aa6112d0af drivers/interrupt_controller: Enable xapic pass-through in intel vt-d
In XAPIC mode, it's possible to tell VT-D to let interrupt in compatible
format passing through.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
4047b793c8 drivers/interrupt_controller: Generate proper MSI address on VT-D
SHV bit depends on the number of vectors allocated.
If it's facing a multi-vector MSI array, it will set the bit.
If not the bit must be 0.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
6ed593f861 drivers/pcie: Extending parameters to pcie_msi_map
n_vector will be necessary for VT-D actually.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
25b8df0bdb drivers/pcie: Even single MSI based interrupt needs to be remapped
Refactor to handle this case. This is valid only when MSI multi-vector
feature is enabled.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
fa34b135f5 arch/x86: Make sure PCIE allocated IRTEs are tighten to irq/vector
As all interruption need to go through VT-D, calling vt-d remap will
happen on lower level as seen next, so make sure all pcie related
irq/vector get tighten to their respective allocated IRTE.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
84319db9fe arch/x86: All dynamic IRQ connection need to be remapped
Allocate an IRTE for all irq being connected through
arch_irq_connect_dynamic(). This will be mandatory since VT-D expects to
filter all interruptions (but the one it generates, as we will see
later).

Taking into account CONFIG_INTEL_VTD_ICTL_XAPIC_PASSTHROUGH, which could
help for debugging.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
ad8ab01488 arch/x86: On irq remapping, all PCIE MSI/MSI-X need to be remapped
There is no need to differentiate with multi-vector or not, MSI vs
MSI-x: all need to be remapped if Intel VT-D is on.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
f0a7f250a0 arch/x86: Fixing MSI vector allocation
Fixing an out of bound issue.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
f7a2ff4f8d drivers: Fixing the 2 drivers for PCIe IRQ connection
Now these 2 drivers should be working properly in case of IRQ remapping.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
5b3d94510c arch/x86: Implementing ARCH_PCIE_IRQ_CONNECT for ia32 and intel64
While this does not change anything for ia32, this is fixing the chicken
& egg issue on intel64 if (and only if) interrupt remapping is enabled
so pcie_connect_dynamic_irq() is to be called properly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
b5ad9739df drivers/pcie: Add a marco for fixed or MSI IRQ
This is meant to be called by drivers on PCIe BUS with a fixed (from
DTS) IRQ or an MSI one. I.e.: all drivers without a runtime IRQ
detection/allocation.

The arch-specific macro is required to be implemented relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
b5fecc5ff8 drivers/pcie: Add a function for dynamic PCIe IRQ connection
The is meant to fix a chicken & egg issue with MSI interrupt remapping.
Currently, drivers first connect the irq (by-passing any possible MSI
remapping), so the IRQ ends-up being remapped at the IOAPIC level which
is not what we want.

So adding a dedicated function to properly handle this case. This is
valid only for runtime dynamic IRQ connection obviously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
fbb2f1511c drivers/pcie: Add a function to know MSI/MSI-x support of an endpoint
And since it does yet another round of pcie_get_cap() on PCIE_MSI_CAP_ID
and PCIE_MSIX_CAP_ID, let's factorize that into a utility function and
change the relevant places to use that function instead.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Kai Vehmanen
60325019aa samples/subsys/audio/sof: use -fstrict-overflow for SOF
Align compiler flags of SOF Zephyr build with the build SOF XTOS
and use -fstrict-overflow.

With -fno-strict-overflow, some versions of XCC compiler (e.g. xt-xcc
12.0.8) always emit a "bltu" instruction to check for overflow in loops
like:

  unsigned int n;
  for(n = 0; n < 1024; n++)
	do_arithmetic();

With "-fno-strict-overflow", you'll have:
  18:   068076                  loop    a0, 22 <dummy_dspload+0x22>
  1b:   445a                    add.n   a4, a4, a5
  1d:   551b                    addi.n  a5, a5, 1
  1f:   023657                  bltu    a6, a5, 25 <dummy_dspload+0x25>
  22:   fffc86                  j       18 <dummy_dspload+0x18>

With "-fstrict-overflow":
  16:   038476                  loop    a4, 1d <dummy_dspload+0x1d>
  19:   223a                    add.n   a2, a2, a3
  1b:   331b                    addi.n  a3, a3, 1

As this is a common pattern in audio DSP code, change the default
for SOF builds to -fstrict-overflow.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-01-07 10:46:14 -05:00
Kai Vehmanen
212347f94d samples/subsys/audio/sof: build with CONFIG_SPEED_OPTIMIZATIONS
The inner loops of SOF audio algorithms benefit from
compiler optimizations. On Intel cAVS platforms, it was noted
zero-overhead loops ("loop" family of instructions) is not
used for fixed-size inner loops when using -Os (optimize for
size) and the XCC xtensa toolchain.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-01-07 10:46:14 -05:00
Gerard Marull-Paretas
35e8f42bc1 ci: doc-build: use --no-verbose when using wget
The -q flag supresses all wget output, even when there is a failure.
This makes it difficult to diagnose CI failures when the download fails.
The --no-verbose flag is a better choice: it is silent enough but it
always shows the outcome.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:41:59 -05:00
Gerard Marull-Paretas
8d04deb2d9 device: improve (z_)device_is_ready docs
Improve the documentation so that both z_device_is_ready and
device_is_ready are consistent with each other. Information about PM has
been removed since device_is_ready does not take into account the PM
status of a device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:41:23 -05:00
Gerard Marull-Paretas
0b0435a96c device: deprecate (z_)device_usable_check
The functionality provided by device_usable_check is already provided by
device_is_ready. The (z_)device_usable_check APIs have been
re-implemented using the (z_)device_is_ready APIs and have been marked
as deprecated.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:41:23 -05:00
Gerard Marull-Paretas
8b3560a119 drivers: clock_control: use device_is_ready
device_usable_check() can return 0 or -ENODEV, so using device_is_ready
is equivalent if we return -ENODEV when the device is not ready.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:41:23 -05:00
Gerard Marull-Paretas
47bfb6fb4c device: implement device_is_ready as syscall
Instead of using device_usable_check() syscall, implement a new syscall
for device_is_ready that uses z_device_is_ready underneath.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:41:23 -05:00
Gerard Marull-Paretas
b2b8fdf539 device: s/z_device_ready/z_device_is_ready
Rename z_device_ready to z_device_is_ready. Function name suggests a
boolean result this way, in line with other functions (e.g.
device_is_ready).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:41:23 -05:00
Gerard Marull-Paretas
08e8dfcd6e ci: doc-build: run apt-get update before install
Make sure the package index is always up-to-date before installing.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-07 10:40:54 -05:00
Daniel DeGrasse
e6cac6f029 tests: disk: Add fixture for sdcard test
Add fixture disk_sdcard for the sdcard test, since the test requires an
SD card to be present on the board.

Fixes #41331

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-07 08:01:22 -06:00
Immo Birnbaum
aa6245603b tests: subsys: logging: revert #40848
revert #40848 which excluded certain logging test cases on qemu_cortex_a9
due to #39978.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-07 07:58:43 -06:00
Immo Birnbaum
095d92a697 tests: subsys: logging: revert #40842
revert #40842 which excluded certain logging test cases on qemu_cortex_a9
due to #39978.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-07 07:58:43 -06:00
Immo Birnbaum
131a5dfd62 arch: arm: aarch32: fix section alignment behind rodata region start marker
Fix for issue 39978. This commit assigns the __rodata_region_start marker
to the ROMABLE region prior to the inclusion of linker/common-rom.ld,
linker/thread-local-storage.ld and linker/cplusplus-rom.ld. Prior to this
fix, the __rodata_region_start marker was properly aligned and indicated
the expected memory location for the start of the rodata section and
similar sections, but it was disconnected from the ROMABLE region into
which the subsequent sections are being integrated, resulting in placement
of those sections right behind the previous section in the ROMABLE region
and therefore at addresses below the __rodata_region_start marker.

For the sake of consistent behaviour, the end marker of the text region
has been modified accordingly.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-07 07:58:43 -06:00
Rubin Gerritsen
acaf4eedaf Bluetooth: Host: Extract out ad_stream to set long adv data
This structure can be reused to set periodic advertising data.
The structure tries fills the buffer as much as possible.
Later this can be reused for setting advertising data in other cases
as well.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-01-07 15:37:01 +02:00
Daniel DeGrasse
1f2672995b boards: mm_feather: Enable EDMA0 node
Enable EDMA0 node to prevent build warning when DMA MCUX driver is
included in build.

Fixes #41524

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-07 07:36:42 -06:00
Daniel DeGrasse
8fb417a6c4 boards: mm_swiftio: Enable EDMA0 node
Enable EDMA0 node to prevent build warning when DMA MCUX driver is
included in build.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-07 07:36:42 -06:00
Herman Berget
acd2b8fdcc Bluetooth: Host: Reset scan state on scan stop
bt_le_stop() previously did the same restting as bt_scan_reset(). After
the recent changes they were out of sync.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Herman Berget
4c110f8f17 Bluetooth: Host: Move ext adv property conversion to separate function
How the conversion worked was unclear. Moving the conversion out to a
separate function and documenting how it works makes the code easier to
understand.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Herman Berget
6ede31428d Bluetooth: Host: Reassemble extended advertising reports
The host reassembles fragmented advertising reports from the controller.

Non-complete advertising reports from different advertisers may not be
interleaved. If non-complete advertising reports from an advertiser
is received while advertising reports from another advertiser is
reassembled, an error message is logged and the advertising report is
discarded. Future scan results may be incomplete.

Advertising reports from legacy PDUs or complete extended advertising
reports may be interleaved as these do not require reassembly.

If the controller sends more advertising data than fits in the
reassembly buffer, the data is truncated. Further advertising reports
from the advertiser are discarded until the final complete advertising
report is received and discarded.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Konstantinos Papadopoulos
821f49fbb4 boards: stm32f769i_disc0: add touchscreen support
Add support for the touchscreen controller on STM32F769I-DISC0(MB1166).
The touchscreen uses Focaltech FT6202 which is compatible with FT5336.
Tested with kscan_touch sample application.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-01-07 07:31:22 -06:00
Casper Meijn
e2588d6a42 boards: arm: pinetime: Add chosen display
commit 65f0c8641c
("boards/shields: add zephyr,display chosen property")
added a chosen display property to most of the boards.
This was missing for the pinetime board.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-01-06 14:35:09 -06:00
Jakub Rzeszutko
f37f8a5dd5 CODEOWNERS: update getopt library location
Getopt has been moved from /lib/utils to /lib/posix hence
CODEOWNERS must be updated accordingly.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2022-01-06 21:26:59 +01:00
Jakub Rzeszutko
2caf587095 tests: lib: getopt
Add tests for the getopt library.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2022-01-06 21:26:59 +01:00
Jakub Rzeszutko
10210bd101 doc: shell getopt support
Documentations has been updated acorcing to changes in the getopt
library.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2022-01-06 21:26:59 +01:00
Jakub Rzeszutko
d4559f53fa lib: getopt: rework and extend getopt library
Getopt has been rework in this way that calling it does not require
extra state parameter and its execution is thread safe.
Global parameters describing the state of the getopt function have been
made available to ensure full API compatibility in using this library.
However, referencing these global variables directly is not thread
safe. In order to get the state of the getopt function for the thread
that is currently using it, call: getopt_state_get();

Extended the library with getopt_long and getopt_long_only functions.

Moved getopt libary from utils to posix.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2022-01-06 21:26:59 +01:00
Aymeric Aillet
7f1f1229e1 soc: arm: renesas: r8a77951: fix defconfig
Fixed an error that could cause problems if
a driver reads "SOC" in the future.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-01-06 15:15:10 -05:00
Berend Ozceri
b208e5811e kernel/swap: Initialize dummy thread's resource pool
The resource pool of the short-lived dummy thread "stub" may be
inherited by other threads created during system initialization. This
commit initializes this resource pool to NULL or the system pool to
ensure that a well-defined resource pool propagates to other threads
that inherit it from the dummy thread.

Fixes #41482.

Signed-off-by: Berend Ozceri <berend@recogni.com>
2022-01-06 11:57:18 -05:00
Immo Birnbaum
beee999cf4 dts: arm: xilinx: Assign uniqe memory-region names for OCM
Assign unique memory-region attribute values for both OCM
memory areas so that the lower region starting at address 0
is identified as OCM_LOW, while the alternate location for
the OCM memory is identified as OCM_HIGH.

The updated linker command file will use those identifiers
for OCM section mapping based on which of the two OCM areas
is marked as 'chosen' at the board level.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-06 11:56:48 -05:00
Immo Birnbaum
cd13e25bb3 arch: arm: aarch32: linker file fix for OCM
Fix the mapping of the sections to be located in the On-Chip
Memory so that the OCM memory region name always matches that
of the chosen OCM DT node's memory-region attribute.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-06 11:56:48 -05:00
Immo Birnbaum
05b5a234bc dts: bindings: arm: YAML description for Zynq OCM
YAML description file for the On-Chip Memory of the Xilinx
Zynq-7000, DT identifier "xlnx,zynq-ocm".

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-06 11:56:48 -05:00
Jordan Yates
d336954d1c tests: remove manual CONFIG_GPIO_EMUL
Remove the manual selection of `CONFIG_GPIO_EMUL` as it is now enabled
by default when devicetree nodes exist.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-06 11:56:15 -05:00
Jordan Yates
c8d1e134ae gpio: emulated: default Kconfig value
Enable the emulated GPIO driver by default if instances exist in
devicetree. This removes the need to manually enable `CONFIG_GPIO_EMUL`
when `CONFIG_GPIO` is enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-06 11:56:15 -05:00
Immo Birnbaum
10c046ce25 CODEOWNERS: owner for SoC Zynq-7000, board qemu_cortex_a9
Set code ownership for:
- soc/arm/xilinx_zynq7000
- boards/arm/qemu_cortex_a9

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-06 11:52:27 -05:00