From nobody Mon Feb 9 18:45:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552207025424588.4130292074647; Sun, 10 Mar 2019 00:37:05 -0800 (PST) Received: from localhost ([127.0.0.1]:41824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2tx8-00005w-56 for importer@patchew.org; Sun, 10 Mar 2019 04:37:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2tnw-0000m1-EI for qemu-devel@nongnu.org; Sun, 10 Mar 2019 04:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2tns-0001AR-PN for qemu-devel@nongnu.org; Sun, 10 Mar 2019 04:27:30 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:60091) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2tnr-00017D-Dx; Sun, 10 Mar 2019 04:27:28 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44HDql42nwz9sN4; Sun, 10 Mar 2019 19:27:14 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1552206435; bh=iJozMpEc0yHCgcikXlcyQ88gqojejIc7pjmmWRyrQu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvNYss15BL6TEnNnV+1sR0NiwEGnFhe7FBM5IlAwcEtMdmKWSmAFZM5kbbo9d5ObV PqkCoQRP11slw82lP9WBiQ81AGu8URWkF1yY/WRiKg+Fnd2/8UTVdKtYeHBbXlSrox pWdRUEcDYgRVcJWc+l0g/jEGbPv+VDANe5WLJXRI= From: David Gibson To: peter.maydell@linaro.org Date: Sun, 10 Mar 2019 19:26:14 +1100 Message-Id: <20190310082703.1245-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190310082703.1245-1-david@gibson.dropbear.id.au> References: <20190310082703.1245-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 11/60] 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: lvivier@redhat.com, groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh 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 Message-Id: <20190301044609.9626-2-sjitindarsingh@gmail.com> Signed-off-by: David Gibson --- 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 =3D { static void cap_safe_cache_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp) { + Error *local_err =3D NULL; uint8_t kvm_val =3D kvmppc_get_cap_safe_cache(); =20 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 differe= nt value for cap-cfpc"); + /* TCG only supports broken, allow other values and print a warnin= g */ + error_setg(&local_err, + "TCG doesn't support requested feature, cap-cfpc=3D%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= =3D%s", cap_cfpc_possible.vals[kvm_val]); } + + if (local_err !=3D NULL) + warn_report_err(local_err); } =20 sPAPRCapPossible cap_sbbc_possible =3D { @@ -262,17 +267,22 @@ sPAPRCapPossible cap_sbbc_possible =3D { static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t = val, Error **errp) { + Error *local_err =3D NULL; uint8_t kvm_val =3D kvmppc_get_cap_safe_bounds_check(); =20 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 warnin= g */ + error_setg(&local_err, + "TCG doesn't support requested feature, cap-sbbc=3D%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 ca= p-sbbc=3D%s", cap_sbbc_possible.vals[kvm_val]); } + + if (local_err !=3D NULL) + warn_report_err(local_err); } =20 sPAPRCapPossible cap_ibs_possible =3D { @@ -288,17 +298,22 @@ sPAPRCapPossible cap_ibs_possible =3D { static void cap_safe_indirect_branch_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp) { + Error *local_err =3D NULL; uint8_t kvm_val =3D kvmppc_get_cap_safe_indirect_branch(); =20 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 warnin= g */ + error_setg(&local_err, + "TCG doesn't support requested feature, cap-ibs=3D%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=3D%s", cap_ibs_possible.vals[kvm_val]); } + + if (local_err !=3D NULL) + warn_report_err(local_err); } =20 #define VALUE_DESC_TRISTATE " (broken, workaround, fixed)" --=20 2.20.1