From nobody Tue Feb 10 04:15:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1575006660; cv=none; d=zohomail.com; s=zohoarc; b=V+uuvB/H2ypE6dAIqkKNU7XVa3tyycPJWzsh0aqFU1YZ0dh8flyeM6eSsXi6Ly3rAZOwaxwt/8nejenirrVOdOyXXE9nRMUI/lL9iRCh4Sx02shUGFkmH12hWJeD2dqBCadQvvZ7ZotPmOrpS0PrmE/ox14PZpg3AWRfzcY4e3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575006660; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sL82UNWSsU/46+eqRhvAOQpeRpnkGib7cNpV5dOuifo=; b=Pro9lNaQ88jsnLlokBFu1a4PDnaU0UYGir/MD/zZMm5yM34AWO03eqPCS5nPNiSLx+XV0dVlltJB0bXhVDZaJEgJXSfS2pKU96sr3wKD8Kc9lnOLvFvT+qTEiQD/27xVZj/TxhNAOr8BmyCXeqASWjzistn5UNwJi4VfsVF+sxo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1575006660949608.0842687842041; Thu, 28 Nov 2019 21:51:00 -0800 (PST) Received: from localhost ([::1]:55076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaZBB-0001hs-F6 for importer@patchew.org; Fri, 29 Nov 2019 00:50:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55653) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaYuy-0002gu-Bs for qemu-devel@nongnu.org; Fri, 29 Nov 2019 00:34:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaYut-0002nc-5x for qemu-devel@nongnu.org; Fri, 29 Nov 2019 00:34:10 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:33515) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iaYus-0002Lv-6k; Fri, 29 Nov 2019 00:34:07 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 47PNTz5B8Fz9sPj; Fri, 29 Nov 2019 16:33:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1575005639; bh=gkJR1uYIZjQwGcO4AthiZKM0GvBR19MZhgvCP1GHfdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bA1yiETXRs4JRRX34AuLOJO25rpIvMjje9cFkaS2VjnFIjPKlLaVT9h2tksS5V20W S0j8JPvEmMjKtd9eEF3zsz7IcVVAFd3gSUX2uD9+ARW/qjNb828iKeeKyW95BFJPSP LgL0OXL2Dd7DWmVhX2chWFkWkHzI8oHzzZnJNrtU= From: David Gibson To: groug@kaod.org, clg@kaod.org Subject: [for-5.0 1/4] spapr: Don't trigger a CAS reboot for XICS/XIVE mode changeover Date: Fri, 29 Nov 2019 16:33:53 +1100 Message-Id: <20191129053356.232413-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191129053356.232413-1-david@gibson.dropbear.id.au> References: <20191129053356.232413-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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, David Gibson , qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org 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" PAPR allows the interrupt controller used on a POWER9 machine (XICS or XIVE) to be selected by the guest operating system, by using the ibm,client-architecture-support (CAS) feature negotiation call. Currently, if the guest selects an interrupt controller different from the one selected at initial boot, this causes the system to be reset with the new model and the boot starts again. This means we run through the SLOF boot process twice, as well as any other bootloader (e.g. grub) in use before the OS calls CAS. This can be confusing and/or inconvenient for users. Thanks to two fairly recent changes, we no longer need this reboot. 1) we now completely regenerate the device tree when CAS is called (meaning we don't need special case updates for all the device tree changes caused by the interrupt controller mode change), 2) we now have explicit code paths to activate and deactivate the different interrupt controllers, rather than just implicitly calling those at machine reset time. We can therefore eliminate the reboot for changing irq mode, simply by putting a called to spapr_irq_update_active_intc() before we call spapr_h_cas_compose_response() (which gives the updated device tree to the guest firmware and OS). Signed-off-by: David Gibson Reviewed-by: Cedric Le Goater Reviewed-by: Greg Kurz --- hw/ppc/spapr_hcall.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 140f05c1c6..05a7ca275b 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1767,21 +1767,10 @@ static target_ulong h_client_architecture_support(P= owerPCCPU *cpu, } spapr->cas_pre_isa3_guest =3D !spapr_ovec_test(ov1_guest, OV1_PPC_3_00= ); spapr_ovec_cleanup(ov1_guest); - if (!spapr->cas_reboot) { - /* If spapr_machine_reset() did not set up a HPT but one is necess= ary - * (because the guest isn't going to use radix) then set it up her= e. */ - if ((spapr->patb_entry & PATE1_GR) && !guest_radix) { - /* legacy hash or new hash: */ - spapr_setup_hpt_and_vrma(spapr); - } - spapr->cas_reboot =3D - (spapr_h_cas_compose_response(spapr, args[1], args[2], - ov5_updates) !=3D 0); - } =20 /* - * Ensure the guest asks for an interrupt mode we support; otherwise - * terminate the boot. + * Ensure the guest asks for an interrupt mode we support; + * otherwise terminate the boot. */ if (guest_xive) { if (!spapr->irq->xive) { @@ -1797,14 +1786,18 @@ static target_ulong h_client_architecture_support(P= owerPCCPU *cpu, } } =20 - /* - * Generate a machine reset when we have an update of the - * interrupt mode. Only required when the machine supports both - * modes. - */ + spapr_irq_update_active_intc(spapr); + if (!spapr->cas_reboot) { - spapr->cas_reboot =3D spapr_ovec_test(ov5_updates, OV5_XIVE_EXPLOI= T) - && spapr->irq->xics && spapr->irq->xive; + /* If spapr_machine_reset() did not set up a HPT but one is necess= ary + * (because the guest isn't going to use radix) then set it up her= e. */ + if ((spapr->patb_entry & PATE1_GR) && !guest_radix) { + /* legacy hash or new hash: */ + spapr_setup_hpt_and_vrma(spapr); + } + spapr->cas_reboot =3D + (spapr_h_cas_compose_response(spapr, args[1], args[2], + ov5_updates) !=3D 0); } =20 spapr_ovec_cleanup(ov5_updates); --=20 2.23.0