Commit graph

41120 commits

Author SHA1 Message Date
Zide Chen
f32eeba925 dts: x86: configure different IO APIC delivery modes for various devices
For HPET devices, configure it with fixed delivery mode because HPET
timer interrupt is needed to fuel the scheduler for all CPUS.

For all other type of devices, like UART, I2C, GPIO, Ethernet, etc.
configure them as lowest priority delivery mode, in which IO APIC
delivers the interrupt to the processor core that is executing at the
lowest priority among all the processors listed in the specified
destination. In this case, the device drivers can avoid the trouble of
handling repeated interrupts delivered to all CPUS.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen
e8b6b86704 interrupt_controller: device driver can configure IO APIC delivery mode
Currently all IO APIC interrupts are configured at fixed delivery mode,
which is good for HEPT timer interrupt but it imposes burdens to
device drivers to properly handle the repeated interrupt sent to all
processors.

This patch makes it more flexible so that device drivers can specify
the delivery mode it desires in the IRQ connect APIs.

- Don't hard code IOAPIC_FIXED in z_ioapic_irq_set(), meaning the
  IRQ delivery mode is passed in from the 'flags' argument and
  individual device driver needs to choose delivery mode for its own
  IO APIC interrupt.

- To support different delivery mode in different IO APIC interrupts,
  need to save and restore RTE[10:8] during IOAPIC suspend and resume.

If device driver doesn't pass either IOAPIC_FIXED or IOAPIC_LOWEST
in IRQ_CONNECT()/irq_connect_dynamic() alike APIs, the delivery mode
bit fields in the target RTE register are '0' which implies fixed mode.
If the device driver wants the interrupt to be delivered to one CPU
only, it needs to explicitly specify IOAPIC_LOWEST in one of the IRQ
connect APIs.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen
ae1137f241 interrupt_controller: change IO APIC to logical destination mode
Currently IO APIC is working in physical destination mode, which
doesn't support interrupt to be delivered to multiple local APICs.
By definition only 4 bits [59:63] in IO APIC IOREDTBL register are
available for destination addresses and it contains an APIC ID only.

This patch changes it to logical destination mode so that IOREDTBL
can potentially define a set of processors and it's posible to deliver
interrupts to multiple APICs.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen
d27f6cb5eb interrupt_controller: program local APIC LDR register for xAPIC
If IO APIC is in logical destination mode, local APICs compare their
logical APIC ID defined in LDR (Logical Destination Register) with
the destination code sent with the interrupt to determine whether or not
to accept the incoming interrupt.

This patch programs LDR in xAPIC mode to support IO APIC logical mode.

The local APIC ID from local APIC ID register can't be used as the
'logical APIC ID' because LAPIC ID may not be consecutive numbers hence
it makes it impossible for LDR to encode 8 IDs within 8 bits.

This patch chooses 0 for BSP, and for APs, cpu_number which is the index
to x86_cpuboot[], which ultimately assigned in z_smp_init[].

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Kumar Gala
6a2cb94f6f sanitycheck: suppress warnings from EDT
We don't need sanitycheck's use of EDT to report warnings, we'll get
them from the build system.  So the warnings are just duplication and
noise, thus lets always suppress them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 21:54:02 -04:00
Kumar Gala
c2135f8721 devicetree: DT_NODE_HAS_COMPAT_STATUS_OKAY -> DT_NODE_HAS_COMPAT_STATUS
Swap this out and make the status a parameter.
Leave a couple of cases of DT_NODE_HAS_COMPAT().

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Martí Bolívar
6f35d3bd16 doc: write documentation about DT-based device instantiation
Add more HOWTO information for the two current devicetree-based device
instantiation styles, and a bit more information on how to create
devices that depend on others.

Point to this from the Kconfig tips page, since it is meant as a
replacement for existing Kconfig practice.

Update macros.bnf.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Kumar Gala
90ffbcb9d3 tests: devicetree: Add explicit has_status checks
Add some tests for DT_NODE_HAS_STATUS

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Martí Bolívar
17b8667197 dts: clean up some redundant DT checks
These are redundantly checking a node's status twice.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Martí Bolívar
7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Martí Bolívar
e96ca54fd8 gen_defines: play tricks to benefit DT_INST users
Even though it is about to be done for sound technical reasons, a
subsequent patch adding access to all device nodes at the last minute
in the 2.3 release is going to be playing a bit of a fast one on
the Zephyr community, especially users of DT_INST APIs.

In particular, instance numbers are currently allocated only to
enabled nodes, but that will not be true soon: *every* node of a
compatible will be allocated an instance number, even disabled ones.

This is especially unfortunate for drivers and applications that
expect singletons of their compatibles, and use DT_INST(0, ...) to
mean "the one enabled instance of my compatible".

To avoid gratuitous breakage, let's prepare for that by sorting each
edt.compat2nodes sub-list so that enabled instances always come before
disabled ones.

