From nobody Fri Nov 1 05:26:13 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=1708008446; cv=none; d=zohomail.com; s=zohoarc; b=gjfVKEYclxDbLG/GbZDYySGTc0CLrS5rskFLPF/r6Ysp0uPf1wCndfJzV43rHp6+e6Kuoqdhenl9HhJoEzrq2lQnwnjidVScnQx7Tz6jh+kV2B4jKYa/cg0OH/nWQAyTNpEXmmyVWzk0t4yj3HuaK9DgXUwQ20f0t6I+wwM7LVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708008446; 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=OUfNPLmItBjPVQVkIuFZlyu1sOPgu8JxvvGpQGChzxE=; b=kuBd9gkklPoX6hs/ZcIADjx/PGfxG6g6kUMufg/nq5Ip5LKL/HS5KnDeIzrTY28uSAt4mpCc68zBz1Uc2FbX+udBOOLDvaAtsKY4541RdiBVmi9D0jScGia2tOKqvavpN/wsH6KUAj/MGck/momI/18ZjGbWyxT8YwzlTa9ID/4= 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 1708008446555736.9952868143414; Thu, 15 Feb 2024 06:47:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rad0h-0006mC-PX; Thu, 15 Feb 2024 09:46:47 -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 1rad0U-0006gu-6e for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:34 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rad0S-00072F-JQ for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:33 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-563d017696eso233115a12.0 for ; Thu, 15 Feb 2024 06:46:32 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id ig4-20020a056402458400b00560c6ff443esm592789edb.66.2024.02.15.06.46.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:46:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708008391; x=1708613191; 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=OUfNPLmItBjPVQVkIuFZlyu1sOPgu8JxvvGpQGChzxE=; b=MGm3er0MwW9oNWe4prVX2uSI8V6rvz14sqC7pGqJPS3KZjLHj8wIvVP3+tFz5+sm4y Ham03+zMTmt7jD44o4GAIeREkk4ArGoEY3K0py1U+aja+v3oAU7k3iE9B6oO6m+enbzQ hHtFJ6G+84fepdGYjvWZYUKCUXe2rEWWQfTfaE5IfhLZfyL0+2mi7ZrwRUGyYkYQBGRM BZD1pDRw5Z73g/gbAMbIw70GogyGYIp8X/u9Qpth3Cdppfi9fDlNzgu+oUBw/TH75Idr OKh0UCZqs+Rt6SpWUD+4oymn/fsxwCeCtUvYRWFVfaDP9hI36lNQ8f9ayEsdEw/gcXUd l0eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008391; x=1708613191; 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=OUfNPLmItBjPVQVkIuFZlyu1sOPgu8JxvvGpQGChzxE=; b=vhzRADrt6KVqQSECIBWp7ZrTakIkcZ0okmu36HVF+Fj7JSkT/j5ZOw+wRKgMsnPdBr gzKs+N9HBggjPG2Hj7oXqSpIiOSoYs07VnDOTBlyMgTuVhmOcr9GmS30fbtjYOpvlnT0 A7MSVqKigW7fkr0FVNpVbNeM6HG2oSJTJmzjh2bobWGzN6NW0ZupT8fsiU2Z2r89/yXG 5EwgyNMN4cUfeECyzSgbaNBU3H/COF075e2R1F8xMKKkFy3BWz7R6TAW5eG6z04MOj/E s1yQk4I3UEkwypJhUGOTmYFa5Jt25IRqE1mJ2X15DVvoWC+ROLuh8jR4CgI2X3tEo1vp sdnA== X-Gm-Message-State: AOJu0Yw5sW5QvxtCifmXdw3GFa1/kCZDy/6YWO9jmfvJZJ41hPkCn68X zoXOMFp9VFSjYaXStMor+Mh7e0TljmubXLN5UkYxdr3rj+DT8K1qWFksrPZ77uj+pAjN/6KmsK7 Oodw= X-Google-Smtp-Source: AGHT+IHQewN413f9xZb/7KQbO7T0WqihjrTkZiKw6ZmroIKGo+VxUO1jTBkS+pgUUUsoXeGN0zCsjQ== X-Received: by 2002:a05:6402:4306:b0:563:bd85:bc49 with SMTP id m6-20020a056402430600b00563bd85bc49mr1284105edc.12.1708008390891; Thu, 15 Feb 2024 06:46:30 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= , Frederic Konrad , Mark Cave-Ayland , Artyom Tarasenko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 1/3] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_set_pil_in() Date: Thu, 15 Feb 2024 15:46:20 +0100 Message-ID: <20240215144623.76233-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215144623.76233-1-philmd@linaro.org> References: <20240215144623.76233-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::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708008448378100001 By passing a DeviceState context to a QDev IRQ handler, we can simplify and use qdev_init_gpio_in_named() instead of qdev_init_gpio_in_named_with_opaque(). Suggested-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mark Cave-Ayland --- hw/sparc/leon3.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index bea84f3ad6..a15f90e142 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -202,9 +202,10 @@ static void leon3_irq_ack(CPUSPARCState *env, int intn= o) */ static void leon3_set_pil_in(void *opaque, int n, int level) { - CPUSPARCState *env =3D opaque; + DeviceState *cpu =3D opaque; + CPUState *cs =3D CPU(cpu); + CPUSPARCState *env =3D cpu_env(cs); uint32_t pil_in =3D level; - CPUState *cs; =20 assert(env !=3D NULL); =20 @@ -220,7 +221,6 @@ static void leon3_set_pil_in(void *opaque, int n, int l= evel) =20 env->interrupt_index =3D TT_EXTINT | i; if (old_interrupt !=3D env->interrupt_index) { - cs =3D env_cpu(env); trace_leon3_set_irq(i); cpu_interrupt(cs, CPU_INTERRUPT_HARD); } @@ -228,7 +228,6 @@ static void leon3_set_pil_in(void *opaque, int n, int l= evel) } } } else if (!env->pil_in && (env->interrupt_index & ~15) =3D=3D TT_EXTI= NT) { - cs =3D env_cpu(env); trace_leon3_reset_irq(env->interrupt_index & 15); env->interrupt_index =3D 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -316,8 +315,7 @@ static void leon3_generic_hw_init(MachineState *machine) 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_with_opaque(DEVICE(cpu), leon3_set_pil_in, - env, "pil", 1); + 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)); --=20 2.41.0 From nobody Fri Nov 1 05:26:13 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=1708008432; cv=none; d=zohomail.com; s=zohoarc; b=QNkJcAOMSy2PQGKP1UTYtdvYNTu9d2jYL8KKvbbBdRhPGRoyYtb0wqLFVDwEz672Ddcy8sLz8ALULN7G3qXo3poAp70epzDyGryU+SzahWa+e/xMyKLwhfVDg6e9QsRJtCypYnZWYS9+CEEm+kaEvwUNzGOifhcEr3IbmPRQz38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708008432; 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=BGKg1tIZ8Pmm8o3jSUHHCrdxf28mb3+tuXvQyvyxP5g=; b=Wnk1cJTXjSP7btgKDLJ0LVxokwR0vGDWXa/xMiPoGrpBfOgG2CiuhCZDq0Kxshw7LAjg046PLyMBcyluWTKATpT2GDhS9OpJEWovEt6mCQAliK3sj8RyXYIt+kZcyVYzIZugUgfhMT6jUIhFYJg0NEbztwbZ9pXACkgLCVodfyE= 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 1708008432349335.2594277965454; Thu, 15 Feb 2024 06:47:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rad0k-0006oT-5x; Thu, 15 Feb 2024 09:46:50 -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 1rad0a-0006ic-Hc for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:46 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rad0Y-00072o-Vz for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:40 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so131763966b.2 for ; Thu, 15 Feb 2024 06:46:37 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id qk9-20020a170906d9c900b00a3ce60b003asm630467ejb.176.2024.02.15.06.46.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708008396; x=1708613196; 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=BGKg1tIZ8Pmm8o3jSUHHCrdxf28mb3+tuXvQyvyxP5g=; b=jk3oC2BoqEi3TVE0K21CLxMOIRISoUrqGSsg+JPjN0adh5acvfLqoDbyfbcFFQ7Xau eoDJ2CmBKaUFmbHIDLUvYWFV1T96Kifzl/eEaeX1KFxeiMosNLXS4dSq9TfNfOGr7tmn FQ4gojLgp5t+WAitV1M4W/VbiCdQd5yAiW4mrvBnONdc2vWFJTbcwWEoOab6N3nwmhBR pDk1gydyClX+aesiNdfnItNmnqpLfxFkcjUCu4+xRrwqscMnZUokV3/5bObN1bqaqDD8 i/28wMojHyDItpn7tSr3QINMLlO56EYIN1axtEEHihK2SP8rjgSXMDlnkgwpQwVkj0HS VkQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008396; x=1708613196; 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=BGKg1tIZ8Pmm8o3jSUHHCrdxf28mb3+tuXvQyvyxP5g=; b=bsfmxZlcudC4nzSWGwReetlznizH+5nVavcTuFc9Ti0MyCjMDYikKJl5Ljne/lcTIx qsrbpiHJugfTLyoj/hap3lh9zIxtKl2ZCWd9CpT7SpC0lyA+JzKNADKCIky+hFq+D06F cfScU3OD6ipkCEl/hfajecIQE49EhYegr0LawEM8tvVJKySvNazh4k6CxzXwNPBQJHPG EcNVmTJvbh66hSXckGacM+up81is/GWIWzFId+5gFoY6mdl+EAtHEBHx2V4ZS8vsv2zJ iKP8t4yEObM7ZeOzd+bCb21sXXzwc44ySEdJI5AaryL/gjVlF/t+vSKC/Bx2w3TSG8Dv XXlA== X-Gm-Message-State: AOJu0YzCxOaBeyGPT439I5TT9Rp4QNkCnatTSXdQxnRdDIGHxjqMGUZy kUw27lK5s0lCS80J3UPQFrIqZSqmvwZ7bLKS0Nrz4AxRBaCfTXA+wWKgnLas4VAKp++mFOX1qBg 3KIo= X-Google-Smtp-Source: AGHT+IGmA0wWedjfejttOQUV3sk2NRjfs/CVAFK+QkK6zX1XEmedaZHF9IAGuxYqclzOHo4ja/r2hQ== X-Received: by 2002:a17:906:370b:b0:a3d:254d:5aaa with SMTP id d11-20020a170906370b00b00a3d254d5aaamr1450284ejc.63.1708008396320; Thu, 15 Feb 2024 06:46:36 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= , Frederic Konrad , Mark Cave-Ayland , Artyom Tarasenko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 2/3] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_start_cpu() Date: Thu, 15 Feb 2024 15:46:21 +0100 Message-ID: <20240215144623.76233-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215144623.76233-1-philmd@linaro.org> References: <20240215144623.76233-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::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708008434226100003 By passing a DeviceState context to a QDev IRQ handler, we can simplify and use qdev_init_gpio_in_named() instead of qdev_init_gpio_in_named_with_opaque(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mark Cave-Ayland --- hw/sparc/leon3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index a15f90e142..44fca1487d 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -241,7 +241,8 @@ static void leon3_start_cpu_async_work(CPUState *cpu, r= un_on_cpu_data data) =20 static void leon3_start_cpu(void *opaque, int n, int level) { - CPUState *cs =3D CPU(opaque); + DeviceState *cpu =3D opaque; + CPUState *cs =3D CPU(cpu); =20 assert(level =3D=3D 1); async_run_on_cpu(cs, leon3_start_cpu_async_work, RUN_ON_CPU_NULL); @@ -310,8 +311,7 @@ static void leon3_generic_hw_init(MachineState *machine) for (i =3D 0; i < machine->smp.cpus; i++) { cpu =3D reset_info->info[i].cpu; env =3D &cpu->env; - qdev_init_gpio_in_named_with_opaque(DEVICE(cpu), leon3_start_cpu, - cpu, "start_cpu", 1); + 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)= ); --=20 2.41.0 From nobody Fri Nov 1 05:26:13 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=1708008451; cv=none; d=zohomail.com; s=zohoarc; b=C3uBbUdw8RGBv2FnAINMHSp9Ngx0PsxDEMcYO57bDAOTAjIdEHVMIkf+Pddc7VYKidpZaN3jEQQexaOWEXYMlx/P14FpFjtFaW2CxoKQHfiIz4Miw/DkQGyWUqh/4EheLyTLdHmaztJZXNEjpnik/J9M4us9T6QLHBomj8FPPK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708008451; 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=zvJ+w++PMP9Jr9Dkgf+8l14WEtpiGiCahalhYRk1Dhg=; b=atUXnL78F/9PjJMcreYCTAOwrYz4V+PQ1f0vUv5AjeqZIX0akMD7j2SOTjb5IAD+8+Z+Vfk5kVbd3HizgrTCGI5FzkXxrcL862Z2IqofZywVN88gHJv6r8pthe+ImV2aCyeFRGmzxNZezT7/5O6XJSaS0m3nwHszLuu5bGQfyxc= 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 1708008451733143.32519402589242; Thu, 15 Feb 2024 06:47:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rad0i-0006oN-H9; Thu, 15 Feb 2024 09:46:48 -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 1rad0f-0006kn-K8 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:47 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rad0e-00073W-2K for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:45 -0500 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a389ea940f1so122037166b.3 for ; Thu, 15 Feb 2024 06:46:43 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id rf14-20020a1709076a0e00b00a3daa068f76sm341597ejc.65.2024.02.15.06.46.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:46:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708008402; x=1708613202; 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=zvJ+w++PMP9Jr9Dkgf+8l14WEtpiGiCahalhYRk1Dhg=; b=MXRQCJx1CBNlpvlxY9SUSa2ItkHl0w8YmlS7WW+xTmE/yKfKx9FL0ubFTtROCfAyZb 9YBxfwD1gsXOIDHNSTwsGpnRMj+Yzx8sKiWk3AYvbi8bQLSXXzq2wKDCxzY9VkXHU9mB JBIn5Ay5yLvOMPytdk3rs0pmMI98e/YYR0pQzBEMbWV/oSabessMDXWMz9QnuTtpqXCO OsNx7PPgyKlkYCf+od7ebz2v5C/a/fdsmkijNtFqRX27xXTnN7v/gDMlcINL9/65MaHS njA1T/L+6qCh8wra+ijCjgQVa1K8WAEMc+u6yu8XDXZ+Ziuv27drbJbia8fpSI4OdH1t 5Szw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008402; x=1708613202; 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=zvJ+w++PMP9Jr9Dkgf+8l14WEtpiGiCahalhYRk1Dhg=; b=Fkl8DyEPfPuIAcb2tJXpHrXIWEp5t1xItsRLwkU0viddGRRKM6/zpUFnUAUqUqbMOK BKEL/2TReHCWrWherqx+0eI+o7xbpuerUqTZCQYYqMbWP7QZiLPYpEwF3zDbNLB6TlmD HBaeVVeltqfx8XmP/rfCOa70J7TIykfQzclIhpA6pvmrIYqW9AA0gPNuau/BfmRGFJ/z lwWKxy+Zlhdzeyc4OAtXBHvwLFpNxf01CY7qWI/31SV1UToYanBNy7bA7RLD/VDgIEVN x5A8xNLXz2KOYD6CeoLcAod1u6f5a+j9yvLiMcb8FFmhAott/ki8fA0XJMwMRB0FHmh2 ut6g== X-Gm-Message-State: AOJu0YwluocXAbtXSDepwzhLPs7BOmkCFAj5Gp+7EYKVzDUYMh9gP4SO msnO0g8npYo6pNj6RJvSce0XMGIDUOvp8F6j0SX/J48oYp1Zgp2OFL6FHPTYUPP18qFX9W7MP8t kMhE= X-Google-Smtp-Source: AGHT+IFzgfrDgkqh5AUbdfbpRMNFkbzwtPT3fXa5Z9u3LaksKb1bjtTljhdvCe4tywCLNr5T922iYw== X-Received: by 2002:a17:907:76d1:b0:a3d:9435:5805 with SMTP id kf17-20020a17090776d100b00a3d94355805mr1425473ejc.13.1708008401884; Thu, 15 Feb 2024 06:46:41 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= , Frederic Konrad , Mark Cave-Ayland , Artyom Tarasenko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v5 3/3] hw/sparc/leon3: Initialize GPIO before realizing CPU devices Date: Thu, 15 Feb 2024 15:46:22 +0100 Message-ID: <20240215144623.76233-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215144623.76233-1-philmd@linaro.org> References: <20240215144623.76233-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::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708008452357100001 Inline cpu_create() in order to call qdev_init_gpio_in_named() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- 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 *machin= e) =20 for (i =3D 0; i < machine->smp.cpus; i++) { /* Init CPU */ - cpu =3D SPARC_CPU(cpu_create(machine->cpu_type)); + cpu =3D 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 =3D &cpu->env; =20 cpu_sparc_set_id(env, i); @@ -311,11 +314,9 @@ static void leon3_generic_hw_init(MachineState *machin= e) for (i =3D 0; i < machine->smp.cpus; i++) { cpu =3D reset_info->info[i].cpu; env =3D &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)); --=20 2.41.0