-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
xtensa: use swint to swith context #5336
Conversation
|
@zhuyanlinzyl |
|
esp32-devkitc:nsh and esp32-devkitc:smp do not work with QEMU. |
esp32s3 is a newly added Xtensa chip. I added the esp32s3 Make.defs agiain. Please review again @masayuki2009 |
@zhuyanlinzyl |
@masayuki2009 No, I only tested in our board with xtensa chip. As QEMU do not work with esp32, This patch need @Ouss4 review and tested in there board. |
@zhuyanlinzyl |
Thanks,I setup the esp32 QEMU environment ant test patch on it @masayuki2009 |
hi @Ouss4 , I'd like to known how to get the esp toolchain |
@zhuyanlinzyl all the toolchains from Espressif can be downloaded from https://github.com/espressif/crosstool-NG/releases |
hi @Ouss4 : I just test this patch in Qemu, And add software interrupt (bit 29, software interrupt 1) for esp32.
But in esp32-devkitc:smp crash in the CPU1 initialize
Could you give me some advice? |
@Ouss4 I think I have find the reason: CPU1 have not generate swi interrupt at all. As esp32 only have two software interrupt bit:
I select ESP32_CPUINT_SOFTWARE1 for CPU0 swi interrupt . As the ESP32_CPUINT_SOFTWARE1 have interrupt level-3. I'd like to know, CPU1 must use another sw interrupt pin to generate interrupt in ESP32? |
@zhuyanlinzyl ESP32 should have a software interrupt per CPU. I think the issue here is that the software interrupt was enabled only for CPU0. |
Note that enabling a CPU interrupt must be done from the specific CPU. We cannot enable CPU1's interrupts from CPU0.
|
@Ouss4
but As g_irqmap is not g_irqmap[CONFIG_SMP_NCPUS] So I think must use separate SWI interrupt pin for each CPU? |
I think your right, the second one (which ever CPU is) overwrites the first one, this is the same case as the GPIO interrupt where the IRQ is the same... We gonna have to treat these separately. |
@Ouss4 : but ESP32 chip only have two swi interrupt:
only |
These are internal CPU interrupts, which means each CPU has both ESP32_CPUINT_SOFTWARE0 and ESP32_CPUINT_SOFTWARE1. They have the same interrupt number but controlled from each CPU's registers. For instance EDIT: On a second thought, I don't think this will get that messy. I had the GPIO example in my mind, but this is a bit different. The only issue is enabling the interrupt using |
@Ouss4 :
So each CPU have separate internal interrupts,Such as Then I think the g_irqmap must be g_irqmap[CONFIG_SMP_NCPUS] for internal interrupts.
I don't think dispatch interrupts is a problem. As every CPU only have one interrupt per number , They handle their own interrupts independently. I have modify up_enable_irq with this patch
Then the smp config work well.
|
@zhuyanlinzyl can you please try #5536 |
hi, @Ouss4 @masayuki2009 @gustavonihei I think this PR contain two many different changes. I have spit into three: #5541: modify xtensa svc to swi. This is first and not depend on each other. Please review These PR before this. |
@zhuyanlinzyl do we still need this patch? |
We do, this is the context switching part. The two other PRs have part of this PR, when both are merged this need to be rebased. |
Both PRs are merged now. @zhuyanlinzyl can you please rebase and fix the conflicts. |
For up_irq_disable, use XCHAL_EXCM_LEVEL For up_irq_save, use XCHAL_IRQ_LEVEL. Then we can use svcall in enter_crritical_section. Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
854bc0f
to
e052fcf
Compare
hi, @masayuki2009 @Ouss4 : Please review and test again. |
@Ouss4 : Could you please review again? |
Reason for use sw-interrupt as syscall interrupt: The xtensa `syscall` instruction can cause SYSCALL interrupt. But SYSCALL interrupt is same interrupt level with level-one interrupt. Nuttx swint can enter `enter_critical_section` and gerenate interrupt. Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
@Ouss4 Yes, |
I pushed a branch internally with this PR. All tests passed except S2 where #5609 is needed. |
Okay, could we can review and merge this PR? @Ouss4 @gustavonihei |
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.
LGTM!
Summary
Follow #5261
Reason for use sw-interrupt as syscall interrupt:
The xtensa
syscall
instruction can cause SYSCALL interrupt.But SYSCALL interrupt is same interrupt level with level-one
interrupt.
Nuttx swint can enter
enter_critical_section
and generate interrupt.Impact
No
Testing
Testing ostest pass on Xtensa core.