Skip to content
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

intel_adsp: ace: secondary core context save and restore #55182

Conversation

tmleman
Copy link
Collaborator

@tmleman tmleman commented Feb 24, 2023

Reusing primary core context save/restore flow for purpose of secondary core D0 -> D3 -> D0 transitions.

FW on secondary core when preparing for D3 will save its context. When core is re-enabled we use dsp_restore_vector as the FW entry point.

Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we clean this up? It seems like you needed a way to tell whether or not a core was being started up after initial boot, and decided to abuse the kernel thread state for the idle thread? That's... no, that's just not right. Those are different subsystems. If the arch/soc code needs to track state for its own purposes, it needs to do it on its own and not repurpose other code from other areas.

FWIW: looking at that soc_cpus_active[] array, I'm guessing that's the right kind of abstraction to be using (though it seems to have been broken by this PR?).

soc/xtensa/intel_adsp/ace/power.c Outdated Show resolved Hide resolved
soc/xtensa/intel_adsp/ace/power.c Outdated Show resolved Hide resolved
soc/xtensa/intel_adsp/ace/power.c Show resolved Hide resolved
@tmleman
Copy link
Collaborator Author

tmleman commented Mar 30, 2023

@andyross please take a look at the updated versions now.

@tmleman tmleman requested a review from ceolin April 12, 2023 12:50
@tmleman
Copy link
Collaborator Author

tmleman commented Apr 12, 2023

@andyross friendly reminder

aborisovich
aborisovich previously approved these changes Apr 12, 2023
@tmleman tmleman added the DNM This PR should not be merged (Do Not Merge) label Apr 17, 2023
@tmleman
Copy link
Collaborator Author

tmleman commented Apr 17, 2023

Adding DNM label because of thesofproject/sof#7433. After this PR is merged zephyr update on SOF side will require additional changes. This would make later bisect more difficult in case of any new problems.

But you can still review and approve.

ceolin
ceolin previously approved these changes Apr 25, 2023
Copy link
Member

@ceolin ceolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still a little bit skeptical about the need of all flush/invalidate cache but you know better than me about it here

@tmleman tmleman removed the DNM This PR should not be merged (Do Not Merge) label Apr 25, 2023
This patch replace temporary stack of the restore vector with interrupt
stack to reduce memory usage. Additionally we can assign seprate stack
for each core. This will allow to reuse this vector for secondary cores.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This patch is preparing cpu context save and restore code so it can be
later used by the multiple cores.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Reusing primary core context save/restore flow for purpose of secondary
core D0 -> D3 -> D0 transitions. If core is re-enabled we use
dsp_restore_vector as the FW entry point.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Masking out all interrupt during power state transition and restoring
them after is now common thing for all power states. No need to
duplicate code.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This patch moves cache flush/invalidation to section executed only when
IMR context saving is enabled. If this option is disabled no FW context
is stored so any lost data doesn't matter.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
@tmleman tmleman dismissed stale reviews from ceolin and aborisovich via 7b1d204 April 26, 2023 12:09
@tmleman tmleman force-pushed the topic/upstream/pr/ace/d3/secondary_core_save branch from 167901a to 7b1d204 Compare April 26, 2023 12:09
@tmleman
Copy link
Collaborator Author

tmleman commented Apr 26, 2023

Rebase after merge of #50136

@aborisovich aborisovich changed the title intel_adsp: ace: secondary core context save and restore [DNM] intel_adsp: ace: secondary core context save and restore Apr 26, 2023
@aborisovich aborisovich added DNM This PR should not be merged (Do Not Merge) and removed DNM This PR should not be merged (Do Not Merge) labels Apr 26, 2023
@aborisovich aborisovich changed the title [DNM] intel_adsp: ace: secondary core context save and restore intel_adsp: ace: secondary core context save and restore Apr 26, 2023
@aborisovich
Copy link
Collaborator

Ignore, added DNM by accident to wrong PR.

Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw this come by again. Looks great to me, my concerns earlier were all addressed.

@carlescufi carlescufi merged commit aba3b12 into zephyrproject-rtos:main Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants