From patchwork Fri Apr 19 06:57:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1925413 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=el2QQQEY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLQBL5SCGz1yPJ for ; Fri, 19 Apr 2024 16:45:14 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxhy3-0007nh-0E; Fri, 19 Apr 2024 02:43:27 -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 1rxhxv-0007mZ-DX; Fri, 19 Apr 2024 02:43:19 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxhxt-0001Bv-Ce; Fri, 19 Apr 2024 02:43:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713508997; x=1745044997; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iWKKaHfg5cqYfoIHDCIm+pcw/eQF/WdGOSbon8iw0RM=; b=el2QQQEYpRFW1ZCJYflrLob1JdWP3qpoTgpfGY8DplZzeOKhuogauvO6 awM9WN4VmqLJh0vKx/lYznk/xrY7KYkNxp5Lx6vkuSDOr7/5o+NGQDniF Zaeyk6xsSRaAl1NzuWiwjgd40JvkD1SIuGyP91Os3ljKRulZemoJbAz+t 6JbeEDi1qmDCN9GDf61VIDQCRUfr55AiWcIU/5hdUpJekUqzHu51HW24o lUtZy1rXCEoY2X22rqJ4zECpFAQOnj5Ry8bM2jWxJojGRNCHmacMnL0ec nVEH/CLOsFGd+o+RCz3VQjC7FpqJbPAHqvwhEJ25dxDcTGdo94HRII4s1 Q==; X-CSE-ConnectionGUID: DuSyXQ1/RaCzf2q0dlWeXw== X-CSE-MsgGUID: 2itpKq9jRgqYJOYlZnw0Zg== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19659918" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19659918" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 23:43:14 -0700 X-CSE-ConnectionGUID: joRA+eebTfWnqvk/AuGOPw== X-CSE-MsgGUID: s9AhufdzQTGPrt2bpVtnxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="28071842" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa004.jf.intel.com with ESMTP; 18 Apr 2024 23:43:11 -0700 From: Zhao Liu To: Thomas Huth , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 1/6] target/s390x/cpu_model: Make check_compatibility() return boolean Date: Fri, 19 Apr 2024 14:57:07 +0800 Message-Id: <20240419065712.1225038-2-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> References: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.067, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu As error.h suggested, the best practice for callee is to return something to indicate success / failure. With returned boolean, there's no need to check @err. Suggested-by: Thomas Huth Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- target/s390x/cpu_models.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 8ed3bb6a27b3..8cb47d905fb4 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -510,7 +510,7 @@ static void check_compat_model_failed(Error **errp, return; } -static void check_compatibility(const S390CPUModel *max_model, +static bool check_compatibility(const S390CPUModel *max_model, const S390CPUModel *model, Error **errp) { ERRP_GUARD(); @@ -518,11 +518,11 @@ static void check_compatibility(const S390CPUModel *max_model, if (model->def->gen > max_model->def->gen) { check_compat_model_failed(errp, max_model, "Selected CPU generation is too new"); - return; + return false; } else if (model->def->gen == max_model->def->gen && model->def->ec_ga > max_model->def->ec_ga) { check_compat_model_failed(errp, max_model, "Selected CPU GA level is too new"); - return; + return false; } #ifndef CONFIG_USER_ONLY @@ -530,14 +530,14 @@ static void check_compatibility(const S390CPUModel *max_model, error_setg(errp, "The unpack facility is not compatible with " "the --only-migratable option. You must remove either " "the 'unpack' facility or the --only-migratable option"); - return; + return false; } #endif /* detect the missing features to properly report them */ bitmap_andnot(missing, model->features, max_model->features, S390_FEAT_MAX); if (bitmap_empty(missing, S390_FEAT_MAX)) { - return; + return true; } error_setg(errp, " "); @@ -546,6 +546,7 @@ static void check_compatibility(const S390CPUModel *max_model, "available in the current configuration: "); error_append_hint(errp, "Consider a different accelerator, QEMU, or kernel version\n"); + return false; } S390CPUModel *get_max_cpu_model(Error **errp) @@ -605,8 +606,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) cpu->model->cpu_ver = max_model->cpu_ver; check_consistency(cpu->model); - check_compatibility(max_model, cpu->model, &err); - if (err) { + if (!check_compatibility(max_model, cpu->model, &err)) { error_propagate(errp, err); return; } From patchwork Fri Apr 19 06:57:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1925412 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Thh8p90p; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLQ9s6Xq7z1yP2 for ; Fri, 19 Apr 2024 16:44:49 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxhy7-0007oZ-GU; Fri, 19 Apr 2024 02:43:31 -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 1rxhxv-0007mv-VV; Fri, 19 Apr 2024 02:43:22 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxhxu-0001C1-9C; Fri, 19 Apr 2024 02:43:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713508998; x=1745044998; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UkzcgPrX7JhPfDWYAR9t1jT+HmH8Ih9TbuBc2w9snTU=; b=Thh8p90paUwISuCL9RBg9/ZBu5OL620AzLhMXyksVvKVHbPEXzGSEFhz hk2psyg34Ix8Itu5Qu2mPd1slj/lMe5xltDHZYsINH1nnyyDrmoPDjuwj N4igtfBv9F4cbpQtjgndNl5AtY8HYqG5eLWUnHi55mgZMz/Tam1i2eDrU pwAPpDTuNOt3tsR6IWSFruGsg0PVJQlgsxYVwWv60AWlE8xMXllsCNN0q D4v0a3ecCL5tD4+pQwwdxZuD4SKSNsIvPiLMD+BIqY+7cn7BO6SxjKXAw eq8fufI/fZ2hQJ7Rwf5cIOKonVXv2Cx+U4RcZXID/zU5cpELQrsezKcVX w==; X-CSE-ConnectionGUID: mywXvmwSQWaKgpeEB6s+Pw== X-CSE-MsgGUID: hENosOE/RVu789S1fHoyWA== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19659924" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19659924" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 23:43:16 -0700 X-CSE-ConnectionGUID: GDKasGoYTKaAuq9XzRk/6Q== X-CSE-MsgGUID: 7yRWAzbTQEukKOq5RH76+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="28071850" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa004.jf.intel.com with ESMTP; 18 Apr 2024 23:43:14 -0700 From: Zhao Liu To: Thomas Huth , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 2/6] target/s390x/cpu_model: Drop local @err in s390_realize_cpu_model() Date: Fri, 19 Apr 2024 14:57:08 +0800 Message-Id: <20240419065712.1225038-3-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> References: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.067, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Use @errp to fetech error information directly and drop the local virable @err. Suggested-by: Thomas Huth Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- target/s390x/cpu_models.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 8cb47d905fb4..052540a866ac 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -577,7 +577,6 @@ S390CPUModel *get_max_cpu_model(Error **errp) void s390_realize_cpu_model(CPUState *cs, Error **errp) { ERRP_GUARD(); - Error *err = NULL; S390CPUClass *xcc = S390_CPU_GET_CLASS(cs); S390CPU *cpu = S390_CPU(cs); const S390CPUModel *max_model; @@ -606,8 +605,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) cpu->model->cpu_ver = max_model->cpu_ver; check_consistency(cpu->model); - if (!check_compatibility(max_model, cpu->model, &err)) { - error_propagate(errp, err); + if (!check_compatibility(max_model, cpu->model, errp)) { return; } From patchwork Fri Apr 19 06:57:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1925407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZGv44uPu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLQ9Q728jz23jF for ; Fri, 19 Apr 2024 16:44:26 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxhy9-0007pa-DA; Fri, 19 Apr 2024 02:43:34 -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 1rxhxy-0007nA-HC; Fri, 19 Apr 2024 02:43:23 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxhxw-0001C1-Ju; Fri, 19 Apr 2024 02:43:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713509000; x=1745045000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LwFLeqkK2C7815gQQwiOlEqSvA1CBsyQ8KubM+wnykI=; b=ZGv44uPu4cfSRTB+AQ4tTQabXwqpguKH4WOXCLGpqPwEAIOF6gC2hS0I 7G+hmGCgP47VoWIP3C/ObSEx3/v3kmXjtzXpW/0IqreDlZ1IVuUcDTHLl VyT18aG+M8fJIMvHCjPkj+oZAw762LoTJtRW8GJwHb8WkUp/3cmoeYYwZ Pf4w2wp3RwPRZOJV+wR/yyPbkbwUkLKrzUroTEP8+Q5a7ClA6kkIzVt4q wiNHUQIV/8/TpTdUyjZp7jEPbHwfs1rkczgIYhgMhqX8kD9vQAqRm8nRG s6V/u6BQUKD0KGiXtKU8SSIKuVCQ9bOa5nSiK+wFbKJjz8VD6yQXnDjd6 Q==; X-CSE-ConnectionGUID: cIh4/bI5RqylTy+/0yNmyw== X-CSE-MsgGUID: bKoxjEcvTGO57vwlGiFlxg== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19659930" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19659930" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 23:43:19 -0700 X-CSE-ConnectionGUID: OQCZVyfFT9mVPkcdyuOKRQ== X-CSE-MsgGUID: RGPOX07FTkijby1WNR6q+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="28071880" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa004.jf.intel.com with ESMTP; 18 Apr 2024 23:43:16 -0700 From: Zhao Liu To: Thomas Huth , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 3/6] target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean Date: Fri, 19 Apr 2024 14:57:09 +0800 Message-Id: <20240419065712.1225038-4-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> References: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.067, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu As error.h suggested, the best practice for callee is to return something to indicate success / failure. So make kvm_s390_get_host_cpu_model() return boolean and check the returned boolean in get_max_cpu_model() instead of accessing @err. Additionally, since now get_max_cpu_model() returns directly if kvm_s390_get_host_cpu_model() fills @err, so make kvm_s390_get_host_cpu_model() return true by default for the non-KVM case in target/s390x/cpu_models.h. Signed-off-by: Zhao Liu --- target/s390x/cpu_models.c | 9 ++++----- target/s390x/cpu_models.h | 5 +++-- target/s390x/kvm/kvm.c | 13 +++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 052540a866ac..a0e4acb707d7 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -560,16 +560,15 @@ S390CPUModel *get_max_cpu_model(Error **errp) } if (kvm_enabled()) { - kvm_s390_get_host_cpu_model(&max_model, &err); + if (!kvm_s390_get_host_cpu_model(&max_model, &err)) { + error_propagate(errp, err); + return NULL; + } } else { max_model.def = s390_find_cpu_def(QEMU_MAX_CPU_TYPE, QEMU_MAX_CPU_GEN, QEMU_MAX_CPU_EC_GA, NULL); bitmap_copy(max_model.features, qemu_max_cpu_feat, S390_FEAT_MAX); } - if (err) { - error_propagate(errp, err); - return NULL; - } cached = true; return &max_model; } diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h index d7b89129891a..5041c1e10fed 100644 --- a/target/s390x/cpu_models.h +++ b/target/s390x/cpu_models.h @@ -116,12 +116,13 @@ S390CPUDef const *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga, #ifdef CONFIG_KVM bool kvm_s390_cpu_models_supported(void); -void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp); +bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp); void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp); #else -static inline void kvm_s390_get_host_cpu_model(S390CPUModel *model, +static inline bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) { + return true; } static inline void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 4ce809c5d46b..57937b4ddbef 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -2375,7 +2375,7 @@ bool kvm_s390_cpu_models_supported(void) KVM_S390_VM_CPU_MACHINE_SUBFUNC); } -void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) +bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) { struct kvm_s390_vm_cpu_machine prop = {}; struct kvm_device_attr attr = { @@ -2390,14 +2390,14 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) if (!kvm_s390_cpu_models_supported()) { error_setg(errp, "KVM doesn't support CPU models"); - return; + return false; } /* query the basic cpu model properties */ rc = kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr); if (rc) { error_setg(errp, "KVM: Error querying host CPU model: %d", rc); - return; + return false; } cpu_type = cpuid_type(prop.cpuid); @@ -2420,13 +2420,13 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) rc = query_cpu_feat(model->features); if (rc) { error_setg(errp, "KVM: Error querying CPU features: %d", rc); - return; + return false; } /* get supported cpu subfunctions indicated via query / test bit */ rc = query_cpu_subfunc(model->features); if (rc) { error_setg(errp, "KVM: Error querying CPU subfunctions: %d", rc); - return; + return false; } /* PTFF subfunctions might be indicated although kernel support missing */ @@ -2482,7 +2482,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) } if (!model->def) { error_setg(errp, "KVM: host CPU model could not be identified"); - return; + return false; } /* for now, we can only provide the AP feature with HW support */ if (ap_available()) { @@ -2506,6 +2506,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) /* strip of features that are not part of the maximum model */ bitmap_and(model->features, model->features, model->def->full_feat, S390_FEAT_MAX); + return true; } static int configure_uv_feat_guest(const S390FeatBitmap features) From patchwork Fri Apr 19 06:57:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1925410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iIGplWm/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLQ9Q6zrjz23jC for ; Fri, 19 Apr 2024 16:44:26 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxhy9-0007pZ-8m; Fri, 19 Apr 2024 02:43:33 -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 1rxhy2-0007nq-8n; Fri, 19 Apr 2024 02:43:26 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxhxz-0001CX-7k; Fri, 19 Apr 2024 02:43:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713509003; x=1745045003; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ucB5FkqzcnuIstw2NbeLrpaazDPnjkDurJu46dvoWLc=; b=iIGplWm/41TzeTHeg13CMFTihtUfLT6G4WQGHq0Smm/A27IvSJrvcUnS yS5ljx0gmcEXb5+ixERroL9ESooc8i4mTBO4Hha2aK6WuEprfg5xUbxij LeuJUkJiXn4QfFog60Il8VEJ91e+bwuX3rb6HhYX6pJ3rv1Ag96PNcEs2 9pMEoktRNwlwCkbFIXpqeJYLX/87AYGVk49/O4i5roud4kPWr+OPTqFug INojeNPSNJAJ1pkQMv2THMOWhKK0BVcgWxzTYWuU5DwSR/Sh/FetviBMb WcWxPj9+VhRNMiFq/atv8zEhhedNDpCzxgl/dqB6/Wk0tfyYzDND1KHvA A==; X-CSE-ConnectionGUID: ofnMlBcvSLu2lBESLc2KSg== X-CSE-MsgGUID: dMBOO1DlREO68GwFRJilhg== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19659945" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19659945" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 23:43:22 -0700 X-CSE-ConnectionGUID: Q2gs5EYESRebsok4FwG5WA== X-CSE-MsgGUID: zj2ExFi7TamFhVFEifQZhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="28071900" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa004.jf.intel.com with ESMTP; 18 Apr 2024 23:43:19 -0700 From: Zhao Liu To: Thomas Huth , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 4/6] target/s390x/cpu_models: Drop local @err in get_max_cpu_model() Date: Fri, 19 Apr 2024 14:57:10 +0800 Message-Id: <20240419065712.1225038-5-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> References: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.067, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Use @errp to fetech error information directly and drop the local virable @err. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- target/s390x/cpu_models.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index a0e4acb707d7..aae452cfd3fc 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -551,7 +551,6 @@ static bool check_compatibility(const S390CPUModel *max_model, S390CPUModel *get_max_cpu_model(Error **errp) { - Error *err = NULL; static S390CPUModel max_model; static bool cached; @@ -560,8 +559,7 @@ S390CPUModel *get_max_cpu_model(Error **errp) } if (kvm_enabled()) { - if (!kvm_s390_get_host_cpu_model(&max_model, &err)) { - error_propagate(errp, err); + if (!kvm_s390_get_host_cpu_model(&max_model, errp)) { return NULL; } } else { From patchwork Fri Apr 19 06:57:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1925408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DmJr01r/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLQ9Q60rNz23hf for ; Fri, 19 Apr 2024 16:44:26 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxhyF-0007sC-FC; Fri, 19 Apr 2024 02:43:39 -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 1rxhy5-0007oc-IN; Fri, 19 Apr 2024 02:43:29 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxhy2-0001C1-IA; Fri, 19 Apr 2024 02:43:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713509006; x=1745045006; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IZecTxaU+frQtocDHWoMZbTxqF4pkIWlVnz4Y1UGpIM=; b=DmJr01r/aX+QCm2bHHzuwve3NOADZbPleqfkLedzsVKgq0n+ccPuBaYO O9DtBFQtO6GuIbw4zipKkWD1jHULpmavlPndEwkVAfN98TJJvqAkIdNVn saxabOUBE1ZNxHs4nNR2RM1Ev4xHtfUH/662LjenusV4YAFksvR993TOS VdcJahFujJxAxBWdmilS2NUlGlSzNO5LdXqsVedJexDrlGodIHQjg+0J+ auZnZa3PK8lkSUnvEx1RKBriz2zdDJHxShZP8RjRSx9IxrgqSf9AnOycg 5lxHpwvqZOSibaa/83Al2rLPqrcRphb+jSP4XTyLcRuQn3dwsooc/DFrk w==; X-CSE-ConnectionGUID: I5jaqsLnSAqRjm7dog+veg== X-CSE-MsgGUID: QYaAYf6mTn+TIXtyxREEUQ== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19659953" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19659953" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 23:43:24 -0700 X-CSE-ConnectionGUID: l2dhBQ8GRZ2UN4QvOcGYJg== X-CSE-MsgGUID: Jv+QNeDzQ2mcIPgqa1ZLMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="28071914" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa004.jf.intel.com with ESMTP; 18 Apr 2024 23:43:22 -0700 From: Zhao Liu To: Thomas Huth , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 5/6] target/s390x/cpu_models: Make kvm_s390_apply_cpu_model() return boolean Date: Fri, 19 Apr 2024 14:57:11 +0800 Message-Id: <20240419065712.1225038-6-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> References: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.067, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu As error.h suggested, the best practice for callee is to return something to indicate success / failure. So make kvm_s390_apply_cpu_model() return boolean and check the returned boolean in apply_cpu_model() instead of accessing @err. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- target/s390x/cpu_models.h | 5 +++-- target/s390x/cpu_models_sysemu.c | 3 +-- target/s390x/kvm/kvm.c | 15 ++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h index 5041c1e10fed..1be94294319d 100644 --- a/target/s390x/cpu_models.h +++ b/target/s390x/cpu_models.h @@ -117,16 +117,17 @@ S390CPUDef const *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga, #ifdef CONFIG_KVM bool kvm_s390_cpu_models_supported(void); bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp); -void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp); +bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp); #else static inline bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) { return true; } -static inline void kvm_s390_apply_cpu_model(const S390CPUModel *model, +static inline bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) { + return true; } static inline bool kvm_s390_cpu_models_supported(void) { diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c index 2d99218069cb..bf855c659d5e 100644 --- a/target/s390x/cpu_models_sysemu.c +++ b/target/s390x/cpu_models_sysemu.c @@ -405,8 +405,7 @@ void apply_cpu_model(const S390CPUModel *model, Error **errp) } if (kvm_enabled()) { - kvm_s390_apply_cpu_model(model, &err); - if (err) { + if (!kvm_s390_apply_cpu_model(model, &err)) { error_propagate(errp, err); return; } diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 57937b4ddbef..6334fb84141b 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -2543,7 +2543,7 @@ static void kvm_s390_configure_apie(bool interpret) } } -void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) +bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) { struct kvm_s390_vm_cpu_processor prop = { .fac_list = { 0 }, @@ -2560,11 +2560,11 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) if (kvm_s390_cmma_available()) { kvm_s390_enable_cmma(); } - return; + return true; } if (!kvm_s390_cpu_models_supported()) { error_setg(errp, "KVM doesn't support CPU models"); - return; + return false; } prop.cpuid = s390_cpuid_from_cpu_model(model); prop.ibc = s390_ibc_from_cpu_model(model); @@ -2574,19 +2574,19 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); if (rc) { error_setg(errp, "KVM: Error configuring the CPU model: %d", rc); - return; + return false; } /* configure cpu features indicated e.g. via SCLP */ rc = configure_cpu_feat(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU features: %d", rc); - return; + return false; } /* configure cpu subfunctions indicated via query / test bit */ rc = configure_cpu_subfunc(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU subfunctions: %d", rc); - return; + return false; } /* enable CMM via CMMA */ if (test_bit(S390_FEAT_CMM, model->features)) { @@ -2601,8 +2601,9 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) rc = configure_uv_feat_guest(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU UV features %d", rc); - return; + return false; } + return true; } void kvm_s390_restart_interrupt(S390CPU *cpu) From patchwork Fri Apr 19 06:57:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1925411 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gYHtscWr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLQ9j6Qbsz1yP2 for ; Fri, 19 Apr 2024 16:44:41 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxhyH-0007tS-TR; Fri, 19 Apr 2024 02:43:41 -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 1rxhy6-0007ov-7v; Fri, 19 Apr 2024 02:43:31 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxhy4-0001CX-L9; Fri, 19 Apr 2024 02:43:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713509008; x=1745045008; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QW0U6rqEdHhhrUN6J4GUhhbNLR4rcAUCgpYyl5CCOUg=; b=gYHtscWrXwtPsmRzhGd4kG+Y8Ha2X4SstYd/iU06D8CmlW+Ya57KK2TD eg27vY++KSAO55p7bSwfA4ldu97mXkUh/REA60QsPPXe2IOfLzuIi/lML jMV4vsjp4Afa13eJNyUCyCkKGVE1bgi1rkZvumkJdm3HJIiimrr75IjYC V7jVvy38eS1SxRJLZe+C4pivaZFwFKndkD07UJqJDaS9tnFRyBmdIAkaX lddsdqabr1e/LlE46W2buIvlSqVJonzfzRFsCKrnXIMAJ8XI2uiv6HNhl ttIsWzdK8zaqF85F2eSztV58GprpLlnxSMl/9NX/EV1JCywCod4XafoOZ g==; X-CSE-ConnectionGUID: jq94hL5bT920tJDdBRd1hg== X-CSE-MsgGUID: noKV8yJbTCGXUlO0TY2Htw== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19659959" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19659959" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 23:43:27 -0700 X-CSE-ConnectionGUID: DWmkPqKvR1eDdtP7gcRgIg== X-CSE-MsgGUID: cokQpEhZSsWGHwmJ33GhqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="28071927" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa004.jf.intel.com with ESMTP; 18 Apr 2024 23:43:24 -0700 From: Zhao Liu To: Thomas Huth , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 6/6] target/s390x/cpu_models_sysemu: Drop local @err in apply_cpu_model() Date: Fri, 19 Apr 2024 14:57:12 +0800 Message-Id: <20240419065712.1225038-7-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> References: <20240419065712.1225038-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.067, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Use @errp to fetech error information directly and drop the local virable @err. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- target/s390x/cpu_models_sysemu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c index bf855c659d5e..15be729c3d48 100644 --- a/target/s390x/cpu_models_sysemu.c +++ b/target/s390x/cpu_models_sysemu.c @@ -389,7 +389,6 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa, void apply_cpu_model(const S390CPUModel *model, Error **errp) { - Error *err = NULL; static S390CPUModel applied_model; static bool applied; @@ -405,8 +404,7 @@ void apply_cpu_model(const S390CPUModel *model, Error **errp) } if (kvm_enabled()) { - if (!kvm_s390_apply_cpu_model(model, &err)) { - error_propagate(errp, err); + if (!kvm_s390_apply_cpu_model(model, errp)) { return; } }