From patchwork Mon Sep 18 16:02:44 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: 724163 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1774419wro; Mon, 18 Sep 2023 09:06:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHTo8MF65xJrOYIaSFGIAMJqA2J5qusIKnnafvKNDVnFSHKmWDZTpPt3T9qvVURZaUSTpt X-Received: by 2002:a05:6102:1344:b0:44e:9113:ac58 with SMTP id j4-20020a056102134400b0044e9113ac58mr4842979vsl.6.1695053212823; Mon, 18 Sep 2023 09:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695053212; cv=none; d=google.com; s=arc-20160816; b=R/jmEbcAFzouFth6JOu1OILaKfp7/dzjStQCJ8e8slOqmtYOF1QH/1F4i+4FAO3Hb3 L8H4l8Z7muvW3Bud9l7BWo//SSMcgsu3g3Zgs074XKW17XPKrEBpfl+jF6WA50BTl+0T FCOun4sstDINSMnCQCuDDZeH/VywR0MV9h0U/nfECJRo38lEeKn5ECTSfhbHnCLpXN90 su0Yp4PGEJLgqdBkLD7Ty5jNIM8ymR8LO6bk7DqYqfslnNq4yIW/EBedZVfw7ZEi1qRk 82V2w1o4VQlisPQF83JCGGlqzRXtStcvuRdvfTv6iyE3gDP9Qs813zLGdxE9oYwDzjMO M2Jg== 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=I+18fO8c7Dk0qCgNhOL8JkONKbHnDNHi1cgc68a1fr4=; fh=AIYNAcrfQPdTp+tiOBYg2bCy2NfWRbXD73JV9SLWbpM=; b=ITpC5cS+MKiTllsioMa2i8cDANPICkOZtlY6MrXT+/+VLwDFQUfLSGN6y24Z9jqeCJ sx11ZvoXlzeZhcgy7kmCIyrPRdD0CJZCL1BMcjWvKL4ynx4OWeZ+/oLxl5CkHCbqQV6l ahKUWzl2mfHcSuXhq0lDpoN65dBNAOkcdsuQzY0zZ83nPVBqmHqAWybINT6CUdrT7RY1 F4OkwexHz3ew3d7O0PV3gGOuZB04U6M4VQNuK6YRdLYlCswBWwwqgY8UUZfPDAJvrBiP 9SFAaJCfVIQbjcR5Z4cSPAHjrI3hChle5MBbKNZdV67joWwMhIac6WqQKVljaZOKwUae EfWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UsYJ+7hp; 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 p4-20020a05610223e400b0044d3666c69fsi869618vsc.174.2023.09.18.09.06.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2023 09:06:52 -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=UsYJ+7hp; 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 1qiGjc-0008Op-Ab; Mon, 18 Sep 2023 12:04:28 -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 1qiGjB-0006vN-Rb for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:04:03 -0400 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 1qiGj9-0004Ad-5y for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:04:01 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-532784c8770so328939a12.1 for ; Mon, 18 Sep 2023 09:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695053037; x=1695657837; 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=I+18fO8c7Dk0qCgNhOL8JkONKbHnDNHi1cgc68a1fr4=; b=UsYJ+7hpAjzNQaE52yIQuo+wt63KLjjf1ElQYbCF/BauBdBzwinFwcyE6ORUfS/77s noywBnU1i+wuY1jhLfMhBtsXH9lt21+zZzqrKzxIy1Rp/OHh0hCKjUGGffwYw4IM/Yy2 A9HHrkTMFhBEzpaHt1Q2M8HezFiLdA9H/nJhOwZcxwo2c41CuVLuUFsEYo9B8YEtTRO+ bUDlR/sUZ643uuULSGDF+jXh3hbGFddVcherUTzKppdOrnMEdMP5qbQ3DPk1Rnte536q uQ1QuheJ0BJ3Ac0CNcesRs/8kKyoKJlb0hGP7ZK4cLqMA7I/dXMHX0AleQj/tHtVkVX2 b81g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053037; x=1695657837; 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=I+18fO8c7Dk0qCgNhOL8JkONKbHnDNHi1cgc68a1fr4=; b=SwAhM3LMtF0x7L2cXLXAGW0+u4j7uRiRkbzJX/hBvobuXc4fbhObp75IclQQYMHePj p+27BBN92ZTHf0dh1xsArimvw9vhaCnoeVgUjr5G/hN4dSHRNNdaBej/qUZj8LNUX6n3 Dt0sDE3mEBnxHnOut0kwO/jDSUeegDqyyAsH3Ujkv7M7aNGdRHLqOthVqHQHPIdMWfN0 kiOS99f/ArTSWiBcHjEuxbBnbGr55IJq68aa/FS1w5yr0i+Lcpf/OMkHlFFZK9kYA+Sn 2789UtTnpQXlMpGxlMntz4JC9RAbfZyudvHvXvG9CUsZg123rVL2i+p9QW6OoROhD00a F/9A== X-Gm-Message-State: AOJu0YwM4A37YXcV21/T8EqtIG86AZIRwZ4Dy0kt6NCp8ew9MnH7R6wB Ar0i6KEZ382F3mn+yaIQo5ch0p2GVpLdHsvjLx6eYa3X X-Received: by 2002:a17:906:74db:b0:9ad:e3f0:f335 with SMTP id z27-20020a17090674db00b009ade3f0f335mr6095624ejl.70.1695053037410; Mon, 18 Sep 2023 09:03:57 -0700 (PDT) Received: from localhost.localdomain (static-212-193-78-212.thenetworkfactory.nl. [212.78.193.212]) by smtp.gmail.com with ESMTPSA id qt11-20020a170906eceb00b009a19fa8d2e9sm6481188ejb.206.2023.09.18.09.03.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 09:03:56 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , Paolo Bonzini , Max Filippov , David Hildenbrand , Peter Xu , Anton Johansson , Peter Maydell , kvm@vger.kernel.org, Marek Vasut , David Gibson , Brian Cain , Yoshinori Sato , "Edgar E . Iglesias" , Claudio Fontana , Daniel Henrique Barboza , Artyom Tarasenko , Marcelo Tosatti , qemu-ppc@nongnu.org, Liu Zhiwei , Aurelien Jarno , Ilya Leoshkevich , Daniel Henrique Barboza , Bastian Koppelmann , =?utf-8?q?C=C3=A9dric_?= =?utf-8?q?Le_Goater?= , Alistair Francis , Alessandro Di Federico , Song Gao , Marcel Apfelbaum , Chris Wulff , "Michael S. Tsirkin" , Alistair Francis , Fabiano Rosas , qemu-s390x@nongnu.org, Yanan Wang , Luc Michel , Weiwei Li , Bin Meng , Stafford Horne , Xiaojuan Yang , "Daniel P . Berrange" , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Jiaxun Yang , Richard Henderson , Aleksandar Rikalo , Bernhard Beschow , Mark Cave-Ayland , qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Nicholas Piggin , Greg Kurz , Michael Rolnik , Eduardo Habkost , Markus Armbruster , Palmer Dabbelt Subject: [PATCH 11/22] target/nios2: Create IRQs *after* accelerator vCPU is realized Date: Mon, 18 Sep 2023 18:02:44 +0200 Message-ID: <20230918160257.30127-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230918160257.30127-1-philmd@linaro.org> References: <20230918160257.30127-1-philmd@linaro.org> MIME-Version: 1.0 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 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 Architecture specific hardware doesn't have a particular dependency on the accelerator vCPU (created with cpu_exec_realizefn), and can be initialized *after* the vCPU is realized. Doing so allows further generic API simplification (in few commits). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/nios2/cpu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 7a92fc5f2c..f500ca7ba2 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -201,14 +201,6 @@ static void nios2_cpu_realizefn(DeviceState *dev, Error **errp) Nios2CPUClass *ncc = NIOS2_CPU_GET_CLASS(dev); Error *local_err = NULL; -#ifndef CONFIG_USER_ONLY - if (cpu->eic_present) { - qdev_init_gpio_in_named(DEVICE(cpu), eic_set_irq, "EIC", 1); - } else { - qdev_init_gpio_in_named(DEVICE(cpu), iic_set_irq, "IRQ", 32); - } -#endif - cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); @@ -220,6 +212,14 @@ static void nios2_cpu_realizefn(DeviceState *dev, Error **errp) /* We have reserved storage for cpuid; might as well use it. */ cpu->env.ctrl[CR_CPUID] = cs->cpu_index; +#ifndef CONFIG_USER_ONLY + if (cpu->eic_present) { + qdev_init_gpio_in_named(DEVICE(cpu), eic_set_irq, "EIC", 1); + } else { + qdev_init_gpio_in_named(DEVICE(cpu), iic_set_irq, "IRQ", 32); + } +#endif + ncc->parent_realize(dev, errp); cpu_reset(cs); }