From nobody Tue Feb 10 02:27:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519971696246420.23142059107886; Thu, 1 Mar 2018 22:21:36 -0800 (PST) Received: from localhost ([::1]:32840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ere4V-0006Oz-84 for importer@patchew.org; Fri, 02 Mar 2018 01:21:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erdnc-0000kI-St for qemu-devel@nongnu.org; Fri, 02 Mar 2018 01:04:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erdna-00045X-JR for qemu-devel@nongnu.org; Fri, 02 Mar 2018 01:04:08 -0500 Received: from ozlabs.org ([103.22.144.67]:51637) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erdna-00040J-13; Fri, 02 Mar 2018 01:04:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3zszJY6D1Mz9sWq; Fri, 2 Mar 2018 17:03:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1519970637; bh=qE5IPJLOaO3LZh2gKkqzesRDKptFFq7TlBQRumwf/5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z58TuIFBVGVL6UpqvLEYIZ4P/eymsCfJ4t+wpNHzRycP3jACfefqIK3bVub/+KU3d uo25ATqXjxBQ+hlwotavtMKwMjDqQzLwlYFMy47d9p5901iykOCFOR/TT0QUp17yGG S6ThWtPR5QuHPAePgRjx5Hf6xXp+FL4nsOzIV93U= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 2 Mar 2018 17:03:47 +1100 Message-Id: <20180302060350.24330-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180302060350.24330-1-david@gibson.dropbear.id.au> References: <20180302060350.24330-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 21/24] ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: surajjs@au1.ibm.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh Convert cap-sbbc (speculation barrier bounds checking) to a custom spapr-cap type. Signed-off-by: Suraj Jitindar Singh [dwg: Removed trailing whitespace] [dwg: Don't explicitly list "?"/help option, trust convention] Signed-off-by: David Gibson --- hw/ppc/spapr_caps.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 4a93a3b4de..f75d6ff211 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -267,14 +267,22 @@ static void cap_safe_cache_apply(sPAPRMachineState *s= papr, uint8_t val, } } =20 +sPAPRCapPossible cap_sbbc_possible =3D { + .num =3D 3, + .vals =3D {"broken", "workaround", "fixed"}, + .help =3D "broken - no protection, workaround - workaround available, = fixed - fixed in hardware", +}; + static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t = val, Error **errp) { + uint8_t kvm_val =3D kvmppc_get_cap_safe_bounds_check(); + if (tcg_enabled() && val) { /* TODO - for now only allow broken for TCG */ error_setg(errp, "Requested safe bounds check capability level not= supported by tcg, try a different value for cap-sbbc"); - } else if (kvm_enabled() && (val > kvmppc_get_cap_safe_bounds_check())= ) { - error_setg(errp, "Requested safe bounds check capability level not= supported by kvm, try a different value for cap-sbbc"); + } else if (kvm_enabled() && (val > kvm_val)) { + error_setg(errp, "Requested safe bounds check capability level not= supported by kvm, try cap-sbbc=3D%s", cap_sbbc_possible.vals[kvm_val]); } } =20 @@ -335,9 +343,10 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = =3D { .name =3D "sbbc", .description =3D "Speculation Barrier Bounds Checking" VALUE_DESC_= TRISTATE, .index =3D SPAPR_CAP_SBBC, - .get =3D spapr_cap_get_tristate, - .set =3D spapr_cap_set_tristate, + .get =3D spapr_cap_get_string, + .set =3D spapr_cap_set_string, .type =3D "string", + .possible =3D &cap_sbbc_possible, .apply =3D cap_safe_bounds_check_apply, }, [SPAPR_CAP_IBS] =3D { --=20 2.14.3