qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: David Gibson <david@gibson.dropbear.id.au>, benh@kernel.crashing.org
Cc: agraf@suse.de, qemu-devel@nongnu.org, gwshan@au1.ibm.com,
	mdroth@linux.vnet.ibm.com, alex.williamson@redhat.com,
	qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 11/12] spapr_pci: Remove finish_realize hook
Date: Mon, 29 Feb 2016 12:44:33 +1100	[thread overview]
Message-ID: <56D3A281.7070404@ozlabs.ru> (raw)
In-Reply-To: <1456486323-8047-12-git-send-email-david@gibson.dropbear.id.au>

On 02/26/2016 10:32 PM, David Gibson wrote:
> Now that spapr-pci-vfio-host-bridge is reduced to just a stub, there is
> only one implementation of the finish_realize hook in sPAPRPHBClass.  So,
> we can fold that implementation into its (single) caller, and remove the
> hook.  That's the last thing left in sPAPRPHBClass, so that can go away as
> well.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>

> ---
>   hw/ppc/spapr_pci.c          | 25 +++++--------------------
>   include/hw/pci-host/spapr.h | 12 ------------
>   2 files changed, 5 insertions(+), 32 deletions(-)
>
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 336ffd2..2faaa03 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -1335,11 +1335,12 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
>       SysBusDevice *s = SYS_BUS_DEVICE(dev);
>       sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
>       PCIHostState *phb = PCI_HOST_BRIDGE(s);
> -    sPAPRPHBClass *info = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(s);
>       char *namebuf;
>       int i;
>       PCIBus *bus;
>       uint64_t msi_window_size = 4096;
> +    sPAPRTCETable *tcet;
> +    uint32_t nb_table;
>
>       if (sphb->index != (uint32_t)-1) {
>           hwaddr windows_base;
> @@ -1489,33 +1490,20 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
>           }
>       }
>
> -    if (!info->finish_realize) {
> -        error_setg(errp, "finish_realize not defined");
> -        return;
> -    }
> -
> -    info->finish_realize(sphb, errp);
> -
> -    sphb->msi = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
> -}
> -
> -static void spapr_phb_finish_realize(sPAPRPHBState *sphb, Error **errp)
> -{
> -    sPAPRTCETable *tcet;
> -    uint32_t nb_table;
> -
>       nb_table = sphb->dma_win_size >> SPAPR_TCE_PAGE_SHIFT;
>       tcet = spapr_tce_new_table(DEVICE(sphb), sphb->dma_liobn,
>                                  0, SPAPR_TCE_PAGE_SHIFT, nb_table, false);
>       if (!tcet) {
>           error_setg(errp, "Unable to create TCE table for %s",
>                      sphb->dtbusname);
> -        return ;
> +        return;
>       }
>
>       /* Register default 32bit DMA window */
>       memory_region_add_subregion(&sphb->iommu_root, sphb->dma_win_addr,
>                                   spapr_tce_get_iommu(tcet));
> +
> +    sphb->msi = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
>   }
>
>   static int spapr_phb_children_reset(Object *child, void *opaque)
> @@ -1667,7 +1655,6 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data)
>   {
>       PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
>       DeviceClass *dc = DEVICE_CLASS(klass);
> -    sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_CLASS(klass);
>       HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(klass);
>
>       hc->root_bus_path = spapr_phb_root_bus_path;
> @@ -1677,7 +1664,6 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data)
>       dc->vmsd = &vmstate_spapr_pci;
>       set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
>       dc->cannot_instantiate_with_device_add_yet = false;
> -    spc->finish_realize = spapr_phb_finish_realize;
>       hp->plug = spapr_phb_hot_plug_child;
>       hp->unplug = spapr_phb_hot_unplug_child;
>   }
> @@ -1687,7 +1673,6 @@ static const TypeInfo spapr_phb_info = {
>       .parent        = TYPE_PCI_HOST_BRIDGE,
>       .instance_size = sizeof(sPAPRPHBState),
>       .class_init    = spapr_phb_class_init,
> -    .class_size    = sizeof(sPAPRPHBClass),
>       .interfaces    = (InterfaceInfo[]) {
>           { TYPE_HOTPLUG_HANDLER },
>           { }
> diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
> index 7110222..a603feb 100644
> --- a/include/hw/pci-host/spapr.h
> +++ b/include/hw/pci-host/spapr.h
> @@ -32,20 +32,8 @@
>   #define SPAPR_PCI_HOST_BRIDGE(obj) \
>       OBJECT_CHECK(sPAPRPHBState, (obj), TYPE_SPAPR_PCI_HOST_BRIDGE)
>
> -#define SPAPR_PCI_HOST_BRIDGE_CLASS(klass) \
> -     OBJECT_CLASS_CHECK(sPAPRPHBClass, (klass), TYPE_SPAPR_PCI_HOST_BRIDGE)
> -#define SPAPR_PCI_HOST_BRIDGE_GET_CLASS(obj) \
> -     OBJECT_GET_CLASS(sPAPRPHBClass, (obj), TYPE_SPAPR_PCI_HOST_BRIDGE)
> -
> -typedef struct sPAPRPHBClass sPAPRPHBClass;
>   typedef struct sPAPRPHBState sPAPRPHBState;
>
> -struct sPAPRPHBClass {
> -    PCIHostBridgeClass parent_class;
> -
> -    void (*finish_realize)(sPAPRPHBState *sphb, Error **errp);
> -};
> -
>   typedef struct spapr_pci_msi {
>       uint32_t first_irq;
>       uint32_t num;
>


-- 
Alexey

  reply	other threads:[~2016-02-29  1:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 11:31 [Qemu-devel] [PATCH 00/12] Allow EEH on spapr-pci-host-bridge devices David Gibson
2016-02-26 11:31 ` [Qemu-devel] [PATCH 01/12] vfio: Start improving VFIO/EEH interface David Gibson
2016-02-29  0:58   ` Alexey Kardashevskiy
2016-02-29  3:13     ` David Gibson
2016-02-26 11:31 ` [Qemu-devel] [PATCH 02/12] spapr_pci: Switch to vfio_eeh_as_op() interface David Gibson
2016-02-29  1:43   ` Alexey Kardashevskiy
2016-02-29  3:00     ` David Gibson
2016-02-26 11:31 ` [Qemu-devel] [PATCH 03/12] spapr_pci: Eliminate class callbacks David Gibson
2016-02-29  1:43   ` Alexey Kardashevskiy
2016-02-29  3:42     ` Alexey Kardashevskiy
2016-02-26 11:31 ` [Qemu-devel] [PATCH 04/12] spapr_pci: Fold spapr_phb_vfio_eeh_configure() into spapr_pci code David Gibson
2016-02-29  1:43   ` Alexey Kardashevskiy
2016-02-29  3:45     ` Alexey Kardashevskiy
2016-02-29  4:25       ` Alexey Kardashevskiy
2016-02-29  6:20         ` David Gibson
2016-02-26 11:31 ` [Qemu-devel] [PATCH 05/12] spapr_pci: Fold spapr_phb_vfio_eeh_reset() " David Gibson
2016-02-29  1:43   ` Alexey Kardashevskiy
2016-02-26 11:31 ` [Qemu-devel] [PATCH 06/12] spapr_pci: Fold spapr_phb_vfio_eeh_get_state() " David Gibson
2016-02-29  1:43   ` Alexey Kardashevskiy
2016-02-26 11:31 ` [Qemu-devel] [PATCH 07/12] spapr_pci: Fold spapr_phb_vfio_eeh_set_option() " David Gibson
2016-02-29  1:44   ` Alexey Kardashevskiy
2016-02-26 11:31 ` [Qemu-devel] [PATCH 08/12] spapr_pci: Fold spapr_phb_vfio_reset() " David Gibson
2016-02-29  1:44   ` Alexey Kardashevskiy
2016-02-26 11:32 ` [Qemu-devel] [PATCH 09/12] spapr_pci: Allow EEH on spapr-pci-host-bridge David Gibson
2016-02-29  1:44   ` Alexey Kardashevskiy
2016-02-26 11:32 ` [Qemu-devel] [PATCH 10/12] spapr_pci: (Mostly) remove spapr-pci-vfio-host-bridge David Gibson
2016-02-29  1:42   ` Alexey Kardashevskiy
2016-02-29  3:06     ` David Gibson
2016-02-26 11:32 ` [Qemu-devel] [PATCH 11/12] spapr_pci: Remove finish_realize hook David Gibson
2016-02-29  1:44   ` Alexey Kardashevskiy [this message]
2016-02-26 11:32 ` [Qemu-devel] [PATCH 12/12] vfio: Eliminate vfio_container_ioctl() David Gibson
2016-02-29  1:44   ` Alexey Kardashevskiy
2016-02-26 11:33 ` [Qemu-devel] [PATCH 00/12] Allow EEH on spapr-pci-host-bridge devices David Gibson

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=56D3A281.7070404@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=gwshan@au1.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).