From nobody Sat Nov 23 22:28:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1730641337; cv=none; d=zohomail.com; s=zohoarc; b=ZIl800FvmucibWukY6xvV0lx7Mj5G8PPkn1rFxljMeoOLpLDik+U5pEm7dV2SIET3MoR6eVGRnY1ijHGMb5Nk/rKdBJCJ6mMv4UAS11Qz0ZmYEZVWF+qo2fO3eijj+kLL2nQbWdhTGfazr/0zhDxG3WGWMTdZ6m7BUhWlYymMg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730641337; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=scKsKjVwCuGqApOSyGEnsOwcmcTTDBAW30tcpamKwQc=; b=gBXQa+m+uXOhKlNPCdhOwfe6Qs+woyalBe+45z++XZULvaNBzNiEAsBBgE/QvQ22iy/5exp5e85vEkGAuLp8v1nvuu0fZYqcVAPtpBlaismM8CKvDZ5jLxiRbzIPXj5a32uQmP+qHHEH7QODCZPvGV+dIJTC4BqRD7hrcavgvB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173064133753863.6955858315016; Sun, 3 Nov 2024 05:42:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7al0-0006Nd-R8; Sun, 03 Nov 2024 08:35:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t7akn-00069s-Kl; Sun, 03 Nov 2024 08:34:54 -0500 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7akm-0001Eg-4C; Sun, 03 Nov 2024 08:34:53 -0500 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a99cc265e0aso541952966b.3; Sun, 03 Nov 2024 05:34:50 -0800 (PST) Received: from archlinux.. (pd9ed7f6d.dip0.t-ipconnect.de. [217.237.127.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5664350esm424328866b.159.2024.11.03.05.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 05:34:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730640889; x=1731245689; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=scKsKjVwCuGqApOSyGEnsOwcmcTTDBAW30tcpamKwQc=; b=Qj+RsAd2eF6KCsX4IZJ1308F/XbnlP3/CQSPukHmSXmuWHxedaiu8otAgHYU+ZiNv8 r+3OTfJ+ltZka9nPURbUzQkp5j4I+WqlmH1omZDZGOhIRvmJrLYuL2S5mrWr4SkDT7T1 UDh/qcqzTpC0S3vT1XLM9MsgHJzJmD/6lCN7OY+//4cmla0Af7NYBnJG6C2bZqr8/adX pqfKt8L8q+1u58imxx4ruFPu0Ig70R0qQ8+kgxtobfUCRq3DHPbd1tW1vA+oaR6tpIJ2 kxEjdQilZwxDLX/J4CsdoTHc4helHaYvPQOgJJZEndvE8+597v/z9O5Z7HeEnEvHMdPe 7+OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730640889; x=1731245689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=scKsKjVwCuGqApOSyGEnsOwcmcTTDBAW30tcpamKwQc=; b=T2hZYGRYz30YUIAZ0YPdwlOA7p8yN5Jr2VhxCr+7K7uTwEcpErvw1pt7d25k5V1fEV GmTLz0hRy1/zZgeNhW1GhoFNnHMYWSf56kQmY/nOSluCIfScNE2a2mtecNFHyT1nr5HY mBnQm1PKREN/b8v4JI9czeeCQyGsm/kWsvSOPU3pGwQBYbY0lDDDKXQqMUAeIW2vN9lv J/wjdyDYW3uGEdNfxwbC8pMoDUeu5zDO59FEG2h+IG13CK2T4kGRrAEw3osTn695Tiw0 sZa84bmWJ8nHQzY2wNl5BkEYNMyQuP9Ju/qibz2Zbbaz5KcSsbPgniWFohfgvt/5yyXK QvEg== X-Forwarded-Encrypted: i=1; AJvYcCWVDF6gBmb/joFkdvLe8R9GnDRVAGvweJcFJHTocok231sSQYAf+dAmXkhQv2ccZG6/Gi3R/PX+HnQ=@nongnu.org, AJvYcCWvu8T6X5WmfnhNpEjO1El+ulAmInTx1Rz1BWIhBEGYUgHdzBkY8pbDzlRBri1U+Br4pxMSIPhrTPCI@nongnu.org X-Gm-Message-State: AOJu0Yx+tgeGS5k01geqZRMkNGQLTU/I17C/XMSCAigaVc500Zva9zZL 2aFuR6di0su/Q10hJj4InwvOysewJ+Ix+KCTjvXZdqRFxHRc6n8oYexFKg== X-Google-Smtp-Source: AGHT+IF1QfdyD0Jguue1vn3h1azepvYr0LOfkoX+8GlEMqCtWBmSee7YXuBr+DBGsjlI8018RI6KmA== X-Received: by 2002:a17:907:3f1f:b0:a99:fb10:128e with SMTP id a640c23a62f3a-a9de5fee8admr2751310366b.36.1730640888604; Sun, 03 Nov 2024 05:34:48 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jason Wang , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , Hanna Reitz , Nicholas Piggin , Corey Minyard , Kevin Wolf , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , qemu-block@nongnu.org, Alex Williamson , Daniel Henrique Barboza Subject: [PATCH v4 06/26] hw/ppc/e500: Reuse TYPE_GPIO_PWR Date: Sun, 3 Nov 2024 14:33:52 +0100 Message-ID: <20241103133412.73536-7-shentey@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241103133412.73536-1-shentey@gmail.com> References: <20241103133412.73536-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=shentey@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1730641338614116600 Content-Type: text/plain; charset="utf-8" Taking inspiration from the ARM virt machine, port away from qemu_allocate_irq() by reusing TYPE_GPIO_PWR. Signed-off-by: Bernhard Beschow --- hw/ppc/e500.c | 16 ++++------------ hw/ppc/Kconfig | 1 + 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index a0c856568b..5d75a090ee 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -30,7 +30,6 @@ #include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "sysemu/reset.h" -#include "sysemu/runstate.h" #include "kvm_ppc.h" #include "sysemu/device_tree.h" #include "hw/ppc/openpic.h" @@ -47,7 +46,6 @@ #include "hw/platform-bus.h" #include "hw/net/fsl_etsec/etsec.h" #include "hw/i2c/i2c.h" -#include "hw/irq.h" #include "hw/sd/sdhci.h" #include "hw/misc/unimp.h" =20 @@ -887,13 +885,6 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineSt= ate *pms, return dev; } =20 -static void ppce500_power_off(void *opaque, int line, int on) -{ - if (on) { - qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); - } -} - void ppce500_init(MachineState *machine) { MemoryRegion *address_space_mem =3D get_system_memory(); @@ -1072,7 +1063,7 @@ void ppce500_init(MachineState *machine) sysbus_create_simple("e500-spin", pmc->spin_base, NULL); =20 if (pmc->has_mpc8xxx_gpio) { - qemu_irq poweroff_irq; + DeviceState *gpio_pwr_dev; =20 dev =3D qdev_new("mpc8xxx_gpio"); s =3D SYS_BUS_DEVICE(dev); @@ -1082,8 +1073,9 @@ void ppce500_init(MachineState *machine) sysbus_mmio_get_region(s, 0)); =20 /* Power Off GPIO at Pin 0 */ - poweroff_irq =3D qemu_allocate_irq(ppce500_power_off, NULL, 0); - qdev_connect_gpio_out(dev, 0, poweroff_irq); + gpio_pwr_dev =3D sysbus_create_simple("gpio-pwr", -1, NULL); + qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in_named(gpio_pwr_dev, + "shutdown", 0= )); } =20 /* Platform Bus Device */ diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index b44d91bebb..12ca3caabf 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -158,6 +158,7 @@ config E500 imply VIRTIO_PCI select ETSEC select GPIO_MPC8XXX + select GPIO_PWR select OPENPIC select PFLASH_CFI01 select PLATFORM_BUS --=20 2.47.0