-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kernel: Use IOAPIC and LAPIC instead of the PIC #304
Conversation
Report that IOAPIC IRQ0 is broken under qemu.Ideally, we'd use IRQ0 for the timer, in order to match what we have with the PIC. Unfortunately, qemu unconditionally redirects irqs on pin0 to pin2. SunriseOS/kernel/src/devices/hpet.rs Lines 515 to 525 in 92d3d7a
This comment was generated by todo based on a
|
Support bitflags. That'd be nice.SunriseOS/kernel/src/devices/apic.rs Lines 127 to 137 in 163e4d4
This comment was generated by todo based on a
|
See chapterSunriseOS/kernel/src/devices/apic.rs Lines 143 to 153 in 163e4d4
This comment was generated by todo based on a
|
This is wrong. It is not Send.SunriseOS/kernel/src/devices/apic.rs Lines 555 to 565 in 163e4d4
This comment was generated by todo based on a
|
Mask everything.SunriseOS/kernel/src/devices/apic.rs Lines 578 to 588 in 163e4d4
This comment was generated by todo based on a
|
IoApic should not be Sync!IoApic manually implements Sync to allow it to be stored in a static. This is, however, wildly unsafe. It "works" today because we only have a single CPU and no preemption. SunriseOS/kernel/src/devices/ioapic.rs Lines 119 to 129 in 163e4d4
This comment was generated by todo based on a
|
Avoid mapping the same MMIO pages multiple times.Currently, if we need to map distinct MMIO regions sharing the same page, we do multiple mapping. This is wasteful of address space, which is a relatively scarce resource. SunriseOS/kernel/src/devices/ioapic.rs Lines 222 to 232 in 163e4d4
This comment was generated by todo based on a
|
LocalAPIC should not be Send/Sync.LocalApic should be stored in a cpu_local, removing the need for Send/ Sync bounds. Problem is, we don't really have a way to create CPU Locals yet. SunriseOS/kernel/src/devices/apic.rs Lines 554 to 564 in d5048d1
This comment was generated by todo based on a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took so long
PIC is so 1980s, IOAPIC is so 200s. Moving to the APIC provides us with two immediate and one long term benefit: 1. It allows us to use MSI for PCI interruptions, which should cleanly resolve the problem that level triggered interrupts don't work well in the context of a microkernel. 2. It provides us with a nice speed boost compared to the PIC, what with the IO-APIC being a lot cleaner to use. 3. It will eventually allow SMP. The IO-APIC is mostly wired in the same way the PIC is. However, under QEmu, there's a bug that prevents using IRQ line 0, so we have to move the timer to another IRQ line (we use 2 since that's the recommended line for timers).
PIC is so 1980s, IOAPIC is so 2000s.
Moving to the APIC provides us with two immediate and one long term benefit:
It allows us to use MSI for PCI interruptions, which should cleanly resolve the problem that level triggered interrupts don't work well in the context of a microkernel.
It provides us with a nice speed boost compared to the PIC, what with the IO-APIC being a lot cleaner to use.
It will eventually allow SMP.
The IO-APIC is mostly wired in the same way the PIC is. However, under QEmu, there's a bug that prevents using IRQ line 0, so we have to move the timer to another IRQ line (we use 2 since that's the recommended line for timers).