linux - what is "num_regions" returned by the ioctl (VFIO_DEVICE_GET_REGION_INFO) in vfio -


i trying understand how vfio works on pci. have read https://www.kernel.org/doc/documentation/vfio.txt, , writting test based on it. @ point,my code looks this:

/* pci device information (number of regions , interrupts...) */ ret = ioctl(vfio_dev_fd, vfio_device_get_info, &device_info); if (ret) {         printf("  %s cannot device info, "                         "error %i (%s)\n", pci_addr, errno, strerror(errno));         close(vfio_dev_fd);         return -1; } printf ("found %d regions in device\n", device_info.num_regions); 

what not understand last printf shows 9 (nine) regions! looking @ config space of pci device can see:

cat /sys/bus/pci/devices/0000\:06\:00.0/config | hd 00000000  e4 14 81 16 00 04 10 00  10 00 00 02 10 00 00 00  |................| 00000010  04 00 de f3 00 00 00 00  04 00 df f3 00 00 00 00  |................| 00000020  00 00 00 00 00 00 00 00  00 00 00 00 28 10 6e 02  |............(.n.| 00000030  00 00 00 00 48 00 00 00  00 00 00 00 0a 01 00 00  |....h...........| 00000040 

i new pci, interpretation of there 2 barss on board (0 , 2). , though max number of regions (bars?) 6 on pci.

there nevertheless little indication misunderstanding something: kernel doc mentioned above states:

for pci devices, config space region

so lead 3 regions board looking at... still says 9... pci region pci_vfio? how numbered , accessed?...

thanks.

from vfio.h:

/*  * vfio-pci bus driver makes use of following fixed region ,  * irq index mapping.  unimplemented regions return size of zero.  * unimplemented irq types return count of zero.  */  enum {     vfio_pci_bar0_region_index,     vfio_pci_bar1_region_index,     vfio_pci_bar2_region_index,     vfio_pci_bar3_region_index,     vfio_pci_bar4_region_index,     vfio_pci_bar5_region_index,     vfio_pci_rom_region_index,     vfio_pci_config_region_index,     /*      * expose vga regions defined pci base class 03, subclass 00.      * includes i/o port ranges 0x3b0 0x3bb , 0x3c0 0x3df      * mmio range 0xa0000 0xbffff.  each implemented      * range found @ it's identity mapped offset region      * offset, example 0x3b0 region_info.offset + 0x3b0.  areas      * between described ranges unimplemented.      */     vfio_pci_vga_region_index,     vfio_pci_num_regions }; 

so, these additional regions way provide access configuration space, option rom , vga-specific i/o (ports , legacy framebuffer 0xa0000...0xbffff window).


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -