From nobody Thu Dec 18 08:28:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517947293673147.13491343334647; Tue, 6 Feb 2018 12:01:33 -0800 (PST) Received: from localhost ([::1]:53831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9Qm-0003Xg-Lx for importer@patchew.org; Tue, 06 Feb 2018 15:01:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej8j9-0005lA-Hl for qemu-devel@nongnu.org; Tue, 06 Feb 2018 14:16:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej8iz-0008GZ-Ac for qemu-devel@nongnu.org; Tue, 06 Feb 2018 14:16:23 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48526) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej8iy-0008FR-Ty for qemu-devel@nongnu.org; Tue, 06 Feb 2018 14:16:13 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w16JFLd1057807 for ; Tue, 6 Feb 2018 14:16:12 -0500 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fyg4xphj0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 06 Feb 2018 14:16:11 -0500 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Feb 2018 14:16:10 -0500 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 6 Feb 2018 14:16:08 -0500 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w16JG7fk42860740; Tue, 6 Feb 2018 19:16:07 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48783AC043; Tue, 6 Feb 2018 14:17:28 -0500 (EST) Received: from localhost (unknown [9.80.97.150]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 0C6BBAC03A; Tue, 6 Feb 2018 14:17:27 -0500 (EST) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 13:15:12 -0600 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180206191515.25830-1-mdroth@linux.vnet.ibm.com> References: <20180206191515.25830-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18020619-0048-0000-0000-000002332F5B X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008485; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000248; SDB=6.00985886; UDB=6.00500282; IPR=6.00765252; BA=6.00005813; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019407; XFM=3.00000015; UTC=2018-02-06 19:16:09 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18020619-0049-0000-0000-00004409E79E Message-Id: <20180206191515.25830-52-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-06_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802060241 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 51/54] target/ppc/spapr_caps: Add new tristate cap safe_cache 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: David Gibson , qemu-stable@nongnu.org, christian.ehrhardt@canonical.com, Suraj Jitindar Singh Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh Add new tristate cap cap-cfpc to represent the cache flush on privilege change capability. Signed-off-by: Suraj Jitindar Singh Reviewed-by: David Gibson Signed-off-by: David Gibson (cherry picked from commit 8f38eaf8f9dd194c9961cf76c675724930ce4570) Signed-off-by: Michael Roth --- hw/ppc/spapr.c | 2 ++ hw/ppc/spapr_caps.c | 36 ++++++++++++++++++++++++++---------- include/hw/ppc/spapr.h | 5 ++++- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6ab39a0e61..37a414ffe6 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1765,6 +1765,7 @@ static const VMStateDescription vmstate_spapr =3D { &vmstate_spapr_cap_htm, &vmstate_spapr_cap_vsx, &vmstate_spapr_cap_dfp, + &vmstate_spapr_cap_cfpc, NULL } }; @@ -3709,6 +3710,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) smc->default_caps.caps[SPAPR_CAP_HTM] =3D SPAPR_CAP_OFF; smc->default_caps.caps[SPAPR_CAP_VSX] =3D SPAPR_CAP_ON; smc->default_caps.caps[SPAPR_CAP_DFP] =3D SPAPR_CAP_ON; + smc->default_caps.caps[SPAPR_CAP_CFPC] =3D SPAPR_CAP_BROKEN; spapr_caps_add_properties(smc, &error_abort); } =20 diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 3a195c8fef..183916895c 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -74,11 +74,8 @@ static void spapr_cap_set_bool(Object *obj, Visitor *v, = const char *name, spapr->eff.caps[cap->index] =3D value ? SPAPR_CAP_ON : SPAPR_CAP_OFF; } =20 -static void __attribute__ ((unused)) spapr_cap_get_tristate(Object *obj, - Visitor *v, - const char *na= me, - void *opaque, - Error **errp) +static void spapr_cap_get_tristate(Object *obj, Visitor *v, const char *na= me, + void *opaque, Error **errp) { sPAPRCapabilityInfo *cap =3D opaque; sPAPRMachineState *spapr =3D SPAPR_MACHINE(obj); @@ -104,11 +101,8 @@ static void __attribute__ ((unused)) spapr_cap_get_tri= state(Object *obj, g_free(val); } =20 -static void __attribute__ ((unused)) spapr_cap_set_tristate(Object *obj, - Visitor *v, - const char *na= me, - void *opaque, - Error **errp) +static void spapr_cap_set_tristate(Object *obj, Visitor *v, const char *na= me, + void *opaque, Error **errp) { sPAPRCapabilityInfo *cap =3D opaque; sPAPRMachineState *spapr =3D SPAPR_MACHINE(obj); @@ -187,6 +181,18 @@ static void cap_dfp_apply(sPAPRMachineState *spapr, ui= nt8_t val, Error **errp) } } =20 +static void cap_safe_cache_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 cache capability level not suppor= ted by tcg, try a different value for cap-cfpc"); + } else if (kvm_enabled() && (val > kvmppc_get_cap_safe_cache())) { + error_setg(errp, "Requested safe cache capability level not suppor= ted by kvm, try a different value for cap-cfpc"); + } +} + +#define VALUE_DESC_TRISTATE " (broken, workaround, fixed)" =20 sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D { [SPAPR_CAP_HTM] =3D { @@ -219,6 +225,15 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = =3D { .type =3D "bool", .apply =3D cap_dfp_apply, }, + [SPAPR_CAP_CFPC] =3D { + .name =3D "cfpc", + .description =3D "Cache Flush on Privilege Change" VALUE_DESC_TRIS= TATE, + .index =3D SPAPR_CAP_CFPC, + .get =3D spapr_cap_get_tristate, + .set =3D spapr_cap_set_tristate, + .type =3D "string", + .apply =3D cap_safe_cache_apply, + }, }; =20 static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, @@ -324,6 +339,7 @@ const VMStateDescription vmstate_spapr_cap_##cap =3D { = \ SPAPR_CAP_MIG_STATE(htm, HTM); SPAPR_CAP_MIG_STATE(vsx, VSX); SPAPR_CAP_MIG_STATE(dfp, DFP); +SPAPR_CAP_MIG_STATE(cfpc, CFPC); =20 void spapr_caps_reset(sPAPRMachineState *spapr) { diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 5d78024433..fdb80f2118 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -60,8 +60,10 @@ typedef enum { #define SPAPR_CAP_VSX 0x01 /* Decimal Floating Point */ #define SPAPR_CAP_DFP 0x02 +/* Cache Flush on Privilege Change */ +#define SPAPR_CAP_CFPC 0x03 /* Num Caps */ -#define SPAPR_CAP_NUM (SPAPR_CAP_DFP + 1) +#define SPAPR_CAP_NUM (SPAPR_CAP_CFPC + 1) =20 /* * Capability Values @@ -761,6 +763,7 @@ int spapr_caps_pre_save(void *opaque); extern const VMStateDescription vmstate_spapr_cap_htm; extern const VMStateDescription vmstate_spapr_cap_vsx; extern const VMStateDescription vmstate_spapr_cap_dfp; +extern const VMStateDescription vmstate_spapr_cap_cfpc; =20 static inline uint8_t spapr_get_cap(sPAPRMachineState *spapr, int cap) { --=20 2.11.0