From patchwork Tue Aug 13 21:05:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 171217 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1399759ily; Tue, 13 Aug 2019 14:11:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDS83cSPq2sWmseg6P5Vip0ZGK8IIN1u9Pn8NGHEAdGKXywU9KCU277uBXHQaq4sxhiZw9 X-Received: by 2002:a05:620a:6cf:: with SMTP id 15mr33472318qky.98.1565730712202; Tue, 13 Aug 2019 14:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565730712; cv=none; d=google.com; s=arc-20160816; b=UaPUJvU5Jmch9IVNYWXTV8wyKqBxjRs59Xd/UrHIu1Wk5Xc5/s654vSV9Vh6IZLj7L GyMnyZzNZ+dgysHn6i1aV4hjLrGIVYjCW7SF/eWt4c7TEP6QcjYvNCreiprQazwkOmhp mcaeB8sDsyuIyiH7o/ZlmrGp39DThgUvIX0ttoTsVRfNVtzU17hP/QOgtctXQrMTp/bK s9XGECrB7mrq5s+CFSFFMENqR8soGucm8NSmj/bznjThX7CqSON5ZMs+DJVrxUmv+SdI uaI3lOorkwjulCcZLu781jzRkTFU7N1wEo6iOjYVtAniUZF2fnlA2+nA6KUjUnCTdq4T uKXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version:references :in-reply-to:message-id:date:to:from; bh=FsLpo8JpdiLXdKuXzSpP/A/dAc8J0CbYIS3Cl6WOb28=; b=gnpKFxaCPOdqh/JWezEkO2neoQc2bSM9xTozj8Qb73GWdTeNtojODKG29KMUrWDLo+ lPzkOrG9Bn9zd7wtDd3zGgQU9/6VOf2/i3+l/u+bOa9AowAEYpNsGjohKdhpbZZpPBZW 1xOONJriP2a+uhBsSCQ5lW/lyjSsGDqh6pwq7P7qaDtknyeg5dp3H8BjuX0yoqXhNRX6 BAXe0211Pn/Pv6F9CuWccH+MP0hJ1CRrn2YW95jxDoHtA/X9YLFhe3GJBsJUlRM7qdRN lj6RobKjRfbRHHntrLDP9ykZYHUY5/JjXO5Hn4NC18ZCzjGFEZYvvcumdaZNV41agt8C C3HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j5si5713547qte.76.2019.08.13.14.11.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Aug 2019 14:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:55498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxe59-0000eQ-PR for patch@linaro.org; Tue, 13 Aug 2019 17:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41899) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxe1J-00053C-JA for qemu-devel@nongnu.org; Tue, 13 Aug 2019 17:07:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxe1I-0001YF-Fh for qemu-devel@nongnu.org; Tue, 13 Aug 2019 17:07:53 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33788 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hxe1A-0001LH-Kq; Tue, 13 Aug 2019 17:07:44 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id CF7AED25FCFDA0750D96; Wed, 14 Aug 2019 05:07:41 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.47.94.0) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Wed, 14 Aug 2019 05:07:32 +0800 From: Shameer Kolothum To: , , , Date: Tue, 13 Aug 2019 22:05:35 +0100 Message-ID: <20190813210539.31164-9-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190813210539.31164-1-shameerali.kolothum.thodi@huawei.com> References: <20190813210539.31164-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.94.0] 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.32 Subject: [Qemu-devel] [PATCH-for-4.2 v9 08/12] 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- hw/arm/virt.c | 12 ++++-------- include/hw/arm/virt.h | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) -- 2.17.1 Reviewed-by: Eric Auger diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 56d64fc0a9..0e75213b44 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -787,10 +787,6 @@ static void virt_powerdown_req(Notifier *n, void *opaque) qemu_set_irq(qdev_get_gpio_in(gpio_key_dev, 0), 1); } -static Notifier virt_system_powerdown_notifier = { - .notify = virt_powerdown_req -}; - static void create_gpio(const VirtMachineState *vms, qemu_irq *pic) { char *nodename; @@ -831,10 +827,6 @@ static void create_gpio(const VirtMachineState *vms, qemu_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); } @@ -1726,6 +1718,10 @@ static void machvirt_init(MachineState *machine) vms->acpi_dev = create_acpi_ged(vms, pic); } + /* connect powerdown request */ + vms->powerdown_notifier.notify = 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; #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)