From mboxrd@z Thu Jan 1 00:00:00 1970 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 466ADC6FD1F for ; Tue, 2 Apr 2024 12:35:56 +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:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=f8CIMRJ3XiPvmJ60oRfE4Xu0pmYaGOcxqPpyYXIQKWg=; b=M3CuqXeIfK2ikv mu+UB64PyH9Ya0XuYheCdKqwq3AkiIBMwGHqr3LiPpHNsrAv8AO01e6mEP8fmB+Pk6pgsfkN4pDyK SnwISLmTxkelWvyinvMlX517qzbgfRx582DQSGMoCTI8h+cSTneqMDoxNuFdm1lbRFjR4Vh8VpJPN xpvZvZkauocQ1ItyJbxHGN1Ij46Qa9faQlFWoBoiflOzuNUoMrKn2IBO9dZBXp4LD5O47M8/6MRMT FasXZk3djOLlFLSCNIcDhdLwBJFzBrwXZcoAOJBSeMPJ/EL+DqBvhNJxygRIowWFSJh68yGlWrIBc 5IuhFJCgllDs1UdyXC7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdMh-0000000B4My-0LYa; Tue, 02 Apr 2024 12:35:47 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdMd-0000000B4M5-13rw for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2024 12:35:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B53AC60FE3; Tue, 2 Apr 2024 12:35:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DB33C433C7; Tue, 2 Apr 2024 12:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712061342; bh=7+z6FHMMk9EWFQfppPVQiC+yP/sYKpg6rT2yPxQXsKQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NQp6/uke1jwfqfrQTJZGOj++7cB1q1V44B1/1HjkdR9up+FY9tvfjK6s2fjHtiQbt p6SzLzIyCwNtRL5WRYDC2vvL/B6XArhRUcTvrvTPumMCTr6m/GQQmzFY6zi1tDVdCQ i5ZH6Oz0jvTecofvowm4+JYf2o/EdM1y+IbUYHilLEr9JbqOSrOyKqW2Yg1x4LIFQS HI6Pd4DwRfQLrD7Zu/6ijZUOdb7P95FEeg6k1N6FHxgB8sq/rJCfgVRtaxy4Elc77S Kjuy+C5lMlFxkZ9si9edMbA+UuC0xj0etWgOglft3wI6DU2ehLAaoYm9RLmQwOQlVm 6v1Ln4XZ7mgrw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rrdMZ-000hgr-LY; Tue, 02 Apr 2024 13:35:39 +0100 Date: Tue, 02 Apr 2024 13:35:35 +0100 Message-ID: <86jzlgt014.wl-maz@kernel.org> From: Marc Zyngier To: t00849498 Cc: , , , , Subject: Re: [PATCH] irqchip/gic-v3-its: Don't need VSYNC if VMAPP with {V, Alloc}=={0, x} In-Reply-To: <20240402114147.3788881-1-tangnianyao@huawei.com> References: <20240402114147.3788881-1-tangnianyao@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: tangnianyao@huawei.com, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, guoyang2@huawei.com, wangwudi@hisilicon.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240402_053544_608024_AC3317A1 X-CRM114-Status: GOOD ( 26.46 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 02 Apr 2024 12:41:47 +0100, t00849498 wrote: > > From GIC spec, a VMAPP with {V, Alloc}=={0, x} is self-synchronizing, It'd be nice to quote the part of the spec (5.3.19). > This means the ITS command queue does not show the command as > consumed until all of its effects are completed. A VSYNC with unmapped > vpeid is not needed. > > Signed-off-by: t00849498 Previous contributions with the same email address had the name "Nianyao Tang" associated with it. Was it wrong in the past? Or is the above wrong? > --- > drivers/irqchip/irq-gic-v3-its.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index fca888b36680..a0ca5dcbb245 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -789,6 +789,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, > unsigned long vpt_addr, vconf_addr; > u64 target; > bool alloc; > + bool unmap_v4_1 = !desc->its_vmapp_cmd.valid && is_v4_1(its); > > its_encode_cmd(cmd, GITS_CMD_VMAPP); > its_encode_vpeid(cmd, desc->its_vmapp_cmd.vpe->vpe_id); > @@ -832,6 +833,9 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, > out: > its_fixup_cmd(cmd); > > + if (unmap_v4_1) > + return NULL; > + > return valid_vpe(its, desc->its_vmapp_cmd.vpe); > } > This is a bit ugly. We already have a whole block dedicated to handling VMAPP with V=0 and GICv4.1, and it'd be more readable to keep all that code together. Something like the untested patch below. Thanks, M. 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, -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel