c9881212948f3c572f8f3b6d68923b6a03490ac2
[dpdk.git] / drivers / bus / fslmc / fslmc_vfio.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
4  *   Copyright 2016,2019 NXP
5  *
6  */
7
8 #ifndef _FSLMC_VFIO_H_
9 #define _FSLMC_VFIO_H_
10
11 #include <rte_vfio.h>
12
13 /* Pathname of FSL-MC devices directory. */
14 #define SYSFS_FSL_MC_DEVICES    "/sys/bus/fsl-mc/devices"
15 #define DPAA2_MC_DPNI_DEVID     7
16 #define DPAA2_MC_DPSECI_DEVID   3
17 #define DPAA2_MC_DPCON_DEVID    5
18 #define DPAA2_MC_DPIO_DEVID     9
19 #define DPAA2_MC_DPBP_DEVID     10
20 #define DPAA2_MC_DPCI_DEVID     11
21
22 typedef struct fslmc_vfio_device {
23         int fd; /* fslmc root container device ?? */
24         int index; /*index of child object */
25         struct fslmc_vfio_device *child; /* Child object */
26 } fslmc_vfio_device;
27
28 typedef struct fslmc_vfio_group {
29         int fd; /* /dev/vfio/"groupid" */
30         int groupid;
31         struct fslmc_vfio_container *container;
32         int object_index;
33         struct fslmc_vfio_device *vfio_device;
34 } fslmc_vfio_group;
35
36 typedef struct fslmc_vfio_container {
37         int fd; /* /dev/vfio/vfio */
38         int used;
39         int index; /* index in group list */
40         struct fslmc_vfio_group *group;
41 } fslmc_vfio_container;
42
43 extern char *fslmc_container;
44 int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index);
45 int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index);
46
47 int rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
48                               int vfio_dev_fd,
49                               int num_irqs);
50
51 int fslmc_vfio_setup_group(void);
52 int fslmc_vfio_process_group(void);
53 char *fslmc_get_container(void);
54 int fslmc_get_container_group(int *gropuid);
55 int rte_fslmc_vfio_dmamap(void);
56 __rte_experimental
57 int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size);
58
59 #endif /* _FSLMC_VFIO_H_ */