From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de,
David Hildenbrand <dahi@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 15/23] s390/sclp: move sclp_execute related functions into the SCLP class
Date: Mon, 31 Aug 2015 13:13:55 +0200 [thread overview]
Message-ID: <1441019643-10677-16-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1441019643-10677-1-git-send-email-cornelia.huck@de.ibm.com>
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
Let's move the sclp_execute related functions into the SCLP class
and pass the device state as parameter, so we have easy access to
the SCLPDevice later on.
Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/sclp.c | 53 +++++++++++++++++++++++++++++++++----------------
include/hw/s390x/sclp.h | 9 +++++++++
2 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 14cc8c1..c367ff8 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -28,8 +28,13 @@ static inline SCLPEventFacility *get_event_facility(void)
NULL));
}
+static inline SCLPDevice *get_sclp_device(void)
+{
+ return SCLP(object_resolve_path_type("", TYPE_SCLP, NULL));
+}
+
/* Provide information about the configuration, CPUs and storage */
-static void read_SCP_info(SCCB *sccb)
+static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
{
ReadInfo *read_info = (ReadInfo *) sccb;
sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
@@ -129,7 +134,7 @@ static void read_SCP_info(SCCB *sccb)
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
}
-static void read_storage_element0_info(SCCB *sccb)
+static void read_storage_element0_info(SCLPDevice *sclp, SCCB *sccb)
{
int i, assigned;
int subincrement_id = SCLP_STARTING_SUBINCREMENT_ID;
@@ -155,7 +160,7 @@ static void read_storage_element0_info(SCCB *sccb)
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
}
-static void read_storage_element1_info(SCCB *sccb)
+static void read_storage_element1_info(SCLPDevice *sclp, SCCB *sccb)
{
ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) sccb;
sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
@@ -176,7 +181,8 @@ static void read_storage_element1_info(SCCB *sccb)
sccb->h.response_code = cpu_to_be16(SCLP_RC_STANDBY_READ_COMPLETION);
}
-static void attach_storage_element(SCCB *sccb, uint16_t element)
+static void attach_storage_element(SCLPDevice *sclp, SCCB *sccb,
+ uint16_t element)
{
int i, assigned, subincrement_id;
AttachStorageElement *attach_info = (AttachStorageElement *) sccb;
@@ -200,7 +206,7 @@ static void attach_storage_element(SCCB *sccb, uint16_t element)
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
}
-static void assign_storage(SCCB *sccb)
+static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
{
MemoryRegion *mr = NULL;
uint64_t this_subregion_size;
@@ -255,7 +261,7 @@ static void assign_storage(SCCB *sccb)
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
}
-static void unassign_storage(SCCB *sccb)
+static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
{
MemoryRegion *mr = NULL;
AssignStorage *assign_info = (AssignStorage *) sccb;
@@ -299,7 +305,7 @@ static void unassign_storage(SCCB *sccb)
}
/* Provide information about the CPU */
-static void sclp_read_cpu_info(SCCB *sccb)
+static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb)
{
ReadCpuInfo *cpu_info = (ReadCpuInfo *) sccb;
CPUState *cpu;
@@ -326,34 +332,35 @@ static void sclp_read_cpu_info(SCCB *sccb)
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
}
-static void sclp_execute(SCCB *sccb, uint32_t code)
+static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)
{
- SCLPEventFacility *ef = get_event_facility();
+ SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
+ SCLPEventFacility *ef = sclp->event_facility;
SCLPEventFacilityClass *efc = EVENT_FACILITY_GET_CLASS(ef);
switch (code & SCLP_CMD_CODE_MASK) {
case SCLP_CMDW_READ_SCP_INFO:
case SCLP_CMDW_READ_SCP_INFO_FORCED:
- read_SCP_info(sccb);
+ sclp_c->read_SCP_info(sclp, sccb);
break;
case SCLP_CMDW_READ_CPU_INFO:
- sclp_read_cpu_info(sccb);
+ sclp_c->read_cpu_info(sclp, sccb);
break;
case SCLP_READ_STORAGE_ELEMENT_INFO:
if (code & 0xff00) {
- read_storage_element1_info(sccb);
+ sclp_c->read_storage_element1_info(sclp, sccb);
} else {
- read_storage_element0_info(sccb);
+ sclp_c->read_storage_element0_info(sclp, sccb);
}
break;
case SCLP_ATTACH_STORAGE_ELEMENT:
- attach_storage_element(sccb, (code & 0xff00) >> 8);
+ sclp_c->attach_storage_element(sclp, sccb, (code & 0xff00) >> 8);
break;
case SCLP_ASSIGN_STORAGE:
- assign_storage(sccb);
+ sclp_c->assign_storage(sclp, sccb);
break;
case SCLP_UNASSIGN_STORAGE:
- unassign_storage(sccb);
+ sclp_c->unassign_storage(sclp, sccb);
break;
case SCLP_CMDW_CONFIGURE_PCI:
s390_pci_sclp_configure(1, sccb);
@@ -369,6 +376,8 @@ static void sclp_execute(SCCB *sccb, uint32_t code)
int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
{
+ SCLPDevice *sclp = get_sclp_device();
+ SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
int r = 0;
SCCB work_sccb;
@@ -403,7 +412,7 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
goto out;
}
- sclp_execute((SCCB *)&work_sccb, code);
+ sclp_c->execute(sclp, (SCCB *)&work_sccb, code);
cpu_physical_memory_write(sccb, &work_sccb,
be16_to_cpu(work_sccb.h.length));
@@ -474,12 +483,22 @@ static void sclp_init(Object *obj)
static void sclp_class_init(ObjectClass *oc, void *data)
{
+ SCLPDeviceClass *sc = SCLP_CLASS(oc);
DeviceClass *dc = DEVICE_CLASS(oc);
dc->desc = "SCLP (Service-Call Logical Processor)";
dc->realize = sclp_realize;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+
+ sc->read_SCP_info = read_SCP_info;
+ sc->read_storage_element0_info = read_storage_element0_info;
+ sc->read_storage_element1_info = read_storage_element1_info;
+ sc->attach_storage_element = attach_storage_element;
+ sc->assign_storage = assign_storage;
+ sc->unassign_storage = unassign_storage;
+ sc->read_cpu_info = sclp_read_cpu_info;
+ sc->execute = sclp_execute;
}
static TypeInfo sclp_info = {
diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
index f243438..60db98c 100644
--- a/include/hw/s390x/sclp.h
+++ b/include/hw/s390x/sclp.h
@@ -181,8 +181,17 @@ typedef struct SCLPDevice {
typedef struct SCLPDeviceClass {
/* private */
DeviceClass parent_class;
+ void (*read_SCP_info)(SCLPDevice *sclp, SCCB *sccb);
+ void (*read_storage_element0_info)(SCLPDevice *sclp, SCCB *sccb);
+ void (*read_storage_element1_info)(SCLPDevice *sclp, SCCB *sccb);
+ void (*attach_storage_element)(SCLPDevice *sclp, SCCB *sccb,
+ uint16_t element);
+ void (*assign_storage)(SCLPDevice *sclp, SCCB *sccb);
+ void (*unassign_storage)(SCLPDevice *sclp, SCCB *sccb);
+ void (*read_cpu_info)(SCLPDevice *sclp, SCCB *sccb);
/* public */
+ void (*execute)(SCLPDevice *sclp, SCCB *sccb, uint32_t code);
} SCLPDeviceClass;
typedef struct sclpMemoryHotplugDev sclpMemoryHotplugDev;
--
2.5.1
next prev parent reply other threads:[~2015-08-31 11:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 11:13 [Qemu-devel] [PATCH 00/23] s390x: further patches Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 01/23] s390x/css: handle ccw-0 TIC correctly Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 02/23] s390x/css: ccw-0 enforces count > 0 Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 03/23] s390x/event-facility: fix receive mask check Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 04/23] s390x/css: start with cleared cstat/dstat Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 05/23] s390x/event-facility: fix location of receive mask Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 06/23] pc-bios/s390-ccw: Device detection in higher subchannel sets Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 07/23] pc-bios/s390-ccw: rebuild image Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 08/23] s390x/kvm: make setting of in-kernel irq routes more efficient Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 09/23] s390x/gdb: support reading/writing of control registers Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 10/23] sclp/s390: rework sclp cpu hotplug device notification Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 11/23] s390/sclp: rework sclp event facility initialization + device realization Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 12/23] s390/sclp: replace sclp event types with proper defines Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 13/23] s390/sclp: temporarily fix unassignment/reassignment of memory subregions Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 14/23] s390/sclp: introduce a root sclp device Cornelia Huck
2015-08-31 11:13 ` Cornelia Huck [this message]
2015-08-31 11:13 ` [Qemu-devel] [PATCH 16/23] s390/sclp: move sclp_service_interrupt into the " Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 17/23] s390: no need to manually parse for slots and maxmem Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 18/23] s390: disallow memory hotplug for the s390-virtio machine Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 19/23] s390/sclp: ignore memory hotplug operations if it is disabled Cornelia Huck
2015-08-31 11:14 ` [Qemu-devel] [PATCH 20/23] s390: move memory calculation into the sclp device Cornelia Huck
2015-08-31 11:14 ` [Qemu-devel] [PATCH 21/23] s390: unify allocation of initial memory Cornelia Huck
2015-08-31 11:14 ` [Qemu-devel] [PATCH 22/23] s390/sclp: store the increment_size in the sclp device Cornelia Huck
2015-08-31 11:14 ` [Qemu-devel] [PATCH 23/23] s390/sclp: simplify calculation of rnmax 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=1441019643-10677-16-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=jfrei@linux.vnet.ibm.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 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).