Hi Thanos,

On 10/2/20 4:04 PM, Thanos Makatos wrote:
>> -----Original Message-----
>> From: Auger Eric <eric.au...@redhat.com>
>> Sent: 02 October 2020 14:56
>> To: Thanos Makatos <thanos.maka...@nutanix.com>; vfio-
>> us...@redhat.com
>> Cc: John G Johnson <john.g.john...@oracle.com>
>> Subject: Re: [vfio-users] location of regions
>> VFIO_REGION_TYPE_MIGRATION/VFIO_REGION_SUBTYPE_MIGRATION
>>
>> Hi Thanos,
>>
>> On 10/2/20 2:54 PM, Thanos Makatos wrote:
>>> According to linux/include/uapi/linux/vfio.h, for a device to support
>> migration
>>> it must provide a VFIO capability of type VFIO_REGION_INFO_CAP_TYPE
>> and set
>>> .type/.subtype to
>> VFIO_REGION_TYPE_MIGRATION/VFIO_REGION_TYPE_MIGRATION.
>>>
>>> What confuses me is the following:
>>>
>>> "The structure vfio_device_migration_info is placed at the 0th offset of
>>> the VFIO_REGION_SUBTYPE_MIGRATION region to get and set VFIO
>> device related
>>> migration information."
>>>
>>> Where do regions VFIO_REGION_TYPE_MIGRATION and
>> VFIO_REGION_SUBTYPE_MIGRATION
>>> live on the device's address space? Is just like any other region, except 
>>> that
>>> in the case of a PCI device it's index must be equal to, or larger than,
>>> VFIO_PCI_NUM_REGIONS, and set arbitrarily by the device
>> implementation? If
>>> so, then I suppose this index must appear in struct
>> vfio_device_info.num_regions?
>>
>> You need to call VFIO_DEVICE_GET_REGION_INFO with the region
>> type/subtype. The index of the region is stored in struct
>> vfio_region_info index.
> 
> Are you talking from perspective of the user or the driver? I want to know how
> to support migration in the driver. VFIO_DEVICE_GET_REGION_INFO doesn't take a
> type/subtype argument, it only takes the region index and the driver fills in
> the rest of the information.
> 
Yep sorry I was talking about the user perspective and rather looked at
the QEMU helpers. Iterate on all regions using
VFIO_DEVICE_GET_REGION_INFO. Test the retrieved info has the
VFIO_REGION_INFO_CAP_TYPE cap. If it has, compare
vfio_region_info_cap_type type/subtype against the one you look for. If
it has this is the one you look for and you have the index.

In the kernel such region is added using vfio_pci_register_dev_region()

Hope this clarifies

Eric


_______________________________________________
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users

Reply via email to