From nobody Sun May 5 09:22:45 2024 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; 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=1579440854; cv=none; d=zohomail.com; s=zohoarc; b=IfM8wV4WWZ5FlHoLg+uPd7e4fLcgeb5JZbWhTyHB1WDB6i4ipblnB1ennL77A415s5U4cT2rrFCG2pimV2TSarFIIivBBS0jR1bdOlDd+/oJNihiZP6zOsbWfPP0N4tRVDQVt7m8PpgZ+O2uREiaUs/970RlVSKOidAR8uFrk88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579440854; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=UOkxyAd+gggpxMlkpJeOvgmMWghVIiclQ+tzsQpgcYE=; b=B6ZOLu8O7bRkKD7izHk2IC57cBMeJqmexAZ2RUZjc7JP0qzPayOGeiljvC2cTu9rhlUOK7hR7S0Jx4DDLaTppLgAUmTD0uh2lzJXG+/1qwMh/LupENnL0S/VkknOpX54nk6/QuO+Sx5r2c23fm97wwWI+pZ/SMyE3J333++wEjQ= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1579440854922639.0007263710206; Sun, 19 Jan 2020 05:34:14 -0800 (PST) Received: from localhost ([::1]:50284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itAiS-0003qW-GW for importer@patchew.org; Sun, 19 Jan 2020 08:34:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33577) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itAgy-0003J2-DS for qemu-devel@nongnu.org; Sun, 19 Jan 2020 08:32:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itAgx-0007zE-Ai for qemu-devel@nongnu.org; Sun, 19 Jan 2020 08:32:40 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2688 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1itAgu-0007uI-Hl; Sun, 19 Jan 2020 08:32:36 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0BB7FE69CDB940A01276; Sun, 19 Jan 2020 21:32:27 +0800 (CST) Received: from DESKTOP-8RFUVS3.china.huawei.com (10.173.222.27) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Sun, 19 Jan 2020 21:32:17 +0800 From: Zenghui Yu To: , , Subject: [PATCH] hw/intc/arm_gicv3_kvm: Stop wrongly programming GICR_PENDBASER.PTZ bit Date: Sun, 19 Jan 2020 21:30:51 +0800 Message-ID: <20200119133051.642-1-yuzenghui@huawei.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected 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: 45.249.212.190 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: Zenghui Yu , maz@kernel.org, kvmarm@lists.cs.columbia.edu, wanghaibin.wang@huawei.com, eric.auger@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If LPIs are disabled, KVM will just ignore the GICR_PENDBASER.PTZ bit when restoring GICR_CTLR. Setting PTZ here makes littlt sense in "reduce GIC initialization time". And what's worse, PTZ is generally programmed by guest to indicate to the Redistributor whether the LPI Pending table is zero when enabling LPIs. If migration is triggered when the PTZ has just been cleared by guest (and before enabling LPIs), we will see PTZ=3D=3D1 on the destination side, which is not as expected. Let's just drop this hackish userspace behavior. Also take this chance to refine the comment a bit. Fixes: 367b9f527bec ("hw/intc/arm_gicv3_kvm: Implement get/put functions") Signed-off-by: Zenghui Yu --- hw/intc/arm_gicv3_kvm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 9c7f4ab871..49304ca589 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -336,7 +336,10 @@ static void kvm_arm_gicv3_put(GICv3State *s) kvm_gicd_access(s, GICD_CTLR, ®, true); =20 if (redist_typer & GICR_TYPER_PLPIS) { - /* Set base addresses before LPIs are enabled by GICR_CTLR write */ + /* + * Restore base addresses before LPIs are potentially enabled by + * GICR_CTLR write + */ for (ncpu =3D 0; ncpu < s->num_cpu; ncpu++) { GICv3CPUState *c =3D &s->cpu[ncpu]; =20 @@ -347,12 +350,6 @@ static void kvm_arm_gicv3_put(GICv3State *s) kvm_gicr_access(s, GICR_PROPBASER + 4, ncpu, ®h, true); =20 reg64 =3D c->gicr_pendbaser; - if (!(c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS)) { - /* Setting PTZ is advised if LPIs are disabled, to reduce - * GIC initialization time. - */ - reg64 |=3D GICR_PENDBASER_PTZ; - } regl =3D (uint32_t)reg64; kvm_gicr_access(s, GICR_PENDBASER, ncpu, ®l, true); regh =3D (uint32_t)(reg64 >> 32); --=20 2.19.1