From patchwork Wed Apr 3 08:35:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tangnianyao X-Patchwork-Id: 13615365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7680CD1288 for ; Wed, 3 Apr 2024 08:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=t78lT/jMDXGfwjP8S+M2VCnyjVkQiK3B8yahKhG2EPQ=; b=omaIYo6M6rtS+9 ogGGOPD52vfORS/DZvWbKjvVtovCq8xFDTcm+ljzLuDtKmTb/wxb+H42i7m4HGSS7ky/R5I1pFTo2 00FGKfdIxeMmAR/t3HJI/zSTzUuZqb6mYJ4fadoDtX6b93n/IvgC3TmZPGmt/5/kVNaZe2urMj194 zdoDWSZis1ofCOb8ZSNT8142Uy/wFWLMtqXC0eijXL9ky426eHHzR1MgSdbmhsruGeJe8SBKUc0xj MzPj4cinYu/liFQemi+G4LEm1I6k6IHMSl56USn2bkBp778Yp02ccFJ2EC9s7RHjCBlMOtcfbYZq5 tjdwBD+wrtcrZph+Kagg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrw6R-0000000EvF9-0Nha; Wed, 03 Apr 2024 08:36:15 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrw6O-0000000EvED-3lYJ for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2024 08:36:14 +0000 Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4V8dLT1QRtz1R9kP; Wed, 3 Apr 2024 16:33:21 +0800 (CST) Received: from kwepemd500014.china.huawei.com (unknown [7.221.188.63]) by mail.maildlp.com (Postfix) with ESMTPS id 2C5CE1A0172; Wed, 3 Apr 2024 16:36:07 +0800 (CST) Received: from 228-1616.huawei.com (10.67.246.68) by kwepemd500014.china.huawei.com (7.221.188.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Wed, 3 Apr 2024 16:36:06 +0800 From: t00849498 To: , , , CC: , , Subject: [RESPIN PATCH] irqchip/gic-v3-its:Fix GICv4.1 needless VSYNC after unmap VPE Date: Wed, 3 Apr 2024 08:35:56 +0000 Message-ID: <20240403083556.3862236-1-tangnianyao@huawei.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Originating-IP: [10.67.246.68] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemd500014.china.huawei.com (7.221.188.63) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_013613_135791_138F3710 X-CRM114-Status: GOOD ( 10.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nianyao Tang Quote from GIC spec 5.3.19, a VMAPP with {V, Alloc}=={0, x} is self-synchronizing, This means the ITS command queue does not show the command as consumed until all of its effects are completed. We don't need VSYNC to guarantee unmap finish. And VSYNC after unmap VPE will reach an invalid vpe table entry, which may trigger exception like SError or RAS. Let's fix it. Signed-off-by: Nianyao Tang Reviewed-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index fca888b36680..2a537cbfcb07 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -786,6 +786,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, struct its_cmd_block *cmd, struct its_cmd_desc *desc) { + struct its_vpe *vpe = valid_vpe(its, desc->its_vmapp_cmd.vpe); unsigned long vpt_addr, vconf_addr; u64 target; bool alloc; @@ -798,6 +799,11 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, if (is_v4_1(its)) { alloc = !atomic_dec_return(&desc->its_vmapp_cmd.vpe->vmapp_count); its_encode_alloc(cmd, alloc); + /* + * Unmapping a VPE is self-synchronizing on GICv4.1, + * no need to issue a VSYNC. + */ + vpe = NULL; } goto out; @@ -832,7 +838,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, out: its_fixup_cmd(cmd); - return valid_vpe(its, desc->its_vmapp_cmd.vpe); + return vpe; } static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,