Add native_posix USB virtual driver connected over USBIP to the Host
Linux.
Fixes: #9846
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Some defines should have been converted from CONFIG_ to DT_ prefix. For
some reason they got missed in this driver.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The sample was defining a #define with a CONFIG_ prefix but this wasn't
coming from Kconfig. Change the define name not to conflict with the
Kconfig CONFIG_ namespace.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The driver was defining a macro with a CONFIG_ prefix but this wasn't
coming from Kconfig. Change the macro name not to conflict with the
Kconfig CONFIG_ namespace.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The driver was defining a macro with a CONFIG_ prefix but this wasn't
coming from Kconfig. Change the macro name not to conflict with the
Kconfig CONFIG_ namespace.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Idle threads must (for obvious reasons!) always be preemptible from
the perspective of the scheduler. But when preemptive scheduling is
disabled, they are given a priority of -1, which is the lowest
COOPERATIVE priority. So the scheduler preemption logic needed an
extra test for this case and couldn't just rely on the existing
priority comparison. This was a measurable performance loss, as this
is a hot path on existing benchmarks.
Limit that test to circumstances (!CONFIG_PREEMPT_ENABLED) where it's
actually needed.
Longer term it would be better to just force the existence of one
"preemptible" thread priority always, but right now the number of
priorities and the state of the PREEMPT_ENABLED kconfig flag are
linked, and the existing interrupt return code (with no preemption,
you know with certainty which thread you are returning to and can skip
some work) on some platforms fails when I try this.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
For historical reasons, some architectures had a valid _current thread
pointer at initialization time and others didn't. So the scheduler
logic had a test that checks _current vs. NULL every time it needed to
check premption, when this was only a workaround for initialization
state.
Fix things so that there is a dummy thread always (and clean up the
code to do a struct assignment instead of a memset of bare memory),
and we can remove that test from the scheduler hot path.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
GCC 6.2.0 is making frustratingly poor inlining decisions with some of
these routines, resulting in an awful lot of runtime calls for code
that is only ever expanded once or twice within the file.
Treat with targetted ALWAYS_INLINE's to force the issue. The
scheduler code is a hot path.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Something is going wrong with code generation here, potentially the
inline assembly generated by _arch_irq_un/lock(), and these calls are
not being inlined by gcc. So what should be a ~3 instruction sequence
on most uniprocessor architectures is turning into 8-20 cycles worth
of work to implement the API as written.
Use an ALWAYS_INLINE, which is sort of ugly semantically but produces
much better code.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The sys_dlist_insert_*() functions had a behavior where a NULL
argument for the insertion position to sys_dlist_insert_after/before()
was interpreted as "the end of the list". We never used that
convention (except in one spot internal to dlist.h which was not
itself used anywhere), and of course already have an API for appending
and prepending to a list.
In practice this was a performance disaster. The NULL check is
virtually never provable statically by the compiler, so that test and
branch is present always. And worse, the check and call to another
function was pushing this beyond the complexity limit for gcc to
inline a function (at -Os optimization anyway), forcing us to use
function calls for what should be a ~8 instruction sequence. The
upshot is that dlist insertions were 2-3x slower than they needed to
be.
Deprecate these older APIs and introduce a new sys_dlist_insert() call
which can be much better optimized.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Useful tool for performance work that removes interaction with other
APIs and thread state. The best part is that it doesn't rely on timer
interrupt delivery and so works with -icount even on existing qemu
versions and produces deterministic output.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Now that all supported xtensa boards use DTS we can move the Kconfig
setting to the arch level. Remove HAS_DTS from board Kconfig files.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Its been at least 2 releases since we marked a number of watchdog APIs
as deprecated. Lets remove them.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The dts files on these boards had some CONFIG_ defines related to which
memory should be used to hold code. We move this choice out of DTS and
back into Kconfig.
As such, we removed the default setting of 'zephyr,flash' and just
map
CONFIG_CODE_ITCM to:
DT_NXP_IMX_RT_ITCM_0_SIZE
DT_NXP_IMX_RT_ITCM_0_BASE_ADDRESS
CONFIG_CODE_{QSPI,HYPERFLASH} to:
DT_NXP_IMX_FLEXSPI_402A8000_SIZE_1
DT_NXP_IMX_FLEXSPI_402A8000_BASE_ADDDRESS_1
for the mimxrt1050_evk, we remove the default setting of 'zephyr,sram'
and just map:
CONFIG_DATA_DTCM to:
DT_NXP_IMX_DTCM_0_SIZE
DT_NXP_IMX_DTCM_0_BASE_ADDRESS
CONFIG_DATA_SDRAM to:
DT_MMIO_SRAM_80000000_SIZE
DT_MMIO_SRAM_80000000_BASE_ADDRESS
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Move the how enabling of CONFIG_XIP impacts CONFIG_FLASH_SIZE and
CONFIG_FLASH_BASE_ADDRESS to Kconfig instead of dts.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
dts will now generate DT_SRAM_BASE_ADDRESS, DT_SRAM_SIZE,
DT_FLASH_BASE_ADDRESS, and DT_FLASH_SIZE defines. Kconfig can utilize
these defines to set defaults for the CONFIG_ variants.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add docs on the kconfigfunctions that we support. We only expose some
functions related to device tree currently.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Export a new KCONFIG_DOC_MODE environment variable when building the doc
and invoking Kconfig, so that the functions that expect a build folder
can accordingly return a hardcoded value.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
As a step to completing removing use of Kconfig defines in dts files we
need to change how we configure/set CONFIG_FLASH_LOAD_{OFFSET,SIZE}.
Previously we would set them based on how the chosen property
'zephyr,code-partition' was set to. If 'zephyr,code-partition' wasn't
set we would default the values to 0. We had some generic overlay logic
which would define 'zephyr,code-partition' based on
CONFIG_BOOTLOADER_MCUBOOT.
Going forward if the DTS has 'zephyr,code-partition' set we will
generate DT_CODE_PARTITION_OFFSET & DT_CODE_PARTITION_SIZE defines. We
will leave it to Kconfig to set CONFIG_FLASH_LOAD_OFFSET &
CONFIG_FLASH_LOAD_SIZE.
We introduce a python script that allows Kconfig to extract data from
the DTS and thus we can utilize DT_CODE_PARTITION_OFFSET and
DT_CODE_PARTITION_SIZE values to set defaults for
CONFIG_FLASH_LOAD_OFFSET & CONFIG_FLASH_LOAD_SIZE.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
As we want to remove dts dependency on Kconfig, we had a case based on
CONFIG_BOOTLOADER_MCUBOOT. From a DTS point of view that was just
getting the chosen property 'zephyr,code-partition' set. We can easily
move this to the actual dts files and remove the mcuboot.overlay.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Based on work from Sebastian Bøe and updated to current tree.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Expose PROJECT_BINARY_DIR to kconfig since we will we looking for
generated files from dts pass in the future and need to know the
location of those files.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The power subsystems call the sys_pm_notify_lps_entry()
and sys_pm_notify_lps_exit() to notify application that
given power mode has been entered and exited. This commit
adds weak implementation of these functions in order to
not force applications to implement its own empty stubs.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
The gpio_port_ functions provided by the gpio API do not provide
currently a mask parameter. As such they operate on a full port only.
In practice such functions are not useful. This commit deprecates them
to allow adding port functions with support for a mask parameter in the
future.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
gpio_port_* functions are being deprecated. Convert boards/altera_max10
sample to use gpio_pin_* functions instead.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit implements a CTF-backend for Zephyr's tracing API.
The CTF-backend itself is split in a middle-layer and a bottom-layer.
- Middle-layer decides the payload in event transactions,
- Bottom-layer implements the IO transport.
A simple POSIX bottom-layer is provided so far.
Signed-off-by: François Delawarde <fnde@oticon.com>
To be used in the implementation of a POSIX bottom layer to CTF Tracing.
Origin: William Swanson
License: MIT
URL: https://github.com/swansontec/map-macro
commit: 383c38e95e94d4dbd67ec7e31eff80cd317e3f8d
Purpose: Helper macros for CTF POSIX bottom layer.
Maintained-by: External
Signed-off-by: François Delawarde <fnde@oticon.com>
The algorithm used in residency-based power policy should
select the most saving power mode basing on the expected
sleep time. However due to small bug, the most power
efficient mode was never selected.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).
Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Though these are currently used by the core only, it will be then used
by net_context as well. This one of the steps to get rid of net_pkt's
appdata/appdatalen attributes.
Also normalizing all ip/proto parameters name to ip_hdr and proto_hdr.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that net_pkt are accessed through a common r/w API, using below a
net_pkt_cursor, let's have an option that will reset this cursor once
the net_pkt is freed.
Result is instead of segfaulting on r/w access, these operations will
bail out properly. Subsequent, and logical (unless you have a leak
which is another issue) net_pkt_unref will tell you who/where the pkt
was freed. Without it, you will get a segfault for instance, but that
won't tell you the exact reason. This options can help you then.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This goes through basic allocation, atomic read/write, data
getter/setter and cloning/copying.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The test counts the '\0' of the data copied, though it does not belong
to the packet.
Since the test by-passes net_ipv6_input, which would update the packet
length according to what is in the IPv6 header, the checksum calculation
fails.
Before, checksum calculation used to grab the length from IPv6 header,
but that changed to use net_pkt_get_len(): that one must provide the
real lenth.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Only next to be removed functions like net_tcp_set_checksum() are left
untouched. All the rest is switched.
Adding net_tcp_finalize() to follow the same logic as for UDP and else.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This proovse to drastically reduce runtime overhead as it does not need
to parse IP nor TCP header all over again in a lot of places.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
As these were parsed already by IPv4/6 input functions let's use them.
Applying the change on trivial UDP usage. TCP usage will have its own
commit.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These will be specifically needed in TCP, as well as being used in
context internally.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Since the rework of L2/L3 split, only L2 has access to its header. Thus
up to Ethernet one to set LLDP PTYPE.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>