From patchwork Mon Sep 18 16:02:47 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: 13389999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA06EC46CA1 for ; Mon, 18 Sep 2023 16:18:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjIRQSH (ORCPT ); Mon, 18 Sep 2023 12:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjIRQR5 (ORCPT ); Mon, 18 Sep 2023 12:17:57 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10C32A2 for ; Mon, 18 Sep 2023 09:09:43 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-52f3ba561d9so10226824a12.1 for ; Mon, 18 Sep 2023 09:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695053381; x=1695658181; darn=vger.kernel.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=wbLvVhCdjkLoKVSI3XlIe8h3b/C8JwK6Lt4fUZyBeQw=; b=MSEwH4vKfd0quO6q5e7dnGQrLGblqgd85rR3+R1OP9mzcGRwYJ77anICgeWWvtQvq3 tXOReoA3QkkryDhvazpG2E4LAr9c8saaqDUSuFS9PWunhZkPqwUFc3Rwt2OSku8zGDwP 37eEzBnbePhYGrhk63TkdlficlUJwX3UfadffN+0gwMbzTi9v08uR0dpIBKt67LnmfEk boHbFZfgqsuRac7qipNXCixXQnRcgTJS22mzBuAvDJJAEqConIZl4PJoPnlPn4B96xdc AWdzsXIMLq1CnbAKRIADJtUcFIhDxDWLkzANX544ObBYPM+VVBtI6T217ZNY8CGGdrQf cW6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053381; x=1695658181; 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=wbLvVhCdjkLoKVSI3XlIe8h3b/C8JwK6Lt4fUZyBeQw=; b=xOrA0aGUm+58geGcdrWuHi1rFgJt5wHInPocM6+UE/zFsjGupA4hVSWEMKgCzTdfNW XglZ5UW2AGeG4hGbATvWK7IDMMTD6x3qrEdO9CVjyAr1TYlVbTUEbVQmeIpA49CaIXQn x/jIjEf/PCQ9jyMp7Lx6A0vO4+sk3cF1jgJ9yQQmCHHRiuil8bR6gFUFrWxnk0nLuiMy 5VFcHWNtVUSL1fwY2JpwcLuYXfFWhUwibF7hMvUiiuzyd4mSSTX+nwyGEV4ziZ4Wwmaj d7L/O/JTwU4KBugW8Qhu2m7uFtA57R1nQwHBlkkUenMz6tb2vZJdz++VJ7cWV9HRDgwk qMrw== X-Gm-Message-State: AOJu0YygsArK/Lem8MNGZo+CjAMWRkcGjywerAu/+qB4K7XuDc9mjeit slqyY7gjcmkd6nrasFoBN0XRogrgtb/9NfEjsDdC6pUP X-Google-Smtp-Source: AGHT+IGUIRL/Cj2QgpL/SWnZOOte/5aXBCe8PvtqKJ8rdHwjYW7XrtiQqR5SrkqTU7jQZeCu2Klurw== X-Received: by 2002:a17:906:311a:b0:9a9:f0e6:904e with SMTP id 26-20020a170906311a00b009a9f0e6904emr154241ejx.16.1695053053645; Mon, 18 Sep 2023 09:04:13 -0700 (PDT) Received: from localhost.localdomain (static-212-193-78-212.thenetworkfactory.nl. [212.78.193.212]) by smtp.gmail.com with ESMTPSA id n26-20020a170906119a00b00997cce73cc7sm6586020eja.29.2023.09.18.09.04.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 09:04:13 -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 14/22] target/sparc: Init CPU environment *after* accelerator vCPU is realized Date: Mon, 18 Sep 2023 18:02:47 +0200 Message-ID: <20230918160257.30127-15-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 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org These fields from the environment don't affect how accelerators create their vCPU thread. We can safely reorder them *after* the cpu_exec_realizefn() call. Doing so allows further generic API simplification (in the next commit). Signed-off-by: Philippe Mathieu-Daudé --- target/sparc/cpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 2fdc95eda9..88157fcd33 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -756,6 +756,12 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) SPARCCPU *cpu = SPARC_CPU(dev); CPUSPARCState *env = &cpu->env; + cpu_exec_realizefn(cs, &local_err); + if (local_err != NULL) { + error_propagate(errp, local_err); + return; + } + #if defined(CONFIG_USER_ONLY) if ((env->def.features & CPU_FEATURE_FLOAT)) { env->def.features |= CPU_FEATURE_FLOAT128; @@ -776,12 +782,6 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) env->version |= env->def.nwindows - 1; #endif - cpu_exec_realizefn(cs, &local_err); - if (local_err != NULL) { - error_propagate(errp, local_err); - return; - } - scc->parent_realize(dev, errp); }