On 30.09.2021 11:35, Oleksandr Andrushchenko wrote:
> On 30.09.21 11:53, Jan Beulich wrote:
>> On 30.09.2021 09:52, Oleksandr Andrushchenko wrote:
>>> --- a/xen/drivers/passthrough/pci.c
>>> +++ b/xen/drivers/passthrough/pci.c
>>> @@ -889,6 +889,31 @@ int pci_remove_virtual_device(struct domain *d, const
>>> struct pci_dev *pdev)
>>> xfree(vdev);
>>> return 0;
>>> }
>>> +
>>> +/*
>>> + * Find the physical device which is mapped to the virtual device
>>> + * and translate virtual SBDF to the physical one.
>>> + */
>>> +bool pci_translate_virtual_device(const struct domain *d, pci_sbdf_t *sbdf)
>>> +{
>>> + struct vpci_dev *vdev;
>> const (afaict)
> Ok
>>
>>> + bool found = false;
>>> +
>>> + pcidevs_lock();
>>> + list_for_each_entry ( vdev, &d->vdev_list, list )
>>> + {
>>> + if ( vdev->sbdf.sbdf == sbdf->sbdf )
>>> + {
>>> + /* Replace virtual SBDF with the physical one. */
>>> + *sbdf = vdev->pdev->sbdf;
>>> + found = true;
>>> + break;
>>> + }
>>> + }
>>> + pcidevs_unlock();
>> As per the comments on the earlier patch, locking as well as placement
>> may need reconsidering.
> Other then that do you have other comments on this?
Iirc this was the only thing here. But I haven't got around to look
at patches 4-9 yet ...
Jan