riscv / riscv-aia

https://jira.riscv.org/browse/RVG-59
Creative Commons Attribution 4.0 International
72 stars 18 forks source link

How to distinguish IPI and external interrupt if using IMSIC to accomplish IPI #89

Closed zhangdujiao closed 3 weeks ago

zhangdujiao commented 1 month ago

From the spec "However, so long as the same software (e.g. an operating system or machine monitor) is in control at both endpoints of an IPI, source and destination, there should be no reason for a destination hart to misinterpret the purpose of an incoming external interrupt that represents an IPI." How to understand this... The OS knows the source core and destination core of an specific IPI, as well as the interrupt ID. After the OS sends an IPI with a specific interrupt ID from the source core, when the destination core receives this specific external interrupt ID, it indicates that the IPI from the source core is received. Is that correct? If so, any other interrupt cannot be pointed to the same eip in IMSIC interrupt file of target core, right?

jhauser-us commented 3 weeks ago

If so, any other interrupt cannot be pointed to the same eip in IMSIC interrupt file of target core, right?

Yes, to avoid confusion, other external interrupts to the same interrupt file should not use the same minor interrupt identity. (At least, not concurrently. With sufficient serialization, it is possible to re-purpose interrupt identities over time.)

Devices that support MSIs allow software to configure the data values for the MSIs they write, which for RISC-V will be the minor interrupt identity in the destination interrupt file. Hence, software always controls use of these interrupt identity numbers among all participants.

Each interrupt file in an IMSIC supports a minimum of 63 minor identities for external interrupts, and may support as many as 2047. Each interrupt identity is two bits in an interrupt file: one bit in the interrupt-pending array, and one bit in the interrupt-enable array.

zhangdujiao commented 3 weeks ago

Yes, to avoid confusion, other external interrupts to the same interrupt file should not use the same minor interrupt identity. (At least, not concurrently. With sufficient serialization, it is possible to re-purpose interrupt identities over time.)

many thanks!