History log of /haiku/src/system/kernel/arch/x86/msi.cpp
Revision Date Author Comments
# 02463fb4 05-Mar-2024 X512 <danger_mail@list.ru>

kernel/int: consolidate interrupt vector number to `int32`

This is no-op for 32 bit platforms because `int32` is defined as `long` there.

Change interrupt vector number from 64 bits to 32 bits for 64 bit platforms.

Change-Id: I52d1ad616cab16488804e9733c7afaf772a670ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7507
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 629f071b 27-Feb-2024 X512 <danger_mail@list.ru>

pci: extend MSI interrupt vector number to 32 bits

Also increase MSI message data size to 32 bits according to PCIe spec.

Remove 0xff check for MSI interrupts because it is potentially valid
interrupt vector number. Reject 0xff only for legacy pin interrupts.

- MSI-X supports up to 2048 interrupts per device that do not fit to
`uint8`.

- Non-x86 systems may use separate interrupt vector ranges for
hard-wired interrupts and MSI interrupts so `uint8` is not enough to
represent all of them.

Change-Id: Iaf9ffb197ec23db0f97ffe3ea756d28d7bfc8705
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7433
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# d229332a 02-Jul-2014 Augustin Cavalier <waddlesplash@gmail.com>

CIDs 1162783 & 1162784: out-of-bounds access & write in MSI.

* The number of IO vectors is not 256 on x86, but rather 224 as set by
NUM_IO_VECTORS in "arch_int.h".
* Jessicah mentioned hearing about MSI crashes before, but that was a
few weeks ago.
* These were the only CIDs in the MSI code.

Signed-off-by: Michael Lotz <mmlr@mlotz.ch>


# 66395144 19-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86[_64]: Support assigning MSI IRQs to arbitrary CPU


# 46f7a54d 26-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

MSI: Use the effective APIC id of the boot CPU for the address destination.

* This should only affect systems where the CPU ids aren't sequential (mostly
non Intel).
* Fixes #9807.


# fa6327c9 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Compile remaining x86 bits for x86_64.

The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.


# 2865db34 20-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile msi.cpp for x86_64.

Needed to link the PCI module, not enabling it yet though, I'm not
sure whether everything needed for it is in place yet.


# 20f094cc 12-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Fix and add copyright year spotted by Urias.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42833 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc2d7cb0 12-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

* Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically
be used to mark certain io interrupt vectors as reserved and to allocate from
the still free ones. It is a kernel private API for now though.
* Make the MSI code use that functionality instead of implementing its own which
slims it down considerably and also removes quite a bit of hardcoded knowledge
about the interrupt layout that didn't really belong there.
* Mark the various in-use interrupts as reserved from the components that
actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a56cbb2a 11-May-2011 Michael Lotz <mmlr@mlotz.ch>

* When initializing MSI support, don't assume a single 24 entry IO-APIC. Instead
mark the ISA interrupts as unusable and then use ioapic_is_interrupt_available
to determine if that vector is possibly taken by an IO-APIC. If IO-APICs are
not used, this will simply always return false, leaving all vectors free for
MSI use.
* The msi_init() now has to be done after a potential IO-APIC init, so it is now
done after ioapic_init() instead of inside apic_init().
* Add apic_disable_local_ints() to clear the local ints on the local APIC once
we are in APIC mode (i.e. the IO-APIC is set up and we don't need the external
routing anymore).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41445 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 33fbe254 13-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
in the assumption of apic local interrupt, MSI or IPI. This also removes
the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
calls in the SMP and timer code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36221 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d229332a33feb23d9ca9f3869ec7c4e4b09a990f 02-Jul-2014 Augustin Cavalier <waddlesplash@gmail.com>

CIDs 1162783 & 1162784: out-of-bounds access & write in MSI.

* The number of IO vectors is not 256 on x86, but rather 224 as set by
NUM_IO_VECTORS in "arch_int.h".
* Jessicah mentioned hearing about MSI crashes before, but that was a
few weeks ago.
* These were the only CIDs in the MSI code.

Signed-off-by: Michael Lotz <mmlr@mlotz.ch>


# 663951443784bb63d60abe742f1d1379fb153e18 19-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86[_64]: Support assigning MSI IRQs to arbitrary CPU


# 46f7a54d8c545ff61d59d6b336232d2b65c3b1fd 26-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

MSI: Use the effective APIC id of the boot CPU for the address destination.

* This should only affect systems where the CPU ids aren't sequential (mostly
non Intel).
* Fixes #9807.


# fa6327c9f48f89f3be1f229d5aca749241b55bf0 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Compile remaining x86 bits for x86_64.

The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.


# 2865db34c861fc7e72d1076885e671b5b2d0e7dc 20-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile msi.cpp for x86_64.

Needed to link the PCI module, not enabling it yet though, I'm not
sure whether everything needed for it is in place yet.


# 20f094cc38adc63ae5b19b07bb90863734012f02 12-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Fix and add copyright year spotted by Urias.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42833 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc2d7cb04d7ad78424169fd0df4d236de2bb17d1 12-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

* Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically
be used to mark certain io interrupt vectors as reserved and to allocate from
the still free ones. It is a kernel private API for now though.
* Make the MSI code use that functionality instead of implementing its own which
slims it down considerably and also removes quite a bit of hardcoded knowledge
about the interrupt layout that didn't really belong there.
* Mark the various in-use interrupts as reserved from the components that
actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a56cbb2afbf4dbfb4a07dfdd95f10637a195a053 11-May-2011 Michael Lotz <mmlr@mlotz.ch>

* When initializing MSI support, don't assume a single 24 entry IO-APIC. Instead
mark the ISA interrupts as unusable and then use ioapic_is_interrupt_available
to determine if that vector is possibly taken by an IO-APIC. If IO-APICs are
not used, this will simply always return false, leaving all vectors free for
MSI use.
* The msi_init() now has to be done after a potential IO-APIC init, so it is now
done after ioapic_init() instead of inside apic_init().
* Add apic_disable_local_ints() to clear the local ints on the local APIC once
we are in APIC mode (i.e. the IO-APIC is set up and we don't need the external
routing anymore).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41445 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 33fbe254964dff2c8b8a3e1522bbefff14d51ea1 13-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
in the assumption of apic local interrupt, MSI or IPI. This also removes
the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
calls in the SMP and timer code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36221 a95241bf-73f2-0310-859d-f6bbb57e9c96