From: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
To: Marcel Apfelbaum <marcel@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] virtio-pci: Set the QEMU_PCI_CAP_EXPRESS capability early in its DeviceClass realize method
Date: Tue, 1 Dec 2015 21:30:07 +0200 [thread overview]
Message-ID: <20151201213007.2b41e810@halley> (raw)
In-Reply-To: <565DCC97.5020504@redhat.com>
Hi,
On Tue, 1 Dec 2015 18:36:39 +0200 Marcel Apfelbaum <marcel@redhat.com> wrote:
> > + if (pci_is_express(pci_dev) && pci_bus_is_express(pci_dev->bus) &&
> > + !pci_bus_is_root(pci_dev->bus)) {
> > int pos;
>
> Here you should check only for 'pci_is_express(pci_dev)' .
[snip]
> > +static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
> > +{
> > + VirtioPCIClass *vpciklass = VIRTIO_PCI_GET_CLASS(qdev);
> > + VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev);
> > + PCIDevice *pci_dev = &proxy->pci_dev;
> > +
> > + if (!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_PCIE) &&
> > + !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN)) {
> > + pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
>
> And here you should also check:
> pci_bus_is_express(pci_dev->bus) && !pci_bus_is_root(pci_dev->bus))
>
> The reason is the device becomes express only if *all* the conditions
> are met.
I'm ok with either approaches.
However it seems common practice to set QEMU_PCI_CAP_EXPRESS
unconditionally for PCIE devices.
The few existing PCIE devices do so by assigning their
PCIDeviceClass.is_express to 1 within their 'class_init', regardless the
properties of the bus their on.
(e.g. xhci_class_init, megasas_class_init, vfio_pci_dev_class_init,
nvme_class_init, and more)
Some devices later call pcie_endpoint_cap_init conditionally.
(e.g. usb_xhci_realize).
Can you please examine this and let me know the preferred approach?
> > + DeviceRealize saved_dc_realize;
>
> I would change the name to parent_realize :)
Sure.
next prev parent reply other threads:[~2015-12-01 19:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 16:23 [Qemu-devel] [PATCH] virtio-pci: Set the QEMU_PCI_CAP_EXPRESS capability early in its DeviceClass realize method Shmulik Ladkani
2015-12-01 16:36 ` Marcel Apfelbaum
2015-12-01 19:30 ` Shmulik Ladkani [this message]
2015-12-01 20:46 ` Marcel Apfelbaum
2015-12-02 8:01 ` Shmulik Ladkani
2015-12-02 9:51 ` Marcel Apfelbaum
2015-12-02 13:30 ` Shmulik Ladkani
2015-12-02 14:00 ` Marcel Apfelbaum
2015-12-02 14:27 ` 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=20151201213007.2b41e810@halley \
--to=shmulik.ladkani@ravellosystems.com \
--cc=marcel@redhat.com \
--cc=mst@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).