qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 4/5] vmxnet3: The vmxnet3 device is a PCIE en


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH v2 4/5] vmxnet3: The vmxnet3 device is a PCIE endpoint
Date: Mon, 7 Dec 2015 10:46:52 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


On 12/05/2015 03:57 AM, Shmulik Ladkani wrote:
> Thanks Jason,
>
> On Fri, 4 Dec 2015 16:49:52 +0800 Jason Wang <address@hidden> wrote:
>>> @@ -2257,6 +2262,10 @@ static void vmxnet3_pci_realize(PCIDevice *pci_dev, 
>>> Error **errp)
>>>  
>>>      vmxnet3_net_init(s);
>>>  
>>> +    if (pci_is_express(pci_dev) && pci_bus_is_express(pci_dev->bus)) {
>> Looks like pci_bus_is_express() has been checked in
>> pcie_endpoint_cap_init().
> Yes, but only for toggling between 'type = PCI_EXP_TYPE_ENDPOINT' vs.
> 'type = PCI_EXP_TYPE_RC_END'.
>
> We would not like to expose the capability stating device is an express
> endpoint (of any kind) unless it is located on a pcie bus.

Ok

>>> +static void vmxnet3_realize(DeviceState *qdev, Error **errp)
>>> +{
>>> +    VMXNET3Class *vc = VMXNET3_DEVICE_GET_CLASS(qdev);
>>> +    PCIDevice *pci_dev = PCI_DEVICE(qdev);
>>> +    VMXNET3State *s = VMXNET3(qdev);
>>> +
>>> +    if (!(s->compat_flags & VMXNET3_COMPAT_FLAG_DISABLE_PCIE)) {
>>> +        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
>>> +    }
>>> +
>>> +    vc->parent_dc_realize(qdev, errp);
>>> +}
>> It's not clear that how the class helps here. Why not simply do
>> everthing in vmxnet3_pci_realize()?
> Since 'vmxnet3_pci_realize' is invoked too late. By the time it's
> invoked, the config space is already allocated during 'pci_qdev_realize',
> without correctly knowing whether the device is pci or pcie.
>
> We must call 'pci_qdev_realize' (parent_dc_realize) only after
> 'cap_present' is properly set.
> See discussion here:
>   https://lists.nongnu.org/archive/html/qemu-devel/2015-12/msg00043.html

Thanks for the pointer, consider 2.5 release is near. I will consider
this series for 2.6 (after find some time to re-evaluate this patch).


>
> Regards,
> Shmulik
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]