From patchwork Mon Sep 18 16:02:52 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: 724159 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1773329wro; Mon, 18 Sep 2023 09:05:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIAcWznnpXHvzniRekT7Uyccp5uHDt5ks5is4TSp57FuLBcEH+eREQNc4wvE215RgeJ/vv X-Received: by 2002:a05:6214:716:b0:64f:4e7a:bc4d with SMTP id c22-20020a056214071600b0064f4e7abc4dmr8760779qvz.43.1695053108964; Mon, 18 Sep 2023 09:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695053108; cv=none; d=google.com; s=arc-20160816; b=MH+FjhiFrAZj9rHrsHuvTe7qelL2o10/UgfVtekqykObHyaZnq5JTJwZSiJns+pAAV 09WE234DEFkB5QrXicmJfwZo0pbkZLzX5S/AypbMVZf3LRdnwoWKeI9M0GQ0p1pAvin7 VBgS8IPvyRpro9hNz5lrWPwkYmD8qRQihBejyf3resn1QUWJk0Oxanmh0vYQB5LkVSSn 16R3qEdm7cv8C8fyjW5iz4BOEkC8F04v5vbnmn0y8vs2843UeF2WBkr0ADoX+MaAi88T cIskMPnXmAsm1mRoLvVyiUr1ljjeoHkhRVIk3kqxFW2oWm1ezmyCalZk+oQRBViS5qPm 0JHg== 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=ikcGGGCIJyFk0iGLkDvtO0LMxTWmhw6kUdLFh+619DA=; fh=AIYNAcrfQPdTp+tiOBYg2bCy2NfWRbXD73JV9SLWbpM=; b=iU2WA4NYBxP2ojMFixht++NkAGH/Z98X8i3xICIxfCVPXXpMo5C0Uu1qb9r9v7YYXp IRV3yiwnBhwhDbq8uVF3v8zEptxgcvrEGWLwsHfuvkuSNdbOzZsSLoUglVLAi/1aGM1h dwuIT6zeo+QNBQpca5KELidNdCTM3tDkHAeZZg1DOwGXwC73XMSMgTRIQi3aOVSfeIYJ VMNLnPBaVfrzHVrtQY42TElNw7kdM3SpU4IlgxUR88Ad41tvd4h+AxYJECzcqA+2eUvh P/wQiAoEiUo94VQCutjuuMxBj4p81wxXMSrA9+4pzxY1vAQxSXlNTALYh44hpb6j3bH9 uEnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mv3ja5W3; 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 g1-20020a0cdf01000000b0064f5b24c6ffsi5837295qvl.426.2023.09.18.09.05.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2023 09:05:08 -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=mv3ja5W3; 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 1qiGjv-0001Wp-P8; Mon, 18 Sep 2023 12:04:47 -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 1qiGjt-0001M4-DK for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:04:46 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiGjq-0004QS-11 for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:04:44 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2bcde83ce9fso76833081fa.1 for ; Mon, 18 Sep 2023 09:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695053080; x=1695657880; 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=ikcGGGCIJyFk0iGLkDvtO0LMxTWmhw6kUdLFh+619DA=; b=mv3ja5W3XcPXcetv5Y/VtVb/CDeg90J4JMJfi7D5cQ/hhrqsoyhrgsortPLqULs198 AP6NgorKqlO0k6sNJQ4dgTWWl4/sLyhxU5mLle6x8zCz+zFKtIvHILiBLVpjoZuQ++mB PZTh16tqfzHulfXHi5wiifqMleWqVcRSjF4HzE8ViejvasJ0EyWm7fTj6fzLu553vnaR AdLaktXRWsSQACk0OkAs1oSXw985JTavGiYA777p9i4qOsn+dvxNJU/pW91BgBq/uNun UbWOc66plS4bp1SnOMUIPMksHJyiK4ulIu2DrIPthtsreVNoRtY84dKHsAOkkpbh+3Pe kdAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053080; x=1695657880; 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=ikcGGGCIJyFk0iGLkDvtO0LMxTWmhw6kUdLFh+619DA=; b=BMVwNwA3jV96gWYN1Q9tRoLFf9o+COtG9XkbZzZO/SW25fneE2EzKAl7oH6aXBjKqJ gIHwLHOlTFOKjQPPe2AZ3HKwvH4Z5Ic+D/n8NQc3wokTEKXX3IAGawoGwIjoQeqoPR/2 Dd0K4AvR+a91NaJ6RxiOoPCFUUNVdW465GtfThpR1HDXPZd9PMQlg/cNGd106a5TSzsm pjvqIz6B3Zrr57ptBartKvNvOBNZDsmcY9npxp44XvxGQwQQtSQ+rduDrqfvg50NBTXG 37xg07OrHTfmOwrZE4xij4hYfICpMf7b6VjZrycIX93ATjvm891ptdznBEVfc5VDcW6D kTCg== X-Gm-Message-State: AOJu0Yx5hlAasUlAoC3d/pGRTEyhtl8/o1pGU+1IdnBE+Pheu4AS+hpb X8cDvJIQzMOE90Wchagix56I+TVFmsAXepBHexZnZj0E X-Received: by 2002:a2e:9d42:0:b0:2b9:e53f:e1fd with SMTP id y2-20020a2e9d42000000b002b9e53fe1fdmr7980710ljj.34.1695053080249; Mon, 18 Sep 2023 09:04:40 -0700 (PDT) Received: from localhost.localdomain (static-212-193-78-212.thenetworkfactory.nl. [212.78.193.212]) by smtp.gmail.com with ESMTPSA id v24-20020a1709060b5800b0098951bb4dc3sm6599465ejg.184.2023.09.18.09.04.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 09:04:39 -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 19/22] target/s390x: Have s390_realize_cpu_model() return a boolean Date: Mon, 18 Sep 2023 18:02:52 +0200 Message-ID: <20230918160257.30127-20-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::232; envelope-from=philmd@linaro.org; helo=mail-lj1-x232.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 s390_realize_cpu_model() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé --- target/s390x/s390x-internal.h | 2 +- target/s390x/cpu.c | 3 +-- target/s390x/cpu_models.c | 12 +++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h index 781ac08458..67f21f53a9 100644 --- a/target/s390x/s390x-internal.h +++ b/target/s390x/s390x-internal.h @@ -260,7 +260,7 @@ static inline void s390_cpu_unhalt(S390CPU *cpu) /* cpu_models.c */ void s390_cpu_model_class_register_props(ObjectClass *oc); -void s390_realize_cpu_model(CPUState *cs, Error **errp); +bool s390_realize_cpu_model(CPUState *cs, Error **errp); S390CPUModel *get_max_cpu_model(Error **errp); void apply_cpu_model(const S390CPUModel *model, Error **errp); ObjectClass *s390_cpu_class_by_name(const char *name); diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 7257d4bc19..1a44a6d2b2 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -232,8 +232,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp) Error *err = NULL; /* the model has to be realized before qemu_init_vcpu() due to kvm */ - s390_realize_cpu_model(cs, &err); - if (err) { + if (!s390_realize_cpu_model(cs, &err)) { goto out; } diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index f030be0d55..0605073dc3 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -567,7 +567,7 @@ S390CPUModel *get_max_cpu_model(Error **errp) return &max_model; } -void s390_realize_cpu_model(CPUState *cs, Error **errp) +bool s390_realize_cpu_model(CPUState *cs, Error **errp) { Error *err = NULL; S390CPUClass *xcc = S390_CPU_GET_CLASS(cs); @@ -576,19 +576,19 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) if (xcc->kvm_required && !kvm_enabled()) { error_setg(errp, "CPU definition requires KVM"); - return; + return false; } if (!cpu->model) { /* no host model support -> perform compatibility stuff */ apply_cpu_model(NULL, errp); - return; + return false; } max_model = get_max_cpu_model(errp); if (!max_model) { error_prepend(errp, "CPU models are not available: "); - return; + return false; } /* copy over properties that can vary */ @@ -601,7 +601,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) check_compatibility(max_model, cpu->model, &err); if (err) { error_propagate(errp, err); - return; + return false; } apply_cpu_model(cpu->model, errp); @@ -617,6 +617,8 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) return; } #endif + + return true; } static void get_feature(Object *obj, Visitor *v, const char *name,