Commit Graph

15 Commits

Author SHA1 Message Date
Stefan Kalkowski e05d26567d hw: make 'smp' property an aspect (Ref #1312)
This commit separates certain SMP aspects into 'spec/smp' subdirectories.
Thereby it simplifies non-SMP implementations again, where no locking
and several platform specific maintainance operations are not needed.
Moreover, it moves several platform specifics to appropriated places,
removes dead code from x86, and starts to turn global static pointers
into references that are handed over.
2016-01-15 16:42:12 +01:00
Adrian-Ken Rueegsegger ec92e9c3df hw_x86_64: Only handle masking of I/O APIC IRQs
Ignore toggle requests for vectors not assigned to the I/O APIC.

Fixes #1651
2015-08-21 11:00:59 +02:00
Adrian-Ken Rueegsegger 965d85d52d hw_x86_64: Support for dynamic IRQ mode setting
Add a Platform::setup_irq_mode function which enables the IRQ session to
update the trigger mode and polarity of the associated IRQ according to
the session parameters. On ARM this function is a nop.

This change enables the x86_64 platform to support devices which use
arbitrary trigger modes and polarity settings, e.g. AHCI on QEMU and
real hardware.

Fixes #1528.
2015-05-28 11:17:28 +02:00
Reto Buerki 58178949ef hw_x86_64: Make AHCI driver work
The assumption that IRQs in the legacy ISA range are always
edge-triggered is wrong. For the free-for-use IRQs it depends on the
actual device which uses the specific IRQ. Therefore, treat IRQs 9, 10
and 11 as level-triggered.
2015-05-26 09:39:50 +02:00
Reto Buerki afec233f50 hw_x86_64: Use _edge_triggered() in _create_irt_entry() 2015-05-26 09:39:50 +02:00
Reto Buerki 5eed6de910 hw_x86_64: Let _edge_triggered() operate on IRQ
Use the base IRQ in the _edge_triggered() utility function, not the
remapped vector.
2015-05-26 09:39:50 +02:00
Reto Buerki 6af893123e hw_x86_64: Only block masking of legacy IRQs
Allow legacy IRQ unmasking. Initially, all IRQs are masked and must be
explicitly unmasked by a driver.
2015-05-26 09:39:50 +02:00
Reto Buerki e034846f32 hw_x86_64: Initially mask IRQs in _create_irt_entry 2015-05-26 09:39:50 +02:00
Martin Stein c6417051ce hw & x86: Use register framework for IRTEs
Ref #1494
2015-05-26 09:39:45 +02:00
Adrian-Ken Rueegsegger 36b2cf932b hw_x86_64: Initialize complete I/O APIC IRT entries
Also set high 32 bits of I/O APIC redirection table entries.
2015-05-20 17:53:00 +02:00
Reto Buerki c82f5e9269 hw_x86_64: Do not mask edge-triggered interrupts
Do not mask edge-triggered interrupts to avoid losing them while masked,
see Intel 82093AA I/O Advanced Programmable Interrupt Controller
(IOAPIC) specification, section 3.4.2, "Interrupt Mask":

"When this bit is 1, the interrupt signal is masked. Edge-sensitive
interrupts signaled on a masked interrupt pin are ignored (i.e., not
delivered or held pending)"

Or to quote Linus Torvalds on the subject:

"Now, edge-triggered interrupts are a _lot_ harder to mask, because the
Intel APIC is an unbelievable piece of sh*t, and has the edge-detect
logic _before_ the mask logic, so if a edge happens _while_ the device
is masked, you'll never ever see the edge ever again (unmasking will not
cause a new edge, so you simply lost the interrupt)."

So when you "mask" an edge-triggered IRQ, you can't really mask it at
all, because if you did that, you'd lose it forever if the IRQ comes in
while you masked it. Instead, we're supposed to leave it active, and set
a flag, and IF the IRQ comes in, we just remember it, and mask it at
that point instead, and then on unmasking, we have to replay it by
sending a self-IPI." [1]

[1] - http://yarchive.net/comp/linux/edge_triggered_interrupts.html

Ref #1448
2015-03-27 11:53:34 +01:00
Martin Stein bfe1fac37c hw_x86_64: style fixes
Ref #1448
2015-03-27 11:53:34 +01:00
Reto Buerki 28b5e67a8c Update or add hw_x86_64 copyright headers 2015-03-27 11:53:32 +01:00
Reto Buerki a21959fc26 hw_x86_64: Implement APIC-based PIC driver
The implementation initializes the Local APIC (LAPIC) of CPU 0 in xapic
mode (mmio register access) and uses the I/O APIC to remap, mask and
unmask hardware IRQs. The remapping offset of IRQs is 48.

Also initialize the legacy PIC and mask all interrupts in order to
disable it.

For more information about LAPIC and I/O APIC see Intel SDM Vol. 3A,
chapter 10 and the Intel 82093AA I/O Advanced Programmable Interrupt
Controller (IOAPIC) specification

Set bit 9 in the RFLAGS register of user CPU context to enable
interrupts on kernel- to usermode switch.
2015-03-27 11:53:31 +01:00
Norman Feske a974726e26 hw: skeleton for building on x86_64
This patch contains the initial code needed to build and bootstrap the
base-hw kernel on x86 64-bit platforms. It gets stuck earlier
because the binary contains 64-bit instructions, but it is started in
32-bit mode. The initial setup of page tables and switch to long mode is
still missing from the crt0 code.
2015-03-27 11:53:16 +01:00