Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Inter-VM Shared Memory

Interfaces for Inter-VM Shared Memory (ivshmem). More...

Functions

size_t ivshmem_get_mem (const struct device *dev, uintptr_t *memmap)
 Get the inter-VM shared memory.
uint32_t ivshmem_get_id (const struct device *dev)
 Get our VM ID.
uint16_t ivshmem_get_vectors (const struct device *dev)
 Get the number of interrupt vectors we can use.
int ivshmem_int_peer (const struct device *dev, uint32_t peer_id, uint16_t vector)
 Interrupt another VM.
int ivshmem_register_handler (const struct device *dev, struct k_poll_signal *signal, uint16_t vector)
 Register a vector notification (interrupt) handler.
size_t ivshmem_get_rw_mem_section (const struct device *dev, uintptr_t *memmap)
 Get the ivshmem read/write section (ivshmem-v2 only).
size_t ivshmem_get_output_mem_section (const struct device *dev, uint32_t peer_id, uintptr_t *memmap)
 Get the ivshmem output section for a peer (ivshmem-v2 only).
uint32_t ivshmem_get_state (const struct device *dev, uint32_t peer_id)
 Get the state value of a peer (ivshmem-v2 only).
int ivshmem_set_state (const struct device *dev, uint32_t state)
 Set our state (ivshmem-v2 only).
uint32_t ivshmem_get_max_peers (const struct device *dev)
 Get the maximum number of peers supported (ivshmem-v2 only).
uint16_t ivshmem_get_protocol (const struct device *dev)
 Get the protocol used by this ivshmem instance (ivshmem-v2 only).
int ivshmem_enable_interrupts (const struct device *dev, bool enable)
 Set the interrupt enablement for our VM (ivshmem-v2 only).

Detailed Description

Interfaces for Inter-VM Shared Memory (ivshmem).

Function Documentation

◆ ivshmem_enable_interrupts()

int ivshmem_enable_interrupts ( const struct device * dev,
bool enable )

#include <zephyr/drivers/virtualization/ivshmem.h>

Set the interrupt enablement for our VM (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
enableTrue to enable interrupts, false to disable
Returns
0 on success, a negative errno otherwise

◆ ivshmem_get_id()

uint32_t ivshmem_get_id ( const struct device * dev)

#include <zephyr/drivers/virtualization/ivshmem.h>

Get our VM ID.

Parameters
devPointer to the device structure for the driver instance
Returns
our VM ID or 0 if we are not running on doorbell version

◆ ivshmem_get_max_peers()

uint32_t ivshmem_get_max_peers ( const struct device * dev)

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the maximum number of peers supported (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
Returns
the maximum number of peers supported, or 0

◆ ivshmem_get_mem()

size_t ivshmem_get_mem ( const struct device * dev,
uintptr_t * memmap )

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the inter-VM shared memory.

Note: This API is not supported for ivshmem-v2, as the R/W and R/O areas may not be mapped contiguously. For ivshmem-v2, use the ivshmem_get_rw_mem_section, ivshmem_get_output_mem_section and ivshmem_get_state APIs to access the shared memory.

Parameters
devPointer to the device structure for the driver instance
memmapA pointer to fill in with the memory address
Returns
the size of the memory mapped, or 0

◆ ivshmem_get_output_mem_section()

size_t ivshmem_get_output_mem_section ( const struct device * dev,
uint32_t peer_id,
uintptr_t * memmap )

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the ivshmem output section for a peer (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
peer_idThe VM ID whose output memory section to get
memmapA pointer to fill in with the memory address
Returns
the size of the memory mapped, or 0

◆ ivshmem_get_protocol()

uint16_t ivshmem_get_protocol ( const struct device * dev)

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the protocol used by this ivshmem instance (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
Returns
the protocol

◆ ivshmem_get_rw_mem_section()

size_t ivshmem_get_rw_mem_section ( const struct device * dev,
uintptr_t * memmap )

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the ivshmem read/write section (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
memmapA pointer to fill in with the memory address
Returns
the size of the memory mapped, or 0

◆ ivshmem_get_state()

uint32_t ivshmem_get_state ( const struct device * dev,
uint32_t peer_id )

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the state value of a peer (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
peer_idThe VM ID whose state to get
Returns
the state value of the peer

◆ ivshmem_get_vectors()

uint16_t ivshmem_get_vectors ( const struct device * dev)

#include <zephyr/drivers/virtualization/ivshmem.h>

Get the number of interrupt vectors we can use.

Parameters
devPointer to the device structure for the driver instance
Returns
the number of available interrupt vectors

◆ ivshmem_int_peer()

int ivshmem_int_peer ( const struct device * dev,
uint32_t peer_id,
uint16_t vector )

#include <zephyr/drivers/virtualization/ivshmem.h>

Interrupt another VM.

Parameters
devPointer to the device structure for the driver instance
peer_idThe VM ID to interrupt
vectorThe interrupt vector to use
Returns
0 on success, a negative errno otherwise

◆ ivshmem_register_handler()

int ivshmem_register_handler ( const struct device * dev,
struct k_poll_signal * signal,
uint16_t vector )

#include <zephyr/drivers/virtualization/ivshmem.h>

Register a vector notification (interrupt) handler.

Parameters
devPointer to the device structure for the driver instance
signalA pointer to a valid and ready to be signaled struct k_poll_signal. Or NULL to unregister any handler registered for the given vector.
vectorThe interrupt vector to get notification from

Note: The returned status, if positive, to a raised signal is the vector that generated the signal. This lets the possibility to the user to have one signal for all vectors, or one per-vector.

Returns
0 on success, a negative errno otherwise

◆ ivshmem_set_state()

int ivshmem_set_state ( const struct device * dev,
uint32_t state )

#include <zephyr/drivers/virtualization/ivshmem.h>

Set our state (ivshmem-v2 only).

Attention
Available only when the following Kconfig option is enabled: CONFIG_IVSHMEM_V2.
Parameters
devPointer to the device structure for the driver instance
stateThe state value to set
Returns
0 on success, a negative errno otherwise