[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC server v2 04/11] vfio-user: find and init PCI device
From: |
Jag Raman |
Subject: |
Re: [PATCH RFC server v2 04/11] vfio-user: find and init PCI device |
Date: |
Fri, 10 Sep 2021 15:02:36 +0000 |
> On Sep 8, 2021, at 8:43 AM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Fri, Aug 27, 2021 at 01:53:23PM -0400, Jagannathan Raman wrote:
>> @@ -96,6 +102,28 @@ static void vfu_object_machine_done(Notifier *notifier,
>> void *data)
>> strerror(errno));
>> return;
>> }
>> +
>> + dev = qdev_find_recursive(sysbus_get_default(), o->devid);
>> + if (dev == NULL) {
>> + error_setg(&error_abort, "vfu: Device %s not found", o->devid);
>> + return;
>> + }
>> +
>> + if (!object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
>> + error_setg(&error_abort, "vfu: %s not a PCI devices", o->devid);
>> + return;
>> + }
>> +
>> + o->pci_dev = PCI_DEVICE(dev);
>> +
>> + ret = vfu_pci_init(o->vfu_ctx, VFU_PCI_TYPE_CONVENTIONAL,
>> + PCI_HEADER_TYPE_NORMAL, 0);
>
> What is needed to support PCI Express?
I think we could check if o->pci_dev supports QEMU_PCI_CAP_EXPRESS,
and based on that choose if we should use
VFU_PCI_TYPE_CONVENTIONAL or VFU_PCI_TYPE_EXPRESS.
pci_is_express() is already doing that, although it’s a private function
now. It’s a good time to export it.
--
Jag