qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"sameo@linux.intel.com" <sameo@linux.intel.com>,
	"shannon.zhaosl@gmail.com" <shannon.zhaosl@gmail.com>,
	"ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Linuxarm <linuxarm@huawei.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"xuwei \(O\)" <xuwei5@huawei.com>,
	"sebastien.boeuf@intel.com" <sebastien.boeuf@intel.com>,
	"lersek@redhat.com" <lersek@redhat.com>
Subject: Re: [Qemu-devel] [PATCH-for-4.2 v10 05/11] hw/arm/virt: Enable device memory cold/hot plug with ACPI boot
Date: Tue, 17 Sep 2019 17:25:45 +0200	[thread overview]
Message-ID: <20190917172545.41e1dfb9@redhat.com> (raw)
In-Reply-To: <5FC3163CFD30C246ABAA99954A238FA83F3F293A@lhreml524-mbs.china.huawei.com>

On Mon, 16 Sep 2019 10:30:45 +0000
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> wrote:

> Hi Igor,
> 
> > -----Original Message-----
> > From: Igor Mammedov [mailto:imammedo@redhat.com]
> > Sent: 11 September 2019 14:07
> > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> > Cc: qemu-devel@nongnu.org; qemu-arm@nongnu.org;
> > eric.auger@redhat.com; peter.maydell@linaro.org;
> > shannon.zhaosl@gmail.com; sameo@linux.intel.com;
> > sebastien.boeuf@intel.com; xuwei (O) <xuwei5@huawei.com>;
> > lersek@redhat.com; ard.biesheuvel@linaro.org; Linuxarm
> > <linuxarm@huawei.com>
> > Subject: Re: [PATCH-for-4.2 v10 05/11] hw/arm/virt: Enable device memory
> > cold/hot plug with ACPI boot
> > 
> > On Wed, 4 Sep 2019 09:56:23 +0100
> > Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> wrote:
> > 
> > [...]  
> > > @@ -730,6 +733,19 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,  
> > VirtMachineState *vms)  
> > >                        vms->highmem, vms->highmem_ecam);
> > >      acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO],
> > >                         (irqmap[VIRT_GPIO] + ARM_SPI_BASE));
> > > +    if (vms->acpi_dev) {
> > > +        build_ged_aml(scope, "\\_SB."GED_DEVICE,
> > > +                      HOTPLUG_HANDLER(vms->acpi_dev),
> > > +                      irqmap[VIRT_ACPI_GED] + ARM_SPI_BASE,  
> > AML_SYSTEM_MEMORY,  
> > > +                      memmap[VIRT_ACPI_GED].base);
> > > +    }
> > > +
> > > +    if (vms->acpi_dev && ms->ram_slots) {
> > > +        build_memory_hotplug_aml(scope, ms->ram_slots, "\\_SB",  
> > NULL,  
> > > +                                 AML_SYSTEM_MEMORY,
> > > +  
> > memmap[VIRT_PCDIMM_ACPI].base);  
> > > +    }  
> > one more thing (though non critical), if ms->ram_slots == 0 ^^^^
> > makes IASL spew a warning
> > 
> >     External (_SB_.MHPC.MSCN, MethodObj)    // Warning: Unknown
> > method, guessing 0 arguments
> > 
> > In general non-existing references within methods are fine if they aren't ever
> > used.
> > however we can be a little bit less sloppy.
> > Below you advertise "event = ACPI_GED_MEM_HOTPLUG_EVT", and then here
> > suddenly
> > don't generate essential AML part for it here.  
> 
> Ok.
> 
> > For consistency if above is conditioned on ms->ram_slots != 0, probably
> > it would be better to move that condition where you set 'event' value and
> > check property value above instead of ms->ram_slots  
> 
> I understand the concern here, but not sure I get the suggestion to check 
> the "property" instead of ms->ram_slots correctly. 
> 
> Is this what you have in mind?
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 538b3bbefa..5c9269dca1 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -742,10 +742,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>                        memmap[VIRT_ACPI_GED].base);
>      }
>  
> -    if (vms->acpi_dev && ms->ram_slots) {
> -        build_memory_hotplug_aml(scope, ms->ram_slots, "\\_SB", NULL,
> -                                 AML_SYSTEM_MEMORY,
> -                                 memmap[VIRT_PCDIMM_ACPI].base);
> +    if (vms->acpi_dev) {
> +        uint32_t event = object_property_get_uint(OBJECT(vms->acpi_dev),
> +                                                  "ged-event", NULL);
s/NULL/error_abort/

> +
> +        if (event & ACPI_GED_MEM_HOTPLUG_EVT) {
> +            build_memory_hotplug_aml(scope, ms->ram_slots, "\\_SB", NULL,
> +                                     AML_SYSTEM_MEMORY,
> +                                     memmap[VIRT_PCDIMM_ACPI].base);
> +        }
>      }
>  
>      acpi_dsdt_add_power_button(scope);
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index bc152ea2b0..6b024b16df 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -534,8 +534,13 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
>  static inline DeviceState *create_acpi_ged(VirtMachineState *vms, qemu_irq *pic)
>  {
>      DeviceState *dev;
> +    MachineState *ms = MACHINE(vms);
>      int irq = vms->irqmap[VIRT_ACPI_GED];
> -    uint32_t event = ACPI_GED_MEM_HOTPLUG_EVT;
> +    uint32_t event = 0;
> +
> +    if (ms->ram_slots) {
> +        event = ACPI_GED_MEM_HOTPLUG_EVT;
> +    }
>  
>      dev = qdev_create(NULL, TYPE_ACPI_GED);
>      qdev_prop_set_uint32(dev, "ged-event", event);
> 
> ---8---
>
> Please let me know.
Looks good to me.

Thanks!


> 
> Thanks,
> Shameer
> 
>  
> > [...]  
> > > +static inline DeviceState *create_acpi_ged(VirtMachineState *vms,  
> > qemu_irq *pic)  
> > > +{
> > > +    DeviceState *dev;
> > > +    int irq = vms->irqmap[VIRT_ACPI_GED];
> > > +    uint32_t event = ACPI_GED_MEM_HOTPLUG_EVT;
> > > +
> > > +    dev = qdev_create(NULL, TYPE_ACPI_GED);
> > > +    qdev_prop_set_uint32(dev, "ged-event", event);
> > > +    qdev_init_nofail(dev);
> > > +
> > > +    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0,  
> > vms->memmap[VIRT_ACPI_GED].base);  
> > > +    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1,  
> > vms->memmap[VIRT_PCDIMM_ACPI].base);  
> > > +
> > > +    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irq]);
> > > +
> > > +    return dev;
> > > +}
> > > +  
> > [...]  



  reply	other threads:[~2019-09-17 15:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  8:56 [Qemu-devel] [PATCH-for-4.2 v10 00/11] ARM virt: ACPI memory hotplug support Shameer Kolothum
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 01/11] hw/acpi: Make ACPI IO address space configurable Shameer Kolothum
2019-09-04 11:27   ` Igor Mammedov
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 02/11] hw/acpi: Do not create memory hotplug method when handler is not defined Shameer Kolothum
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 03/11] hw/acpi: Add ACPI Generic Event Device Support Shameer Kolothum
2019-09-11 12:34   ` Igor Mammedov
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 04/11] hw/arm/virt: Add memory hotplug framework Shameer Kolothum
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 05/11] hw/arm/virt: Enable device memory cold/hot plug with ACPI boot Shameer Kolothum
2019-09-11 12:48   ` Igor Mammedov
2019-09-11 13:07   ` Igor Mammedov
2019-09-16 10:30     ` Shameerali Kolothum Thodi
2019-09-17 15:25       ` Igor Mammedov [this message]
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 06/11] hw/arm/virt-acpi-build: Add PC-DIMM in SRAT Shameer Kolothum
2019-09-11 13:14   ` Igor Mammedov
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 07/11] hw/arm: Factor out powerdown notifier from GPIO Shameer Kolothum
2019-09-11 13:08   ` Igor Mammedov
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 08/11] hw/arm: Use GED for system_powerdown event Shameer Kolothum
2019-09-11 13:20   ` Igor Mammedov
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 09/11] docs/specs: Add ACPI GED documentation Shameer Kolothum
2019-09-11 12:54   ` Peter Maydell
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 10/11] tests: add dummy ACPI tables for arm/virt board Shameer Kolothum
2019-09-11 12:57   ` Peter Maydell
2019-09-11 13:50     ` Igor Mammedov
2019-09-11 13:55       ` Michael S. Tsirkin
2019-09-11 14:33         ` Shameerali Kolothum Thodi
2019-09-17 15:11         ` Michael S. Tsirkin
2019-09-17 15:23           ` Peter Maydell
2019-09-04  8:56 ` [Qemu-devel] [PATCH-for-4.2 v10 11/11] tests: Add bios tests to arm/virt Shameer Kolothum
2019-09-11 13:46   ` Igor Mammedov

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=20190917172545.41e1dfb9@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=eric.auger@redhat.com \
    --cc=lersek@redhat.com \
    --cc=linuxarm@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sameo@linux.intel.com \
    --cc=sebastien.boeuf@intel.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shannon.zhaosl@gmail.com \
    --cc=xuwei5@huawei.com \
    /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).