-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Add architectural support for shared interrupts (take 2) #61422
Add architectural support for shared interrupts (take 2) #61422
Conversation
01f40b9
to
fedd16d
Compare
315465e
to
0561ac1
Compare
0561ac1
to
d941bf9
Compare
…tion Borrow from zephyrproject-rtos#61422. Will rebased after it is merged. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
…tion Borrow from zephyrproject-rtos#61422. Will rebased after it is merged. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
…tion Borrow from zephyrproject-rtos#61422. Will rebased after it is merged. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit introduces all the necessary changes for enabling the usage of shared interrupts. This works by using a second interrupt table: _shared_sw_isr_table which keeps track of all of the ISR/arg pairs sharing the same interrupt line. Whenever a second ISR/arg pair is registered on the same interrupt line using IRQ_CONNECT(), the entry in _sw_isr_table will be overwriten by a (shared_isr, _shared_sw_isr_table[irq]) pair. In turn, shared_isr() will invoke all of the ISR/arg pairs registered on the same interrupt line. This feature only works statically, meaning you can only make use of shared interrupts using IRQ_CONNECT(). Attempting to dynamically register a ISR/arg pair will overwrite the hijacked _sw_isr_table entry. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
…tion Since the shared IRQ code will also use the same logic to compute the _sw_isr_table index, move the computing logic to a separate function: z_get_sw_isr_table_idx(), which can be used by other modules. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This works by overwriting z_isr_install()'s definition (possible since the symbol is now weak) with our own definiton. Whenever trying to register a new ISR/arg pair, z_isr_install() will check to see if the interrupt line is already in use. If it's not then it will not share the interrupt and will work exactly as the old z_isr_install(), meaning it will just write the new ISR/arg pair to _sw_isr_table. If the interrupt line is already being used by an ISR/arg pair then that line will become shared, meaning we'll overwrite _sw_isr_table with our own (z_shared_isr, z_shared_sw_isr_table[irq]) pair. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit provides the users a way to disconnect dynamic interrupts. This is needed because we don't want to keep piling up ISR/arg pairs until the number of registrable clients is reached. This feature is only relevant for shared and dynamic interrupts. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit introduces a new testcase for shared interrupts. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit adds the documentation for shared interrupts. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Add a note that shared interrupts are now supported. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
9f1ca67
to
931d81a
Compare
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.
Still good here
…tion Borrow from zephyrproject-rtos#61422. Will rebased after it is merged. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Great work @LaurentiuM1234 ! |
So does this mean shared interrupts are only compatible with Aarch64? I didn't get a chance to review this change before it went in, but it looks like tests were tailored to arm64. It's hard for me to tell from the tests that were added, but was any attention given to multi-level interrupts? What are the implications in terms of size for multi-level interrupts? At a glance, it looks to be |
Shared interrupts work on any architecture. The restriction to
The shared interrupt code is multi-level interrupt-aware. By this I mean it uses
I'd say the formula is something like: O(N * (sizeof(size_t) + k * sizeof(struct z_shared_isr_client))), where N is the number of interrupts and k is the value of |
This is an enhancement/alternative to #61331 which is meant to allow making use of shared interrupts with
IRQ_CONNECT()
(statically) andirq_connect_dynamic
(dynamically).A few notes:
shared_irq.c
inarch/common/
for consistency reasons (it's somewhat the same thing assw_isr_common.c
which is placed there)_shared_irq_table
should be placed in the same memory as_sw_isr_table
(RAM or ROM).