All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 20/39] virtio-pci: convert to memory API
Date: Mon, 08 Aug 2011 10:21:15 -0500	[thread overview]
Message-ID: <4E3FFEEB.8000509@codemonkey.ws> (raw)
In-Reply-To: <1312808972-1718-21-git-send-email-avi@redhat.com>

On 08/08/2011 08:09 AM, Avi Kivity wrote:
> except msix.
>
> [jan: fix build]

This actually breaks the build:

   CC    libhw64/virtio-pci.o
cc1: warnings being treated as errors
/home/anthony/git/qemu/hw/virtio-pci.c: In function ‘virtio_write_config’:
/home/anthony/git/qemu/hw/virtio-pci.c:496:19: error: unused variable ‘vdev’
make[1]: *** [virtio-pci.o] Error 1
make: *** [subdir-libhw64] Error 2


>
> Reviewed-by: Richard Henderson<rth@twiddle.net>
> Reviewed-by: Anthony Liguori<aliguori@us.ibm.com>
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
>   hw/virtio-pci.c |   71 +++++++++++++++++++++----------------------------------
>   hw/virtio-pci.h |    2 +-
>   2 files changed, 28 insertions(+), 45 deletions(-)
>
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index f3b3293..5df380d 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -162,7 +162,8 @@ static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy,
>   {
>       VirtQueue *vq = virtio_get_queue(proxy->vdev, n);
>       EventNotifier *notifier = virtio_queue_get_host_notifier(vq);
> -    int r;
> +    int r = 0;
> +
>       if (assign) {
>           r = event_notifier_init(notifier, 1);
>           if (r<  0) {
> @@ -170,24 +171,11 @@ static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy,
>                            __func__, r);
>               return r;
>           }
> -        r = kvm_set_ioeventfd_pio_word(event_notifier_get_fd(notifier),
> -                                       proxy->addr + VIRTIO_PCI_QUEUE_NOTIFY,
> -                                       n, assign);
> -        if (r<  0) {
> -            error_report("%s: unable to map ioeventfd: %d",
> -                         __func__, r);
> -            event_notifier_cleanup(notifier);
> -        }
> +        memory_region_add_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY, 2,
> +                                  true, n, event_notifier_get_fd(notifier));
>       } else {
> -        r = kvm_set_ioeventfd_pio_word(event_notifier_get_fd(notifier),
> -                                       proxy->addr + VIRTIO_PCI_QUEUE_NOTIFY,
> -                                       n, assign);
> -        if (r<  0) {
> -            error_report("%s: unable to unmap ioeventfd: %d",
> -                         __func__, r);
> -            return r;
> -        }
> -
> +        memory_region_del_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY, 2,
> +                                  true, n, event_notifier_get_fd(notifier));
>           /* Handle the race condition where the guest kicked and we deassigned
>            * before we got around to handling the kick.
>            */
> @@ -424,7 +412,6 @@ static uint32_t virtio_pci_config_readb(void *opaque, uint32_t addr)
>   {
>       VirtIOPCIProxy *proxy = opaque;
>       uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);
> -    addr -= proxy->addr;
>       if (addr<  config)
>           return virtio_ioport_read(proxy, addr);
>       addr -= config;
> @@ -435,7 +422,6 @@ static uint32_t virtio_pci_config_readw(void *opaque, uint32_t addr)
>   {
>       VirtIOPCIProxy *proxy = opaque;
>       uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);
> -    addr -= proxy->addr;
>       if (addr<  config)
>           return virtio_ioport_read(proxy, addr);
>       addr -= config;
> @@ -446,7 +432,6 @@ static uint32_t virtio_pci_config_readl(void *opaque, uint32_t addr)
>   {
>       VirtIOPCIProxy *proxy = opaque;
>       uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);
> -    addr -= proxy->addr;
>       if (addr<  config)
>           return virtio_ioport_read(proxy, addr);
>       addr -= config;
> @@ -457,7 +442,6 @@ static void virtio_pci_config_writeb(void *opaque, uint32_t addr, uint32_t val)
>   {
>       VirtIOPCIProxy *proxy = opaque;
>       uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);
> -    addr -= proxy->addr;
>       if (addr<  config) {
>           virtio_ioport_write(proxy, addr, val);
>           return;
> @@ -470,7 +454,6 @@ static void virtio_pci_config_writew(void *opaque, uint32_t addr, uint32_t val)
>   {
>       VirtIOPCIProxy *proxy = opaque;
>       uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);
> -    addr -= proxy->addr;
>       if (addr<  config) {
>           virtio_ioport_write(proxy, addr, val);
>           return;
> @@ -483,7 +466,6 @@ static void virtio_pci_config_writel(void *opaque, uint32_t addr, uint32_t val)
>   {
>       VirtIOPCIProxy *proxy = opaque;
>       uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);
> -    addr -= proxy->addr;
>       if (addr<  config) {
>           virtio_ioport_write(proxy, addr, val);
>           return;
> @@ -492,30 +474,26 @@ static void virtio_pci_config_writel(void *opaque, uint32_t addr, uint32_t val)
>       virtio_config_writel(proxy->vdev, addr, val);
>   }
>
> -static void virtio_map(PCIDevice *pci_dev, int region_num,
> -                       pcibus_t addr, pcibus_t size, int type)
> -{
> -    VirtIOPCIProxy *proxy = container_of(pci_dev, VirtIOPCIProxy, pci_dev);
> -    VirtIODevice *vdev = proxy->vdev;
> -    unsigned config_len = VIRTIO_PCI_REGION_SIZE(pci_dev) + vdev->config_len;
> -
> -    proxy->addr = addr;
> -
> -    register_ioport_write(addr, config_len, 1, virtio_pci_config_writeb, proxy);
> -    register_ioport_write(addr, config_len, 2, virtio_pci_config_writew, proxy);
> -    register_ioport_write(addr, config_len, 4, virtio_pci_config_writel, proxy);
> -    register_ioport_read(addr, config_len, 1, virtio_pci_config_readb, proxy);
> -    register_ioport_read(addr, config_len, 2, virtio_pci_config_readw, proxy);
> -    register_ioport_read(addr, config_len, 4, virtio_pci_config_readl, proxy);
> +const MemoryRegionPortio virtio_portio[] = {
> +    { 0, 0x10000, 1, .write = virtio_pci_config_writeb, },
> +    { 0, 0x10000, 2, .write = virtio_pci_config_writew, },
> +    { 0, 0x10000, 4, .write = virtio_pci_config_writel, },
> +    { 0, 0x10000, 1, .read = virtio_pci_config_readb, },
> +    { 0, 0x10000, 2, .read = virtio_pci_config_readw, },
> +    { 0, 0x10000, 4, .read = virtio_pci_config_readl, },
> +    PORTIO_END_OF_LIST()
> +};
>
> -    if (vdev->config_len)
> -        vdev->get_config(vdev, vdev->config);
> -}
> +static const MemoryRegionOps virtio_pci_config_ops = {
> +    .old_portio = virtio_portio,
> +    .endianness = DEVICE_LITTLE_ENDIAN,
> +};
>
>   static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
>                                   uint32_t val, int len)
>   {
>       VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
> +    VirtIODevice *vdev = proxy->vdev;

This variable isn't needed.  I'll remove it.

Regards,

Anthony Liguori

  reply	other threads:[~2011-08-08 15:21 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08 13:08 [PATCH v4 00/39] Memory API, batch 2: PCI devices Avi Kivity
2011-08-08 13:08 ` [Qemu-devel] " Avi Kivity
2011-08-08 13:08 ` [PATCH v4 01/39] memory: rename PORTIO_END to PORTIO_END_OF_LIST Avi Kivity
2011-08-08 13:08   ` [Qemu-devel] " Avi Kivity
2011-08-08 15:12   ` Anthony Liguori
2011-08-08 13:08 ` [PATCH v4 02/39] pci: add API to get a BAR's mapped address Avi Kivity
2011-08-08 13:08   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:08 ` [PATCH v4 03/39] vmsvga: don't remember pci BAR address in callback any more Avi Kivity
2011-08-08 13:08   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:08 ` [PATCH v4 04/39] vga: convert vga and its derivatives to the memory API Avi Kivity
2011-08-08 13:08   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:08 ` [PATCH v4 05/39] cirrus: simplify mmio BAR access functions Avi Kivity
2011-08-08 13:08   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:08 ` [PATCH v4 06/39] cirrus: simplify bitblt " Avi Kivity
2011-08-08 13:08   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 07/39] cirrus: simplify vga window mmio " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 08/39] vga: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 09/39] cirrus: simplify linear framebuffer " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 10/39] Integrate I/O memory regions into qemu Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 11/39] pci: pass I/O address space to new PCI bus Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 12/39] pci: allow I/O BARs to be registered with pci_register_bar_region() Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 13/39] rtl8139: convert to memory API Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 14/39] ac97: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-09 10:09   ` malc
2011-08-09 10:09     ` malc
2011-08-08 13:09 ` [PATCH v4 15/39] e1000: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 16/39] eepro100: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 17/39] es1370: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-09 10:10   ` malc
2011-08-09 10:10     ` malc
2011-08-08 13:09 ` [PATCH v4 18/39] ide: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 19/39] ivshmem: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 20/39] virtio-pci: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 15:21   ` Anthony Liguori [this message]
2011-08-08 15:25     ` [PATCH v4.1 " Avi Kivity
2011-08-08 15:25       ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 21/39] ahci: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 22/39] intel-hda: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 23/39] lsi53c895a: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-10 19:28   ` Gerhard Wiesinger
2011-08-10 19:28     ` Gerhard Wiesinger
2011-08-11  6:11     ` Avi Kivity
2011-08-11  6:11       ` Avi Kivity
2011-08-08 13:09 ` [PATCH v4 24/39] ppc: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-09-08 16:34   ` Alexander Graf
2011-09-08 16:47   ` Alexander Graf
2011-08-08 13:09 ` [PATCH v4 25/39] ne2000: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 26/39] pcnet: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-09  6:55   ` Bob Breuer
2011-08-09  6:55     ` [Qemu-devel] " Bob Breuer
2011-08-09  6:52     ` Avi Kivity
2011-08-09  6:52       ` Avi Kivity
2011-08-09 12:42       ` Michael S. Tsirkin
2011-08-09 12:42         ` Michael S. Tsirkin
2011-08-09 12:44         ` Avi Kivity
2011-08-09 12:44           ` Avi Kivity
2011-08-09 12:48           ` Michael S. Tsirkin
2011-08-09 12:48             ` Michael S. Tsirkin
2011-08-09 12:52             ` Avi Kivity
2011-08-09 12:52               ` Avi Kivity
2011-08-08 13:09 ` [PATCH v4 27/39] i6300esb: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 28/39] isa-mmio: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 29/39] sun4u: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 30/39] ehci: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 31/39] uhci: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 32/39] xen-platform: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 33/39] msix: " Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 34/39] pci: remove pci_register_bar_simple() Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 35/39] pci: convert pci rom to memory API Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 36/39] pci: remove pci_register_bar() Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 37/39] pci: fold BAR mapping function into its caller Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 38/39] pci: rename pci_register_bar_region() to pci_register_bar() Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 13:09 ` [PATCH v4 39/39] pci: remove support for pre memory API BARs Avi Kivity
2011-08-08 13:09   ` [Qemu-devel] " Avi Kivity
2011-08-08 15:16 ` [PATCH v4 00/39] Memory API, batch 2: PCI devices Michael S. Tsirkin
2011-08-08 15:16   ` [Qemu-devel] " Michael S. Tsirkin
2011-08-08 16:30 ` Anthony Liguori
2011-08-08 16:30   ` [Qemu-devel] " Anthony Liguori

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=4E3FFEEB.8000509@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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 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.