NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_devemu_pci.h File Reference
#include <stdint.h>
#include <sys/uio.h>
#include <doca_error.h>
#include <doca_dev.h>
#include <doca_mmap.h>
#include <doca_ctx.h>
#include <doca_pe.h>
#include <doca_devemu_pci_type.h>
Include dependency graph for doca_devemu_pci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef uint64_t doca_dpa_dev_devemu_pci_db_t
 DPA handle for emulated PCI device doorbell. More...
 
typedef uint64_t doca_dpa_dev_devemu_pci_db_completion_t
 DPA handle for emulated PCI device doorbell completion context. More...
 
typedef uint64_t doca_dpa_dev_devemu_pci_msix_t
 DPA handle for emulated PCI device MSI-X. More...
 
typedef void(* doca_devemu_pci_dev_event_hotplug_state_change_handler_cb_t) (struct doca_devemu_pci_dev *pci_dev, union doca_data user_data)
 Function to be executed on hotplug state change event occurrence. More...
 
typedef void(* doca_devemu_pci_dev_event_bar_stateful_region_driver_write_handler_cb_t) (struct doca_devemu_pci_dev_event_bar_stateful_region_driver_write *event, union doca_data user_data)
 Function to be executed on PCI write transactions to BAR stateful region. More...
 
typedef void(* doca_devemu_pci_dev_event_flr_handler_cb_t) (struct doca_devemu_pci_dev *pci_dev, union doca_data user_data)
 Function to be executed on PCI FLR (Function Level Reset). The event handler will enable users to quiesce, flush and reset the necessary resources associated with the emulated PCI device. Upon event, all PCI I/O transactions to/from the host memory are disabled. Additionally, the user should re-configure the emulated PCI device. This re-configuration requires flushing of all the outstanding resources associated with the emulated PCI device, which were initially owned by the PCI device and moved the the ownership of the user. The re-configuration also requires destruction of all the associated resources (e.g. DBs, MSIXs, MMAPs), resetting the associated emulated PCI device (perform stop() and start() operations) and re-creating all the needed resources. More...
 

Enumerations

enum  doca_devemu_pci_hotplug_state { DOCA_DEVEMU_PCI_HP_STATE_POWER_OFF = 0 , DOCA_DEVEMU_PCI_HP_STATE_UNPLUG_IN_PROGRESS , DOCA_DEVEMU_PCI_HP_STATE_PLUG_IN_PROGRESS , DOCA_DEVEMU_PCI_HP_STATE_POWER_ON }
 DOCA devemu pci hotplug state. More...
 

Functions

DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_cap_get_max_hotplug_devices (const struct doca_devinfo *devinfo, uint32_t *max_hotplug_devices)
 Get the maximum number of PCI devices, across all PCI types, that can be hot-plugged by the device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_cap_is_mmap_add_dev_supported (const struct doca_devinfo *devinfo, uint8_t *supported)
 Check if adding the device to a DOCA mmap associated with a DOCA devemu PCI device is supported. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_create (struct doca_devemu_pci_type *pci_type, struct doca_dev_rep *dev_rep, struct doca_pe *progress_engine, struct doca_devemu_pci_dev **pci_dev)
 Allocate DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_destroy (struct doca_devemu_pci_dev *pci_dev)
 Free a DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_device_id (const struct doca_devemu_pci_dev *pci_dev, uint16_t *device_id)
 Get the PCI Device ID configured to DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_device_id (struct doca_devemu_pci_dev *pci_dev, uint16_t device_id)
 Set the PCI Device ID of a specific DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_vendor_id (const struct doca_devemu_pci_dev *pci_dev, uint16_t *vendor_id)
 Get the PCI Vendor ID configured to DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_vendor_id (struct doca_devemu_pci_dev *pci_dev, uint16_t vendor_id)
 Set the PCI Vendor ID of a specific DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_subsystem_id (const struct doca_devemu_pci_dev *pci_dev, uint16_t *subsystem_id)
 Get the PCI Subsystem ID configured to DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_subsystem_id (struct doca_devemu_pci_dev *pci_dev, uint16_t subsystem_id)
 Set the PCI Subsystem ID of a specific DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_subsystem_vendor_id (const struct doca_devemu_pci_dev *pci_dev, uint16_t *subsystem_vid)
 Get the PCI Subsystem Vendor ID configured to DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_subsystem_vendor_id (struct doca_devemu_pci_dev *pci_dev, uint16_t subsystem_vid)
 Set the PCI Subsystem Vendor ID of a specific DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_revision_id (const struct doca_devemu_pci_dev *pci_dev, uint8_t *revision_id)
 Get the PCI Revision ID configured to DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_revision_id (struct doca_devemu_pci_dev *pci_dev, uint8_t revision_id)
 Set the PCI Revision ID of a specific DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_class_code (const struct doca_devemu_pci_dev *pci_dev, uint32_t *class_code)
 Get the PCI Class Code configured to DOCA devemu PCI device to identify generic operation. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_class_code (struct doca_devemu_pci_dev *pci_dev, uint32_t class_code)
 Set the PCI Class Code of a specific DOCA devemu PCI device to identify generic operation. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_num_msix (const struct doca_devemu_pci_dev *pci_dev, uint16_t *num_msix)
 Get the number of MSI-X vectors configured to DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_set_num_msix (struct doca_devemu_pci_dev *pci_dev, uint16_t num_msix)
 Set the number of MSI-X vectors of a specific DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_modify_bar_stateful_region_default_values (struct doca_devemu_pci_dev *pci_dev, uint8_t id, uint64_t start_addr, void *default_values, uint64_t size)
 Modify default registers values for stateful region in a DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_modify_bar_stateful_region_values (struct doca_devemu_pci_dev *pci_dev, uint8_t id, uint64_t offset, void *values, uint64_t size)
 Modify registers values for stateful region in a DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_query_bar_stateful_region_values (struct doca_devemu_pci_dev *pci_dev, uint8_t id, uint64_t offset, void *out_values, uint64_t size)
 Query registers values of the stateful region in a DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL struct doca_ctx * doca_devemu_pci_dev_as_ctx (struct doca_devemu_pci_dev *pci_dev)
 Convert DOCA devemu PCI device instance into DOCA context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_is_flr (const struct doca_devemu_pci_dev *pci_dev, uint8_t *flr)
 Query wheather the DOCA devemu PCI device is having FLR (Function Level Reset). More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_hotplug_state (struct doca_devemu_pci_dev *pci_dev, enum doca_devemu_pci_hotplug_state *state)
 Get the hotplug state of the DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_rep_get_hotplug_state (struct doca_dev_rep *rep_dev, enum doca_devemu_pci_hotplug_state *state)
 Get the hotplug state of a DOCA representor device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_hotplug (struct doca_devemu_pci_dev *pci_dev)
 Issue hotplug procedure of the DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_hotunplug (struct doca_devemu_pci_dev *pci_dev)
 Issue hot unplug procedure of the DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_event_hotplug_state_change_register (struct doca_devemu_pci_dev *pci_dev, doca_devemu_pci_dev_event_hotplug_state_change_handler_cb_t handler, union doca_data user_data)
 Register to hotplug state changes. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_event_bar_stateful_region_driver_write_register (struct doca_devemu_pci_dev *pci_dev, doca_devemu_pci_dev_event_bar_stateful_region_driver_write_handler_cb_t handler, uint8_t bar_id, uint64_t bar_region_start_addr, union doca_data user_data)
 Register to BAR stateful region driver write event. More...
 
DOCA_EXPERIMENTAL struct doca_devemu_pci_dev * doca_devemu_pci_dev_event_bar_stateful_region_driver_write_get_pci_dev (struct doca_devemu_pci_dev_event_bar_stateful_region_driver_write *event)
 Get DOCA devemu PCI device from BAR stateful region driver write event. More...
 
DOCA_EXPERIMENTAL uint8_t doca_devemu_pci_dev_event_bar_stateful_region_driver_write_get_bar_id (struct doca_devemu_pci_dev_event_bar_stateful_region_driver_write *event)
 Get the BAR id from BAR stateful region driver write event. More...
 
DOCA_EXPERIMENTAL uint64_t doca_devemu_pci_dev_event_bar_stateful_region_driver_write_get_bar_region_start_addr (struct doca_devemu_pci_dev_event_bar_stateful_region_driver_write *event)
 Get the BAR region start address that is associated with BAR stateful region driver write event. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_event_flr_register (struct doca_devemu_pci_dev *pci_dev, doca_devemu_pci_dev_event_flr_handler_cb_t handler, union doca_data user_data)
 Register to PCI FLR (Function Level Reset) event. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_create (struct doca_dpa_thread *th, struct doca_devemu_pci_db_completion **db_comp)
 Allocate DOCA devemu PCI device doorbell completion context on DPA. The created completion context will be associated with a single dpa thread. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_destroy (struct doca_devemu_pci_db_completion *db_comp)
 Destroy the DOCA devemu PCI device doorbell completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_start (struct doca_devemu_pci_db_completion *db_comp)
 Start DOCA devemu PCI device doorbell completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_stop (struct doca_devemu_pci_db_completion *db_comp)
 Stop DOCA devemu PCI device doorbell completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_get_dpa_handle (struct doca_devemu_pci_db_completion *db_comp, doca_dpa_dev_devemu_pci_db_completion_t *db_comp_handle)
 Get the DPA handle for the DOCA devemu PCI device doorbell completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_set_max_num_dbs (struct doca_devemu_pci_db_completion *db_comp, uint32_t num_dbs)
 Set the maximal number of doorbells that can be associated with the completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_get_max_num_dbs (struct doca_devemu_pci_db_completion *db_comp, uint32_t *num_dbs)
 Get the maximal number of doorbells that can be associated with the completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_completion_get_curr_num_dbs (struct doca_devemu_pci_db_completion *db_comp, uint32_t *num_dbs)
 Get the current number of doorbells that are associated with the completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_create_on_dpa (struct doca_devemu_pci_dev *pci_dev, struct doca_devemu_pci_db_completion *db_comp, uint8_t bar_id, uint64_t bar_start_addr, uint32_t db_id, uint64_t user_data_on_dpa, struct doca_devemu_pci_db **db)
 Allocate DOCA devemu PCI device doorbell on DPA. The created doorbell will be associated with a single completion context that was also created on DPA. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_destroy (struct doca_devemu_pci_db *db)
 Destroy the DOCA devemu PCI device doorbell. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_get_dpa_handle (struct doca_devemu_pci_db *db, doca_dpa_dev_devemu_pci_db_t *db_handle)
 Get the DPA handle for the DOCA devemu PCI device doorbell. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_start (struct doca_devemu_pci_db *db)
 Start DOCA devemu PCI device doorbell. A started doorbell will be able to trigger completions on the associated doorbell completion context. Therefore, in case the doorbell was created on DPA, one should bind the associated doorbell handle to its doorbell completion context before starting the doorbell. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_stop (struct doca_devemu_pci_db *db)
 Stop DOCA devemu PCI device doorbell. A stopped doorbell will not trigger completions on the associated doorbell completion context. Therefore, in case the doorbell was created on DPA, one should stop the doorbell before un-binding the associated doorbell handle from its doorbell completion context. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_modify_value (struct doca_devemu_pci_db *db, uint32_t db_value)
 Modify the current value of DOCA devemu PCI device doorbell. If the doorbell is started, this setting will behave as if the doorbell value was modified by the PCI device driver. If doorbell value will not be modified before starting the DOCA devemu PCI device doorbell, the device will keep the current value of the doorbell. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_db_query_value (struct doca_devemu_pci_db *db, uint32_t *db_value)
 Query the current value of DOCA devemu PCI device doorbell. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_msix_create_on_dpa (struct doca_devemu_pci_dev *pci_dev, uint8_t bar_id, uint64_t bar_start_addr, uint16_t msix_idx, uint64_t user_data_on_dpa, struct doca_devemu_pci_msix **msix)
 Allocate DOCA devemu PCI device MSI-X context on DPA. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_msix_destroy (struct doca_devemu_pci_msix *msix)
 Destroy the DOCA devemu PCI device MSI-X. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_msix_get_dpa_handle (struct doca_devemu_pci_msix *msix, doca_dpa_dev_devemu_pci_msix_t *msix_handle)
 Get the DPA handle for the DOCA devemu PCI device MSI-X. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_mmap_create (struct doca_devemu_pci_dev *pci_dev, struct doca_mmap **mmap)
 Allocates zero size memory map object with default/unset attributes associated with a DOCA devemu PCI device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_get_available_resources (const struct doca_devinfo *devinfo, struct doca_devemu_pci_resources **pci_resources)
 Retrieve available PCI resources for device usage. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_release_resources (struct doca_devemu_pci_resources *pci_resources)
 Release the DOCA devemu PCI resources structure. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_resources_get_num_msix (const struct doca_devemu_pci_resources *pci_resources, uint32_t *num_msix)
 Retrieve the number of MSI-X vectors from a PCI resources structure. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_resources_get_num_db (const struct doca_devemu_pci_resources *pci_resources, uint32_t *num_db)
 Retrieve the number of Doorbells from a PCI resources structure. More...