From patchwork Fri Mar 1 04:46:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 10834459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99A501390 for ; Fri, 1 Mar 2019 05:01:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FEC12F728 for ; Fri, 1 Mar 2019 05:01:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72BCC2F72A; Fri, 1 Mar 2019 05:01:37 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ED0C12F728 for ; Fri, 1 Mar 2019 05:01:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:50778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzaIh-0001sz-H6 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Mar 2019 00:01:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzaHQ-0000yq-OQ for qemu-devel@nongnu.org; Fri, 01 Mar 2019 00:00:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gza40-0004kG-2L for qemu-devel@nongnu.org; Thu, 28 Feb 2019 23:46:24 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:35422) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gza3y-0004ja-Tp; Thu, 28 Feb 2019 23:46:23 -0500 Received: by mail-pl1-x642.google.com with SMTP id p19so10862632plo.2; Thu, 28 Feb 2019 20:46:22 -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=928razDsvEkoTwqHvUmbipbk8bZkAaKdfCbJ1DfQay0=; b=Iy8xKf6rKtMnqpvBtap5fwS0C0xpyO3grUxxXO/vmUEUBdLWo6V6RWplwxvCLjF/rT RwD5Hfy350C1kXtrH6XbmojxE5pq0Qa0uavev4OmHNIm4x2rckiEW9aDOsMFs8ZaHrjn uL+G2zgLTX1ZW3bGMzWtMylEXPGZzxp29Q7yPSkryTpAaOXD9gAFe8ySDEYEVNgSeN7k iSqQKJk3AHCAtn1fB9JpVpRkHexbj6nK+phLi/fGIS9bDwo2ucu55oRSnWq0A/yzNpR9 qgL23CzciCGjbHqv4gmWgOHty+NOae/pRwMKzJMIYUVrUUL3DgoTBin76Ku+ICCMlAoG FyxQ== 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=928razDsvEkoTwqHvUmbipbk8bZkAaKdfCbJ1DfQay0=; b=lsM9nOd/Vd6tI74NdZHnSZhJcmIgPjkeiKKk84Osr8uw7I/xCBUq0u86PtlcTmqZR2 dANhfYMDusszUcYepmHDAM1OgrlRTwAaF9fweIEAK+tWsEhaxhj+srYGG12yUsI06NTD iNgnwFrXgtTkqZOY7B4Dx40Em+dw+ud43NukG8BuX0uoBIV72GyRGLpgWDudsTr0G1KA +vtHQ+EmhiDUHQeNjuPR3RG7DbiuxDQn/GwRZ6W4d0bLmUuykEQv5IZgQtWLMy6Ue3Fg Wz/Cch3+Qr9zXKOn2sAR/idnoBDvUUMPPR1SIj/OLKA1Z4/U9wxFoZrFPHrHR3YFnSPx 7W+g== X-Gm-Message-State: APjAAAVs/mya8cXSGVMtRJuRoDiJvxCYqplD/WaBqXatouRVYmI5kAgz h/OtjlWbqAACKdzWKKpcFFJoG2/X X-Google-Smtp-Source: APXvYqxAJ0RzcedFexuPPMz6sHLIFHEhd+FPm2SGrmryzt97HRsR2pLNhS4drHvtHQ1i/vlF6Oy/+g== X-Received: by 2002:a17:902:8303:: with SMTP id bd3mr3502878plb.10.1551415581756; Thu, 28 Feb 2019 20:46:21 -0800 (PST) Received: from surajjs2.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id f65sm18804266pff.21.2019.02.28.20.46.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 20:46:21 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Fri, 1 Mar 2019 15:46:08 +1100 Message-Id: <20190301044609.9626-2-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190301044609.9626-1-sjitindarsingh@gmail.com> References: <20190301044609.9626-1-sjitindarsingh@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [QEMU-PPC] [PATCH 1/2] target/ppc/tcg: make spapr_caps apply cap-[cfpc/sbbc/ibs] non-fatal for tcg 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: 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_caps cap-cfpc, cap-sbbc and cap-ibs are used to control the availability of certain mitigations to the guest. These haven't been implemented under TCG, it is unlikely they ever will be, and it is unclear as to whether they even need to be. As such, make failure to apply these capabilities under TCG non-fatal. Instead we print a warning message to the user but still allow the guest to continue. Signed-off-by: Suraj Jitindar Singh --- hw/ppc/spapr_caps.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index f03f2f64e7..b68d767d63 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -239,17 +239,22 @@ sPAPRCapPossible cap_cfpc_possible = { static void cap_safe_cache_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp) { + Error *local_err = NULL; uint8_t kvm_val = kvmppc_get_cap_safe_cache(); if (tcg_enabled() && val) { - /* TODO - for now only allow broken for TCG */ - error_setg(errp, -"Requested safe cache capability level not supported by tcg, try a different value for cap-cfpc"); + /* TCG only supports broken, allow other values and print a warning */ + error_setg(&local_err, + "TCG doesn't support requested feature, cap-cfpc=%s", + cap_cfpc_possible.vals[val]); } else if (kvm_enabled() && (val > kvm_val)) { error_setg(errp, "Requested safe cache capability level not supported by kvm, try cap-cfpc=%s", cap_cfpc_possible.vals[kvm_val]); } + + if (local_err != NULL) + warn_report_err(local_err); } sPAPRCapPossible cap_sbbc_possible = { @@ -262,17 +267,22 @@ sPAPRCapPossible cap_sbbc_possible = { static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp) { + Error *local_err = NULL; uint8_t kvm_val = 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"); + /* TCG only supports broken, allow other values and print a warning */ + error_setg(&local_err, + "TCG doesn't support requested feature, cap-sbbc=%s", + cap_sbbc_possible.vals[val]); } else if (kvm_enabled() && (val > kvm_val)) { error_setg(errp, "Requested safe bounds check capability level not supported by kvm, try cap-sbbc=%s", cap_sbbc_possible.vals[kvm_val]); } + + if (local_err != NULL) + warn_report_err(local_err); } sPAPRCapPossible cap_ibs_possible = { @@ -288,17 +298,22 @@ sPAPRCapPossible cap_ibs_possible = { static void cap_safe_indirect_branch_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp) { + Error *local_err = NULL; uint8_t kvm_val = kvmppc_get_cap_safe_indirect_branch(); 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"); + /* TCG only supports broken, allow other values and print a warning */ + error_setg(&local_err, + "TCG doesn't support requested feature, cap-ibs=%s", + cap_ibs_possible.vals[val]); } else if (kvm_enabled() && (val > kvm_val)) { error_setg(errp, "Requested safe indirect branch capability level not supported by kvm, try cap-ibs=%s", cap_ibs_possible.vals[kvm_val]); } + + if (local_err != NULL) + warn_report_err(local_err); } #define VALUE_DESC_TRISTATE " (broken, workaround, fixed)"