From nobody Tue Feb 10 11:33:50 2026 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=1558542862; cv=none; d=zoho.com; s=zohoarc; b=VnHrb3AIfVpXOeve8djJifgaFrRb+M3w4GIlAi0II5CHUZnJg5bPgNugm8QmHVLcMraWrNshQHNViM74lxNHCmBkdIjn6OUpbJuxPhlUBqG6AloUPtKpt0UKNNNe1CuYeB01uB7xEJJ7g+XeQHgHtyekvDnGtgzvx00xuA4Cfjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558542862; 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=rYWUu1LkdEmOD+uNli1EMWjjMW1a35NXTYx9MXlUKe4=; b=RkF9q87lyoUb7YEHXXcLseYxYAezwJLT7IUT/obrhSV1ZXN+q6z7k8392vC4J27GXVS/eAdkmH8uZvSwZrWfM2+N9SNYuyX8govPhWK6xsPzXATicW6CXxslS0RhAvcQZ+QGTuieLnGQaqv+uwIq+9ZheNd8oRo5UFFTi9FIZcc= 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 1558542862964588.343467157515; Wed, 22 May 2019 09:34:22 -0700 (PDT) Received: from localhost ([127.0.0.1]:47649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTUBx-0004zG-19 for importer@patchew.org; Wed, 22 May 2019 12:34:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTU3G-0006lP-L9 for qemu-devel@nongnu.org; Wed, 22 May 2019 12:25:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTU3D-0002J2-Ss for qemu-devel@nongnu.org; Wed, 22 May 2019 12:25:14 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2222 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTU3A-000270-2S; Wed, 22 May 2019 12:25:08 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0CEED676E2640AC55D0D; Thu, 23 May 2019 00:25:03 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Thu, 23 May 2019 00:24:24 +0800 From: Shameer Kolothum To: , , , Date: Wed, 22 May 2019 17:22:52 +0100 Message-ID: <20190522162252.28568-9-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190522162252.28568-1-shameerali.kolothum.thodi@huawei.com> References: <20190522162252.28568-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.190 Subject: [Qemu-devel] [PATCH v5 8/8] hw/arm: Use GED for system_powerdown event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" Use GED for system_powerdown event instead of GPIO for ACPI. Guest boot with DT still uses GPIO. Signed-off-by: Shameer Kolothum Reviewed-by: Eric Auger --- hw/arm/virt-acpi-build.c | 37 +------------------------------------ hw/arm/virt.c | 7 +++---- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index ed8e0cee3a..f23b276d77 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -49,7 +49,6 @@ #include "kvm_arm.h" =20 #define ARM_SPI_BASE 32 -#define ACPI_POWER_BUTTON_DEVICE "PWRB" =20 static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) { @@ -328,37 +327,6 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMap= Entry *memmap, aml_append(scope, dev); } =20 -static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap, - uint32_t gpio_irq) -{ - Aml *dev =3D aml_device("GPO0"); - aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0061"))); - aml_append(dev, aml_name_decl("_ADR", aml_int(0))); - aml_append(dev, aml_name_decl("_UID", aml_int(0))); - - Aml *crs =3D aml_resource_template(); - aml_append(crs, aml_memory32_fixed(gpio_memmap->base, gpio_memmap->siz= e, - AML_READ_WRITE)); - aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, - AML_EXCLUSIVE, &gpio_irq, 1)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - Aml *aei =3D aml_resource_template(); - /* Pin 3 for power button */ - const uint32_t pin_list[1] =3D {3}; - aml_append(aei, aml_gpio_int(AML_CONSUMER, AML_EDGE, AML_ACTIVE_HIGH, - AML_EXCLUSIVE, AML_PULL_UP, 0, pin_list, = 1, - "GPO0", NULL, 0)); - aml_append(dev, aml_name_decl("_AEI", aei)); - - /* _E03 is handle for power button */ - Aml *method =3D aml_method("_E03", 0, AML_NOTSERIALIZED); - aml_append(method, aml_notify(aml_name(ACPI_POWER_BUTTON_DEVICE), - aml_int(0x80))); - aml_append(dev, method); - aml_append(scope, dev); -} - static void acpi_dsdt_add_power_button(Aml *scope) { Aml *dev =3D aml_device(ACPI_POWER_BUTTON_DEVICE); @@ -761,9 +729,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPO= RTS); acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE), vms->highmem, vms->highmem_ecam); - acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO], - (irqmap[VIRT_GPIO] + ARM_SPI_BASE)); if (vms->acpi_dev) { + acpi_dsdt_add_power_button(scope); build_ged_aml(scope, "\\_SB."GED_DEVICE, HOTPLUG_HANDLER(vms->acpi_dev), irqmap[VIRT_ACPI_GED] + ARM_SPI_BASE, AML_SYSTEM_MEM= ORY); @@ -774,8 +741,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) AML_SYSTEM_MEMORY); } =20 - acpi_dsdt_add_power_button(scope); - aml_append(dsdt, scope); =20 /* copy AML table into ACPI tables blob and patch header there */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8dfd7537b9..bb83160888 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -525,7 +525,7 @@ static inline DeviceState *create_acpi_ged(VirtMachineS= tate *vms, qemu_irq *pic) { DeviceState *dev; int irq =3D vms->irqmap[VIRT_ACPI_GED]; - uint32_t event =3D ACPI_GED_MEM_HOTPLUG_EVT; + uint32_t event =3D ACPI_GED_MEM_HOTPLUG_EVT | ACPI_GED_PWR_DOWN_EVT; =20 dev =3D DEVICE(object_new(TYPE_ACPI_GED)); qdev_prop_set_uint64(dev, "memhp-base", @@ -1710,12 +1710,11 @@ static void machvirt_init(MachineState *machine) =20 create_pcie(vms, pic); =20 - create_gpio(vms, pic); - if (aarch64 && firmware_loaded && acpi_enabled) { vms->acpi_dev =3D create_acpi_ged(vms, pic); + } else { + create_gpio(vms, pic); } - /* 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. --=20 2.17.1