From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [PATCH] vfio-pci: Enable PCIe extended config space
Date: Mon, 28 Jan 2013 19:23:16 +0200 [thread overview]
Message-ID: <20130128172316.GA25035@redhat.com> (raw)
In-Reply-To: <20130124004551.3605.2059.stgit@bling.home>
On Wed, Jan 23, 2013 at 05:46:13PM -0700, Alex Williamson wrote:
> We don't know pre-init time whether the device we're exposing is PCIe
> or legacy PCI. We could ask for it to be specified via a device
> option, but that seems like too much to ask of the user. Instead we
> can assume everything will be PCIe, which makes PCI-core allocate
> enough config space. Removing the flag during init leaves the space
> allocated, but allows legacy PCI devices to report the real device
> config space size to rest of Qemu.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
It's a bit of a hack but I don't have a better idea.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/vfio_pci.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/vfio_pci.c b/hw/vfio_pci.c
> index c51ae67..66537b7 100644
> --- a/hw/vfio_pci.c
> +++ b/hw/vfio_pci.c
> @@ -1899,6 +1899,9 @@ static int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vdev)
> (unsigned long)reg_info.flags);
>
> vdev->config_size = reg_info.size;
> + if (vdev->config_size == PCI_CONFIG_SPACE_SIZE) {
> + vdev->pdev.cap_present &= ~QEMU_PCI_CAP_EXPRESS;
> + }
> vdev->config_offset = reg_info.offset;
>
> error:
> @@ -2121,6 +2124,7 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
> pdc->exit = vfio_exitfn;
> pdc->config_read = vfio_pci_read_config;
> pdc->config_write = vfio_pci_write_config;
> + pdc->is_express = 1; /* We might be */
> }
>
> static const TypeInfo vfio_pci_dev_info = {
>
prev parent reply other threads:[~2013-01-28 17:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 0:46 [PATCH] vfio-pci: Enable PCIe extended config space Alex Williamson
2013-01-28 17:23 ` Michael S. Tsirkin [this message]
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=20130128172316.GA25035@redhat.com \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--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