[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACP
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device |
Date: |
Fri, 11 Apr 2014 11:13:39 +0200 |
On Mon, 7 Apr 2014 18:21:14 +0300
"Michael S. Tsirkin" <address@hidden> wrote:
> On Mon, Apr 07, 2014 at 04:26:02PM +0200, Igor Mammedov wrote:
> > On Mon, 7 Apr 2014 11:13:01 -0300
> > Eduardo Habkost <address@hidden> wrote:
> >
> > > On Mon, Apr 07, 2014 at 01:07:53PM +1000, Alexey Kardashevskiy wrote:
> > > > On 04/05/2014 12:36 AM, Igor Mammedov wrote:
> > > > > Notify PIIX4_PM/ICH9LPC device about hotplug event,
> > > > > so that it would send SCI to guest notifying about
> > > > > newly added memory.
> > > > >
> > > > > Signed-off-by: Igor Mammedov <address@hidden>
> > > > > ---
> > > > > hw/i386/pc.c | 13 +++++++++++++
> > > > > 1 file changed, 13 insertions(+)
> > > > >
> > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > > > > index 734c6ee..ee5cf88 100644
> > > > > --- a/hw/i386/pc.c
> > > > > +++ b/hw/i386/pc.c
> > > > > @@ -60,6 +60,8 @@
> > > > > #include "acpi-build.h"
> > > > > #include "hw/mem/dimm.h"
> > > > > #include "trace.h"
> > > > > +#include "hw/acpi/piix4.h"
> > > > > +#include "hw/i386/ich9.h"
> > > > >
> > > > > /* debug PC/ISA interrupts */
> > > > > //#define DEBUG_IRQ
> > > > > @@ -1484,6 +1486,8 @@ void qemu_register_pc_machine(QEMUMachine *m)
> > > > > static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> > > > > DeviceState *dev, Error **errp)
> > > > > {
> > > > > + Object *acpi_dev;
> > > > > + HotplugHandlerClass *hhc;
> > > > > Error *local_err = NULL;
> > > > > PCMachineState *pcms = PC_MACHINE(hotplug_dev);
> > > > > DimmDevice *dimm = DIMM(dev);
> > > > > @@ -1517,10 +1521,19 @@ static void pc_dimm_plug(HotplugHandler
> > > > > *hotplug_dev,
> > > > > }
> > > > > trace_mhp_pc_dimm_assigned_slot(dimm->slot);
> > > > >
> > > > > + acpi_dev = (acpi_dev = piix4_pm_find()) ? acpi_dev : ;
> > ;
> > > >
> > > >
> > > > wow. just wow.
> > >
> > > I had to read the C99 spec to find out if this was safe. :-)
> > >
> > > But I believe it is readable, I wouldn't mind keeping it that way.
> > >
> > I'll change it to a less obscure form:
> >
> > acpi_dev = piix4_pm_find();
> > if (!acpi_dev) {
> > acpi_dev = ich9_lpc_find();
> > }
>
>
> or
>
> Object *piix = piix4_pm_find();
> Object *lpc = ich9_lpc_find();
> assert(!!piix != !!lpc);
wouldn't that assert on device_add if qemu was started without ACPI?
Exiting with error if acpi_dev == NULL seems safer here.
>
>
> so we verify it's one of the other.
>
--
Regards,
Igor
- [Qemu-devel] [PATCH 30/35] pc: ACPI BIOS: name CPU hotplug ACPI0004 device, (continued)
Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Michael S. Tsirkin, 2014/04/07
- Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Igor Mammedov, 2014/04/07
- Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Igor Mammedov, 2014/04/07
- Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Michael S. Tsirkin, 2014/04/07
- Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Igor Mammedov, 2014/04/11
- Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Paolo Bonzini, 2014/04/14
- Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Igor Mammedov, 2014/04/14
Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Michael S. Tsirkin, 2014/04/16
Re: [Qemu-devel] [PATCH 28/35] pc: propagate memory hotplug event to ACPI device, Igor Mammedov, 2014/04/16
[Qemu-devel] [PATCH 35/35] pc: ACPI BIOS: update pregenerated ACPI table blobs, Igor Mammedov, 2014/04/04