Skip to content

Commit

Permalink
sclp/s390: rework sclp cpu hotplug device notification
Browse files Browse the repository at this point in the history
Let's get rid of this strange local variable + irq logic and
work directly on the QOM. (hint: what happens if two such devices
are created?)

We could introduce proper QOM class + state for the cpu hotplug device,
however that would result in too much overhead for a simple
"trigger_signal" function.

Also remove one unnecessary class function initialization.

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>
  • Loading branch information
David Hildenbrand authored and cohuck committed Sep 7, 2015
1 parent 5b9f634 commit 073f57a
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions hw/s390x/sclpcpu.c
Expand Up @@ -25,13 +25,16 @@ typedef struct ConfigMgtData {
uint8_t event_qualifier;
} QEMU_PACKED ConfigMgtData;

static qemu_irq *irq_cpu_hotplug; /* Only used in this file */

#define EVENT_QUAL_CPU_CHANGE 1

void raise_irq_cpu_hotplug(void)
{
qemu_irq_raise(*irq_cpu_hotplug);
Object *obj = object_resolve_path_type("", TYPE_SCLP_CPU_HOTPLUG, NULL);

SCLP_EVENT(obj)->event_pending = true;

/* Trigger SCLP read operation */
sclp_service_interrupt(0);
}

static unsigned int send_mask(void)
Expand Down Expand Up @@ -70,31 +73,14 @@ static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr,
return 1;
}

static void trigger_signal(void *opaque, int n, int level)
{
SCLPEvent *event = opaque;
event->event_pending = true;

/* Trigger SCLP read operation */
sclp_service_interrupt(0);
}

static int irq_cpu_hotplug_init(SCLPEvent *event)
{
irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1);
return 0;
}

static void cpu_class_init(ObjectClass *oc, void *data)
{
SCLPEventClass *k = SCLP_EVENT_CLASS(oc);
DeviceClass *dc = DEVICE_CLASS(oc);

k->init = irq_cpu_hotplug_init;
k->get_send_mask = send_mask;
k->get_receive_mask = receive_mask;
k->read_event_data = read_event_data;
k->write_event_data = NULL;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}

Expand Down

0 comments on commit 073f57a

Please sign in to comment.