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)" From patchwork Fri Mar 1 04:46:09 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: 10834469 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 0FD451390 for ; Fri, 1 Mar 2019 05:03:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F282E2F728 for ; Fri, 1 Mar 2019 05:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4A9A2F72E; Fri, 1 Mar 2019 05:03:36 +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 90A912F728 for ; Fri, 1 Mar 2019 05:03:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:50790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzaKd-0003Ee-Ql for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Mar 2019 00:03:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzaHs-0000yq-Q6 for qemu-devel@nongnu.org; Fri, 01 Mar 2019 00:00:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gza42-0004lT-LH for qemu-devel@nongnu.org; Thu, 28 Feb 2019 23:46:27 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:33601) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gza41-0004kj-Lj; Thu, 28 Feb 2019 23:46:25 -0500 Received: by mail-pl1-x632.google.com with SMTP id y10so10885794plp.0; Thu, 28 Feb 2019 20:46:25 -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=3/Lanh6/bbKiAjHXi0VYhsYPbH29pYzMJlyWiU3lxIs=; b=KckkvGJshhOn9LpWH/RBCmnQJhwh1G5PiQ/EC+ux8nBeIzbzFMOqoTzKOJxWkvI0TV mtyO7dDKsKFPBjhhYE20YKHdzdLqQTd0nwyaogNZo2cckXqMjEoQhSdFMzWrlJRFj4eW bFxIi4hHlCY4VQPL2mRgY3UeeXau9yTCigM49lIF6zIG+VWFTnCogy+I1Bal+61ZU4qi 436xivMMLnRrnunXXeTYro1JsRpdZCbnx0VgonP/8F/iRs0LvfXE1jDdi75ANsCvP0h9 0EmjxDfhPWazYyoQP6NiQbN8Df5WG3dAl2WXoFQOsUOGouWUJJqJBit3g6ioMrQlt0xF R5pg== 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=3/Lanh6/bbKiAjHXi0VYhsYPbH29pYzMJlyWiU3lxIs=; b=UJfR9hTcub2VK/vEmsz+wG++V/Yqf386tDfR3RuMWRBUrCWxUdncLwQ3Ucs9iNJAtv 3EdgIijbpfyAcGkS3cytKAZ2j6hL4VSmJZeXKKizYxgkf2gpvKshkXfUrwu61KaXsOef Plf62B1mOs3VKoRTmByBBNJDQi9rhpbx5y4PGgNhH/kwXjl9y8yfzpwVXNKabyWpOIHN l7qjJA1CPyVB8jjNfuPQ6u2wIUmS/zQqf8XczVVWrqNCME+pxs5kg5oOnpQbVGz6VJ3a TI1Xpv7XD4hKxX8EQ9/+okSBQ5YSmrxg6AE4D8c7mJSdd7N1LovbW8xda8l87r5mo908 aqRg== X-Gm-Message-State: APjAAAWCDFMsLFZZJph9PepMtrr8+Igjw7NWNWAqBh5ons26F0RDk5Iv SfRu1iSLOHnNzFu1NnkNUXcZlNn+ X-Google-Smtp-Source: APXvYqyh50LAnkc/haDABfc7dei+lyZi69CvUL8uZMItcinv+UTgmy8fPNzZ8sVi8HhUT5saufrARg== X-Received: by 2002:a17:902:8e82:: with SMTP id bg2mr3395940plb.217.1551415584522; Thu, 28 Feb 2019 20:46:24 -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.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 20:46:23 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Fri, 1 Mar 2019 15:46:09 +1100 Message-Id: <20190301044609.9626-3-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::632 Subject: [Qemu-devel] [QEMU-PPC] [PATCH 2/2] target/ppc/spapr: Enable mitigations by default for pseries-4.0 machine type 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 There are currently 3 mitigations the availability of which is controlled by the spapr-caps mechanism, cap-cfpc, cap-sbbc, and cap-ibs. Enable these mitigations by default for the pseries-4.0 machine type. By now machine firmware should have been upgraded to allow these settings. Signed-off-by: Suraj Jitindar Singh --- hw/ppc/spapr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 708e18dcdf..b103d2677e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4314,9 +4314,9 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_OFF; smc->default_caps.caps[SPAPR_CAP_VSX] = SPAPR_CAP_ON; 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_CFPC] = SPAPR_CAP_WORKAROUND; + smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND; + smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_WORKAROUND; smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 16; /* 64kiB */ smc->default_caps.caps[SPAPR_CAP_NESTED_KVM_HV] = SPAPR_CAP_OFF; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = SPAPR_CAP_ON; @@ -4396,6 +4396,9 @@ static void spapr_machine_3_1_class_options(MachineClass *mc) mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0"); smc->update_dt_enabled = false; smc->dr_phb_enabled = false; + 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_LARGE_DECREMENTER] = SPAPR_CAP_OFF; }