xref: /openbmc/qemu/hw/s390x/sclp.c (revision 91bfcdb0)
1 /*
2  * SCLP Support
3  *
4  * Copyright IBM, Corp. 2012
5  *
6  * Authors:
7  *  Christian Borntraeger <borntraeger@de.ibm.com>
8  *  Heinz Graalfs <graalfs@linux.vnet.ibm.com>
9  *
10  * This work is licensed under the terms of the GNU GPL, version 2 or (at your
11  * option) any later version.  See the COPYING file in the top-level directory.
12  *
13  */
14 
15 #include "cpu.h"
16 #include "sysemu/kvm.h"
17 #include "exec/memory.h"
18 #include "sysemu/sysemu.h"
19 #include "exec/address-spaces.h"
20 #include "hw/boards.h"
21 #include "hw/s390x/sclp.h"
22 #include "hw/s390x/event-facility.h"
23 #include "hw/s390x/s390-pci-bus.h"
24 
25 static inline SCLPDevice *get_sclp_device(void)
26 {
27     return SCLP(object_resolve_path_type("", TYPE_SCLP, NULL));
28 }
29 
30 /* Provide information about the configuration, CPUs and storage */
31 static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
32 {
33     ReadInfo *read_info = (ReadInfo *) sccb;
34     MachineState *machine = MACHINE(qdev_get_machine());
35     sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
36     CPUState *cpu;
37     int cpu_count = 0;
38     int i = 0;
39     int rnsize, rnmax;
40     int slots = MIN(machine->ram_slots, s390_get_memslot_count(kvm_state));
41 
42     CPU_FOREACH(cpu) {
43         cpu_count++;
44     }
45 
46     /* CPU information */
47     read_info->entries_cpu = cpu_to_be16(cpu_count);
48     read_info->offset_cpu = cpu_to_be16(offsetof(ReadInfo, entries));
49     read_info->highest_cpu = cpu_to_be16(max_cpus);
50 
51     for (i = 0; i < cpu_count; i++) {
52         read_info->entries[i].address = i;
53         read_info->entries[i].type = 0;
54     }
55 
56     read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO |
57                                         SCLP_HAS_PCI_RECONFIG);
58 
59     /* Memory Hotplug is only supported for the ccw machine type */
60     if (mhd) {
61         mhd->standby_subregion_size = MEM_SECTION_SIZE;
62         /* Deduct the memory slot already used for core */
63         if (slots > 0) {
64             while ((mhd->standby_subregion_size * (slots - 1)
65                     < mhd->standby_mem_size)) {
66                 mhd->standby_subregion_size = mhd->standby_subregion_size << 1;
67             }
68         }
69         /*
70          * Initialize mapping of guest standby memory sections indicating which
71          * are and are not online. Assume all standby memory begins offline.
72          */
73         if (mhd->standby_state_map == 0) {
74             if (mhd->standby_mem_size % mhd->standby_subregion_size) {
75                 mhd->standby_state_map = g_malloc0((mhd->standby_mem_size /
76                                              mhd->standby_subregion_size + 1) *
77                                              (mhd->standby_subregion_size /
78                                              MEM_SECTION_SIZE));
79             } else {
80                 mhd->standby_state_map = g_malloc0(mhd->standby_mem_size /
81                                                    MEM_SECTION_SIZE);
82             }
83         }
84         mhd->padded_ram_size = ram_size + mhd->pad_size;
85         mhd->rzm = 1 << mhd->increment_size;
86 
87         read_info->facilities |= cpu_to_be64(SCLP_FC_ASSIGN_ATTACH_READ_STOR);
88     }
89 
90     rnsize = 1 << (sclp->increment_size - 20);
91     if (rnsize <= 128) {
92         read_info->rnsize = rnsize;
93     } else {
94         read_info->rnsize = 0;
95         read_info->rnsize2 = cpu_to_be32(rnsize);
96     }
97 
98     rnmax = machine->maxram_size >> sclp->increment_size;
99     if (rnmax < 0x10000) {
100         read_info->rnmax = cpu_to_be16(rnmax);
101     } else {
102         read_info->rnmax = cpu_to_be16(0);
103         read_info->rnmax2 = cpu_to_be64(rnmax);
104     }
105 
106     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
107 }
108 
109 static void read_storage_element0_info(SCLPDevice *sclp, SCCB *sccb)
110 {
111     int i, assigned;
112     int subincrement_id = SCLP_STARTING_SUBINCREMENT_ID;
113     ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) sccb;
114     sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
115 
116     if (!mhd) {
117         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
118         return;
119     }
120 
121     if ((ram_size >> mhd->increment_size) >= 0x10000) {
122         sccb->h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);
123         return;
124     }
125 
126     /* Return information regarding core memory */
127     storage_info->max_id = cpu_to_be16(mhd->standby_mem_size ? 1 : 0);
128     assigned = ram_size >> mhd->increment_size;
129     storage_info->assigned = cpu_to_be16(assigned);
130 
131     for (i = 0; i < assigned; i++) {
132         storage_info->entries[i] = cpu_to_be32(subincrement_id);
133         subincrement_id += SCLP_INCREMENT_UNIT;
134     }
135     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
136 }
137 
138 static void read_storage_element1_info(SCLPDevice *sclp, SCCB *sccb)
139 {
140     ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) sccb;
141     sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
142 
143     if (!mhd) {
144         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
145         return;
146     }
147 
148     if ((mhd->standby_mem_size >> mhd->increment_size) >= 0x10000) {
149         sccb->h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);
150         return;
151     }
152 
153     /* Return information regarding standby memory */
154     storage_info->max_id = cpu_to_be16(mhd->standby_mem_size ? 1 : 0);
155     storage_info->assigned = cpu_to_be16(mhd->standby_mem_size >>
156                                          mhd->increment_size);
157     storage_info->standby = cpu_to_be16(mhd->standby_mem_size >>
158                                         mhd->increment_size);
159     sccb->h.response_code = cpu_to_be16(SCLP_RC_STANDBY_READ_COMPLETION);
160 }
161 
162 static void attach_storage_element(SCLPDevice *sclp, SCCB *sccb,
163                                    uint16_t element)
164 {
165     int i, assigned, subincrement_id;
166     AttachStorageElement *attach_info = (AttachStorageElement *) sccb;
167     sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
168 
169     if (!mhd) {
170         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
171         return;
172     }
173 
174     if (element != 1) {
175         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
176         return;
177     }
178 
179     assigned = mhd->standby_mem_size >> mhd->increment_size;
180     attach_info->assigned = cpu_to_be16(assigned);
181     subincrement_id = ((ram_size >> mhd->increment_size) << 16)
182                       + SCLP_STARTING_SUBINCREMENT_ID;
183     for (i = 0; i < assigned; i++) {
184         attach_info->entries[i] = cpu_to_be32(subincrement_id);
185         subincrement_id += SCLP_INCREMENT_UNIT;
186     }
187     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
188 }
189 
190 static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
191 {
192     MemoryRegion *mr = NULL;
193     uint64_t this_subregion_size;
194     AssignStorage *assign_info = (AssignStorage *) sccb;
195     sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
196     ram_addr_t assign_addr;
197     MemoryRegion *sysmem = get_system_memory();
198 
199     if (!mhd) {
200         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
201         return;
202     }
203     assign_addr = (assign_info->rn - 1) * mhd->rzm;
204 
205     if ((assign_addr % MEM_SECTION_SIZE == 0) &&
206         (assign_addr >= mhd->padded_ram_size)) {
207         /* Re-use existing memory region if found */
208         mr = memory_region_find(sysmem, assign_addr, 1).mr;
209         memory_region_unref(mr);
210         if (!mr) {
211 
212             MemoryRegion *standby_ram = g_new(MemoryRegion, 1);
213 
214             /* offset to align to standby_subregion_size for allocation */
215             ram_addr_t offset = assign_addr -
216                                 (assign_addr - mhd->padded_ram_size)
217                                 % mhd->standby_subregion_size;
218 
219             /* strlen("standby.ram") + 4 (Max of KVM_MEMORY_SLOTS) +  NULL */
220             char id[16];
221             snprintf(id, 16, "standby.ram%d",
222                      (int)((offset - mhd->padded_ram_size) /
223                      mhd->standby_subregion_size) + 1);
224 
225             /* Allocate a subregion of the calculated standby_subregion_size */
226             if (offset + mhd->standby_subregion_size >
227                 mhd->padded_ram_size + mhd->standby_mem_size) {
228                 this_subregion_size = mhd->padded_ram_size +
229                   mhd->standby_mem_size - offset;
230             } else {
231                 this_subregion_size = mhd->standby_subregion_size;
232             }
233 
234             memory_region_init_ram(standby_ram, NULL, id, this_subregion_size,
235                                    &error_fatal);
236             /* This is a hack to make memory hotunplug work again. Once we have
237              * subdevices, we have to unparent them when unassigning memory,
238              * instead of doing it via the ref count of the MemoryRegion. */
239             object_ref(OBJECT(standby_ram));
240             object_unparent(OBJECT(standby_ram));
241             vmstate_register_ram_global(standby_ram);
242             memory_region_add_subregion(sysmem, offset, standby_ram);
243         }
244         /* The specified subregion is no longer in standby */
245         mhd->standby_state_map[(assign_addr - mhd->padded_ram_size)
246                                / MEM_SECTION_SIZE] = 1;
247     }
248     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
249 }
250 
251 static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
252 {
253     MemoryRegion *mr = NULL;
254     AssignStorage *assign_info = (AssignStorage *) sccb;
255     sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
256     ram_addr_t unassign_addr;
257     MemoryRegion *sysmem = get_system_memory();
258 
259     if (!mhd) {
260         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
261         return;
262     }
263     unassign_addr = (assign_info->rn - 1) * mhd->rzm;
264 
265     /* if the addr is a multiple of 256 MB */
266     if ((unassign_addr % MEM_SECTION_SIZE == 0) &&
267         (unassign_addr >= mhd->padded_ram_size)) {
268         mhd->standby_state_map[(unassign_addr -
269                            mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0;
270 
271         /* find the specified memory region and destroy it */
272         mr = memory_region_find(sysmem, unassign_addr, 1).mr;
273         memory_region_unref(mr);
274         if (mr) {
275             int i;
276             int is_removable = 1;
277             ram_addr_t map_offset = (unassign_addr - mhd->padded_ram_size -
278                                      (unassign_addr - mhd->padded_ram_size)
279                                      % mhd->standby_subregion_size);
280             /* Mark all affected subregions as 'standby' once again */
281             for (i = 0;
282                  i < (mhd->standby_subregion_size / MEM_SECTION_SIZE);
283                  i++) {
284 
285                 if (mhd->standby_state_map[i + map_offset / MEM_SECTION_SIZE]) {
286                     is_removable = 0;
287                     break;
288                 }
289             }
290             if (is_removable) {
291                 memory_region_del_subregion(sysmem, mr);
292                 object_unref(OBJECT(mr));
293             }
294         }
295     }
296     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
297 }
298 
299 /* Provide information about the CPU */
300 static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb)
301 {
302     ReadCpuInfo *cpu_info = (ReadCpuInfo *) sccb;
303     CPUState *cpu;
304     int cpu_count = 0;
305     int i = 0;
306 
307     CPU_FOREACH(cpu) {
308         cpu_count++;
309     }
310 
311     cpu_info->nr_configured = cpu_to_be16(cpu_count);
312     cpu_info->offset_configured = cpu_to_be16(offsetof(ReadCpuInfo, entries));
313     cpu_info->nr_standby = cpu_to_be16(0);
314 
315     /* The standby offset is 16-byte for each CPU */
316     cpu_info->offset_standby = cpu_to_be16(cpu_info->offset_configured
317         + cpu_info->nr_configured*sizeof(CPUEntry));
318 
319     for (i = 0; i < cpu_count; i++) {
320         cpu_info->entries[i].address = i;
321         cpu_info->entries[i].type = 0;
322     }
323 
324     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
325 }
326 
327 static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)
328 {
329     SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
330     SCLPEventFacility *ef = sclp->event_facility;
331     SCLPEventFacilityClass *efc = EVENT_FACILITY_GET_CLASS(ef);
332 
333     switch (code & SCLP_CMD_CODE_MASK) {
334     case SCLP_CMDW_READ_SCP_INFO:
335     case SCLP_CMDW_READ_SCP_INFO_FORCED:
336         sclp_c->read_SCP_info(sclp, sccb);
337         break;
338     case SCLP_CMDW_READ_CPU_INFO:
339         sclp_c->read_cpu_info(sclp, sccb);
340         break;
341     case SCLP_READ_STORAGE_ELEMENT_INFO:
342         if (code & 0xff00) {
343             sclp_c->read_storage_element1_info(sclp, sccb);
344         } else {
345             sclp_c->read_storage_element0_info(sclp, sccb);
346         }
347         break;
348     case SCLP_ATTACH_STORAGE_ELEMENT:
349         sclp_c->attach_storage_element(sclp, sccb, (code & 0xff00) >> 8);
350         break;
351     case SCLP_ASSIGN_STORAGE:
352         sclp_c->assign_storage(sclp, sccb);
353         break;
354     case SCLP_UNASSIGN_STORAGE:
355         sclp_c->unassign_storage(sclp, sccb);
356         break;
357     case SCLP_CMDW_CONFIGURE_PCI:
358         s390_pci_sclp_configure(1, sccb);
359         break;
360     case SCLP_CMDW_DECONFIGURE_PCI:
361         s390_pci_sclp_configure(0, sccb);
362         break;
363     default:
364         efc->command_handler(ef, sccb, code);
365         break;
366     }
367 }
368 
369 int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
370 {
371     SCLPDevice *sclp = get_sclp_device();
372     SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
373     int r = 0;
374     SCCB work_sccb;
375 
376     hwaddr sccb_len = sizeof(SCCB);
377 
378     /* first some basic checks on program checks */
379     if (env->psw.mask & PSW_MASK_PSTATE) {
380         r = -PGM_PRIVILEGED;
381         goto out;
382     }
383     if (cpu_physical_memory_is_io(sccb)) {
384         r = -PGM_ADDRESSING;
385         goto out;
386     }
387     if ((sccb & ~0x1fffUL) == 0 || (sccb & ~0x1fffUL) == env->psa
388         || (sccb & ~0x7ffffff8UL) != 0) {
389         r = -PGM_SPECIFICATION;
390         goto out;
391     }
392 
393     /*
394      * we want to work on a private copy of the sccb, to prevent guests
395      * from playing dirty tricks by modifying the memory content after
396      * the host has checked the values
397      */
398     cpu_physical_memory_read(sccb, &work_sccb, sccb_len);
399 
400     /* Valid sccb sizes */
401     if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||
402         be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) {
403         r = -PGM_SPECIFICATION;
404         goto out;
405     }
406 
407     sclp_c->execute(sclp, (SCCB *)&work_sccb, code);
408 
409     cpu_physical_memory_write(sccb, &work_sccb,
410                               be16_to_cpu(work_sccb.h.length));
411 
412     sclp_c->service_interrupt(sclp, sccb);
413 
414 out:
415     return r;
416 }
417 
418 static void service_interrupt(SCLPDevice *sclp, uint32_t sccb)
419 {
420     SCLPEventFacility *ef = sclp->event_facility;
421     SCLPEventFacilityClass *efc = EVENT_FACILITY_GET_CLASS(ef);
422 
423     uint32_t param = sccb & ~3;
424 
425     /* Indicate whether an event is still pending */
426     param |= efc->event_pending(ef) ? 1 : 0;
427 
428     if (!param) {
429         /* No need to send an interrupt, there's nothing to be notified about */
430         return;
431     }
432     s390_sclp_extint(param);
433 }
434 
435 void sclp_service_interrupt(uint32_t sccb)
436 {
437     SCLPDevice *sclp = get_sclp_device();
438     SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
439 
440     sclp_c->service_interrupt(sclp, sccb);
441 }
442 
443 /* qemu object creation and initialization functions */
444 
445 void s390_sclp_init(void)
446 {
447     Object *new = object_new(TYPE_SCLP);
448 
449     object_property_add_child(qdev_get_machine(), TYPE_SCLP, new,
450                               NULL);
451     object_unref(OBJECT(new));
452     qdev_init_nofail(DEVICE(new));
453 }
454 
455 static void sclp_realize(DeviceState *dev, Error **errp)
456 {
457     MachineState *machine = MACHINE(qdev_get_machine());
458     SCLPDevice *sclp = SCLP(dev);
459     Error *l_err = NULL;
460     uint64_t hw_limit;
461     int ret;
462 
463     object_property_set_bool(OBJECT(sclp->event_facility), true, "realized",
464                              &l_err);
465     if (l_err) {
466         goto error;
467     }
468 
469     ret = s390_set_memory_limit(machine->maxram_size, &hw_limit);
470     if (ret == -E2BIG) {
471         error_setg(&l_err, "qemu: host supports a maximum of %" PRIu64 " GB",
472                    hw_limit >> 30);
473         goto error;
474     } else if (ret) {
475         error_setg(&l_err, "qemu: setting the guest size failed");
476         goto error;
477     }
478     return;
479 error:
480     assert(l_err);
481     error_propagate(errp, l_err);
482 }
483 
484 static void sclp_memory_init(SCLPDevice *sclp)
485 {
486     MachineState *machine = MACHINE(qdev_get_machine());
487     ram_addr_t initial_mem = machine->ram_size;
488     ram_addr_t max_mem = machine->maxram_size;
489     ram_addr_t standby_mem = max_mem - initial_mem;
490     ram_addr_t pad_mem = 0;
491     int increment_size = 20;
492 
493     /* The storage increment size is a multiple of 1M and is a power of 2.
494      * The number of storage increments must be MAX_STORAGE_INCREMENTS or fewer.
495      * The variable 'increment_size' is an exponent of 2 that can be
496      * used to calculate the size (in bytes) of an increment. */
497     while ((initial_mem >> increment_size) > MAX_STORAGE_INCREMENTS) {
498         increment_size++;
499     }
500     if (machine->ram_slots) {
501         while ((standby_mem >> increment_size) > MAX_STORAGE_INCREMENTS) {
502             increment_size++;
503         }
504     }
505     sclp->increment_size = increment_size;
506 
507     /* The core and standby memory areas need to be aligned with
508      * the increment size.  In effect, this can cause the
509      * user-specified memory size to be rounded down to align
510      * with the nearest increment boundary. */
511     initial_mem = initial_mem >> increment_size << increment_size;
512     standby_mem = standby_mem >> increment_size << increment_size;
513 
514     /* If the size of ram is not on a MEM_SECTION_SIZE boundary,
515        calculate the pad size necessary to force this boundary. */
516     if (machine->ram_slots && standby_mem) {
517         sclpMemoryHotplugDev *mhd = init_sclp_memory_hotplug_dev();
518 
519         if (initial_mem % MEM_SECTION_SIZE) {
520             pad_mem = MEM_SECTION_SIZE - initial_mem % MEM_SECTION_SIZE;
521         }
522         mhd->increment_size = increment_size;
523         mhd->pad_size = pad_mem;
524         mhd->standby_mem_size = standby_mem;
525     }
526     machine->ram_size = initial_mem;
527     machine->maxram_size = initial_mem + pad_mem + standby_mem;
528     /* let's propagate the changed ram size into the global variable. */
529     ram_size = initial_mem;
530 }
531 
532 static void sclp_init(Object *obj)
533 {
534     SCLPDevice *sclp = SCLP(obj);
535     Object *new;
536 
537     new = object_new(TYPE_SCLP_EVENT_FACILITY);
538     object_property_add_child(obj, TYPE_SCLP_EVENT_FACILITY, new, NULL);
539     /* qdev_device_add searches the sysbus for TYPE_SCLP_EVENTS_BUS */
540     qdev_set_parent_bus(DEVICE(new), sysbus_get_default());
541     object_unref(new);
542     sclp->event_facility = EVENT_FACILITY(new);
543 
544     sclp_memory_init(sclp);
545 }
546 
547 static void sclp_class_init(ObjectClass *oc, void *data)
548 {
549     SCLPDeviceClass *sc = SCLP_CLASS(oc);
550     DeviceClass *dc = DEVICE_CLASS(oc);
551 
552     dc->desc = "SCLP (Service-Call Logical Processor)";
553     dc->realize = sclp_realize;
554     dc->hotpluggable = false;
555     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
556 
557     sc->read_SCP_info = read_SCP_info;
558     sc->read_storage_element0_info = read_storage_element0_info;
559     sc->read_storage_element1_info = read_storage_element1_info;
560     sc->attach_storage_element = attach_storage_element;
561     sc->assign_storage = assign_storage;
562     sc->unassign_storage = unassign_storage;
563     sc->read_cpu_info = sclp_read_cpu_info;
564     sc->execute = sclp_execute;
565     sc->service_interrupt = service_interrupt;
566 }
567 
568 static TypeInfo sclp_info = {
569     .name = TYPE_SCLP,
570     .parent = TYPE_DEVICE,
571     .instance_init = sclp_init,
572     .instance_size = sizeof(SCLPDevice),
573     .class_init = sclp_class_init,
574     .class_size = sizeof(SCLPDeviceClass),
575 };
576 
577 sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void)
578 {
579     DeviceState *dev;
580     dev = qdev_create(NULL, TYPE_SCLP_MEMORY_HOTPLUG_DEV);
581     object_property_add_child(qdev_get_machine(),
582                               TYPE_SCLP_MEMORY_HOTPLUG_DEV,
583                               OBJECT(dev), NULL);
584     qdev_init_nofail(dev);
585     return SCLP_MEMORY_HOTPLUG_DEV(object_resolve_path(
586                                    TYPE_SCLP_MEMORY_HOTPLUG_DEV, NULL));
587 }
588 
589 sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void)
590 {
591     return SCLP_MEMORY_HOTPLUG_DEV(object_resolve_path(
592                                    TYPE_SCLP_MEMORY_HOTPLUG_DEV, NULL));
593 }
594 
595 static void sclp_memory_hotplug_dev_class_init(ObjectClass *klass,
596                                                void *data)
597 {
598     DeviceClass *dc = DEVICE_CLASS(klass);
599 
600     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
601 }
602 
603 static TypeInfo sclp_memory_hotplug_dev_info = {
604     .name = TYPE_SCLP_MEMORY_HOTPLUG_DEV,
605     .parent = TYPE_SYS_BUS_DEVICE,
606     .instance_size = sizeof(sclpMemoryHotplugDev),
607     .class_init = sclp_memory_hotplug_dev_class_init,
608 };
609 
610 static void register_types(void)
611 {
612     type_register_static(&sclp_memory_hotplug_dev_info);
613     type_register_static(&sclp_info);
614 }
615 type_init(register_types);
616