From: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Dmitry Fleytman <dmitry@daynix.com>,
Marcel Apfelbaum <marcel@redhat.com>,
idan.brown@ravellosystems.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 4/5] vmxnet3: The vmxnet3 device is a PCIE endpoint
Date: Fri, 4 Dec 2015 21:57:26 +0200 [thread overview]
Message-ID: <20151204215726.7b04e578@halley> (raw)
In-Reply-To: <566153B0.3030405@redhat.com>
Thanks Jason,
On Fri, 4 Dec 2015 16:49:52 +0800 Jason Wang <jasowang@redhat.com> 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.
> > +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
Regards,
Shmulik
next prev parent reply other threads:[~2015-12-04 19:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 15:26 [Qemu-devel] [PATCH v2 0/5] Fine-tune device capabilities Shmulik Ladkani
2015-12-02 15:26 ` [Qemu-devel] [PATCH v2 1/5] vmxnet3: Change offsets of msi/msix pci capabilities Shmulik Ladkani
2015-12-04 8:49 ` Jason Wang
2015-12-04 19:38 ` Shmulik Ladkani
2015-12-07 2:40 ` Jason Wang
2015-12-02 15:26 ` [Qemu-devel] [PATCH v2 2/5] vmxnet3: Change the offset of the MSIX PBA table Shmulik Ladkani
2015-12-02 15:26 ` [Qemu-devel] [PATCH v2 3/5] vmxnet3: coding: Introduce VMXNET3Class Shmulik Ladkani
2015-12-02 15:26 ` [Qemu-devel] [PATCH v2 4/5] vmxnet3: The vmxnet3 device is a PCIE endpoint Shmulik Ladkani
2015-12-04 8:49 ` Jason Wang
2015-12-04 19:57 ` Shmulik Ladkani [this message]
2015-12-07 2:46 ` Jason Wang
2015-12-02 15:26 ` [Qemu-devel] [PATCH v2 5/5] vmxnet3: Report the Device Serial Number capability Shmulik Ladkani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151204215726.7b04e578@halley \
--to=shmulik.ladkani@ravellosystems.com \
--cc=dmitry@daynix.com \
--cc=idan.brown@ravellosystems.com \
--cc=jasowang@redhat.com \
--cc=marcel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).