Page MenuHomeFreeBSD

riscv vmm: various fixes in APLIC
ClosedPublic

Authored by br on Mon, Feb 3, 12:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Feb 14, 3:24 PM
Unknown Object (File)
Fri, Feb 14, 3:23 PM
Unknown Object (File)
Fri, Feb 7, 10:03 PM
Unknown Object (File)
Wed, Feb 5, 10:46 AM
Subscribers

Details

Summary
  • Implement level-sensitive interrupts
  • Disable up to 32 interrupts by a single query (CLRIE register handling)
  • Implement reading from DOMAINCFG

This is a minimal set of changes needed to boot Linux guest.

More work TODO to handle other APLIC registers read/write.

Test Plan

Linux booting in 0.48s with this. FreeBSD also speeds up for some reason

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

br requested review of this revision.Mon, Feb 3, 12:14 PM
sys/riscv/vmm/vmm_aplic.c
178
180

Do you want to check the return value here?

304

Why isn't the mutex required here?

Add spinlock around DOMAINCFG acccess.

sys/riscv/vmm/vmm_aplic.c
180

Do you want to check the return value here?

from the spec the write is ignored if value written is not an active interrupt source number in the domain
https://github.com/riscv/riscv-aia/releases/download/0.2-draft.24/riscv-interrupts-024.pdf

304

Indeed. Added!

sys/riscv/vmm/vmm_aplic.c
157

Why not just

if ((irq->sourcecfg & SOURCECFG_SM_M) != SOURCECFG_SM_INACTIVE) {
    if (enabled)
        ...
}

?

178

This change is required to avoid UB.

180

This would be useful to mention in a comment, along with a (void) cast for the aplic_set_enabled() call.

Address @markj comments. Thanks, Mark!

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Feb 5, 9:35 AM
This revision was automatically updated to reflect the committed changes.