riscv / riscv-aia

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

What's the purpose of virtual interrupts? #67

Open zhuotianshu opened 6 months ago

zhuotianshu commented 6 months ago

I'm confused about the purpose of virtual interrupts. What Can it do that mideleg can't?

zhuotianshu commented 6 months ago

Now I get that virtual interrupt is for hypervisor to filer the interrupt directed to vs mode, but I still don't have an idea about the concrete scenario in which this feature may be useful.

lixiaogangkkk commented 1 month ago

Now I get that virtual interrupt is for hypervisor to filer the interrupt directed to vs mode, but I still don't have an idea about the concrete scenario in which this feature may be useful.

@zhuotianshu You should read more about virtualization, to get the detail about para-virtualization and full-virtualization

  1. Virtual interrupts mechanism is designed to direct interrupt into virtual supervisor (most of time, it's a guest OS running at VS privilege level, such as Linux Kernel, Windows Kernel).
  2. Most of the time, if hardware doesn't support interrupts to be directed into virtual supervisor, the host OS running at HS privilege level should take over interrupts which the VM cares about, then host OS emulates interrupt to notify guest OS to handle its interrupt one step further.
zhuotianshu commented 1 month ago

Thank you for replying @lixiaogangkkk . I finally understood this, but now I'm confused about what should be the priority of virtual interrupts, such as a SEI directed to S mode generated by setting mvip.SEI.