riscv / riscv-aia

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

A question of Interrupt filtering? #105

Open ZeyueShen opened 4 days ago

ZeyueShen commented 4 days ago

According to spec 5.3, mvip and mvien can be used to implement interrupt filtering. Here's an idea for an interrupt filtering method: Firstly, an array of external interrupt ids that need to be filtered. Secondly, s mode external interrupt is generated for an id stored in this array in S mode. After entering the trap, read stopei to obtain the id, and then configure mvien[9]=1, mvip[9]=1, mie[9]=0. After exiting the trap, Then enter the virtual interrupt trap. At this time, csrrw stopei will report illegal instrction exception, and then jump to the exception trap in M mode to clear mvien[9], mvip[9] and csrrw stopei. At this time, the information obtained through csrrw stopei will be stored in a total of previously defined public variables. This public variable is then used after exiting the trap so that S mode can obtain information about the external interrupt. Is it possible to pass the obtained external interrupt information to S mode by using public variables?