Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp1498047lff; Sun, 19 Jan 2020 05:32:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxdIdSQ23OqKoXo3U1h71FUg34Qu4Tz4fZpNSejlog0l8A9I+dSDKge4j5wlzLzMzyKDaz9 X-Received: by 2002:a05:6214:13a8:: with SMTP id h8mr15796652qvz.41.1579440755541; Sun, 19 Jan 2020 05:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579440755; cv=none; d=google.com; s=arc-20160816; b=Vqb/WUfHsq0H6yei0SpoxTtr0oZSoynBLVLQeN7ovdOhLud1rt8Sd0Sy6GGtqAhxRJ VCXZ+RiY/hqCEY3XOIsG/HsLkebPqRAuJ1AVpKY/zvcaf5WPry7g+Xk1+8MVUFJJoM32 LcVfJsaEQu24r8mcTWa4/1qw6xaDxoNyfOWQDsR0o3TCOOsP001b7CFLNDuIra7RCdSI 6gvi3vUI1t6wXn+e+jTR65dGeSXUQF2yuDubtt58ngyHb77D6n6ixzqETa88cLpKyfVA 99EYvp0O+1OzYaj981BA209Zxs4P4atMdoYCaSMjqWKa6vSFMb8/u1f2u6qFMip2ERZY TmgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:cc :mime-version:message-id:date:subject:to:from; bh=ZgBR79GdAyaZMsxf6BrV3Gp0LGtKD+H1KOvyBYeWCVs=; b=pFuMSHg5zF4GDlPLyr7cHKi3dmPx+KDwby9XydiJmZbD31L3xlCyPAAamBmtwi2444 3rP+7B1HHHRliLL17oigqGlsKd0ei67Jk0zoveqwkhw4wmTUS6w0jCS92z5Mq29Qwo/U xrs1M5DxRDZNO9moS/lIcHa04brDWBNzV9sw8/LURVNQ4jqpROKX2cU5vpo0cbg+Zg12 JDBdf+vjN3vgL8mGQvL4bFP0++eZrqiiGj+fijQZRpPEhH84RkeqwzN74y8ASIQnhnFC Z25boY5RaM6weSeMJww3Sz1ARMCZcrVDmt+HjqLSSV7bi4F8Ui+lCKp3Zm6BaUSvp19X ISrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of kvmarm-bounces@lists.cs.columbia.edu designates 128.59.11.253 as permitted sender) smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Return-Path: Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu. [128.59.11.253]) by mx.google.com with ESMTP id df10si17821311qvb.155.2020.01.19.05.32.35; Sun, 19 Jan 2020 05:32:35 -0800 (PST) Received-SPF: pass (google.com: domain of kvmarm-bounces@lists.cs.columbia.edu designates 128.59.11.253 as permitted sender) client-ip=128.59.11.253; Authentication-Results: mx.google.com; spf=pass (google.com: domain of kvmarm-bounces@lists.cs.columbia.edu designates 128.59.11.253 as permitted sender) smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DFCBF4AEB3; Sun, 19 Jan 2020 08:32:34 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu X-Spam-Flag: NO X-Spam-Score: -1.502 X-Spam-Level: X-Spam-Status: No, score=-1.502 required=6.1 tests=[BAYES_00=-1.9, DNS_FROM_AHBL_RHSBL=2.699, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001] autolearn=no Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ux7mLXMINdx8; Sun, 19 Jan 2020 08:32:33 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B26484ACFA; Sun, 19 Jan 2020 08:32:33 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 997BA4ACFA for ; Sun, 19 Jan 2020 08:32:32 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E5w4vXv+UKpW for ; Sun, 19 Jan 2020 08:32:31 -0500 (EST) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id D2B964ACE6 for ; Sun, 19 Jan 2020 08:32:30 -0500 (EST) 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 Cc: maz@kernel.org, kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu X-TUID: G3BqE930x6p1 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==1 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); 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 = 0; ncpu < s->num_cpu; ncpu++) { GICv3CPUState *c = &s->cpu[ncpu]; @@ -347,12 +350,6 @@ static void kvm_arm_gicv3_put(GICv3State *s) kvm_gicr_access(s, GICR_PROPBASER + 4, ncpu, ®h, true); reg64 = 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 |= GICR_PENDBASER_PTZ; - } regl = (uint32_t)reg64; kvm_gicr_access(s, GICR_PENDBASER, ncpu, ®l, true); regh = (uint32_t)(reg64 >> 32); -- 2.19.1 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm