qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Marc Marí" <marc.mari.barcelo@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/7] tests: Add virtio device initialization
Date: Fri, 25 Jul 2014 16:19:41 +0100	[thread overview]
Message-ID: <20140725151941.GC1855@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1406226665-1710-3-git-send-email-marc.mari.barcelo@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1936 bytes --]

On Thu, Jul 24, 2014 at 08:31:00PM +0200, Marc Marí wrote:
> +static uint32_t qvirtio_pci_get_features(QVirtioDevice *d)
> +{
> +    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;
> +    return qpci_io_readl(dev->pdev, dev->addr + QVIRTIO_DEVICE_FEATURES);
> +}

Unused?  If it's unused, then it's untested.

> +
> +static uint8_t qvirtio_pci_get_status(QVirtioDevice *d)
> +{
> +    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;
> +    return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_DEVICE_STATUS);
> +}

Unused?

> +
> +static void qvirtio_pci_set_status(QVirtioDevice *d, uint8_t val)
> +{
> +    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;
> +    qpci_io_writeb(dev->pdev, dev->addr + QVIRTIO_DEVICE_STATUS, val);

Unused?

> @@ -73,3 +97,11 @@ QVirtioPCIDevice *qvirtio_pci_device_find(QPCIBus *bus, uint16_t device_type)
>  
>      return dev;
>  }
> +
> +void qvirtio_pci_enable_device(QVirtioPCIDevice *d)
> +{
> +    qpci_device_enable(d->pdev);
> +    d->addr = qpci_iomap(d->pdev, 0);
> +    g_assert(d->addr != NULL);
> +}

Where is qpci_iounmap() called to clean up?

> @@ -67,6 +69,18 @@ static void pci_basic(void)
>      g_assert_cmphex(dev->vdev.device_type, ==, QVIRTIO_BLK_DEVICE_ID);
>      g_assert_cmphex(dev->pdev->devfn, ==, ((PCI_SLOT << 3) | PCI_FN));
>  
> +    qvirtio_pci_enable_device(dev);
> +    qvirtio_reset(&qvirtio_pci, &dev->vdev);
> +    qvirtio_set_acknowledge(&qvirtio_pci, &dev->vdev);
> +    qvirtio_set_driver(&qvirtio_pci, &dev->vdev);
> +
> +    /* MSI-X is not enabled */
> +    addr = dev->addr + QVIRTIO_DEVICE_SPECIFIC_NO_MSIX;
> +
> +    capacity = qpci_io_readl(dev->pdev, addr) |
> +                qpci_io_readl(dev->pdev, addr+4);
> +    g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE/512);

Please add a qvirtio_config_read() function instead of directly
accessing the virtio configuration space via PCI.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-07-25 15:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24 18:30 [Qemu-devel] [PATCH 0/7] Virtio PCI libqos driver Marc Marí
2014-07-24 18:30 ` [Qemu-devel] [PATCH 1/7] tests: Functions bus_foreach and device_find from libqos virtio API Marc Marí
2014-07-25 14:56   ` Stefan Hajnoczi
2014-07-24 18:31 ` [Qemu-devel] [PATCH 2/7] tests: Add virtio device initialization Marc Marí
2014-07-25 15:19   ` Stefan Hajnoczi [this message]
2014-07-25 17:01     ` Marc Marí
2014-07-28  9:21       ` Stefan Hajnoczi
2014-07-24 18:31 ` [Qemu-devel] [PATCH 3/7] libqtest: add QTEST_LOG for debugging qtest testcases Marc Marí
2014-07-25 15:22   ` Stefan Hajnoczi
2014-07-24 18:31 ` [Qemu-devel] [PATCH 4/7] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc Marc Marí
2014-07-25 15:22   ` Stefan Hajnoczi
2014-07-29 20:47   ` John Snow
2014-07-29 21:10   ` Peter Maydell
2014-07-24 18:31 ` [Qemu-devel] [PATCH 5/7] libqos: Change free function called in malloc Marc Marí
2014-07-25 15:23   ` Stefan Hajnoczi
2014-07-29 20:47   ` John Snow
2014-07-24 18:31 ` [Qemu-devel] [PATCH 6/7] virtio-blk: Correct bug in support for flexible descriptor layout Marc Marí
2014-07-24 18:31 ` [Qemu-devel] [PATCH 7/7] libqos: Added basic virtqueue support to virtio implementation Marc Marí
2014-07-25 16:10   ` Stefan Hajnoczi

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=20140725151941.GC1855@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=marc.mari.barcelo@gmail.com \
    --cc=pbonzini@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).