Skip to content

Conversation

@ycsin
Copy link
Member

@ycsin ycsin commented May 31, 2024

@ycsin ycsin requested review from Thalley and andyross May 31, 2024 16:33
@ycsin ycsin marked this pull request as ready for review May 31, 2024 16:42
@zephyrbot zephyrbot added area: Kernel area: Architectures area: SPARC SPARC Architecture area: NIOS2 NIOS2 Architecture area: X86 x86 Architecture (32-bit) area: native port Host native arch port (native_sim) labels May 31, 2024
@ycsin ycsin force-pushed the pr/arch_esf branch 2 times, most recently from 4c12eaf to fc67715 Compare June 1, 2024 02:28
@ycsin ycsin force-pushed the pr/arch_esf branch 3 times, most recently from ad90a8d to 04b935a Compare June 2, 2024 07:32
ycsin added 9 commits June 4, 2024 16:26
Create `zephyr/include/zephyr/arch/exception.h`, which will
redirect to the corrent architecture-specific exception header
based on Kconfig.

Some of the architectures define their esf struct in
architecture-specific `arch.h`, refactor them out into a
separate `exception.h`.

Signed-off-by: Yong Cong Sin <[email protected]>
`fatal.h` has 2 functions that use the `z_arch_esf_t` type.

Include `exception.h`, which should have the `z_arch_esf_t`
defined.

Signed-off-by: Yong Cong Sin <[email protected]>
Rename every architecture's esf struct to `struct esf`.

Signed-off-by: Yong Cong Sin <[email protected]>
Make `struct arch_esf` compulsory for all architectures by
declaring it in the `arch_interface.h` header.

After this commit, the named struct `z_arch_esf_t` is only used
internally to generate offsets, and is slated to be removed
from the `arch_interface.h` header in the future.

Signed-off-by: Yong Cong Sin <[email protected]>
Created `GEN_OFFSET_STRUCT` & `GEN_NAMED_OFFSET_STRUCT` that
works for `struct`, and remove the use of `z_arch_esf_t`
completely.

Signed-off-by: Yong Cong Sin <[email protected]>
Add a note about the introduction of `struct arch_esf` and the
deprecation of `z_arch_esf_t`.

Signed-off-by: Yong Cong Sin <[email protected]>
Update the git revision of the `sof` module.

Signed-off-by: Yong Cong Sin <[email protected]>
x86 32bit defines `CONFIG_X86` while its 64bit counterpart
defines an additional `CONFIG_X86_64`, by reordering the
include order we can make it look a bit cleaner.

Signed-off-by: Yong Cong Sin <[email protected]>
Zephyr support out-of-tree architectures so we shouldn't
throw error for archs not listed here.

Signed-off-by: Yong Cong Sin <[email protected]>
@ycsin ycsin requested a review from aescolar June 4, 2024 08:27
@aescolar aescolar dismissed their stale review June 4, 2024 08:35

Addressed

@ycsin ycsin added this to the v3.7.0 milestone Jun 4, 2024
@carlescufi carlescufi removed the Breaking API Change Breaking changes to stable, public APIs label Jun 4, 2024
@ycsin
Copy link
Member Author

ycsin commented Jun 4, 2024

ping @andyross could you please take another look? Thanks

@MaureenHelm MaureenHelm merged commit a2b0c2c into zephyrproject-rtos:main Jun 4, 2024
@ycsin ycsin deleted the pr/arch_esf branch June 5, 2024 00:52
@Thalley
Copy link
Contributor

Thalley commented Jun 5, 2024

Thanks for the quick fix @ycsin

One thing I can see today is that now zephyr/include/zephyr/arch/arm/cortex_m/exception.h may be included before sys_define_gpr_with_alias has been defined.

This effectively means that the new generic exception.h header cannot be included for ARM before zephyr/include/zephyr/arch/arm/arch.h has been included, as zephyr/include/zephyr/arch/arm/arch.h defines the sys_define_gpr_with_alias macro.

I almost expect that if we fix the above, yet another include issue will appear. These type of include issues will continue to appear unless verified by a tool (attempting to fix or verify manually will be nearly impossible).

@Thalley
Copy link
Contributor

Thalley commented Jun 11, 2024

Thanks for the quick fix @ycsin

One thing I can see today is that now zephyr/include/zephyr/arch/arm/cortex_m/exception.h may be included before sys_define_gpr_with_alias has been defined.

This effectively means that the new generic exception.h header cannot be included for ARM before zephyr/include/zephyr/arch/arm/arch.h has been included, as zephyr/include/zephyr/arch/arm/arch.h defines the sys_define_gpr_with_alias macro.

I almost expect that if we fix the above, yet another include issue will appear. These type of include issues will continue to appear unless verified by a tool (attempting to fix or verify manually will be nearly impossible).

@ycsin are you looking into this? Otherwise I'll go ahead and create another issue :)

If you are not already, you may want to use a tool like the clang includer-cleaner or clangd to catch future issues.

@ycsin
Copy link
Member Author

ycsin commented Jun 11, 2024

@ycsin are you looking into this? Otherwise I'll go ahead and create another issue :)

Not looking into this, please feel free to create another issue

@Thalley
Copy link
Contributor

Thalley commented Jun 11, 2024

@ycsin are you looking into this? Otherwise I'll go ahead and create another issue :)

Not looking into this, please feel free to create another issue

The fix for this was quite simple, so decided to take a look at fixing it myself: #74106

ycsin added a commit to ycsin/zephyr that referenced this pull request Jan 21, 2025
The exception stack frame type `z_arch_esf_t` had been deprecated
since zephyrproject-rtos#73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.

Signed-off-by: Yong Cong Sin <[email protected]>
Signed-off-by: Yong Cong Sin <[email protected]>
kartben pushed a commit that referenced this pull request Jan 23, 2025
The exception stack frame type `z_arch_esf_t` had been deprecated
since #73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.

Signed-off-by: Yong Cong Sin <[email protected]>
Signed-off-by: Yong Cong Sin <[email protected]>
RuibinChang pushed a commit to RuibinChang/zephyr that referenced this pull request Feb 10, 2025
The exception stack frame type `z_arch_esf_t` had been deprecated
since zephyrproject-rtos#73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.

(cherry picked from commit 085df8b)

Original-Signed-off-by: Yong Cong Sin <[email protected]>
Original-Signed-off-by: Yong Cong Sin <[email protected]>
GitOrigin-RevId: 085df8b
Cr-Build-Id: 8724909411128659441
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8724909411128659441
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: Ie88a95de7734ad8636c1a4679debdd844fbf2df6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6196370
Commit-Queue: ChromeOS Prod (Robot) <[email protected]>
Bot-Commit: ChromeOS Prod (Robot) <[email protected]>
Tested-by: ChromeOS Prod (Robot) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Architectures area: Kernel area: native port Host native arch port (native_sim) area: NIOS2 NIOS2 Architecture area: SPARC SPARC Architecture area: X86 x86 Architecture (32-bit) manifest manifest-sof

Projects

None yet

10 participants