Skip to content

os/board/rtl8730e/src/component: Add critical section in GDMA channel… #6705

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhongnuo-tang
Copy link
Contributor

… allocate

  1. In SMP, the same channel might be allocated to both cores if they are access it simultaneously
  2. add critical section to ensure only one core can access at one time

… allocate

1. In SMP, the same channel might be allocated to both cores if they are access it simultaneously
2. add critical section to ensure only one core can access at one time
@@ -730,7 +730,9 @@ GDMA_ChnlAlloc(u32 GDMA_Index, IRQ_FUN IrqFun, u32 IrqData, u32 IrqPriority)
u8 ValTemp = 0;

assert_param(IS_GDMA_Index(GDMA_Index));

#ifdef CONFIG_SMP
irqstate_t flags = enter_critical_section();
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Is this required enter_critical_section? not dma lock like sem or mutex?
  2. Is there any issue from this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I think mutex/sem should also be fine, the purpose is to prevent multi-core accessing this at the same time. Let me think about how to modify it.
  2. GDMA channel is not dedicated to each peripheral, so it will search for available channel and allocate it to the respective peripheral during initialization. There is a chance where multi core access, the same free channel is allocatecd to different peripherals and this will cause issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @sunghan-chang ,
After discussion, I still think enter_critical_section should be used, because channel allocate/free might be called in ISR, so sem or mutex shouldnt be used..

@sunghan-chang
Copy link
Contributor

@zhongnuo-tang Could you let us know how verify (test)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants