From nobody Fri Oct 18 04:24:40 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707482062; cv=none; d=zohomail.com; s=zohoarc; b=O0QqPwCD9M9yOtLTjquHQBUOA4TGbl/pVU6A3XWbJje1CpnjQK0huO1Bs9wxylcHn9CGnu9xUErIVTDyPXCuyRAzMj/j+2g9+yZ1ni/iITB2b5F55JbfZlfuENHnTyAWEnGV9D5sekebqbgnj/Il/9vYybAsEihLIlCY7TNksM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707482062; h=Content-Type: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=EzmCAZqDnP2GixBxkCB+iCs3cLSrfN0BzrHq0xGFwRw=; b=Rn6hQScUtmoP6yUSMZast/LGtR+aeI1RDNUo/VncOx3G7ElQQNvMvLD3BfIOm6RzdwA9AS4Ay2MH13eGnYichjJSfCBVGb2OttX4Z1HYmcON4wjgMDi9f02LjigdLL8KnWOIY3ijyca3eHbTZvOmVjwU2hgtoKoEmoX4IfeFOHM= 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 1707482062707417.97696988400764; Fri, 9 Feb 2024 04:34:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYQ4R-0008DV-4r; Fri, 09 Feb 2024 07:33:31 -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 1rYQ45-00086K-CD for qemu-devel@nongnu.org; Fri, 09 Feb 2024 07:33:09 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYQ42-0001wg-SP for qemu-devel@nongnu.org; Fri, 09 Feb 2024 07:33:08 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4107ed0c536so766095e9.2 for ; Fri, 09 Feb 2024 04:33:05 -0800 (PST) Received: from m1x-phil.lan ([176.187.218.105]) by smtp.gmail.com with ESMTPSA id jr6-20020a05600c560600b0041079d336c7sm484051wmb.39.2024.02.09.04.33.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 09 Feb 2024 04:33:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707481984; x=1708086784; 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=EzmCAZqDnP2GixBxkCB+iCs3cLSrfN0BzrHq0xGFwRw=; b=O3StNvGaCW5pR50S+3/8bugspf+NpvrYo2inwabPaLaGhb1D0NR0E2UfPzXgRTKjQz C2jw26s7AMjngnf9v6Tmm73YiaxJHPZbzP58LFQS6Fut6ZqFn+yL8ie50h8Mywd2PN90 FXPE5wCgPO7QUaSyNzE/Lg+ug4Mw+V+NnlJZCNwxDO9jmwJkwGrlrACgau0Vb7Bv8yn1 2wO+cR0lIQJeoSriyfJj/HedoqdMBoR+lxtxppnjjsyKrbPEsjPtE9I8Ogyf1KJnVw3T NkdviWAf2qDHpTqzt5hy72fTnqJKuz4OSqxWvC8X1CrfRMIWyw7db9oBxzUD4WSIMZ3W D6xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707481984; x=1708086784; 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=EzmCAZqDnP2GixBxkCB+iCs3cLSrfN0BzrHq0xGFwRw=; b=HAmRrk+axQx65guHkqtV3RkLl8hVmfRFnZlMmX44R1duoNX6Ts8Gtdgis6uyKEugF0 3cMc/fiaI3x97I65KRnzxPxjlRVp7hqPhk1e8ua0E0MFeiNjqjB2vM+VgQ1YySj09Qsm eUnYu3B/pBgdAhK0v9bp0vdnmlpJprhNG4SlRfnhhXgcLrqILJ8ZM/fwzvNBEomAG4oJ rXG6IQ1oYBeXuinJHkLekno3fxljKbHgl96V5e+AdW+qbpnUtc4Yy/FuKd/ifb13xqzX toU7+YG7EH1Bbw3oMw7PLcUDl/uGAGfD/bo2ZFSsfwKriQsmk5/76avb6giu8O/doJo1 JOaA== X-Gm-Message-State: AOJu0YwdC3IcOUE32uerljMpz281NPrBN8kNoi+yR/e76F/nwd/1/UhT R+hK8lZvgBDrK5pXeA6vWE4F0wo8ky0d65LxY414JsxKx840sG4egSUbOfRMv/42n+Z4yFNrzBM Z X-Google-Smtp-Source: AGHT+IFFniHgzTURLnYglT2Uf75r2lJLrVzOD6Zm8Bv/u5mrekpnhWZ1KZ33dJ8yDe2BK21x7bT0Ug== X-Received: by 2002:a05:600c:35cc:b0:40f:dc50:aea5 with SMTP id r12-20020a05600c35cc00b0040fdc50aea5mr1230765wmq.22.1707481984432; Fri, 09 Feb 2024 04:33:04 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWXEEO6MR0jNSBaQ5p3sBdVfhNDOQv+N8rvHqTksw8HLNFUba8y0enrZEmMbRvtARpx8UGiGpZ9GoGHaQSXrLcMd78ZhvjzYc/2CmKvvVspbTDqsZEEiq+A8Xv6/Fi2PGsILNbSfLGVlU0KZzW3h/9SgoQ6X4h+W/9/rHyo8ix8162J5gbvi+Gj+xO7c8rCiIjvS7yH0BOOu50owsAcS83l0F2cO91lIt5B0wONiwUZyd8ZhZEL4kPDJZrrzkhoqhr1S1BpF2e5xmjUWAtm7p30SS4GZ6ZMkgZlzC/akWb53O6Wy1R85E8wi03gXRa6eEiqm49eRzWSPZY= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Jiaxun Yang , qemu-block@nongnu.org, John Snow , qemu-ppc@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" Subject: [RFC PATCH 6/7] hw/intc/mips_gic: Initialize IRQ array once device is realized Date: Fri, 9 Feb 2024 13:32:24 +0100 Message-ID: <20240209123226.32576-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240209123226.32576-1-philmd@linaro.org> References: <20240209123226.32576-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707482064667100003 We shouldn't call qdev_get_gpio_in() on unrealized devices. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/mips_gic.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/intc/mips_gic.c b/hw/intc/mips_gic.c index 77ba7348a3..05c8b8f4c4 100644 --- a/hw/intc/mips_gic.c +++ b/hw/intc/mips_gic.c @@ -419,7 +419,6 @@ static void mips_gic_realize(DeviceState *dev, Error **= errp) return; } s->vps =3D g_new(MIPSGICVPState, s->num_vps); - s->irq_state =3D g_new(MIPSGICIRQState, s->num_irq); /* Register the env for all VPs with the GIC */ for (i =3D 0; i < s->num_vps; i++) { if (cs !=3D NULL) { @@ -433,7 +432,14 @@ static void mips_gic_realize(DeviceState *dev, Error *= *errp) } s->gic_timer =3D mips_gictimer_init(s, s->num_vps, gic_timer_expire_cb= ); qdev_init_gpio_in(dev, gic_set_irq, s->num_irq); - for (i =3D 0; i < s->num_irq; i++) { +} + +static void mips_gic_wire(DeviceState *dev) +{ + MIPSGICState *s =3D MIPS_GIC(dev); + + s->irq_state =3D g_new(MIPSGICIRQState, s->num_irq); + for (unsigned i =3D 0; i < s->num_irq; i++) { s->irq_state[i].irq =3D qdev_get_gpio_in(dev, i); } } @@ -450,6 +456,7 @@ static void mips_gic_class_init(ObjectClass *klass, voi= d *data) =20 device_class_set_props(dc, mips_gic_properties); dc->realize =3D mips_gic_realize; + dc->wire =3D mips_gic_wire; } =20 static const TypeInfo mips_gic_info =3D { --=20 2.41.0