From patchwork Thu Feb 15 00:44:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 10220171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F059A60467 for ; Thu, 15 Feb 2018 00:46:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC81B2897A for ; Thu, 15 Feb 2018 00:46:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFB1328A48; Thu, 15 Feb 2018 00:46:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5707F2891A for ; Thu, 15 Feb 2018 00:46:52 +0000 (UTC) Received: from localhost ([::1]:48994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em7hK-0004iW-0v for patchwork-qemu-devel@patchwork.kernel.org; Wed, 14 Feb 2018 19:46:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em7fm-0003WL-La for qemu-devel@nongnu.org; Wed, 14 Feb 2018 19:45:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1em7fl-0005Qh-M0 for qemu-devel@nongnu.org; Wed, 14 Feb 2018 19:45:14 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:46961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1em7fj-0005Ng-6z; Wed, 14 Feb 2018 19:45:11 -0500 Received: by mail-pg0-x242.google.com with SMTP id a11so2930686pgu.13; Wed, 14 Feb 2018 16:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Xq+B74gcKfUo8FeD4xT7AOE+/oNlXKSzsesa0e4TFW0=; b=L03tjjTQLwSQyxxne6hFa6tHY0qa9jJYoj91vfnxS6J6Fwj44gnT5nZLcEwEFf7zOU b1/0VR8v98f4NZ+M65mlSXJYJI5hUZ9lAnvGMtoYeeM5R2sadZzTktNccqSfRqPP5x3c aWv54ulxpaGFyUpzBoIVfGOyCAHc9bDKrE66itOFT48cCr1trvzec1eH6jEYSWZLFe3d jolVO+dwduT+mTr5F9wKYEG+bIyeLJIiHgyBaorNb8r6CdSM2SGsKKqoP79kIjoVGBT+ AmQc44t8eEck29Ljj2J2O1hBdv+JCelulvLSCTCfU+4+73+58TwVMZ8sYpJKnamEODQ+ rS9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Xq+B74gcKfUo8FeD4xT7AOE+/oNlXKSzsesa0e4TFW0=; b=dHHxquAgULX+hBfekl/xfH7klUUJMjpaIeUFwUL9W4GCLGf8NoGvD6G9G8sInYPk+a oiXcu+KxgZO9eFIoFuTlLg6qjaYGh3+wO8ZN0/ogLMOe+28sH8q+vZzXnSCzDVQ5z6Ti EQb2hn7VamPQu5zBf/eYJe6PcjNyuHnB/XUUJ91E0s6FcilijwRKlZzSqlyBFQcNsXF2 23RUVC6jeu0IulNKdHo5SkDgaqib7oUDbE22RWveCei0sZMKBzRr6keuRG2ocrwKx/ZI SwqTQ+VKWgSNVi/OkasDuPgDI7ZjbncXdHnvVG32wM7EiAsKSTQMW0sQqXsYcqKj9gpO ukjQ== X-Gm-Message-State: APf1xPB/bReSHxXuGK35cL6CYM+IZeM60bCd0v9+FnP9d9Fp5ZyRG/Vx e7OxTz3uYA58UGJWxyt9xZC9GdbL X-Google-Smtp-Source: AH8x2255QYEOfebegmYabgShDrgKB1BFRc7IUdG0PmYmEP1Mkl+gzdWeITYjq0h7dE851huFu82FrA== X-Received: by 10.99.49.84 with SMTP id x81mr663042pgx.371.1518655510113; Wed, 14 Feb 2018 16:45:10 -0800 (PST) Received: from surajjs1.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id u85sm12226660pfi.80.2018.02.14.16.45.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 16:45:09 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Thu, 15 Feb 2018 11:44:42 +1100 Message-Id: <20180215004443.18013-2-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180215004443.18013-1-sjitindarsingh@gmail.com> References: <20180215004443.18013-1-sjitindarsingh@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [QEMU-PPC] [PATCH V3 2/3] ppc/spapr-caps: Convert spapr-cap-ibs to be a boolean 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: aik@ozlabs.ru, qemu-devel@nongnu.org, Suraj Jitindar Singh , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The spapr-cap cap-ibs can only have values broken or fixed as there is no workaround. Currently setting the value workaround will hit an assert if the guest makes the hcall h_get_cpu_characteristics. Thus this capability is better suited to being represented as a boolean. Setting this to OFF corresponds to the old BROKEN, that is no indirect branch serialisation. Setting this to ON corresponds to the old FIXED, that is indirect branches are serialised. Reported-by: Satheesh Rajendran Signed-off-by: Suraj Jitindar Singh --- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_caps.c | 12 ++++++------ target/ppc/kvm.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 32a876be56..969db6cde2 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3886,7 +3886,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) smc->default_caps.caps[SPAPR_CAP_DFP] = SPAPR_CAP_ON; smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN; smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN; - smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN; + smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_OFF; spapr_caps_add_properties(smc, &error_abort); } diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index e69d308560..05997b0842 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -207,9 +207,9 @@ static void cap_safe_indirect_branch_apply(sPAPRMachineState *spapr, { if (tcg_enabled() && val) { /* TODO - for now only allow broken for TCG */ - error_setg(errp, "Requested safe indirect branch capability level not supported by tcg, try a different value for cap-ibs"); + error_setg(errp, "Indirect Branch Serialisation support not available, try cap-ibs=off"); } else if (kvm_enabled() && (val > kvmppc_get_cap_safe_indirect_branch())) { - error_setg(errp, "Requested safe indirect branch capability level not supported by kvm, try a different value for cap-ibs"); + error_setg(errp, "Indirect Branch Serialisation support not available, try cap-ibs=off"); } } @@ -263,11 +263,11 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { }, [SPAPR_CAP_IBS] = { .name = "ibs", - .description = "Indirect Branch Serialisation" VALUE_DESC_TRISTATE, + .description = "Indirect Branch Serialisation", .index = SPAPR_CAP_IBS, - .get = spapr_cap_get_tristate, - .set = spapr_cap_set_tristate, - .type = "string", + .get = spapr_cap_get_bool, + .set = spapr_cap_set_bool, + .type = "bool", .apply = cap_safe_indirect_branch_apply, }, }; diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 9842b3bb12..3e3e5f9c1f 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2495,7 +2495,7 @@ static void kvmppc_get_cpu_characteristics(KVMState *s) } /* Parse and set cap_ppc_safe_indirect_branch */ if (c.character & H_CPU_CHAR_BCCTRL_SERIALISED) { - cap_ppc_safe_indirect_branch = 2; + cap_ppc_safe_indirect_branch = 1; } }