From patchwork Fri Oct 20 13:03:27 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: 736240 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp287885wrl; Fri, 20 Oct 2023 06:05:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQ1gY3gFZmFgGHe3eqyax+vcC3LNUxGYRJdkuukWzV+pZC6MUDPMLQxdsctfl6y04RQhyB X-Received: by 2002:a05:622a:96:b0:403:9a33:5f53 with SMTP id o22-20020a05622a009600b004039a335f53mr2079199qtw.38.1697807114290; Fri, 20 Oct 2023 06:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697807114; cv=none; d=google.com; s=arc-20160816; b=mdMMmm7OggMPgDm3Tk59I55hnQOv/FZcZxQNHQZ1AW+JnENPe2jLBSx/A71WNKnKIo i8qBJBVXb6iGuWEzVY+0T8DObuhRZKQo1VAeBI2iupQiQo5j2lZAKqHg6F+J7dfE2Q5G EaG127C1OJKuWTLruKzFlSsCt31uw1z96WYMp2ucBh30M5pv0avY67j+tjg16XiKBc0s ljNhNzu8nWlPh4E2+8mBZtX1OWAM9euQcgx3a1iMutQKuOYImy/rxccnWJuaYyjxPYiW b80/qwFvLWh1a/GyN0t+bsokM99vEYVZsyopZ0nHmYeCpjcQAAKs1ihuyb12oAU6Haeb TFkQ== 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=QWGggua+3ufs1S3QlzhTWcDhlhc7bBCtXi/Y+/UuB8A=; b=Ni7ZaNPKzYQjE75+EhMY1v70BiKGFjHltGJy1h4Z1a3LyxJy8+FqJyHJ8850Pp2G0k c0+yIiyaVdZpDVS+fRUW8qdmRCsSaw6KDPgYAwhSBCwnOhvLvVRJllDnAzc1OJZIR32D tnTtiP1F1w6KTjJ0WyhV43zf4nYnAkr/VMZKkzlHWeXaCOPZI/H5ZLRT3+aMkj9fc6Al IqyK3HkLJR3ezjA0Xsd2U1Uuf27lmD7m4y0XqeijVlX8WPWyIR0yd9H6A8n00rEsC5hh jRiy0M4QYhS8Ki1jrCTpKzkPeKYKBHukf5kT5Z/Fs0MNj2doKrT5bNW4FiNm2bHi0/q5 k82A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZaOVU1Wd; 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 h22-20020ac87d56000000b0041816d65a98si1218579qtb.421.2023.10.20.06.05.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 06:05:14 -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=ZaOVU1Wd; 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 1qtpAz-0001rB-5T; Fri, 20 Oct 2023 09:04:29 -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 1qtpAl-0000rk-1i for qemu-devel@nongnu.org; Fri, 20 Oct 2023 09:04:16 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtpAi-0005Lx-C4 for qemu-devel@nongnu.org; Fri, 20 Oct 2023 09:04:14 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-9ada2e6e75fso121421866b.2 for ; Fri, 20 Oct 2023 06:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697807050; x=1698411850; 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=ZaOVU1WdVB2Eu95j73/qAX8nJn8MV4rWIVcHDVM2rMhC1sxAp/tokeGQd8GlpdqfKY X2nC+WJp5gZeg2NFCY/FzqwrB2rFWH265bO2IRC+ckfUpLlsb63WiAUk/wwRlS+hBtHD jc8/cO+9PMFrRnz0yoE9Ox+gywvv2n5dmfI4Iutv/TsV7LaB+R025mtm17bdt1gmd4mR TOYeWAAQ6kPnECS/RMAfEYXS80yyBAEd4F2m66nKYWkEcZh3/9TEc3N0ma5AG9InXkIG Nj4+ew/esqESDofflc5jWEPDk3XcpBz4fzrmFgcTVDz00lCq/4UQgsViI3f0aARD+blO 1dxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697807050; x=1698411850; 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=snJoinZoCsAJ8jcDBEAroFyOJVSAA09wJiSmC1Vntz3BIjzPCAtlzuo1XD/sd74AG3 JxH2Lz1PG+IGmdOvxVHHN+/FthqTtHI+9nBT4Q571JSfv7FoS8vGS8ulRUnc5ivsej/D OjXXRLR4/b4Tyi+oarv6bMQMIo8GckMX1zwtzGoztFDhUEPaQgS2DXMeUCCm8iEZncuI dpsTbObdBxei5BZZXY+sOAAHzkuXGLULgbvCqEPIlqZpTT1t7s0Lh29MiuRP+n9RHeOU bdzG5nQ5wouBRCk4KmssHE5PkHMgZES1UVpTtudyXy1rcZP2kwuyIyjFGvOMK/5PiLXa Dk1A== X-Gm-Message-State: AOJu0YwiYBBs4ZwuJY8+x7UnWea3FEnm2xw72bolyU1zV0IUoTy1AFXa rOna6nSFN2F8BzDAVWnST3m7BpTMiX57ebRxS5E= X-Received: by 2002:a17:907:a03:b0:9be:5ab2:73c2 with SMTP id bb3-20020a1709070a0300b009be5ab273c2mr1295033ejc.58.1697807049770; Fri, 20 Oct 2023 06:04:09 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id y19-20020a170906519300b009adc7733f98sm1484765ejk.97.2023.10.20.06.04.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 06:04:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 6/9] hw/intc/pxa2xx: Convert to Resettable interface Date: Fri, 20 Oct 2023 15:03:27 +0200 Message-ID: <20231020130331.50048-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020130331.50048-1-philmd@linaro.org> References: <20231020130331.50048-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=philmd@linaro.org; helo=mail-ej1-x62e.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=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+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 = {