From nobody Wed Nov 12 03:45:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1567588117; cv=none; d=zoho.com; s=zohoarc; b=mPHA8jOEEODU1+RVdkY0QgQ1SXIj6f4gI5P5xcBHgmi/R14UJpzOR8XrzbAqaaKKD6LsWNkdPEPAUrvMYUc3H/a9fy1Fcbo8Xe5/OnMA500b7k+E/lBp9FosB9HNdHiaN8xlftBj30XY4bf9i0OzPeL1XmQDmbm4FgH0dBVHgnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567588117; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=d+Y28knmJAqtHdG2lLlZJCXNKp7pRY9ulmhT4Mwhfoc=; b=b88x0ecZDWBmSfOXnG5BywPaYNUTBz15SSO9sLAAgPIo8sjxdN5l9GSmI42grTsoMzLeCpOm2EOZtYKmKQBtWD0tHWvTLhtPBpzN6ZmNybI9hQGNJJ2g8WLzPO9dX8pBVGdm7ATMH2s9Oo2VjELIPAGI/rUX8f4Ifoi2QeL6DHw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567588117662794.6004443800549; Wed, 4 Sep 2019 02:08:37 -0700 (PDT) Received: from localhost ([::1]:54812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5RHI-0000QJ-Eb for importer@patchew.org; Wed, 04 Sep 2019 05:08:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38621) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5R76-0007P7-Qp for qemu-devel@nongnu.org; Wed, 04 Sep 2019 04:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5R75-0007FV-Ge for qemu-devel@nongnu.org; Wed, 04 Sep 2019 04:58:04 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2259 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5R72-0007Dh-SF; Wed, 04 Sep 2019 04:58:01 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 00B234839B1CCFF82788; Wed, 4 Sep 2019 16:57:59 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Wed, 4 Sep 2019 16:57:50 +0800 From: Shameer Kolothum To: , , , Date: Wed, 4 Sep 2019 09:56:25 +0100 Message-ID: <20190904085629.13872-8-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190904085629.13872-1-shameerali.kolothum.thodi@huawei.com> References: <20190904085629.13872-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.237] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 45.249.212.191 Subject: [Qemu-devel] [PATCH-for-4.2 v10 07/11] hw/arm: Factor out powerdown notifier from GPIO 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is in preparation of using GED device for system_powerdown event. Make the powerdown notifier registration independent of create_gpio() fn. Signed-off-by: Shameer Kolothum Reviewed-by: Eric Auger Reviewed-by: Igor Mammedov --- hw/arm/virt.c | 12 ++++-------- include/hw/arm/virt.h | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 95accc28f1..89ee37d7de 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -791,10 +791,6 @@ static void virt_powerdown_req(Notifier *n, void *opaq= ue) qemu_set_irq(qdev_get_gpio_in(gpio_key_dev, 0), 1); } =20 -static Notifier virt_system_powerdown_notifier =3D { - .notify =3D virt_powerdown_req -}; - static void create_gpio(const VirtMachineState *vms, qemu_irq *pic) { char *nodename; @@ -835,10 +831,6 @@ static void create_gpio(const VirtMachineState *vms, q= emu_irq *pic) KEY_POWER); qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", "gpios", phandle, 3, 0); - - /* connect powerdown request */ - qemu_register_powerdown_notifier(&virt_system_powerdown_notifier); - g_free(nodename); } =20 @@ -1730,6 +1722,10 @@ static void machvirt_init(MachineState *machine) vms->acpi_dev =3D create_acpi_ged(vms, pic); } =20 + /* connect powerdown request */ + vms->powerdown_notifier.notify =3D virt_powerdown_req; + qemu_register_powerdown_notifier(&vms->powerdown_notifier); + /* Create mmio transports, so the user can create virtio backends * (which will be automatically plugged in to the transports). If * no backend is created the transport will just sit harmlessly idle. diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 577ee49b4b..0b41083e9d 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -137,6 +137,7 @@ typedef struct { int psci_conduit; hwaddr highest_gpa; DeviceState *acpi_dev; + Notifier powerdown_notifier; } VirtMachineState; =20 #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) --=20 2.17.1