-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
arch/xtensa: arch_cpu_idle cleanup #64760
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -180,6 +180,51 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) | |||||
} | ||||||
#endif /* CONFIG_PM */ | ||||||
|
||||||
#ifdef CONFIG_ARCH_CPU_IDLE_CUSTOM | ||||||
/* xt-clang removes any NOPs more than 8. So we need to set | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Please provide at least one xt-lang version that with confirmed reproduction. This workaround should refer to a proper issue number but for now the mere output of If there was a past discussion in https://github.com/thesofproject/sof about this then also add the link. Toolchain issues are incredibly time-consuming so the last thing they need is incomplete information. I realize you're "only" moving an existing comment but as noted by @andyross this PR does far more than just re-organizing code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @dcpleung was the one who discovered that particular optimizer misfeature, likely on the MTL toolchain? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the xt-clang I used exhibited the same behavior of "ignoring" NOPs beyond 8. |
||||||
* no optimization to avoid those NOPs from being removed. | ||||||
* | ||||||
* This function is simply enough and full of hand written | ||||||
* assembly that optimization is not really meaningful | ||||||
* anyway. So we can skip optimization unconditionally. | ||||||
* Re-evalulate its use and add #ifdef if this assumption | ||||||
* is no longer valid. | ||||||
*/ | ||||||
__no_optimization | ||||||
void arch_cpu_idle(void) | ||||||
{ | ||||||
sys_trace_idle(); | ||||||
|
||||||
/* Just spin forever with interrupts unmasked, for platforms | ||||||
* where WAITI can't be used or where its behavior is | ||||||
* complicated (Intel DSPs will power gate on idle entry under | ||||||
* some circumstances) | ||||||
*/ | ||||||
if (IS_ENABLED(CONFIG_XTENSA_CPU_IDLE_SPIN)) { | ||||||
__asm__ volatile("rsil a0, 0"); | ||||||
__asm__ volatile("loop_forever: j loop_forever"); | ||||||
return; | ||||||
} | ||||||
|
||||||
/* Cribbed from SOF: workaround for a bug in some versions of | ||||||
* the LX6 IP. Preprocessor ugliness avoids the need to | ||||||
* figure out how to get the compiler to unroll a loop. | ||||||
*/ | ||||||
if (IS_ENABLED(CONFIG_XTENSA_WAITI_BUG)) { | ||||||
#define NOP4 __asm__ volatile("nop; nop; nop; nop"); | ||||||
#define NOP32 NOP4 NOP4 NOP4 NOP4 NOP4 NOP4 NOP4 NOP4 | ||||||
#define NOP128() NOP32 NOP32 NOP32 NOP32 | ||||||
NOP128(); | ||||||
#undef NOP128 | ||||||
#undef NOP32 | ||||||
#undef NOP4 | ||||||
__asm__ volatile("isync; extw"); | ||||||
} | ||||||
|
||||||
__asm__ volatile ("waiti 0"); | ||||||
} | ||||||
#endif | ||||||
|
||||||
__imr void power_init(void) | ||||||
{ | ||||||
/* Request HP ring oscillator and | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this. Why would this be an application level override? It seems this is a board/soc specific requirement and if you buiild for these targets, the custom functions has to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kv2019i I tested cavs2.5 and didn't find any issue. I traced this issue which was found on cavs1.8 platforms in 2017 and then these patches was applied. I don't think it still exists on cavs2.5 so I don't enable it with cavs2.5. I reserve it since It will make effect when cavs1.8 platform are supported.