From: Paul Durrant <Paul.Durrant@citrix.com>
To: Anthony Perard <anthony.perard@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Eduardo Habkost <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH] xen-hvm: stop faking I/O to access PCI config space
Date: Fri, 18 May 2018 09:34:33 +0000 [thread overview]
Message-ID: <03b01c2edf144f78bfba30fded0706ce__25395.209019962$1526636035$gmane$org@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <20180517163053.GN2057@perard.uk.xensource.com>
> -----Original Message-----
> From: Anthony PERARD [mailto:anthony.perard@citrix.com]
> Sent: 17 May 2018 17:31
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; qemu-devel@nongnu.org; Stefano
> Stabellini <sstabellini@kernel.org>; Michael S. Tsirkin <mst@redhat.com>;
> Marcel Apfelbaum <marcel@redhat.com>; Paolo Bonzini
> <pbonzini@redhat.com>; Richard Henderson <rth@twiddle.net>; Eduardo
> Habkost <ehabkost@redhat.com>
> Subject: Re: [PATCH] xen-hvm: stop faking I/O to access PCI config space
>
> On Thu, May 03, 2018 at 12:18:40PM +0100, Paul Durrant wrote:
> > This patch removes the current hackery where IOREQ_TYPE_PCI_CONFIG
> > reqyests are handled by faking PIO to 0xcf8 and 0xcfc and replaces it
>
> ^ requests
Ok.
>
> > with direct calls to pci_host_config_read/write_common().
> > Doing so necessitates mapping BDFs to PCIDevices but maintaining a simple
> > QLIST in xen_device_realize/unrealize() will suffice.
> >
> > NOTE: whilst config space accesses are currently limited to
> > PCI_CONFIG_SPACE_SIZE, this patch paves the way to increasing the
> > limit to PCIE_CONFIG_SPACE_SIZE when Xen gains the ability to
> > emulate MCFG table accesses.
> >
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
>
> > +static void cpu_ioreq_config(XenIOState *state, ioreq_t *req)
> > +{
> > + uint32_t sbdf = req->addr >> 32;
> > + uint32_t reg = req->addr;
> > + XenPciDevice *xendev;
> > +
> > + if (req->size > sizeof(uint32_t)) {
> > + hw_error("PCI config access: bad size (%u)", req->size);
> > + }
> > +
> > + QLIST_FOREACH(xendev, &state->dev_list, entry) {
> > + unsigned int i;
> > +
> > + if (xendev->sbdf != sbdf) {
> > + continue;
> > + }
> > +
> > + if (req->dir == IOREQ_READ) {
> > + if (!req->data_is_ptr) {
> > + req->data = pci_host_config_read_common(
> > + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE,
> > + req->size);
> > + trace_cpu_ioreq_config_read(req, sbdf, reg, req->size,
> > + req->data);
> > + } else {
> > + for (i = 0; i < req->count; i++) {
> > + uint32_t tmp;
> > +
> > + tmp = pci_host_config_read_common(
> > + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE,
> > + req->size);
>
> So, if data is a pointer, we just keep reading the same address
> req->count time?
>
That's what would have happened before AFAICT, since the old scheme used port I/O. I think you're right that it is probably worth changing to MMIO semantics with this change though.
Paul
> > + write_phys_req_item(req->data, req, i, &tmp);
> > + }
> > + }
> > + } else if (req->dir == IOREQ_WRITE) {
> > + if (!req->data_is_ptr) {
> > + trace_cpu_ioreq_config_write(req, sbdf, reg, req->size,
> > + req->data);
> > + pci_host_config_write_common(
> > + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, req->data,
> > + req->size);
> > + } else {
> > + for (i = 0; i < req->count; i++) {
> > + uint32_t tmp = 0;
> > +
> > + read_phys_req_item(req->data, req, i, &tmp);
> > + pci_host_config_write_common(
> > + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, tmp,
> > + req->size);
> > + }
> > + }
> > + }
> > + }
> > +}
>
> --
> Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-05-18 9:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 11:18 [Qemu-devel] [PATCH] xen-hvm: stop faking I/O to access PCI config space Paul Durrant
2018-05-03 11:18 ` Paul Durrant
2018-05-03 11:48 ` [Qemu-devel] " Paolo Bonzini
2018-05-03 11:48 ` Paolo Bonzini
2018-05-03 12:41 ` [Qemu-devel] " Alexey G
2018-05-03 12:41 ` Alexey G
2018-05-03 12:49 ` Paul Durrant
2018-05-03 12:49 ` Paul Durrant
2018-05-03 13:16 ` Alexey G
2018-05-03 13:16 ` Alexey G
2018-05-16 8:51 ` Paul Durrant
2018-05-16 8:51 ` Paul Durrant
2018-05-16 9:56 ` Roger Pau Monné
2018-05-16 9:56 ` [Qemu-devel] [Xen-devel] " Roger Pau Monné
2018-05-17 16:30 ` [Qemu-devel] " Anthony PERARD
2018-05-17 16:30 ` Anthony PERARD
2018-05-18 9:34 ` Paul Durrant [this message]
2018-05-18 9:34 ` [Qemu-devel] " Paul Durrant
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='03b01c2edf144f78bfba30fded0706ce__25395.209019962$1526636035$gmane$org@AMSPEX02CL03.citrite.net' \
--to=paul.durrant@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.