This doesn't break any API guarantees, because there basically *are*
no ordering guarantees, in part precisely to give us the flexibility
to do things like this. And it does help patterns that use instances 0
through N-1, including the important singleton case.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Kumar Gala
5cf85fa229 drivers: move nxp_kinetis_temp to for-each style
Move to FOREACH to prepare for an upcoming patch.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Henrik Brix Andersen
338cecbe1a drivers: i2c: shell: add I2C bus recovery shell command
Add I2C shell command for initiating a bus recovery.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen
6aa8a83682 drivers: i2c: gpio: add bus recovery function
Add I2C bus recovery function to the I2C GPIO bitbang driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen
ec90af8e78 drivers: i2c: bitbang: add helper method for I2C bus recovery
Add I2C bitbang helper function for performing bus recovery.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen
71b893056f drivers: i2c: add I2C bus recovery API
Add API for recovering an I2C bus. This API can be used to recover
from situations where the I2C master and one or more I2C slaves are
out of synchronization (e.g. if the I2C master was reset in the middle
of an I2C transaction or if a noise pulse was induced on the SCL
line).

Fixes #23441.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Tomasz Bursztyka
c0ab0de8d1 drivers/interrupt_controller: Rename ioapic init function
The '_' is not necessary, plus it makes the sys init object name
aligning with all others.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
dfe938640b drivers/interrupt_controller: Fix loapic/ioapic header inclusion
s/init.h/device.h

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
48135cdd34 usermode: Rework Z_SYSCALL_SPECIFIC_DRIVER to fit with device refactoring
init_fn is not anymore part of struct device, so let's test instead the
driver's API structure pointer which is also unique per device driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
1eedd5eb64 scripts: Fix gen_kobject_list.py to fit with device refactoring
device_api attribute is not at offset 4 but 8 now as name and
config_info has been directly imported into struct device.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
8d7bb8ffd8 device: Refactor device structures
When the device driver model got introduced, there were no concept of
SYS_INIT() which can be seen as software service. These were introduced
afterwards and reusing the device infrastructure for simplicity.
However, it meant to allocate a bit too much for something that only
required an initialization function to be called at right time.

Thus refactoring the devices structures relevantly:
- introducing struct init_entry which is a generic init end-point
- struct deviceconfig is removed and struct device owns everything now.
- SYS_INIT() generates only a struct init_entry via calling
  INIT_ENTRY_DEFINE()
- DEVICE_AND_API_INIT() generates a struct device and calls
  INIT_ENTRY_DEFINE()
- init objects sections are in ROM
- device objects sections are in RAM (but will end up in ROM once they
  will be 'constified')

It also generate a tiny memory gain on both ROM and RAM, which is nice.

Perhaps kernel/device.c could be renamed to something more relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
48b784abb3 init: Fix tiny indentation issue
The whole file is perfectly indented everywhere else.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
6f318a5223 device: Fix tiny indentation issue
The whole file is perfectly indented everywhere else.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Ioannis Konstantelias
3f0797488c boards: arm: stm32_min_dev: Add ADC_1
Added ADC_1 support.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2020-05-08 15:56:33 -05:00
David Brown
a7d35b7984 samples: net: google_iot: Clarify key type docs
Clarify in the docs the importance of generating a key type that matches
the configuration used to sign JWT tokens.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-08 22:23:37 +02:00
David Brown
fb137098c9 samples: net: google_iot: Add config template to prj.conf
Add the template config values to the prj.conf.  These will need to be
changed according to the instructions in the README.rts.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-08 22:23:37 +02:00
David Brown
961e7e707e samples: net: google_iot: Fix unclear documentation
The instructions on setting the necessary Kconfig values is unclear.
Add a description based on values that can be found in the Google IoT
Core console.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-08 22:23:37 +02:00
Andrew Boie
2873afb7fe aarch32: fix a build failure
Some wires were crossed when an older PR was merged that
had build conflicts with newer code. Update this header
to reflect were the 'nested' member is in the kernel CPU
struct.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-08 13:59:17 -05:00
Dominik Ermel
6ba69f19d4 sys/util.h: Add IS_EMPTY and LIST_DROP_EMPTY macros
IS_EMPTY macro allows to check if defined name is empty, i.e.
does not contain replacement list.
LIST_DROP_EMPTY macro may be used to process __VA_ARGS__ type lists,
e.g. a,b,,c , and remove empty elements.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-05-08 17:50:25 +02:00
Anthony Brandon
4aab0464c3 dts: bindings: st,stm32-sdmmc: remove unneeded type
The label property does not need to have its type set
explicitly to string, so remove it.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-05-08 17:49:32 +02:00
Ioannis Glaropoulos
3a843e1b0a doc: release notes: add note about FP Kconfig symbol name changes
We add a note in the Zephyr v2.3.0 release notes to highlight
a renaming in the Floating Point Services main Kconfig options,
which was done in the 2.3 release cycle.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-08 17:48:55 +02:00
Wentong Wu
4bab17f71e west.yml: update mipi-sys-t to latest version.
Move syst initialization code to zephyr tree and add
more useful fields (payload length and timestamp) in
SyS-T message packet.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Wentong Wu
ab8392fb8f logging: syst: enable protocol timestamp in SyS-T message
Enable protocol timestamp in SyS-T message.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Wentong Wu
450f21ff42 logging: syst: enable length field for SyS-T message
Enable generation of length field for SyS-T message.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Wentong Wu
c3f38db5cb logging: add syst initialization code to zephyr tree
Add syst initialization code to zephyr tree.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Jose Alberto Meza
98ce11676e samples: boards: mec15xxevb: Update power management test cases
Add indication when sleep entry/exit counter do not match the test
expectations.
Measure deep sleep entry latency.
Add sleep entry/exit indication via gpios to debug.
Remove unnecessary trailing \n when using logging.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-08 17:46:45 +02:00
Tomasz Bursztyka
7544263050 scripts: Fix documunt referenc for coccicheck
s/applications/guides

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 17:44:44 +02:00
Andrew Boie
c24673eefc kernel: properly name idle threads
These are now indexed by CPU.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-08 17:44:28 +02:00
Andrew Boie
b7e363661d tests: context: busy-wait with interrupts locked
This is expected to work on all platforms.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-08 17:44:17 +02:00
Frank Li
c8a528d322 boards: mm_swiftio: support west command
Modify burner for pyocd to support:
west flash
west debug
west debugserver

