From patchwork Thu Oct 19 13:09:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735539 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1506724wro; Thu, 19 Oct 2023 06:10:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+b7/66h/MvRw7kAWCIGiaCjYs+ezJ4n9r1Q+5EZQ8ZRKE1EDj6upJKRXdQWbueHtR1THh X-Received: by 2002:adf:ef12:0:b0:32d:a10d:90dd with SMTP id e18-20020adfef12000000b0032da10d90ddmr1574954wro.50.1697721034066; Thu, 19 Oct 2023 06:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697721034; cv=none; d=google.com; s=arc-20160816; b=0O8EB1xb/WGZp7dSPGGxeiKWIl4bp40tRxxpucYOWP8K5pGUdjcKgmT+dFl4qp183v INeP1FDXUL3J9hhBZOKySql44Aq2Aa/KNHscPJv1/7OeNmMz2bdCGEFKqHBQrYkAkI4r UOQMkc0fYHEWgrQF9jv/Dq/8Qd6jAZA3+Pwf6PD+AXvjMxqbc+AZv7WwXYXWIebpGkDo kzmMjnVQXHfHTc3S7f8jRmtOTVqknLXPPbsatHYp7whpLqQOx2Mo4wjlbCsNe5M0ROL+ LfscoOE5oQ5lDGP5wG2wWcH5+OZsOgjufwEyNT/K38r4gAsTKp+BZTfvyaPxGigdt905 f24w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LSmy0AQ2ctzt4sBy/4+sAM4ntN11b2Cq/iHR2Msv118=; fh=rYBZhAJdgCvxZRRcO2tKw9iXjHkAG8ZfVdmqU/2KeAE=; b=NISluXhFH12n+/KxgaIPzyIru/Nf/cFyC4P3fekKUr+MdpDHDdznBiZ6/yGC7wvhCg HNXb5DcEjQrjyjJKGmCNcvOyStyV5lPF89p3Us5PQpzwyHMEp/oweCj2FCPHItN7IIpS +uzLflqb/dk9aeYgFkOolXbYcfsGRmS8+PnvE4sxcCutAS6wchNoyDluaITZeP7nvW1r 2iXzH7WKjPxB4kTneFSBEbBbjbbRn1UOGFP4hBtz4hDfDxZ3Tz7O7rAKj9DWdyFI08J2 s47TgOfhbWfPsOkCy9SOt8v+yfvG0+Hz6iEo/xHwHtyUSzyAzz6oqG0MAyBKqq6PgIXN MokQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qkr/v8nX"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k5-20020adff285000000b0032d9756f644si2715015wro.148.2023.10.19.06.10.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 06:10:34 -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; dkim=pass header.i=@linaro.org header.s=google header.b="qkr/v8nX"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSn0-0005Gu-Hz; Thu, 19 Oct 2023 09:10:14 -0400 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 1qtSms-000558-MA for qemu-devel@nongnu.org; Thu, 19 Oct 2023 09:10:06 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtSmq-0007n0-P8 for qemu-devel@nongnu.org; Thu, 19 Oct 2023 09:10:06 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50797cf5b69so8474347e87.2 for ; Thu, 19 Oct 2023 06:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697721003; x=1698325803; 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=LSmy0AQ2ctzt4sBy/4+sAM4ntN11b2Cq/iHR2Msv118=; b=qkr/v8nXIhz3SoD89Vr1W3sHlI/AXRfkyxtWvpdpwmBXUJYqE0igSD538JhtCDCkmH VKuwEPjOCELSOW0Zzbv+ZaF0SsCBB9DK0UehHrz6zPQPSs90XrOr13vZSLckpqfBkF28 5PSEviougYHkfPxPnxaP901dqXAKaScxh7yT7eVSW7+BDFfvh7wvuH2hMivvPggmLh7D +8YV5R/tRkbT+gL/Q8zVXq4JGOBWrsq8cI2VnrdDOsshG4znZrhaZBPNUUrjETme+nlG HMWSLCrnUn5bnWH8K+8UMcFcCOergOPpT56/MTEKjrNlI0iBBAuhaGwtPbOWroUr4OBI Y+tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697721003; x=1698325803; 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=LSmy0AQ2ctzt4sBy/4+sAM4ntN11b2Cq/iHR2Msv118=; b=MhRjBUWcIvauVI8cYNSpetH4bxwOQ8C0ZKEsu6xrvnqzA50cKCR0ANpnupGeqPfLXu ig9+XueZ8OwYUA7aWwThE7i42mq+qSSWnKQ1gkRnmXUTXu1p11gjFGchSQP+JKA2VtkC zQBgJpdtezVGO05LhAcbYir+mdngrwMuj0U1oajZ6ajP3QPZAjJWGR90hwi6xAhFpwfK o9J60ZRFeXEFTiQxB4ke0mQcd38fFFGvTw0SeYyYxvMbSrwTX07PrmWQnXV/ldvtpCwe 32FZa15+EjCZ7SMutPYU0v109xXEtARA66vTW7FJ8Mc92zUC9yGFsP/DxbrX13zx2xYo oaeA== X-Gm-Message-State: AOJu0YzASH5YBUbcos01WpIcFFrLHcYRA8/+PFxpAF5Kn0SEZowzYfk8 Hm6by3pWaNGENqn3xoTTuzIYnNDgTgEzGo8CngMxTw== X-Received: by 2002:a05:6512:701:b0:503:655:12e7 with SMTP id b1-20020a056512070100b00503065512e7mr1356840lfs.62.1697721002787; Thu, 19 Oct 2023 06:10:02 -0700 (PDT) Received: from m1x-phil.lan (176-131-216-177.abo.bbox.fr. [176.131.216.177]) by smtp.gmail.com with ESMTPSA id bt14-20020a056000080e00b0032da4f70756sm4518629wrb.5.2023.10.19.06.10.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Oct 2023 06:10:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 6/9] hw/intc/pxa2xx: Convert to Resettable interface Date: Thu, 19 Oct 2023 15:09:21 +0200 Message-ID: <20231019130925.18744-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019130925.18744-1-philmd@linaro.org> References: <20231019130925.18744-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=philmd@linaro.org; helo=mail-lf1-x136.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Factor reset code out of the DeviceRealize() handler. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/pxa2xx_pic.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 47132ab982..2eb869a605 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -271,12 +271,9 @@ static int pxa2xx_pic_post_load(void *opaque, int version_id) return 0; } -DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) +static void pxa2xx_pic_reset_hold(Object *obj) { - DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); - PXA2xxPICState *s = PXA2XX_PIC(dev); - - s->cpu = cpu; + PXA2xxPICState *s = PXA2XX_PIC(obj); s->int_pending[0] = 0; s->int_pending[1] = 0; @@ -284,6 +281,14 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) s->int_enabled[1] = 0; s->is_fiq[0] = 0; s->is_fiq[1] = 0; +} + +DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) +{ + DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); + PXA2xxPICState *s = PXA2XX_PIC(dev); + + s->cpu = cpu; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); @@ -319,9 +324,11 @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); dc->desc = "PXA2xx PIC"; dc->vmsd = &vmstate_pxa2xx_pic_regs; + rc->phases.hold = pxa2xx_pic_reset_hold; } static const TypeInfo pxa2xx_pic_info = {