From patchwork Fri Feb 9 12:32:24 2024 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: 771318 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp824209wre; Fri, 9 Feb 2024 04:34:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4swqn3knRZ3LpksHHx3z94tz0BmyDD+4YQE4lXiXmpbn41r7l1Uig8k9ehnyP1VTY/iXR X-Received: by 2002:a05:620a:1002:b0:783:ae14:9ee5 with SMTP id z2-20020a05620a100200b00783ae149ee5mr1620596qkj.5.1707482062469; Fri, 09 Feb 2024 04:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707482062; cv=none; d=google.com; s=arc-20160816; b=nLy5bW4p6kKGsQzpkQpcogDivpcT1lJ8hpGKPBaCycx7tfBg6EMz3iAt3LXHoCJvzN 791ShOQnCATmUzcFhczY6rxxQzaIxd13bcKADcL4QokX6juUj5ky6Qt7z1gKvePStufN 15uJreTrZe70Io0Y+4Wsa4z9seKWfC8iWV0glgKZ2FtWneLaYtw/wdKqgK5mwFceU95o jjSh1Q7Kcb4c5JDYq5rs4+DQtJEomnnGvIYGqnfUfZWyOE4SQYovbxYTlLWRCy3lqamB Cpd8beaZwFHOqj92t453GsdpjW8cPz4sXX2NXmb6eGvffT4t0DvtsdJhm6KIxFcCcIZD 9KQw== 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=EzmCAZqDnP2GixBxkCB+iCs3cLSrfN0BzrHq0xGFwRw=; fh=ZD2Mf1xm54EYZ95jruX+tWZYzdu86dDRrBHojjevNy0=; b=TmFZZRW5jXBpGlR4YSYo+MZP+vSqGgDcCFeZOWs2ArGMSBd5+/00O25B/Ns7i8ZknB zVQRzIVcP1ndlA2X7vPC8hlRPo9vmjbqvQqAZXS2TwQwK//54UJaDekCeuFF0TYJPAY5 OZQygT4HcdQEHl681dop2n57famIg80UbZ/S7jbs+fhu1XbFTpsrbS+0J0loe0R9gdqh WoKG6nL/0+N/923PTVTmwUo5M74a1b9wp7d+fXvSETiM/HNgY3FVfXC6Tc6MB2aHrxOe d9fG60rZAxAjuSRv1hirovWk9jlNGDTvx3RdcV+1PAEas/Opnftpqvljw+gPn7+zBsO7 ySRQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O3StNvGa; 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 X-Forwarded-Encrypted: i=1; AJvYcCVo1Wubu/AetzAH5fIjqcRJ8cbzZZ5UsmGfpkg0Yl2J0pebtNVPMaLBy+kS+d++dCpJaezIuqWYRFElbV/AKHei Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e30-20020a05620a209e00b0078591341b5asi1784493qka.556.2024.02.09.04.34.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2024 04:34:22 -0800 (PST) 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=O3StNvGa; 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 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) 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-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= 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We shouldn't call qdev_get_gpio_in() on unrealized devices. Signed-off-by: Philippe Mathieu-Daudé --- 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 = g_new(MIPSGICVPState, s->num_vps); - s->irq_state = g_new(MIPSGICIRQState, s->num_irq); /* Register the env for all VPs with the GIC */ for (i = 0; i < s->num_vps; i++) { if (cs != NULL) { @@ -433,7 +432,14 @@ static void mips_gic_realize(DeviceState *dev, Error **errp) } s->gic_timer = mips_gictimer_init(s, s->num_vps, gic_timer_expire_cb); qdev_init_gpio_in(dev, gic_set_irq, s->num_irq); - for (i = 0; i < s->num_irq; i++) { +} + +static void mips_gic_wire(DeviceState *dev) +{ + MIPSGICState *s = MIPS_GIC(dev); + + s->irq_state = g_new(MIPSGICIRQState, s->num_irq); + for (unsigned i = 0; i < s->num_irq; i++) { s->irq_state[i].irq = qdev_get_gpio_in(dev, i); } } @@ -450,6 +456,7 @@ static void mips_gic_class_init(ObjectClass *klass, void *data) device_class_set_props(dc, mips_gic_properties); dc->realize = mips_gic_realize; + dc->wire = mips_gic_wire; } static const TypeInfo mips_gic_info = {