All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Andreas Färber" <afaerber@suse.de>,
	"Juan Quintela" <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/8] spapr-iommu: add a bus for spapr-iommu devices
Date: Thu, 10 Apr 2014 14:40:51 +0200	[thread overview]
Message-ID: <53469153.9090309@suse.de> (raw)
In-Reply-To: <1394770689-29039-2-git-send-email-aik@ozlabs.ru>


On 14.03.14 05:18, Alexey Kardashevskiy wrote:
> At the moment sPAPR IOMMU table is a device which participates in
> a migration stream. Normally QEMU uses a get_dev_path() hook from
> the device's bus to compose the section name and @instance_id which are
> used to match the section to the real device. This works till the user
> changes the device order in the command line - if this happens,
> devices get other instance_id's and migration fails.
>
> This adds a TCE bridge bus device per sPAPR machine and places all sPAPR
> IOMMU devices onto it.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Juan, is a different command line device order supposed to work with 
migration?


Alex

> ---
>   hw/ppc/spapr.c         |  3 +++
>   hw/ppc/spapr_iommu.c   | 59 +++++++++++++++++++++++++++++++++++++++++++++++++-
>   include/hw/ppc/spapr.h |  7 ++++++
>   3 files changed, 68 insertions(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 5c9a154..12adc21 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1263,6 +1263,9 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
>       /* Set up EPOW events infrastructure */
>       spapr_events_init(spapr);
>   
> +    /* Set up TCE IOMMUs bus */
> +    spapr->tce_bus = spapr_tce_bus_init();
> +
>       /* Set up VIO bus */
>       spapr->vio_bus = spapr_vio_bus_init();
>   
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index d9fe946..7db0acf 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -157,7 +157,7 @@ sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn, size_t wi
>           return NULL;
>       }
>   
> -    tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE));
> +    tcet = SPAPR_TCE_TABLE(qdev_create(spapr->tce_bus, TYPE_SPAPR_TCE_TABLE));
>       tcet->liobn = liobn;
>       tcet->window_size = window_size;
>   
> @@ -342,9 +342,66 @@ static TypeInfo spapr_tce_table_info = {
>       .instance_finalize = spapr_tce_table_finalize,
>   };
>   
> +static char *spapr_tce_bus_get_dev_name(DeviceState *qdev)
> +{
> +    sPAPRTCETable *tcet = SPAPR_TCE_TABLE(qdev);
> +    char *name;
> +
> +    name = g_strdup_printf("liobn@%x", tcet->liobn);
> +    return name;
> +}
> +
> +static void spapr_tce_bus_class_init(ObjectClass *klass, void *data)
> +{
> +    BusClass *k = BUS_CLASS(klass);
> +
> +    k->get_dev_path = spapr_tce_bus_get_dev_name;
> +}
> +
> +static const TypeInfo spapr_tce_bus_info = {
> +    .name = TYPE_SPAPR_TCE_BUS,
> +    .parent = TYPE_BUS,
> +    .class_init = spapr_tce_bus_class_init,
> +    .instance_size = sizeof(BusState),
> +};
> +
> +static int spapr_tce_bridge_init(SysBusDevice *dev)
> +{
> +    /* nothing */
> +    return 0;
> +}
> +
> +static void spapr_tce_bridge_class_init(ObjectClass *klass, void *data)
> +{
> +    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> +
> +    k->init = spapr_tce_bridge_init;
> +}
> +
> +static const TypeInfo spapr_tce_bridge_info = {
> +    .name          = "spapr-tce-bridge",
> +    .parent        = TYPE_SYS_BUS_DEVICE,
> +    .instance_size = sizeof(SysBusDevice),
> +    .class_init    = spapr_tce_bridge_class_init,
> +};
> +
>   static void register_types(void)
>   {
>       type_register_static(&spapr_tce_table_info);
> +    type_register_static(&spapr_tce_bridge_info);
> +    type_register_static(&spapr_tce_bus_info);
> +}
> +
> +BusState *spapr_tce_bus_init(void)
> +{
> +    DeviceState *dev;
> +
> +    /* Create bridge device */
> +    dev = qdev_create(NULL, spapr_tce_bridge_info.name);
> +    qdev_init_nofail(dev);
> +
> +    /* Create bus on bridge device */
> +    return qbus_create(TYPE_SPAPR_TCE_BUS, dev, "spapr-tce");
>   }
>   
>   type_init(register_types);
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 449fc7c..18332fd 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -12,6 +12,7 @@ struct sPAPRNVRAM;
>   
>   typedef struct sPAPREnvironment {
>       struct VIOsPAPRBus *vio_bus;
> +    BusState *tce_bus;
>       QLIST_HEAD(, sPAPRPHBState) phbs;
>       hwaddr msi_win_addr;
>       MemoryRegion msiwindow;
> @@ -405,4 +406,10 @@ int spapr_dma_dt(void *fdt, int node_off, const char *propname,
>   int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
>                         sPAPRTCETable *tcet);
>   
> +#define TYPE_SPAPR_TCE_BUS "spapr-tce-bus"
> +#define SPAPR_TCE_BUS(obj) \
> +    OBJECT_CHECK(BusState, (obj), TYPE_SPAPR_TCE_BUS)
> +
> +BusState *spapr_tce_bus_init(void);
> +
>   #endif /* !defined (__HW_SPAPR_H__) */

  reply	other threads:[~2014-04-10 12:41 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  4:18 [Qemu-devel] [PATCH 0/8] spapr: fix IOMMU and XICS/IRQs migration Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 1/8] spapr-iommu: add a bus for spapr-iommu devices Alexey Kardashevskiy
2014-04-10 12:40   ` Alexander Graf [this message]
2014-04-10 14:40     ` Alexey Kardashevskiy
2014-04-10 14:52       ` Andreas Färber
2014-04-10 15:18         ` Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 2/8] xics: add flags for interrupts Alexey Kardashevskiy
2014-04-10 12:43   ` Alexander Graf
2014-03-14  4:18 ` [Qemu-devel] [PATCH 3/8] xics: add find_server Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 4/8] xics: add pre_load() hook to ICSStateClass Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 5/8] xics: disable flags reset on xics reset Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 6/8] spapr: move interrupt allocator to xics Alexey Kardashevskiy
2014-04-10 12:51   ` Alexander Graf
2014-04-10 13:24     ` Alexey Kardashevskiy
2014-04-10 13:26       ` Alexander Graf
2014-04-10 14:43         ` Alexey Kardashevskiy
2014-04-11  9:24           ` Alexander Graf
2014-04-11 12:38             ` Alexey Kardashevskiy
2014-04-11 13:58               ` Alexander Graf
2014-04-11 14:50                 ` Alexey Kardashevskiy
2014-04-11 14:58                   ` Alexander Graf
2014-04-11 15:27                     ` Alexey Kardashevskiy
2014-04-11 15:38                       ` Alexander Graf
2014-04-11 16:01                         ` Alexey Kardashevskiy
2014-04-11 16:15                           ` Alexander Graf
2014-04-11 16:30                             ` Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 7/8] spapr: remove @next_irq Alexey Kardashevskiy
2014-03-14  7:19   ` Thomas Huth
2014-03-14  4:18 ` [Qemu-devel] [PATCH 8/8] xics: enable interrupt configuration reset on migration Alexey Kardashevskiy
2014-04-10 12:55   ` Alexander Graf
2014-03-20  1:25 ` [Qemu-devel] [PATCH 0/8] spapr: fix IOMMU and XICS/IRQs migration Andreas Färber
2014-04-04  5:53 ` Alexey Kardashevskiy
2014-05-04 13:56 ` Alexey Kardashevskiy
2014-05-04 21:52   ` Paolo Bonzini
2014-05-04 23:48     ` Alexey Kardashevskiy

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=53469153.9090309@suse.de \
    --to=agraf@suse.de \
    --cc=afaerber@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=quintela@redhat.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 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.