From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBBA0C31E51 for ; Tue, 18 Jun 2019 12:48:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE31820679 for ; Tue, 18 Jun 2019 12:48:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE31820679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdDXC-0000ZP-RO for qemu-devel@archiver.kernel.org; Tue, 18 Jun 2019 08:48:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34921) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdDSr-0005yf-49 for qemu-devel@nongnu.org; Tue, 18 Jun 2019 08:43:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdDSp-00060m-AW for qemu-devel@nongnu.org; Tue, 18 Jun 2019 08:43:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdDSk-0005tV-1T; Tue, 18 Jun 2019 08:43:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E790811D8; Tue, 18 Jun 2019 12:43:45 +0000 (UTC) Received: from [10.36.117.84] (ovpn-117-84.ams2.redhat.com [10.36.117.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A54A357AF; Tue, 18 Jun 2019 12:43:42 +0000 (UTC) To: Shameer Kolothum , qemu-devel@nongnu.org, qemu-arm@nongnu.org, imammedo@redhat.com References: <20190522162252.28568-1-shameerali.kolothum.thodi@huawei.com> <20190522162252.28568-8-shameerali.kolothum.thodi@huawei.com> From: Auger Eric Message-ID: <6bbdbb6a-1b93-7dd6-b73a-74df7321f281@redhat.com> Date: Tue, 18 Jun 2019 14:43:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190522162252.28568-8-shameerali.kolothum.thodi@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 18 Jun 2019 12:43:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH v5 7/8] hw/acpi: Add system power down support to GED X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, sameo@linux.intel.com, ard.biesheuvel@linaro.org, linuxarm@huawei.com, xuwei5@hisilicon.com, shannon.zhaosl@gmail.com, sebastien.boeuf@intel.com, lersek@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi Shameer, On 5/22/19 6:22 PM, Shameer Kolothum wrote: > This adds support to use GED for system power down event. > > Signed-off-by: Shameer Kolothum Reviewed-by: Eric Auger Thanks Eric > --- > hw/acpi/generic_event_device.c | 16 ++++++++++++++++ > include/hw/acpi/generic_event_device.h | 4 ++++ > 2 files changed, 20 insertions(+) > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > index 914fe64716..27c1bb40d4 100644 > --- a/hw/acpi/generic_event_device.c > +++ b/hw/acpi/generic_event_device.c > @@ -20,6 +20,7 @@ > > static const uint32_t ged_supported_events[] = { > ACPI_GED_MEM_HOTPLUG_EVT, > + ACPI_GED_PWR_DOWN_EVT, > }; > > /* > @@ -104,6 +105,11 @@ void build_ged_aml(Aml *table, const char *name, HotplugHandler *hotplug_dev, > aml_append(if_ctx, aml_call0(MEMORY_DEVICES_CONTAINER "." > MEMORY_SLOT_SCAN_METHOD)); > break; > + case ACPI_GED_PWR_DOWN_EVT: > + aml_append(if_ctx, > + aml_notify(aml_name(ACPI_POWER_BUTTON_DEVICE), > + aml_int(0x80))); > + break; > default: > /* > * Please make sure all the events in ged_supported_events[] > @@ -228,6 +234,13 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > acpi_ged_event(s, sel); > } > > +static void acpi_ged_pm_powerdown_req(Notifier *n, void *opaque) > +{ > + AcpiGedState *s = container_of(n, AcpiGedState, powerdown_notifier); > + > + acpi_ged_event(s, ACPI_GED_PWR_DOWN_EVT); > +} > + > static void acpi_ged_device_realize(DeviceState *dev, Error **errp) > { > AcpiGedState *s = ACPI_GED(dev); > @@ -239,6 +252,9 @@ static void acpi_ged_device_realize(DeviceState *dev, Error **errp) > } > > acpi_ged_init(get_system_memory(), dev, &s->ged_state); > + > + s->powerdown_notifier.notify = acpi_ged_pm_powerdown_req; > + qemu_register_powerdown_notifier(&s->powerdown_notifier); > } > > static Property acpi_ged_properties[] = { > diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h > index f69d084c89..9e63b72cb9 100644 > --- a/include/hw/acpi/generic_event_device.h > +++ b/include/hw/acpi/generic_event_device.h > @@ -61,6 +61,8 @@ > > #include "hw/acpi/memory_hotplug.h" > > +#define ACPI_POWER_BUTTON_DEVICE "PWRB" > + > #define TYPE_ACPI_GED "acpi-ged" > #define ACPI_GED(obj) \ > OBJECT_CHECK(AcpiGedState, (obj), TYPE_ACPI_GED) > @@ -79,6 +81,7 @@ > * through GED. > */ > #define ACPI_GED_MEM_HOTPLUG_EVT 0x1 > +#define ACPI_GED_PWR_DOWN_EVT 0x2 > > typedef struct GEDState { > MemoryRegion io; > @@ -88,6 +91,7 @@ typedef struct GEDState { > > typedef struct AcpiGedState { > DeviceClass parent_obj; > + Notifier powerdown_notifier; > MemHotplugState memhp_state; > hwaddr memhp_base; > hwaddr ged_base; >