OpenBSD manual page server

Manual Page Search Parameters

INTRMAP_CREATE(9) Kernel Developer's Manual INTRMAP_CREATE(9)

intrmap_create, intrmap_destroy, intrmap_count, intrmap_cpuinterrupt to CPU mapping API

#include <sys/intrmap.h>

struct intrmap *
intrmap_create(const struct device *dv, unsigned int nintr, unsigned int maxintr, unsigned int flags);

void
intrmap_destroy(struct intrmap *im);

unsigned int
intrmap_count(struct intrmap *im);

struct cpu_info *
intrmap_cpu(struct intrmap *im, unsigned int index);

The interrupt to CPU mapping API supports the use of multiple CPUs by hardware drivers. Drivers that can use multiple interrupts use the API to request a set of CPUs that they can establish those interrupts on. The API limits the requested number of interrupts to what is available on the system, and attempts to distribute the requested interrupts over those CPUs. On some platforms the API will filter the set of available CPUs.

() allocates an interrupt map data structure for use by the driver identified by dv. The number of interrupts the hardware supports is specified via the nintr argument. The driver supplies the maximum number of interrupts it can support via maxintr, which, along with the number of available CPUs at the time the function is called, is used as a constraint on the number of requested interrupts. nintr may be zero to use the driver limit as the number of requested interrupts. The flags argument may have the following defines OR'ed together:

The hardware only supports a power of 2 number of interrupts, so constrain the number of supplied interrupts after the system and driver limits are applied.

() frees the memory associated with the interrupt map data structure passed via im.

() returns the number of interrupts that the driver can establish according to the im interrupt map.

() returns which CPU the interrupt specified in index should be established on according to the im interrupt map. Interrupts are identified as a number from 0 to the value returned by intrmap_count().

intrmap_create(), intrmap_destroy(), intrmap_count(), and intrmap_cpu() can be called during autoconf, or from process context.

intrmap_create() returns a pointer to an interrupt mapping structure on success, or NULL on failure.

intrmap_count() returns the number of interrupts that were allocated for the driver to use.

intrmap_cpu() returns a pointer to the cpu_info structure for the CPU that the interrupt should be established on.

The interrupt mapping API is based on the if_ringmap API in DragonFly. It was ported to OpenBSD 6.8 by David Gwynne <dlg@openbsd.org>.

July 31, 2022 OpenBSD-current