aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/pci
AgeCommit message (Expand)AuthorFilesLines
2019-01-31pci: get the number of interruptsMohsin Kazmi1-0/+3
2019-01-07avf: allocate descriptor memory from local numaDamjan Marion1-0/+1
2018-10-23vlib: Add support for pci io read/writeMohsin Kazmi1-12/+29
2018-10-23Numa-aware, growable physical memory allocator (pmalloc)Damjan Marion1-0/+5
2018-10-22vlib: pci improvementsDamjan Marion2-39/+52
2018-04-09plugins: unload plugin if early init failsDamjan Marion1-0/+8
2018-03-26vlib: add support for vfio no-iommu modeDamjan Marion1-0/+3
2018-03-05vlib: add functions to dynamically open/close PCI deviceDamjan Marion1-0/+5
2018-03-05vlib: rework PCI INTx supportDamjan Marion1-0/+3
2018-03-04vlib: add PCI MSI-X interrupt support (vfio only)Damjan Marion1-1/+14
2018-03-04vlib: map pci region by using vfio FD when vfio is usedDamjan Marion1-5/+5
2018-02-26vlib: fix formatting in pci_config.hDamjan Marion1-103/+111
2017-12-09vlib: PCI rework to support VFIODamjan Marion2-93/+110
2017-11-28net/virtio: support modern device idGabriel Ganne1-0/+7
2017-10-04[aarch64] Fixes CLI crashes on dpaa2 platform.Christophe Fontaine1-1/+1
2017-09-08vlib: move linux-specific code to vlib/linuxDamjan Marion1-665/+0
2017-07-10vlib: fix issues with PCI handling codeDamjan Marion2-7/+7
2017-05-24vlib: use driver_override in sysfs for binding pci devs to vfio/uio driversDamjan Marion1-12/+30
2017-05-08vlib: do not unbind devices already bound to vfio-pciDamjan Marion1-0/+5
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion4-0/+1888
i/pci.h> #include <vlib/linux/vfio.h> #ifdef __x86_64__ /* we keep physmem in low 38 bits of VA address space as some IOMMU implamentation cannot map above that range */ #define VLIB_PHYSMEM_DEFAULT_BASE_ADDDR (1ULL << 36) #else /* let kernel decide */ #define VLIB_PHYSMEM_DEFAULT_BASE_ADDDR 0 #endif clib_error_t * vlib_physmem_shared_map_create (vlib_main_t * vm, char *name, uword size, u32 log2_page_sz, u32 numa_node, u32 * map_index) { clib_pmalloc_main_t *pm = vm->physmem_main.pmalloc_main; vlib_physmem_main_t *vpm = &vm->physmem_main; vlib_physmem_map_t *map; clib_pmalloc_arena_t *a; clib_error_t *error = 0; void *va; uword i; va = clib_pmalloc_create_shared_arena (pm, name, size, log2_page_sz, numa_node); if (va == 0) return clib_error_return (0, "%U", format_clib_error, clib_pmalloc_last_error (pm)); a = clib_pmalloc_get_arena (pm, va); pool_get (vpm->maps, map); *map_index = map->index = map - vpm->maps; map->base = va; map->fd = a->fd; map->n_pages = a->n_pages * a->subpages_per_page; map->log2_page_size = a->log2_subpage_sz; map->numa_node = a->numa_node; for (i = 0; i < a->n_pages; i++) { uword pa = clib_pmalloc_get_pa (pm, (u8 *) va + (i << a->log2_subpage_sz)); /* maybe iova */ if (pa == 0) pa = pointer_to_uword (va); vec_add1 (map->page_table, pa); } return error; } vlib_physmem_map_t * vlib_physmem_get_map (vlib_main_t * vm, u32 index) { vlib_physmem_main_t *vpm = &vm->physmem_main; return pool_elt_at_index (vpm->maps, index); } clib_error_t * vlib_physmem_init (vlib_main_t * vm) { vlib_physmem_main_t *vpm = &vm->physmem_main; clib_error_t *error = 0; u64 *pt = 0; void *p; /* check if pagemap is accessible */ pt = clib_mem_vm_get_paddr (&pt, min_log2 (sysconf (_SC_PAGESIZE)), 1); if (pt && pt[0]) vpm->flags |= VLIB_PHYSMEM_MAIN_F_HAVE_PAGEMAP; vec_free (pt); if ((error = linux_vfio_init (vm))) return error; p = clib_mem_alloc_aligned (sizeof (clib_pmalloc_main_t), CLIB_CACHE_LINE_BYTES); memset (p, 0, sizeof (clib_pmalloc_main_t)); vpm->pmalloc_main = (clib_pmalloc_main_t *) p; if (vpm->base_addr == 0) vpm->base_addr = VLIB_PHYSMEM_DEFAULT_BASE_ADDDR; clib_pmalloc_init (vpm->pmalloc_main, vpm->base_addr, 0); return error; } static clib_error_t * show_physmem (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vlib_physmem_main_t *vpm = &vm->physmem_main; unformat_input_t _line_input, *line_input = &_line_input; u32 verbose = 0, map = 0; if (unformat_user (input, unformat_line_input, line_input)) { while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { if (unformat (line_input, "verbose")) verbose = 1; else if (unformat (line_input, "v")) verbose = 1; else if (unformat (line_input, "detail")) verbose = 2; else if (unformat (line_input, "d")) verbose = 2; else if (unformat (line_input, "map")) map = 1; else break; } unformat_free (line_input); } if (map) vlib_cli_output (vm, " %U", format_pmalloc_map, vpm->pmalloc_main); else vlib_cli_output (vm, " %U", format_pmalloc, vpm->pmalloc_main, verbose); return 0; } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_physmem_command, static) = { .path = "show physmem", .short_help = "show physmem [verbose | detail | map]", .function = show_physmem, }; /* *INDENT-ON* */ static clib_error_t * vlib_physmem_config (vlib_main_t * vm, unformat_input_t * input) { vlib_physmem_main_t *vpm = &vm->physmem_main; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "base-addr 0x%lx", &vpm->base_addr)) ; else return unformat_parse_error (input); } unformat_free (input); return 0; } VLIB_EARLY_CONFIG_FUNCTION (vlib_physmem_config, "physmem"); /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */