Page MenuHomeFreeBSD

riscv intc: convert to a bus
Needs ReviewPublic

Authored by br on Fri, Sep 18, 2:30 PM.
Tags
None
Referenced Files
F173723922: D59813.diff
Sun, Sep 27, 11:19 PM
Unknown Object (File)
Sun, Sep 27, 5:06 AM
Unknown Object (File)
Sat, Sep 26, 10:46 PM
Unknown Object (File)
Sat, Sep 26, 7:56 AM
Unknown Object (File)
Sat, Sep 26, 5:00 AM
Unknown Object (File)
Sat, Sep 26, 2:25 AM
Unknown Object (File)
Fri, Sep 25, 9:32 PM
Unknown Object (File)
Fri, Sep 25, 8:35 PM

Details

Reviewers
mhorne
mmel
jrtc27
Summary

Convert RISC-V intc device to a bus, and establish parent-child relationships with IMSIC

That would allow to propagate PIC_INIT_SECONDARY() call to the child

This is similar to what gicv5 does with IRS department

Test Plan

Tested on Spacemit K3 with IMSIC.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br requested review of this revision.Fri, Sep 18, 2:30 PM
jrtc27 requested changes to this revision.Fri, Sep 18, 2:32 PM
jrtc27 added a subscriber: jrtc27.

Please go read all of D40474

This revision now requires changes to proceed.Fri, Sep 18, 2:32 PM

Please go read all of D40474

I think this comment by @mmel is most useful

I've written this several times in other reviews, I think. Initialization of PICs on secondary cores must be coordinated with the parent PIC and must follow the PIC hierarchy. Imho, the only way to do this correctly is implement this in pic_init_secondary() for each PIC driver.

BTW - most real systems have multiple PIC instances - GICv3 has multiple functions/departments, each of which is a separate PIC, each PCI driver should contain a PIC. And it's not uncommon for a hierarchy to have 3 or 4 nodes.
br retitled this revision from intrng: pic_init_secondary() on non-root interrupt controllers to riscv intc: convert to a bus.
br edited the summary of this revision. (Show Details)
br removed reviewers: andrew, manu.

Another idea draft for discussion

You're definitely right, from an INTRNG point of view. Thanks.

sys/riscv/riscv/intc.c
335

You should initialize the child PIC before enabling the interrupts on this PIC.
A safer way would be to disable the interrupts on this PIC, initialize the child PICs, and then re-enable them.

Initialize the child PIC with interrupts disabled on the root PIC

I intend to review this in the coming days

I think this is quite clean.

We'll let @jrtc27 weigh in.