From nobody Sun May 5 01:45:30 2024 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 1504881548802851.1744662697458; Fri, 8 Sep 2017 07:39:08 -0700 (PDT) Received: from localhost ([::1]:45776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqKR1-0008Gb-J9 for importer@patchew.org; Fri, 08 Sep 2017 10:39:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqKMT-0004Gw-Ja for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqKMN-0001Lv-Gc for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:25 -0400 Received: from 15.mo4.mail-out.ovh.net ([91.121.62.11]:43875) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dqKMN-0001Ks-BH for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:19 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 1C8539564A for ; Fri, 8 Sep 2017 16:34:18 +0200 (CEST) Received: from zorba.kaod.org.com (i15-les03-th2-31-37-69-229.sfr.lns.abo.bbox.fr [31.37.69.229]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id B733E48009C; Fri, 8 Sep 2017 16:34:12 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Date: Fri, 8 Sep 2017 16:33:42 +0200 Message-Id: <20170908143344.12960-2-clg@kaod.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908143344.12960-1-clg@kaod.org> References: <20170908143344.12960-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12279627336593607507 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrfeeggdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 91.121.62.11 Subject: [Qemu-devel] [PATCH 1/3] ppc/xive: fix OV5_XIVE_EXPLOIT bits 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: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Roth , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" On POWER9, the Client Architecture Support (CAS) negotiation process determines whether the guest operates in XIVE Legacy compatibility or in XIVE exploitation mode. Now that we have initial guest support for the XIVE interrupt controller, let's fix the bits definition which have evolved in the latest specs. The platform advertises the XIVE Exploitation Mode support using the property "ibm,arch-vec-5-platform-support-vec-5", byte 23 bits 0-1 : - 0b00 XIVE legacy mode Only - 0b01 XIVE exploitation mode Only - 0b10 XIVE legacy or exploitation mode The OS asks for XIVE Exploitation Mode support using the property "ibm,architecture-vec-5", byte 23 bits 0-1: - 0b00 XIVE legacy mode Only - 0b01 XIVE exploitation mode Only Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr.c | 2 +- include/hw/ppc/spapr_ovec.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index cec441cbf48d..3e3ff1fbc988 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -914,7 +914,7 @@ static void spapr_dt_ov5_platform_support(void *fdt, in= t chosen) PowerPCCPU *first_ppc_cpu =3D POWERPC_CPU(first_cpu); =20 char val[2 * 4] =3D { - 23, 0x00, /* Xive mode: 0 =3D legacy (as in ISA 2.7), 1 =3D Exploi= tation */ + 23, 0x00, /* Xive mode, filled in below. */ 24, 0x00, /* Hash/Radix, filled in below. */ 25, 0x00, /* Hash options: Segment Tables =3D=3D no, GTSE =3D=3D n= o. */ 26, 0x40, /* Radix options: GTSE =3D=3D yes. */ diff --git a/include/hw/ppc/spapr_ovec.h b/include/hw/ppc/spapr_ovec.h index 9edfa5ff7530..bf25e5d954a1 100644 --- a/include/hw/ppc/spapr_ovec.h +++ b/include/hw/ppc/spapr_ovec.h @@ -51,7 +51,8 @@ typedef struct sPAPROptionVector sPAPROptionVector; #define OV5_FORM1_AFFINITY OV_BIT(5, 0) #define OV5_HP_EVT OV_BIT(6, 5) #define OV5_HPT_RESIZE OV_BIT(6, 7) -#define OV5_XIVE_EXPLOIT OV_BIT(23, 7) +#define OV5_XIVE_BOTH OV_BIT(23, 0) +#define OV5_XIVE_EXPLOIT OV_BIT(23, 1) /* 1=3Dexploitation 0=3Dlega= cy */ =20 /* ISA 3.00 MMU features: */ #define OV5_MMU_BOTH OV_BIT(24, 0) /* Radix and hash */ --=20 2.13.5 From nobody Sun May 5 01:45:30 2024 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 1504881475570213.70599089951077; Fri, 8 Sep 2017 07:37:55 -0700 (PDT) Received: from localhost ([::1]:45762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqKPq-0006t3-Cw for importer@patchew.org; Fri, 08 Sep 2017 10:37:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqKMY-0004Lw-LP for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqKMT-0001Pa-4y for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:30 -0400 Received: from 7.mo4.mail-out.ovh.net ([178.33.253.54]:52242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dqKMS-0001Ot-Uo for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:25 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 7F2CA958CE for ; Fri, 8 Sep 2017 16:34:23 +0200 (CEST) Received: from zorba.kaod.org.com (i15-les03-th2-31-37-69-229.sfr.lns.abo.bbox.fr [31.37.69.229]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id 2409448009C; Fri, 8 Sep 2017 16:34:18 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Date: Fri, 8 Sep 2017 16:33:43 +0200 Message-Id: <20170908143344.12960-3-clg@kaod.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908143344.12960-1-clg@kaod.org> References: <20170908143344.12960-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12281034712901258067 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrfeeggdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.253.54 Subject: [Qemu-devel] [PATCH 2/3] spapr: fix CAS-generated reset 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: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Roth , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The OV5_MMU_RADIX_300 requires special handling in the CAS negotiation process. It is cleared from the option vector of the guest before evaluating the changes and re-added later. But, when testing for a possible CAS reset : spapr->cas_reboot =3D spapr_ovec_diff(ov5_updates, ov5_cas_old, spapr->ov5_cas); the bit OV5_MMU_RADIX_300 will each time be seen as removed from the previous OV5 set, hence generating a reset loop. Fix this problem by also clearing the same bit in the ov5_cas_old set. Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr_hcall.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 07b3da8dc4cd..92f1e21358b8 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1575,6 +1575,13 @@ static target_ulong h_client_architecture_support(Po= werPCCPU *cpu, * to worry about this for now. */ ov5_cas_old =3D spapr_ovec_clone(spapr->ov5_cas); + + /* also clear the radix/hash bit from the current ov5_cas bits to + * be in sync with the newly ov5 bits. Else the radix bit will be + * seen as being removed and this will generate a reset loop + */ + spapr_ovec_clear(ov5_cas_old, OV5_MMU_RADIX_300); + /* full range of negotiated ov5 capabilities */ spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest); spapr_ovec_cleanup(ov5_guest); --=20 2.13.5 From nobody Sun May 5 01:45:30 2024 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 1504881623004792.7600130958406; Fri, 8 Sep 2017 07:40:23 -0700 (PDT) Received: from localhost ([::1]:45789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqKSE-0000oB-4d for importer@patchew.org; Fri, 08 Sep 2017 10:40:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqKMZ-0004Mh-I2 for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqKMY-0001SX-3u for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:31 -0400 Received: from 4.mo4.mail-out.ovh.net ([178.32.98.131]:43402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dqKMX-0001Rv-UX for qemu-devel@nongnu.org; Fri, 08 Sep 2017 10:34:30 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id E014693060 for ; Fri, 8 Sep 2017 16:34:28 +0200 (CEST) Received: from zorba.kaod.org.com (i15-les03-th2-31-37-69-229.sfr.lns.abo.bbox.fr [31.37.69.229]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id 8522948009C; Fri, 8 Sep 2017 16:34:23 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Date: Fri, 8 Sep 2017 16:33:44 +0200 Message-Id: <20170908143344.12960-4-clg@kaod.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908143344.12960-1-clg@kaod.org> References: <20170908143344.12960-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12282442087628704595 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrfeeggdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.98.131 Subject: [Qemu-devel] [RFC PATCH 3/3] spapr: generate a CAS reset for the XIVE exploitation mode 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: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Roth , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When the platform and the guest agree on using the XIVE exploitation mode for interrupts, the "interrupt-controller" node needs to reflect the change and the device tree needs an update. Reseting the guest after the CAS negotiation makes this change possible, as the device tree is built at reset time. We use the 'ov5_cas' field to check which interrupt model was negotiated before reset and populate the tree accordingly. Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr.c | 6 +++++- hw/ppc/spapr_hcall.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3e3ff1fbc988..be467ab61ad0 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1073,7 +1073,11 @@ static void *spapr_build_fdt(sPAPRMachineState *spap= r, _FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2)); =20 /* /interrupt controller */ - spapr_dt_xics(xics_max_server_number(), fdt, PHANDLE_XICP); + if (!spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) { + spapr_dt_xics(xics_max_server_number(), fdt, PHANDLE_XICP); + } else { + /* populate device tree for XIVE */ ; + } =20 ret =3D spapr_populate_memory(spapr, fdt); if (ret < 0) { diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 92f1e21358b8..ba00b8d3fdd6 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1613,6 +1613,12 @@ static target_ulong h_client_architecture_support(Po= werPCCPU *cpu, (spapr_h_cas_compose_response(spapr, args[1], args[2], ov5_updates) !=3D 0); } + + /* We need to rebuild the device tree for XIVE, generate a reset */ + if (!spapr->cas_reboot) { + spapr->cas_reboot =3D spapr_ovec_test(ov5_updates, OV5_XIVE_EXPLOI= T); + } + spapr_ovec_cleanup(ov5_updates); =20 if (spapr->cas_reboot) { --=20 2.13.5