From patchwork Fri Jan 19 05:00:04 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: 10174551 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 ED92860386 for ; Fri, 19 Jan 2018 05:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D21EC28505 for ; Fri, 19 Jan 2018 05:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C470D28533; Fri, 19 Jan 2018 05:10:34 +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 30D5A28505 for ; Fri, 19 Jan 2018 05:10:34 +0000 (UTC) Received: from localhost ([::1]:52666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOwj-0007rW-CZ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Jan 2018 00:10:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOn9-0007Zw-QL for qemu-devel@nongnu.org; Fri, 19 Jan 2018 00:00:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOn8-0004sy-PL for qemu-devel@nongnu.org; Fri, 19 Jan 2018 00:00:39 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:43352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOn6-0004ry-8q; Fri, 19 Jan 2018 00:00:36 -0500 Received: by mail-pg0-x243.google.com with SMTP id n17so551187pgf.10; Thu, 18 Jan 2018 21:00:36 -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=Cl9RYPccYnb2JBejPYt/sm0mT5m438pGlb48VHPljnk=; b=XjmepsnLDaTP/EtBF2bL8/UDWrL1DGt2Yplap9Px7aE4WYjTWAhRLylmzbwo47Yq4n hX2XS5WHf9iSD3hZPmPmfI+Az+5cf7fMOVLjWk243wdAGUNkaobS10MpoXYM+iOtGdlN Qbi15TwYqF4bS+TJm4zP9reyvSRAJr5e22xw/oEsOnGKZEKSVN5fkJAMRX8uNPYXKUe0 lD4LAziQtWPpG1xDkcGG00fItmEVRWn0PHqfaBl9r7ZaXCM2nqw93EwTc0q4FDQB1v6c AWmc1Io7crYvfvgC8a0nH0vTXp5mZM4dSfxjtnurr4U6wHFZHU7IbE7elGhnX4qfq78B LnHw== 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=Cl9RYPccYnb2JBejPYt/sm0mT5m438pGlb48VHPljnk=; b=tWiucfYqHY2xYPpO7+qWSbyUvYxAI1eZ6lfmW7esTVa+fkuegtZlj5ybAEf14f8cto vxtPWrTdfX9B1YwLt/X3vRycV2Heo0ej8CTg9IXf9JAw9EJo74t22/j3kR/RhuXQzazg 3ognj3QlWd1jTpLwHh0sT7KxEDUA6qUNwgnXdUy5f8s35HSkPypQqr4mklhsYlDas1nT Qol9q72m0MbYkO/Got6Lc8fwmFqil3/nSpKuhqabnoPj6XkCbmS1oPbY1LnknAS3GROy biYh/BPixS/7vC41CStuMbBgIlKOXqmJRI5iYoE88sU1mtAyEod1pA0Iya/HR5a+zxWX 23pQ== X-Gm-Message-State: AKwxytehZ+4WF3sb3ZVpVIy5R3taSscgt/wEqWKz7k3eZZLqUofofaer l19zof7Dx1HgiRVdcseRAugELkFM X-Google-Smtp-Source: ACJfBovIVjqbmpiBKJvFwZ0JWPOM/trbGAH2gW4lcUbLubTKDTn9LKglHFI+6ymsr4N02PnLU8vOow== X-Received: by 10.101.88.66 with SMTP id s2mr17520701pgr.341.1516338035173; Thu, 18 Jan 2018 21:00:35 -0800 (PST) Received: from surajjs1.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id i128sm14653163pfg.83.2018.01.18.21.00.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 21:00:34 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Fri, 19 Jan 2018 16:00:04 +1100 Message-Id: <20180119050005.29392-7-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180119050005.29392-1-sjitindarsingh@gmail.com> References: <20180119050005.29392-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::243 Subject: [Qemu-devel] [QEMU-PPC] [PATCH V5 6/7] target/ppc/spapr_caps: Add new tristate cap safe_indirect_branch 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: paulus@ozlabs.org, 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 Add new tristate cap cap-ibs to represent the indirect branch serialisation capability. Signed-off-by: Suraj Jitindar Singh Reviewed-by: David Gibson --- V4 -> V5: - Use macro to generate migration state --- hw/ppc/spapr.c | 2 ++ hw/ppc/spapr_caps.c | 21 +++++++++++++++++++++ include/hw/ppc/spapr.h | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4cbed31b16..5544eeb853 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1793,6 +1793,7 @@ static const VMStateDescription vmstate_spapr = { &vmstate_spapr_cap_dfp, &vmstate_spapr_cap_cfpc, &vmstate_spapr_cap_sbbc, + &vmstate_spapr_cap_ibs, NULL } }; @@ -3882,6 +3883,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; spapr_caps_add_properties(smc, &error_abort); } diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index ce1f74f26d..62efdaee38 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -202,6 +202,17 @@ static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t val, } } +static void cap_safe_indirect_branch_apply(sPAPRMachineState *spapr, + uint8_t val, Error **errp) +{ + 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"); + } 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"); + } +} + #define VALUE_DESC_TRISTATE " (broken, workaround, fixed)" sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { @@ -250,6 +261,15 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .type = "string", .apply = cap_safe_bounds_check_apply, }, + [SPAPR_CAP_IBS] = { + .name = "ibs", + .description = "Indirect Branch Serialisation" VALUE_DESC_TRISTATE, + .index = SPAPR_CAP_IBS, + .get = spapr_cap_get_tristate, + .set = spapr_cap_set_tristate, + .type = "string", + .apply = cap_safe_indirect_branch_apply, + }, }; static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, @@ -357,6 +377,7 @@ SPAPR_CAP_MIG_STATE(vsx, VSX); SPAPR_CAP_MIG_STATE(dfp, DFP); SPAPR_CAP_MIG_STATE(cfpc, CFPC); SPAPR_CAP_MIG_STATE(sbbc, SBBC); +SPAPR_CAP_MIG_STATE(ibs, IBS); void spapr_caps_reset(sPAPRMachineState *spapr) { diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index c65be62e92..549d7a4134 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -64,8 +64,10 @@ typedef enum { #define SPAPR_CAP_CFPC 0x03 /* Speculation Barrier Bounds Checking */ #define SPAPR_CAP_SBBC 0x04 +/* Indirect Branch Serialisation */ +#define SPAPR_CAP_IBS 0x05 /* Num Caps */ -#define SPAPR_CAP_NUM (SPAPR_CAP_SBBC + 1) +#define SPAPR_CAP_NUM (SPAPR_CAP_IBS + 1) /* * Capability Values @@ -785,6 +787,7 @@ extern const VMStateDescription vmstate_spapr_cap_vsx; extern const VMStateDescription vmstate_spapr_cap_dfp; extern const VMStateDescription vmstate_spapr_cap_cfpc; extern const VMStateDescription vmstate_spapr_cap_sbbc; +extern const VMStateDescription vmstate_spapr_cap_ibs; static inline uint8_t spapr_get_cap(sPAPRMachineState *spapr, int cap) {