From patchwork Mon Sep 18 16:02:54 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: 724170 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1775766wro; Mon, 18 Sep 2023 09:09:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcXR5hecAozoSuiP1bEJpGLuRaN3s2jZ+lqkLOJLpmJUe5TwN7pwAz5EWvHHEMFixlFhsR X-Received: by 2002:a05:622a:1816:b0:410:443:221a with SMTP id t22-20020a05622a181600b004100443221amr11201314qtc.1.1695053343303; Mon, 18 Sep 2023 09:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695053343; cv=none; d=google.com; s=arc-20160816; b=I+i3zxkCouwIE70TjlImn7D4AUXMCICn/dCWjh6oi0frPVhg17LwxRTv3MOBxaTHrt Dft17sSpDrTI3E7ST5QyOSQCFTM9hq72HxtltlDy17j8+rV2fWwkWXZwyn1Bm7o1TT9s rtQjun+i5FuYyt1ZWQCZayyEsXmn50xKJFYk5GQUez2Rol4Nlr/YBE7KwtHCWoQHOaEF rqNSv/XqF3ySGbaFbZNso7WNzGa/yViOXe5ZU3liGvC8w9ZMzVQS2AwlAyG3yufMARfx Ib6AkkiBHYzeacZ7bV92RhSNoUt5KypjpbCPb3o72octWd3Su33bezGd1Zj3KkROvHwj 3N8g== 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=GMzTvk0FEO6I+ReA5ceoXcLeA6ER1WjzLpFKcs1vmU4=; fh=AIYNAcrfQPdTp+tiOBYg2bCy2NfWRbXD73JV9SLWbpM=; b=ein6tH7yNieqLgyFlKPt8LPrF6KAC9hRD1oF972nunquyfDA1MfMEV5XxNJZeDImb/ SRbciecKYkVCMF7p0UPAZVaBsZH+MvQScdqyCr1diSu6KrW7X9GRvn3BKDlca7rkpDr+ jzTTtiQ2cn6NIMg/1QhgB9eL0tJsM5q/SHou4R8aJTSgo5jYuyVlrx5+nUbm9uuOmC3L AQ/XS8GarUzbaciLxKNtzsjUOaA1LSRSYZ7aIf1JzK/1GADjzJH3QUdBJUyXTOS6/RcM +0SHGsFK90QJ5qAcI9lbF/jUxrz/43geHwKGxr4bKVkXXz3oYI0m+ePSoV125uwZezdk DbwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q28rRDoY; 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 s3-20020a05622a018300b0040345635f05si3028901qtw.132.2023.09.18.09.09.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2023 09:09:03 -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=Q28rRDoY; 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 1qiGkp-0002d7-2d; Mon, 18 Sep 2023 12:05:43 -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 1qiGkC-0001q3-LT for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:05:05 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiGk8-0004Sz-K6 for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:05:04 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-500a8b2b73eso7543020e87.0 for ; Mon, 18 Sep 2023 09:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695053091; x=1695657891; 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=GMzTvk0FEO6I+ReA5ceoXcLeA6ER1WjzLpFKcs1vmU4=; b=Q28rRDoYQuL4rLCoPBaZaDNC9N3PiNlMicDVPslVNuMOPnrcL419E3BZeqnkOwh95M Vve6dMrNUVVkiYnW8qZjUubmA0jWZyJxWPt0m3iBI96LqWilYx2YEe9A1R4kIB07i3tP lMWE3AAmDeuUvBg4K8DcV6CszfOvlAeT9Fv0KewarW+ln5T9Pgike9TD5REYmndjajJO /FPGoqVuKDewqmSBHa82D0Bn5EiHWYm8WuiYwEeM+hP07ycJVmnaE4IYLhQ/QBTRGU4V /5qqEhxTDulmO8ylCeXSevFvoslxxtSMF+6wvi/kFQvTMFy8zW9BxZSfkSfMC4gfckVF +/fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053091; x=1695657891; 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=GMzTvk0FEO6I+ReA5ceoXcLeA6ER1WjzLpFKcs1vmU4=; b=L2WZLI/dC5AlMnuwtYDLu1eaDQcxp0eqRLdHQIaGt9ojd81U5E+qr0BF2p2abbVkxD Q7J+FuW0NlYI91kNz9rxQCZtLD+3312WOGAWSy385H+0JxQogUkBQIUWkBxVbgv3bZgv qblX/woJwfYld9d/vYWmFoC8pV5fuI57MmX07kcu8exFbsrGejnRq7x6EsQRkt2hA9hE R60zD9BuR6Y86njJi5Z+E/xDwjZA+bjXjZby6IsMG6VbgTb8s3raS5NRyq21nGuAwIvf P7kGpxl+LOputBGQZMgg9QGr7a3zD3EqSRMKswM/JfJF7bNQ3CuGzaTSaksE4yn4OSHn Swkw== X-Gm-Message-State: AOJu0YyoI8bX9OBaXQ/rKYgGo0vYm4B97MHQZQ2Nn98QagvLAkv3ggGm T/ocY4XAJaS4i4mRlz4IupEhiXa47Zg9GAG92H4I139n X-Received: by 2002:a05:6512:3f8:b0:503:95d:f2bd with SMTP id n24-20020a05651203f800b00503095df2bdmr4180507lfq.34.1695053091074; Mon, 18 Sep 2023 09:04:51 -0700 (PDT) Received: from localhost.localdomain (static-212-193-78-212.thenetworkfactory.nl. [212.78.193.212]) by smtp.gmail.com with ESMTPSA id i8-20020a0564020f0800b005309eb7544fsm4528407eda.45.2023.09.18.09.04.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 09:04:50 -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 21/22] exec/cpu: Have cpu_exec_realize() return a boolean Date: Mon, 18 Sep 2023 18:02:54 +0200 Message-ID: <20230918160257.30127-22-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::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have cpu_exec_realizefn() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 2 +- cpu.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 1e940f6bb5..3dc6968428 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1014,7 +1014,7 @@ G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...) /* $(top_srcdir)/cpu.c */ void cpu_class_init_props(DeviceClass *dc); void cpu_exec_initfn(CPUState *cpu); -void cpu_exec_realizefn(CPUState *cpu, Error **errp); +bool cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); /** diff --git a/cpu.c b/cpu.c index 84b03c09ac..96ae440b81 100644 --- a/cpu.c +++ b/cpu.c @@ -131,7 +131,7 @@ const VMStateDescription vmstate_cpu_common = { }; #endif -void cpu_exec_realizefn(CPUState *cpu, Error **errp) +bool cpu_exec_realizefn(CPUState *cpu, Error **errp) { /* cache the cpu class for the hotpath */ cpu->cc = CPU_GET_CLASS(cpu); @@ -142,7 +142,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) } if (!accel_cpu_realizefn(cpu, errp)) { - return; + return false; } /* NB: errp parameter is unused currently */ @@ -169,6 +169,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) vmstate_register(NULL, cpu->cpu_index, cpu->cc->sysemu_ops->legacy_vmsd, cpu); } #endif /* CONFIG_USER_ONLY */ + + return true; } void cpu_exec_unrealizefn(CPUState *cpu)