qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Leonid Shatz <leonid.shatz@ravellosystems.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-block@nongnu.org, Hannes Reinecke <hare@suse.de>,
	Dmitry Fleytman <dmitry@daynix.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Subject: [Qemu-devel] [PULL 09/10] pci: Don't register a specialized 'config_write' if default behavior is intended
Date: Wed, 17 Jun 2015 21:38:28 +0200	[thread overview]
Message-ID: <1434569795-10524-10-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1434569795-10524-1-git-send-email-mst@redhat.com>

From: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>

Few devices have their specialized 'config_write' methods which simply
call 'pci_default_write_config' followed by a 'msix_write_config' or
'msi_write_config' calls, using exact same arguments.

This is unnecessary as 'pci_default_write_config' already invokes
'msi_write_config' and 'msix_write_config'.

Also, since 'pci_default_write_config' is the default 'config_write'
handler, we can simply avoid the registration of these specialized
versions.

Cc: Leonid Shatz <leonid.shatz@ravellosystems.com>
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/misc/ivshmem.c    | 1 -
 hw/net/vmxnet3.c     | 9 ---------
 hw/scsi/megasas.c    | 8 --------
 hw/scsi/vmw_pvscsi.c | 8 --------
 4 files changed, 26 deletions(-)

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 5d272c8..231c35f 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -698,7 +698,6 @@ static void ivshmem_write_config(PCIDevice *pci_dev, uint32_t address,
 				 uint32_t val, int len)
 {
     pci_default_write_config(pci_dev, address, val, len);
-    msix_write_config(pci_dev, address, val, len);
 }
 
 static int pci_ivshmem_init(PCIDevice *dev)
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index dfb328d..34ffafd 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2481,14 +2481,6 @@ static const VMStateDescription vmstate_vmxnet3 = {
     }
 };
 
-static void
-vmxnet3_write_config(PCIDevice *pci_dev, uint32_t addr, uint32_t val, int len)
-{
-    pci_default_write_config(pci_dev, addr, val, len);
-    msix_write_config(pci_dev, addr, val, len);
-    msi_write_config(pci_dev, addr, val, len);
-}
-
 static Property vmxnet3_properties[] = {
     DEFINE_NIC_PROPERTIES(VMXNET3State, conf),
     DEFINE_PROP_END_OF_LIST(),
@@ -2507,7 +2499,6 @@ static void vmxnet3_class_init(ObjectClass *class, void *data)
     c->class_id = PCI_CLASS_NETWORK_ETHERNET;
     c->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE;
     c->subsystem_id = PCI_DEVICE_ID_VMWARE_VMXNET3;
-    c->config_write = vmxnet3_write_config,
     dc->desc = "VMWare Paravirtualized Ethernet v3";
     dc->reset = vmxnet3_qdev_reset;
     dc->vmsd = &vmstate_vmxnet3;
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 91a5d97..51ba9e0 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2407,13 +2407,6 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
     }
 }
 
-static void
-megasas_write_config(PCIDevice *pci, uint32_t addr, uint32_t val, int len)
-{
-    pci_default_write_config(pci, addr, val, len);
-    msi_write_config(pci, addr, val, len);
-}
-
 static Property megasas_properties_gen1[] = {
     DEFINE_PROP_UINT32("max_sge", MegasasState, fw_sge,
                        MEGASAS_DEFAULT_SGE),
@@ -2516,7 +2509,6 @@ static void megasas_class_init(ObjectClass *oc, void *data)
     dc->vmsd = info->vmsd;
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
     dc->desc = info->desc;
-    pc->config_write = megasas_write_config;
 }
 
 static const TypeInfo megasas_info = {
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index c6148d3..9c71f31 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1174,13 +1174,6 @@ static const VMStateDescription vmstate_pvscsi = {
     }
 };
 
-static void
-pvscsi_write_config(PCIDevice *pci, uint32_t addr, uint32_t val, int len)
-{
-    pci_default_write_config(pci, addr, val, len);
-    msi_write_config(pci, addr, val, len);
-}
-
 static Property pvscsi_properties[] = {
     DEFINE_PROP_UINT8("use_msg", PVSCSIState, use_msg, 1),
     DEFINE_PROP_END_OF_LIST(),
@@ -1202,7 +1195,6 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_pvscsi;
     dc->props = pvscsi_properties;
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-    k->config_write = pvscsi_write_config;
     hc->unplug = pvscsi_hot_unplug;
     hc->plug = pvscsi_hotplug;
 }
-- 
MST

  parent reply	other threads:[~2015-06-17 19:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 19:38 [Qemu-devel] [PULL 00/10] virtio, pci fixes, enhancements Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 01/10] vhost-user: part of virtio Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 02/10] linux-headers: sync vhost.h Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 03/10] virtio: introduce virtio_legacy_is_cross_endian() Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 04/10] vhost: set vring endianness for legacy virtio Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 05/10] tap: add VNET_LE/VNET_BE operations Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 06/10] vhost-net: tell tap backend about the vnet endianness Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 07/10] vhost_net: re-enable when cross endian Michael S. Tsirkin
2015-06-17 19:38 ` [Qemu-devel] [PULL 08/10] hw/core: rebase sysbus_get_fw_dev_path() to g_strdup_printf() Michael S. Tsirkin
2015-06-17 19:38 ` Michael S. Tsirkin [this message]
2015-06-17 19:38 ` [Qemu-devel] [PULL 10/10] vhost: enable vhost without without MSI-X Michael S. Tsirkin
2015-06-18 10:36 ` [Qemu-devel] [PULL 00/10] virtio, pci fixes, enhancements Peter Maydell
2015-06-18 11:14   ` Michael S. Tsirkin
2015-06-18 16:29     ` Peter Maydell
2015-06-19  7:30       ` Michael S. Tsirkin
2015-06-19  8:32         ` Peter Maydell
2015-06-19 10:19           ` Michael S. Tsirkin
2015-06-19 11:29             ` Peter Maydell

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=1434569795-10524-10-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=hare@suse.de \
    --cc=leonid.shatz@ravellosystems.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shmulik.ladkani@ravellosystems.com \
    /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).