qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Tony Krowiak <akrowiak@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, cohuck@redhat.com, david@redhat.com,
	pmorel@linux.vnet.ibm.com, fiuczy@linux.ibm.com,
	eskultet@redhat.com, agraf@suse.de, borntraeger@de.ibm.com,
	jjherne@linux.vnet.ibm.com, mimu@linux.ibm.com,
	Tony Krowiak <akrowiak@linux.ibm.com>,
	heiko.carstens@de.ibm.com, eric.auger@redhat.com,
	alex.williamson@redhat.com, bjsdjshi@linux.vnet.ibm.com,
	rth@twiddle.net, mjrosato@linux.vnet.ibm.com,
	pasic@linux.vnet.ibm.com, berrange@redhat.com,
	alifm@linux.vnet.ibm.com, qemu-s390x@nongnu.org,
	schwidefsky@de.ibm.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH v10 4/6] s390x/ap: base Adjunct Processor (AP) object model
Date: Wed, 10 Oct 2018 09:28:21 +0200	[thread overview]
Message-ID: <a417dd0c-5692-dbd5-bbdb-e56f63515888@redhat.com> (raw)
In-Reply-To: <20181009175226.22138-5-akrowiak@linux.vnet.ibm.com>

On 2018-10-09 19:52, Tony Krowiak wrote:
> From: Tony Krowiak <akrowiak@linux.ibm.com>
> 
> Introduces the base object model for virtualizing AP devices.
> 
> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
> Tested-by: Pierre Morel<pmorel@linux.ibm.com>
> Acked-by: David Hildenbrand <david@redhat.com>
> ---
>  MAINTAINERS                  | 12 ++++++
>  hw/s390x/Makefile.objs       |  2 +
>  hw/s390x/ap-bridge.c         | 78 ++++++++++++++++++++++++++++++++++++
>  hw/s390x/ap-device.c         | 39 ++++++++++++++++++
>  hw/s390x/s390-virtio-ccw.c   |  4 ++
>  include/hw/s390x/ap-bridge.h | 19 +++++++++
>  include/hw/s390x/ap-device.h | 23 +++++++++++
>  7 files changed, 177 insertions(+)
>  create mode 100644 hw/s390x/ap-bridge.c
>  create mode 100644 hw/s390x/ap-device.c
>  create mode 100644 include/hw/s390x/ap-bridge.h
>  create mode 100644 include/hw/s390x/ap-device.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d12518c08f10..97e8ed808bc0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1199,6 +1199,18 @@ F: include/hw/s390x/s390-ccw.h
>  T: git git://github.com/cohuck/qemu.git s390-next
>  L: qemu-s390x@nongnu.org
>  
> +vfio-ap
> +M: Christian Borntraeger <borntraeger@de.ibm.com>
> +M: Tony Krowiak <akrowiak@linux.ibm.com>
> +M: Halil Pasic <pasic@linux.ibm.com>
> +M: Pierre Morel <pmorel@linux.ibm.com>
> +S: Supported
> +F: hw/s390x/ap-device.c
> +F: hw/s390x/ap-bridge.c
> +F: include/hw/s390x/ap-device.h
> +F: include/hw/s390x/ap-bridge.h
> +L: qemu-s390x@nongnu.org
> +
>  vhost
>  M: Michael S. Tsirkin <mst@redhat.com>
>  S: Supported
> diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs
> index 93282f7c593c..add89b150d90 100644
> --- a/hw/s390x/Makefile.objs
> +++ b/hw/s390x/Makefile.objs
> @@ -20,3 +20,5 @@ obj-$(CONFIG_TCG) += tod-qemu.o
>  obj-$(CONFIG_KVM) += s390-skeys-kvm.o
>  obj-$(CONFIG_KVM) += s390-stattrib-kvm.o
>  obj-y += s390-ccw.o
> +obj-y += ap-device.o
> +obj-y += ap-bridge.o
> diff --git a/hw/s390x/ap-bridge.c b/hw/s390x/ap-bridge.c
> new file mode 100644
> index 000000000000..3795d30dd7c9
> --- /dev/null
> +++ b/hw/s390x/ap-bridge.c
> @@ -0,0 +1,78 @@
> +/*
> + * ap bridge
> + *
> + * Copyright 2018 IBM Corp.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or (at
> + * your option) any later version. See the COPYING file in the top-level
> + * directory.
> + */
> +#include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "hw/sysbus.h"
> +#include "qemu/bitops.h"
> +#include "hw/s390x/ap-bridge.h"
> +#include "cpu.h"
> +
> +static char *ap_bus_get_dev_path(DeviceState *dev)
> +{
> +    /* at most one */
> +    return g_strdup_printf("/1");
> +}
> +
> +static void ap_bus_class_init(ObjectClass *oc, void *data)
> +{
> +    BusClass *k = BUS_CLASS(oc);
> +
> +    k->get_dev_path = ap_bus_get_dev_path;
> +    /* More than one ap device does not make sense */
> +    k->max_dev = 1;
> +}
> +
> +static const TypeInfo ap_bus_info = {
> +    .name = TYPE_AP_BUS,
> +    .parent = TYPE_BUS,
> +    .instance_size = 0,
> +    .class_init = ap_bus_class_init,
> +};
> +
> +void s390_init_ap(void)
> +{
> +    DeviceState *dev;
> +
> +    /* If no AP instructions then no need for AP bridge */
> +    if (!s390_has_feat(S390_FEAT_AP)) {
> +        return;
> +    }
> +
> +    /* Create bridge device */
> +    dev = qdev_create(NULL, TYPE_AP_BRIDGE);
> +    object_property_add_child(qdev_get_machine(), TYPE_AP_BRIDGE,
> +                              OBJECT(dev), NULL);
> +    qdev_init_nofail(dev);
> +
> +    /* Create bus on bridge device */
> +    qbus_create(TYPE_AP_BUS, dev, TYPE_AP_BUS);
> + }
> +
> +static void ap_bridge_class_init(ObjectClass *oc, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(oc);
> +
> +    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> +}
> +
> +static const TypeInfo ap_bridge_info = {
> +    .name          = TYPE_AP_BRIDGE,
> +    .parent        = TYPE_SYS_BUS_DEVICE,
> +    .instance_size = 0,
> +    .class_init    = ap_bridge_class_init,
> +};
> +
> +static void ap_register(void)
> +{
> +    type_register_static(&ap_bridge_info);
> +    type_register_static(&ap_bus_info);
> +}
> +
> +type_init(ap_register)
> diff --git a/hw/s390x/ap-device.c b/hw/s390x/ap-device.c
> new file mode 100644
> index 000000000000..fb6e35024c82
> --- /dev/null
> +++ b/hw/s390x/ap-device.c
> @@ -0,0 +1,39 @@
> +/*
> + * Adjunct Processor (AP) matrix device
> + *
> + * Copyright 2018 IBM Corp.
> + * Author(s): Tony Krowiak <akrowiak@linux.vnet.ibm.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or (at
> + * your option) any later version. See the COPYING file in the top-level
> + * directory.
> + */
> +#include "qemu/osdep.h"
> +#include "qemu/module.h"
> +#include "qapi/error.h"
> +#include "hw/qdev.h"
> +#include "hw/s390x/ap-device.h"
> +
> +static void ap_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +
> +    dc->desc = "AP device class";
> +    dc->hotpluggable = false;
> +}
> +
> +static const TypeInfo ap_device_info = {
> +    .name = AP_DEVICE_TYPE,
> +    .parent = TYPE_DEVICE,
> +    .instance_size = sizeof(APDevice),
> +    .class_size = sizeof(DeviceClass),
> +    .class_init = ap_class_init,
> +    .abstract = true,
> +};
> +
> +static void ap_device_register(void)
> +{
> +    type_register_static(&ap_device_info);
> +}
> +
> +type_init(ap_device_register)
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index f0f7fdcaddf2..3c100c24f3e8 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -32,6 +32,7 @@
>  #include "ipl.h"
>  #include "hw/s390x/s390-virtio-ccw.h"
>  #include "hw/s390x/css-bridge.h"
> +#include "hw/s390x/ap-bridge.h"
>  #include "migration/register.h"
>  #include "cpu_models.h"
>  #include "hw/nmi.h"
> @@ -263,6 +264,9 @@ static void ccw_init(MachineState *machine)
>      /* init the SIGP facility */
>      s390_init_sigp();
>  
> +    /* create AP bridge and bus(es) */
> +    s390_init_ap();
> +
>      /* get a BUS */
>      css_bus = virtual_css_bus_init();
>      s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
> diff --git a/include/hw/s390x/ap-bridge.h b/include/hw/s390x/ap-bridge.h
> new file mode 100644
> index 000000000000..470e439a98ed
> --- /dev/null
> +++ b/include/hw/s390x/ap-bridge.h
> @@ -0,0 +1,19 @@
> +/*
> + * ap bridge
> + *
> + * Copyright 2018 IBM Corp.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or (at
> + * your option) any later version. See the COPYING file in the top-level
> + * directory.
> + */
> +
> +#ifndef HW_S390X_AP_BRIDGE_H
> +#define HW_S390X_AP_BRIDGE_H
> +
> +#define TYPE_AP_BRIDGE "ap-bridge"
> +#define TYPE_AP_BUS "ap-bus"
> +
> +void s390_init_ap(void);
> +
> +#endif
> diff --git a/include/hw/s390x/ap-device.h b/include/hw/s390x/ap-device.h
> new file mode 100644
> index 000000000000..4fb3c9ab82f2
> --- /dev/null
> +++ b/include/hw/s390x/ap-device.h
> @@ -0,0 +1,23 @@
> +/*
> + * Adjunct Processor (AP) matrix device interfaces
> + *
> + * Copyright 2018 IBM Corp.
> + * Author(s): Tony Krowiak <akrowiak@linux.vnet.ibm.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or (at
> + * your option) any later version. See the COPYING file in the top-level
> + * directory.
> + */
> +#ifndef HW_S390X_AP_DEVICE_H
> +#define HW_S390X_AP_DEVICE_H
> +
> +#define AP_DEVICE_TYPE       "ap-device"
> +
> +typedef struct APDevice {
> +    DeviceState parent_obj;
> +} APDevice;
> +
> +#define AP_DEVICE(obj) \
> +    OBJECT_CHECK(APDevice, (obj), AP_DEVICE_TYPE)
> +
> +#endif /* HW_S390X_AP_DEVICE_H */
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

  reply	other threads:[~2018-10-10  7:28 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 17:52 [Qemu-devel] [PATCH v10 0/6] s390x: vfio-ap: guest dedicated crypto adapters Tony Krowiak
2018-10-09 17:52 ` [Qemu-devel] [PATCH v10 1/6] linux-headers: linux header updates for AP support Tony Krowiak
2018-10-10  8:01   ` Cornelia Huck
2018-10-09 17:52 ` [Qemu-devel] [PATCH v10 2/6] s390x/cpumodel: Set up CPU model for AP device support Tony Krowiak
2018-10-09 19:14   ` Christian Borntraeger
2018-10-09 19:48     ` David Hildenbrand
2018-10-10 13:50       ` Tony Krowiak
2018-10-10  8:11   ` Cornelia Huck
2018-10-10  8:12     ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
2018-10-10 11:31   ` [Qemu-devel] " Halil Pasic
2018-10-09 17:52 ` [Qemu-devel] [PATCH v10 3/6] s390x/kvm: enable AP instruction interpretation for guest Tony Krowiak
2018-10-09 19:48   ` David Hildenbrand
2018-10-10  7:19   ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-10-10  8:12   ` Christian Borntraeger
2018-10-10 11:38   ` Halil Pasic
2018-10-10 11:53     ` Cornelia Huck
2018-10-09 17:52 ` [Qemu-devel] [PATCH v10 4/6] s390x/ap: base Adjunct Processor (AP) object model Tony Krowiak
2018-10-10  7:28   ` Thomas Huth [this message]
2018-10-10  8:14   ` Cornelia Huck
2018-10-10 13:59     ` Tony Krowiak
2018-10-10 14:16       ` Cornelia Huck
2018-10-10 11:45   ` [Qemu-devel] [qemu-s390x] " Halil Pasic
2018-10-09 17:52 ` [Qemu-devel] [PATCH v10 5/6] s390x/vfio: ap: Introduce VFIO AP device Tony Krowiak
2018-10-09 19:51   ` David Hildenbrand
2018-10-10  7:29     ` Pierre Morel
2018-10-10  7:55       ` Cornelia Huck
2018-10-10 14:04     ` Tony Krowiak
2018-10-10  8:25   ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-10-10  8:52     ` Cornelia Huck
2018-10-10 14:13       ` Tony Krowiak
2018-10-10 14:12     ` Tony Krowiak
2018-10-10  9:21   ` [Qemu-devel] " Cornelia Huck
2018-10-10 15:49     ` Tony Krowiak
2018-10-10 11:52   ` Halil Pasic
2018-10-10 12:33   ` Pierre Morel
2018-10-10 12:37   ` Pierre Morel
2018-10-10 12:49     ` Christian Borntraeger
2018-10-10 14:20       ` Tony Krowiak
2018-10-09 17:52 ` [Qemu-devel] [PATCH v10 6/6] s390: doc: detailed specifications for AP virtualization Tony Krowiak
2018-10-10  8:14   ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-10-10 14:23     ` Tony Krowiak
2018-10-10  9:23   ` [Qemu-devel] " Cornelia Huck

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=a417dd0c-5692-dbd5-bbdb-e56f63515888@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=akrowiak@linux.ibm.com \
    --cc=akrowiak@linux.vnet.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=alifm@linux.vnet.ibm.com \
    --cc=berrange@redhat.com \
    --cc=bjsdjshi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=eskultet@redhat.com \
    --cc=fiuczy@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=mimu@linux.ibm.com \
    --cc=mjrosato@linux.vnet.ibm.com \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pmorel@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=schwidefsky@de.ibm.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).