-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
headers: Refactor kernel and arch headers. #20119
headers: Refactor kernel and arch headers. #20119
Conversation
stephanosio
commented
Oct 24, 2019
•
edited
Loading
edited
All checks are passing now. checkpatch (informational only, not a failure)
Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
0cf557d
to
94c7ac0
Compare
This PR supersedes the previous PR #20047, which was an attempt at fixing #3056. The changes in this PR fix #3056, while addressing all the essential changes detailed in the issue #19666 as well. Once this gets merged, the following hacks in zephyr/include/arch/x86/ia32/arch.h Line 238 in cc1b94c
zephyr/arch/x86/core/ia32/irq_manage.c Lines 41 to 48 in 8ffff14
Line 93 in 8ffff14
zephyr/arch/arm/core/irq_manage.c Lines 160 to 167 in 8ffff14
|
@stephanosio I presume you are seeing something broken in master, and I want to look into it asap. If that is the case, let's discuss it outside of this PR to not create confusion. If something is broken in master it should be fixed on its own, not in an unrelated PR. |
805d335
to
895c81f
Compare
Force pushing to address the change requested by @SebastianBoe and update hal_nxp revision from PR ref to merged commit hash in west.yml. |
Last merge conflicts are due to the 64-bit updates on the syscalls, am I correct? |
grrrrrrr |
@stephanosio last rebase maybe? :) thanks. |
@stephanosio sorry that was my fault |
This commit refactors kernel and arch headers to establish a boundary between private and public interface headers. The refactoring strategy used in this commit is detailed in the issue This commit introduces the following major changes: 1. Establish a clear boundary between private and public headers by removing "kernel/include" and "arch/*/include" from the global include paths. Ideally, only kernel/ and arch/*/ source files should reference the headers in these directories. If these headers must be used by a component, these include paths shall be manually added to the CMakeLists.txt file of the component. This is intended to discourage applications from including private kernel and arch headers either knowingly and unknowingly. - kernel/include/ (PRIVATE) This directory contains the private headers that provide private kernel definitions which should not be visible outside the kernel and arch source code. All public kernel definitions must be added to an appropriate header located under include/. - arch/*/include/ (PRIVATE) This directory contains the private headers that provide private architecture-specific definitions which should not be visible outside the arch and kernel source code. All public architecture- specific definitions must be added to an appropriate header located under include/arch/*/. - include/ AND include/sys/ (PUBLIC) This directory contains the public headers that provide public kernel definitions which can be referenced by both kernel and application code. - include/arch/*/ (PUBLIC) This directory contains the public headers that provide public architecture-specific definitions which can be referenced by both kernel and application code. 2. Split arch_interface.h into "kernel-to-arch interface" and "public arch interface" divisions. - kernel/include/kernel_arch_interface.h * provides private "kernel-to-arch interface" definition. * includes arch/*/include/kernel_arch_func.h to ensure that the interface function implementations are always available. * includes sys/arch_interface.h so that public arch interface definitions are automatically included when including this file. - arch/*/include/kernel_arch_func.h * provides architecture-specific "kernel-to-arch interface" implementation. * only the functions that will be used in kernel and arch source files are defined here. - include/sys/arch_interface.h * provides "public arch interface" definition. * includes include/arch/arch_inlines.h to ensure that the architecture-specific public inline interface function implementations are always available. - include/arch/arch_inlines.h * includes architecture-specific arch_inlines.h in include/arch/*/arch_inline.h. - include/arch/*/arch_inline.h * provides architecture-specific "public arch interface" inline function implementation. * supersedes include/sys/arch_inline.h. 3. Refactor kernel and the existing architecture implementations. - Remove circular dependency of kernel and arch headers. The following general rules should be observed: * Never include any private headers from public headers * Never include kernel_internal.h in kernel_arch_data.h * Always include kernel_arch_data.h from kernel_arch_func.h * Never include kernel.h from kernel_struct.h either directly or indirectly. Only add the kernel structures that must be referenced from public arch headers in this file. - Relocate syscall_handler.h to include/ so it can be used in the public code. This is necessary because many user-mode public codes reference the functions defined in this header. - Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is necessary to provide architecture-specific thread definition for 'struct k_thread' in kernel.h. - Remove any private header dependencies from public headers using the following methods: * If dependency is not required, simply omit * If dependency is required, - Relocate a portion of the required dependencies from the private header to an appropriate public header OR - Relocate the required private header to make it public. This commit supersedes zephyrproject-rtos#20047, addresses zephyrproject-rtos#19666, and fixes zephyrproject-rtos#3056. Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit modifies the z_new_thread_init function, that was previously declared as ALWAYS_INLINE to be a normal function. z_new_thread_init function is only called by the z_arch_new_thread function and, since this is not a performance-critical function, there is no good justification for inlining it. Signed-off-by: Stephanos Ioannidis <[email protected]>
When compiling the components under the arch directory, the compiler include paths for arch and kernel private headers need to be specified. This was previously done by adding 'zephyr_library_include_directories' to CMakeLists.txt file for every component under the arch directory, and this resulted in a significant amount of duplicate code. This commit uses the CMake 'include_directories' command in the root CMakeLists.txt to simplify specification of the private header include paths for all the arch components. Signed-off-by: Stephanos Ioannidis <[email protected]>
Remove unnecessary inclusion of offsets_short.h in the LPC54114 start-up code. See zephyrproject-rtos/hal_nxp#17. Signed-off-by: Stephanos Ioannidis <[email protected]>
895c81f
to
d108e6a
Compare
Rebased onto the latest master. |
This commit inlines arch_isr_direct_header function that was previously placed in irq_manage.c for no good reason (possibly in relation to the FIXME for zephyrproject-rtos#3056). In addition, since the PR zephyrproject-rtos#20119 resolved the header circular dependency issue described in the issue zephyrproject-rtos#3056, this commit removes the references to it in the code. The reason for not inlining _arch_is_direct_pm as the zephyrproject-rtos#3056 FIXME suggests is that there is little to gain from doing so and there still exists circular dependency for the headers required by this function (zephyrproject-rtos#20119 only addresses kernel_structs.h, which is required for _current and _kernel, which, in turn, is required for handling interrupt nesting in many architectures; in fact, Cortex-A and Cortex-R port will require it as well). Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit inlines the direct ISR functions that were previously implemented in irq_manage.c, since the PR zephyrproject-rtos#20119 resolved the circular dependency between arch.h and kernel_structs.h described in the issue zephyrproject-rtos#3056. Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit inlines arch_isr_direct_header function that was previously placed in irq_manage.c for no good reason (possibly in relation to the FIXME for #3056). In addition, since the PR #20119 resolved the header circular dependency issue described in the issue #3056, this commit removes the references to it in the code. The reason for not inlining _arch_is_direct_pm as the #3056 FIXME suggests is that there is little to gain from doing so and there still exists circular dependency for the headers required by this function (#20119 only addresses kernel_structs.h, which is required for _current and _kernel, which, in turn, is required for handling interrupt nesting in many architectures; in fact, Cortex-A and Cortex-R port will require it as well). Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit inlines the direct ISR functions that were previously implemented in irq_manage.c, since the PR #20119 resolved the circular dependency between arch.h and kernel_structs.h described in the issue #3056. Signed-off-by: Stephanos Ioannidis <[email protected]>
@stephanosio sorry, just see the PR, why we re-write subsys/debug/tracing/CMakeLists.txt? |
Somehow missed this comment. Because |
Zephyr release v.3.2.0 has no EARLY initialization level. So the MPU and L1/L2 initialization is moved to PRE_KERNEL_1 level