Message ID | 1432814932-12608-30-git-send-email-zhaoshenglong@huawei.com |
---|---|
State | New |
Headers | show |
On 28 May 2015 at 13:08, Shannon Zhao <zhaoshenglong@huawei.com> wrote: > @@ -81,7 +81,10 @@ static void trigger_signal(void *opaque, int n, int level) > > static int irq_cpu_hotplug_init(SCLPEvent *event) > { > - irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1); > + qemu_irq irq = qemu_allocate_irq(trigger_signal, event, 0); > + > + irq_cpu_hotplug = irq; > + qemu_free_irq(irq); > return 0; Huh? Surely we can't validly use the irq once you've called qemu_free_irq() on it? -- PMM
On 2015/5/30 18:34, Paolo Bonzini wrote: > > On 28/05/2015 14:08, Shannon Zhao wrote: >> >-static qemu_irq *irq_cpu_hotplug; /* Only used in this file */ >> >+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); >> >+ qemu_irq_raise(irq_cpu_hotplug); >> > } >> > >> > static unsigned int send_mask(void) >> >@@ -81,7 +81,10 @@ static void trigger_signal(void *opaque, int n, int level) >> > >> > static int irq_cpu_hotplug_init(SCLPEvent *event) >> > { >> >- irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1); >> >+ qemu_irq irq = qemu_allocate_irq(trigger_signal, event, 0); >> >+ >> >+ irq_cpu_hotplug = irq; >> >+ qemu_free_irq(irq); >> > return 0; > This is wrong, you cannot free the IRQ after you have stored it in > irq_cpu_hotplug. Yeah, sorry for that. But I don't find who calls raise_irq_cpu_hotplug(). I'm not very familiar with these codes.
diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index 2fe8b5a..1090e2f 100644 --- a/hw/s390x/sclpcpu.c +++ b/hw/s390x/sclpcpu.c @@ -25,13 +25,13 @@ typedef struct ConfigMgtData { uint8_t event_qualifier; } QEMU_PACKED ConfigMgtData; -static qemu_irq *irq_cpu_hotplug; /* Only used in this file */ +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); + qemu_irq_raise(irq_cpu_hotplug); } static unsigned int send_mask(void) @@ -81,7 +81,10 @@ static void trigger_signal(void *opaque, int n, int level) static int irq_cpu_hotplug_init(SCLPEvent *event) { - irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1); + qemu_irq irq = qemu_allocate_irq(trigger_signal, event, 0); + + irq_cpu_hotplug = irq; + qemu_free_irq(irq); return 0; }