Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3095364ybv; Mon, 24 Feb 2020 18:07:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxFJqtQHQN24b9Ga2VJFFzMrrt/Nc95nEBH+uJ+ASxsvI+j8zsmN/NFltkd1y4xm7RifmLr X-Received: by 2002:aca:2b04:: with SMTP id i4mr1631649oik.21.1582596442226; Mon, 24 Feb 2020 18:07:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582596442; cv=none; d=google.com; s=arc-20160816; b=hLCyhxs6ZVWHlSAXdhlMSn5VTAL5pmP1XUtHPDlCZQKl0rvCeegsf5SdRIUO2ugPlV omdjH1OhTsGOavfKe+S26bmRhIfbQwpsxf+oVLuaJcUBC8ZSxBM9888w8TGxyQqIZYWp UcTBtSdUV0TwzQZIsqK0QxQxuC1WWcrn3v8wL2YmI2LJ2bLj2ELMCJNNdgMJ27+s3DLI s7eUXyn1es9d7EaBJ5Zop/SwoRMjHYd3qtCkhJ50VEWDFDfjr7uMOkwfstG+CLQm2TyU cZRfX6soS1ziiYValGMOmmtOsPyIDAOW6zzSxU23sW2B0fC+cSc3oNxdCd8RaJfhDmLn 8heQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=DT/CXKscj1Y4HzauOgit8eKcvixH4oZKG3b7juRTAdU=; b=Oiw/8yJi6cBiLcbDir7CO6+0HDTd71jSMSyXF6MQdE37ThtnQPfl+mG01uPWLJDksN 4JmEFrfdDBDk5b/kHHZozlER8XVTw6SZO+vd9owUSK5iT1tCkHmYMNrMsmMPE0I0N2QE /AT1MoZPy3zKgYa75RmAoPI53muEupHx1hGTcLlVznAk+2NV+w6fvucboNz4DNn7G+fh ZW5LSglASCjSdgUCBRrrx/p4o141WaR31blsWs5frnvK3Q8NMwRXq35p3RpZ9q4cBnrg m79pf5NsCt0zp9uY+sbJZbcP8aZOyH8haZE7VYrB7T+1hW5u1Yyk2i+kO2E/4/j6CaQr kFlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si5604787oie.130.2020.02.24.18.07.09; Mon, 24 Feb 2020 18:07:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728769AbgBYCGu (ORCPT + 99 others); Mon, 24 Feb 2020 21:06:50 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:58960 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728011AbgBYCGu (ORCPT ); Mon, 24 Feb 2020 21:06:50 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8828C5E565293787A2F6; Tue, 25 Feb 2020 10:06:48 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Tue, 25 Feb 2020 10:06:27 +0800 Subject: Re: [PATCH] irqchip/gic-v3-its: Clear Valid before writing any bits else in VPENDBASER To: Marc Zyngier CC: , , , , Yanlei Jia References: <20200224025029.92-1-yuzenghui@huawei.com> From: Zenghui Yu Message-ID: <6ce5c751-6d17-b9ee-4054-edad7de075bf@huawei.com> Date: Tue, 25 Feb 2020 10:06:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 2020/2/25 7:47, Marc Zyngier wrote: > Hi Zenghui, > > On 2020-02-24 02:50, Zenghui Yu wrote: >> The Valid bit must be cleared before changing anything else when writing >> GICR_VPENDBASER to avoid the UNPREDICTABLE behavior. This is exactly what >> we've done on 32bit arm, but not on arm64. > > I'm not quite sure how you decide that Valid must be cleared before > changing > anything else. The reason why we do it on 32bit is that we cannot update > the full 64bit register at once, so we start by clearing Valid so that > we can update the rest. arm64 doesn't require that. The problem came out from discussions with our GIC engineers and what we talked about at that time was IHI 0069E 9.11.36 - the description of the Valid field: "Writing a new value to any bit of GICR_VPENDBASER, other than GICR_VPENDBASER.Valid, when GICR_VPENDBASER.Valid==1 is UNPREDICTABLE." It looks like we should first clear the Valid and then write something else. We might have some mis-understanding about this statement.. > > For the rest of discussion, let's ignore GICv4.1 32bit support (I'm > pretty sure nobody cares about that). > >> This works fine on GICv4 where we only clear Valid for a vPE deschedule. >> With the introduction of GICv4.1, we might also need to talk something >> else >> (e.g., PendingLast, Doorbell) to the redistributor when clearing the >> Valid. >> Let's port the 32bit gicr_write_vpendbaser() to arm64 so that hardware >> can >> do the right thing after descheduling the vPE. > > The spec says that: > > "For a write that writes GICR_VPENDBASER.Valid from 1 to 0, if > GICR_VPENDBASER.PendingLast is written as 1 then > GICR_VPENDBASER.PendingLast > takes an UNKNOWN value and GICR_VPENDBASER.Doorbell is treated as being 0." > > and > > "When GICR_VPENDBASER.Valid is written from 1 to 0, if there are > outstanding > enabled pending interrupts GICR_VPENDBASER.Doorbell is treated as 0." > > which indicate that PendingLast/Doorbell have to be written at the same > time > as we clear Valid. Yes. I obviously missed these two points when writing this patch. > Can you point me to the bit of the v4.1 spec that makes > this "clear Valid before doing anything else" requirement explicit? No, nothing in v4.1 spec supports me :-( The above has been forwarded to Hisilicon and I will confirm these with them. It would be easy for hardware to handle the PendingLast/DB when clearing Valid, I think. Thank you, Zenghui