Signed-off-by: Frank Li <lgl88911@163.com>
2020-05-08 17:43:18 +02:00
Andrew Boie
a203d21962 kernel: remove legacy fields in _kernel
UP should just use _kernel.cpus[0].

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-08 17:42:49 +02:00
Paul Sokolovsky
b07489614f tests: posix: clock: Workaround to align clocks before querying
Before calling clock_gettime() 2 times in row, issue k_usleep(1)
to align code execution to timer interrupt to prevent (well,
minimize) possibility of getting different ticks values.

Suggested by @andyross.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-05-08 17:31:45 +02:00
Paul Sokolovsky
32270ae1b9 tests: posix: eventfd: Don't mix POSIX and Zephyr kernel APIs
K_MSEC() shouldn't be used with poll(), as they come from 2 different
API domains.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-05-08 17:31:45 +02:00
Paul Sokolovsky
a61f86ea8e tests: posix: common: Switch k_sleep() -> k_msleep().
As a step in migration to new timeout API.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-05-08 17:31:45 +02:00
Paul Sokolovsky
0b634793cc lib: posix: Update to new timeout API
Mostly trivial search-and-replace, except for pthread_rwlock.c, where
we need spread timeout over 2 semaphore operations.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-05-08 17:31:45 +02:00
Andrejs Cainikovs
02a5ca931d doc: gsg: add missing python3-dev dependency
Linux distro might not have a python3-dev package installed by default,
which will give an error during Python dependencies installation.

Closes #25128.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@gmail.com>
2020-05-08 17:30:19 +02:00
Daniel Leung
8939847ea5 boards: intel_s1000_crb: fix xt-gdb cannot find register error
With the new RI-2018.0 XCC, xt-gdb complains about not being able
to find register f0. Turns out that xt-gdb needs to be told which
file to look at (the file command) before a load command can be
issued. So swap these two commands in the load_elf.txt file.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-08 11:16:49 -04:00
Torsten Rasmussen
b557bd90a6 cmake: Zephyr sdk backward compatibility with 0.11.1 and 0.11.2
This commit introduces backward compatibility with Zephyr SDK 0.11.1
and 0.11.2 so that users having one of those versions installed can
continue to use that version.

This remove the need to force users to update their SDK.

This is kept in independent commit to ensure it can easily be reverted
when minimum required Zephyr SDK is bumped to version 0.12.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-05-08 17:15:55 +02:00
Torsten Rasmussen
299a154fdd cmake: Zephyr sdk package handling
This commit introduces Zephyr SDK CMake config package.

This removes the need for setting ZEPHYR_SDK_INSTALL_DIR and
ZEPHYR_TOOLCHAIN_VARIANT when using Zephyr SDK in Linux.
It also allows to introduces never SDKs without breaking Zephyr.

For example, with this PR, the current Zephyr SDK is 0.11.1 but when
releasing 0.12 then the current Zephyr will no longer built.
This PR moves the Zephyr SDK CMake related code to the SDK and thus
allowing to use newer SDKs, as long as they are backwards compatible.

It also allows multiple SDK installations, and will automatically select
the version closet to the required version.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-05-08 17:15:55 +02:00