This adds remote fence extension support.
Details
- Reviewers
jrtc27 markj - Commits
- rG8f6b66a9d3f2: riscv vmm: implement SBI RFNC extension.
Tested on EIC7700 although it is not clear if the SoC actually needs it: it works fine with and without this support included.
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
This adds remote fence extension support.
Some further explanation, either here or in a comment, would be helpful.
sys/riscv/vmm/riscv.h | ||
---|---|---|
71 | _INVALID would be a bit clearer as a name here IMO, assuming that "UNK" means "unknown". | |
sys/riscv/vmm/vmm_fence.c | ||
132 | atomic_readandclear_32() is a bit clearer here IMO. | |
170 | Probably this should be atomic_store_32 instead of set_32. The latter is an atomic OR, but it doesn't seem necessary. | |
193 | Why is the mb needed? | |
sys/riscv/vmm/vmm_riscv.c | ||
750 | Need to destroy the mutex here too I believe. | |
sys/riscv/vmm/vmm_sbi.c | ||
120 | Why atomic? This bitset is on the stack. |
sys/riscv/vmm/vmm_fence.c | ||
---|---|---|
193 | To ensure that the request is enqueued before the state of vcpu is obtained on out of order CPUs ? |
sys/riscv/vmm/riscv.h | ||
---|---|---|
104–105 | Pack these two as a bitmask of the desired requests? | |
sys/riscv/vmm/vmm_fence.c | ||
46 | bool? | |
54 | Normally one dequeues from the head and enqueues to the tail | |
56 | What's wrong with *new_fence = *fence? | |
58–60 | ||
71 | Same comments as dequeue | |
113 | Why the parens? | |
150 | bool | |
sys/riscv/vmm/vmm_sbi.c | ||
100–101 | Unused | |
224 | ... and the return value isn't even checked for these |
sys/riscv/vmm/vmm_fence.c | ||
---|---|---|
209 | This is still wrong, just less wrong than before. Once the vcpu is unlocked, there is no guarantee about which host CPU the vcpu is running on. That's why vm_smp_rendezvous() uses vcpu_notify_event(). |
sys/riscv/vmm/vmm_fence.c | ||
---|---|---|
209 | I understand but once we have the request enqueued we don't care if vcpu change its host cpu, because in this case it will process enqueued SBI request on entry to the guest anyway. In this scenario we indeed interrupt wrong CPU without reason, but we don't loose instruction/data synchronization in the guest. |