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

[WIP] arch: riscv: smp: add PLIC-based IPI #81260

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ycsin
Copy link
Member

@ycsin ycsin commented Nov 12, 2024

See #81215
See #81256

FPU_SHARING depends on riscv_plic_irq_is_pending() & riscv_plic_irq_clear_pending()

The currently IPI implementation assumes that CLINT exists in the
system, however, that might not be the case as IPI can be implemented
with PLIC that supports software-triggering as well, such as the Andes
NCEPLIC100.

Refactor the CLINT-based IPI implementations into `ipi_clint.c`, and
create Kconfig that selects the CLINT implementation when
`sifive-clint0` exists and enabled, otherwise default to
`RISCV_SMP_IPI_CUSTOM` which allows OOT implementation. This also
makes way for the upstreaming of non-clint IPI implementation later.

Signed-off-by: Yong Cong Sin <[email protected]>
Add PLIC-based IPI implementation.

Signed-off-by: Yong Cong Sin <[email protected]>
@ycsin ycsin force-pushed the pr/riscv-ipi-plic-alt branch from d8ea9b7 to 998cfd5 Compare November 12, 2024 06:46
@ycsin ycsin added area: RISCV RISCV Architecture (32-bit & 64-bit) area: SMP Symmetric multiprocessing labels Nov 12, 2024
Copy link
Collaborator

@npitre npitre left a comment

Choose a reason for hiding this comment

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

Normally, the device tree should contain stuff that describes the hardware
in a generic way. Here, the fact that FPU and scheduling are assigned IRQ
values in DT is too much software implementation details to live in DT. You
should see the device tree information as something that any operating
system may consume, and another OS implementation could opt to do things
differently,. There are exceptions already, but we should refrain from
adding more of them.

You should consider only listing in the DT all those IRQs that are available
for IPI usage and do the assignment in the source code instead.

@ycsin
Copy link
Member Author

ycsin commented Nov 14, 2024

CI failure is unrelated and fixed by #81367

@npitre
Copy link
Collaborator

npitre commented Nov 14, 2024 via email

@ycsin
Copy link
Member Author

ycsin commented Nov 14, 2024

DT usage still needs fixing per my earlier comment.

Sure, I remember I met some difficulties to generate IRQ_CONNECT()s with LISTIFY() for the second half of the IPIs (FPU). Specifically, I'm not sure how to make the LISTIFY() start from non-zero. But I can try again later.

The FPU part also requires the following PLIC functions that I have yet to work on:

  • riscv_plic_irq_is_pending()
  • riscv_plic_irq_clear_pending()

@npitre
Copy link
Collaborator

npitre commented Nov 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: RISCV RISCV Architecture (32-bit & 64-bit) area: SMP Symmetric multiprocessing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants