blob: e23cee19931a231a7b8f1748152dcb2b25a5d9d5 [file] [log] [blame]
Damjan Marion1ba0fa42018-03-04 17:19:08 +01001/*
2 * Copyright (c) 2018 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef included_vlib_linux_vfio_h
17#define included_vlib_linux_vfio_h
18
19typedef struct
20{
21 int group;
22 int fd;
23 int refcnt;
24} linux_pci_vfio_iommu_group_t;
25
26typedef struct
27{
28 u32 flags;
29#define LINUX_VFIO_F_HAVE_IOMMU (1 << 0)
30 int container_fd;
Damjan Marion1ba0fa42018-03-04 17:19:08 +010031
32 /* VFIO */
33 int iommu_mode;
34
35 /* pool of IOMMU groups */
36 linux_pci_vfio_iommu_group_t *iommu_groups;
37
38 /* iommu group pool index by group id hash */
39 uword *iommu_pool_index_by_group;
40
41} linux_vfio_main_t;
42
43extern linux_vfio_main_t vfio_main;
44
45clib_error_t *linux_vfio_init (vlib_main_t * vm);
46void linux_vfio_dma_map_regions (vlib_main_t * vm);
47clib_error_t *linux_vfio_group_get_device_fd (vlib_pci_addr_t * addr,
48 int *fd);
49
50
51#endif /* included_vlib_linux_vfio_h */
52
53/*
54 * fd.io coding-style-patch-verification: ON
55 *
56 * Local Variables:
57 * eval: (c-set-style "gnu")
58 * End:
59 */