From patchwork Thu Feb 15 17:57:37 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: 772990 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp968175wre; Thu, 15 Feb 2024 10:07:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXOugAVxQIJn1TgTq7WXO2roS9ZuH+bdMlUn2B8TBd6xSma+VeeNmY08pwq4Skmc5fuGBFK9iXggF3dUSo/0tvt X-Google-Smtp-Source: AGHT+IHTjVSbY/JmSCx/qdIW4W+9mDV+8LD/S7VIOaljB7CBFnCAZ60MCkfSoOqVcQhmMpZx7tdG X-Received: by 2002:a05:6122:c92:b0:4c0:254f:75d5 with SMTP id ba18-20020a0561220c9200b004c0254f75d5mr2271701vkb.10.1708020427484; Thu, 15 Feb 2024 10:07:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708020427; cv=none; d=google.com; s=arc-20160816; b=HlnHG896ul4rhJ/xEa3uBsR906hKakhzfU4BgSjs5oUg7/dyutowNbJMjLC0cBkGZQ jbsaFsEsQrbKqZ5GOVXxZUubwdXXYHMzwYdiw07oSzGUXUM22ysJfyB/qUwCiJwIPyfR dJZ8pLiK2a7PxD3liiTLPf3o1cO2aOEfG89DrO1ZOeAR2H8oxB3WIY2mNNW3WtNUFr/Y +8Xw26LhAOdGMZJH2GK2x3rsJIlxmrx/ckO1Phr0iqqte34nKUECmJ6uFxMsWTX9M+H4 WOmxgQDClB4hMN+jTyaZUfzre9Dcp4uDOG8y4Rjy0JVYRuIvmCDBCeX9I4uglgzy2okV TNbQ== 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=+HBz0BFjRQZpbPfXihx7764F0fJuLimkLS/XesyXUFE=; fh=IEeMEBfRuEYv0f+p31NSkjjOHtvzn1XzuxY+KD3YeT8=; b=zdTaOuV15sDlXjiAtuhncTbIUwJJxMfVB5mrIYaiPUPaOfbVQubCuOxHlV7vOi9wre M4nR2Ei+73BW8GoaC++EgMtAYaWjOXAqB9m+hj4kBthso1OuleVaFrdWCnUXjIoptFAz c2G4qH2s3LoF/R8jFcCnMZCiTw1N1KaoDtWNsvJs1G7AJaXifNcJW9JmttO3/KnGKig7 WwGwNghM2Z1Sce7Bflu7QcGABV+OxeU6vpeFrc/Rkv+I6D3mm+euUq5i1Z854nzeez1O //yws520XVfrAPUbfTfyG5gzbDB3Fa6wRa48bObMW86Gpz7RnLhpcwEQhJzmmFla5l3k xA6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mKiYRlPp; 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 y125-20020a1f4b83000000b004b8370fc77dsi389444vka.231.2024.02.15.10.07.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 10:07:07 -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=mKiYRlPp; 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 1rag4U-0007if-13; Thu, 15 Feb 2024 13:02:54 -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 1rag4S-0007XB-55 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:02:52 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rag4P-0002x2-4Z for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:02:51 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3392b12dd21so605783f8f.0 for ; Thu, 15 Feb 2024 10:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708020167; x=1708624967; 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=+HBz0BFjRQZpbPfXihx7764F0fJuLimkLS/XesyXUFE=; b=mKiYRlPpADzQBmNc45OY9EOpJfg2T+u2OEIE9HllBb6vx6JXBI8LD/8vtXX4KHOzfP EJh4APbB8jiDMqhvdQD5xHU/tUFzmpYejE5eFQjAtnl/aWV/WMrNAepDeghAbXZurS2V TORvrts5V2gAhxmBsclx1G1Ojl3OzdgfSgX3QomShOqj4HhGmcoZydHK2R6vthNmC5pX g1vvXMoBrEwA7eQNxm1BRqV2RQ4hHDQZK/hyKOEPIvS+VUZkg/vEhK1K2eSmzFavVcau qZpP5/R5D1hoorKDEPd423Hk/PrCFuvFEphSBgZ7Dk+77nD5YnviJQEy2WErfxiBSpBc TeEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708020167; x=1708624967; 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=+HBz0BFjRQZpbPfXihx7764F0fJuLimkLS/XesyXUFE=; b=lLkbXmQwcOBe4gL9AD2JAARDKurnK+LpIyuoovbEPMotzvqIqcuZDI8GzG8vPUC2MR KJtGIcByA6o7+PZSZhKxJJWQpPny2d4D2Iq9AsFfZEEnOvk0GpSN6Oa6Z1KqF06NFJIt 2mhsElugmKpEcH9czbQezGkDsLTzuRoGsFmtWnPfvKNdDyONr/2rgxUHro9U12kkncOm BBvZYoGL4eSkoTaNmYJcOmR+5nY9Wa8WlCUsLM2TfA8X7mdI6aBRGhOHCN7QpomTF225 J73owFKpDApaBqD9RZgYA1KgseXSt5np/S59V/+cMuKwRQZHZVPPH/wFwJvlWjO0sv5i ynAQ== X-Gm-Message-State: AOJu0YyHMdTpx6UJ1cl4izbU7yYPmxUjeTfiP13URorzUc1mnv2A+xEX trB95lrvt98Dix0TDM46IC7/VBr87UpJiIMDxKupgh+KnFSF1PlIXXzboPc4VBZPlFOHIcClL9Y aAts= X-Received: by 2002:a5d:6dad:0:b0:33b:13a8:81b with SMTP id u13-20020a5d6dad000000b0033b13a8081bmr2075908wrs.0.1708020167254; Thu, 15 Feb 2024 10:02:47 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id n16-20020a5d51d0000000b0033cefb84b16sm2440537wrv.52.2024.02.15.10.02.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 10:02:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Mark Cave-Ayland , =?utf-8?q?Cl=C3=A9ment_Ch?= =?utf-8?q?igot?= , Frederic Konrad , Artyom Tarasenko Subject: [PULL 43/56] hw/sparc/leon3: Initialize GPIO before realizing CPU devices Date: Thu, 15 Feb 2024 18:57:37 +0100 Message-ID: <20240215175752.82828-44-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215175752.82828-1-philmd@linaro.org> References: <20240215175752.82828-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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 Inline cpu_create() in order to call qdev_init_gpio_in_named() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland Message-Id: <20240215144623.76233-4-philmd@linaro.org> --- hw/sparc/leon3.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 44fca1487d..4873b59b6c 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -277,7 +277,10 @@ static void leon3_generic_hw_init(MachineState *machine) for (i = 0; i < machine->smp.cpus; i++) { /* Init CPU */ - cpu = SPARC_CPU(cpu_create(machine->cpu_type)); + cpu = SPARC_CPU(object_new(machine->cpu_type)); + qdev_init_gpio_in_named(DEVICE(cpu), leon3_start_cpu, "start_cpu", 1); + qdev_init_gpio_in_named(DEVICE(cpu), leon3_set_pil_in, "pil", 1); + qdev_realize(DEVICE(cpu), NULL, &error_fatal); env = &cpu->env; cpu_sparc_set_id(env, i); @@ -311,11 +314,9 @@ static void leon3_generic_hw_init(MachineState *machine) for (i = 0; i < machine->smp.cpus; i++) { cpu = reset_info->info[i].cpu; env = &cpu->env; - qdev_init_gpio_in_named(DEVICE(cpu), leon3_start_cpu, "start_cpu", 1); qdev_connect_gpio_out_named(irqmpdev, "grlib-start-cpu", i, qdev_get_gpio_in_named(DEVICE(cpu), "start_cpu", 0)); - qdev_init_gpio_in_named(DEVICE(cpu), leon3_set_pil_in, "pil", 1); qdev_connect_gpio_out_named(irqmpdev, "grlib-irq", i, qdev_get_gpio_in_named(DEVICE(cpu), "pil", 0));