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 0A2B0C30658 for ; Tue, 2 Jul 2024 18:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=McXShdI8S0EtDGoWAGaSG9ykkTeAA277ZQsUVwnx1wM=; b=4q/qNe8erpcsYthQkH/T834e+w cBGi3qGlCpgZ24BsabcSon7Wjb+GTJhiFHYiFI90eUAERTM3/+oYkCuKAfiCI0nPq7Iyq3dGTWVZW ttu4Mf65nk3Pi02/fyqzcDh8bp/naVNLLRBXeq2/mGhrmGfwGCr5+ORKiSRga4gVhl7Jnm0I731hK r5iwqjWOgCjdhDOKptCGmZ/T8m+3ElEvtX6WDJML4oXhCNntq5DiyOO3nyV/nMWpEg7lzd2NwGW+u 9toFWXtkbgkdgRQeD08tzfnuTaLe256UUS/FXNNy/gG2jB7VG9Dz4ZKKgtnW5o5nMDxuvig0kxopL 8+b/xvaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOiZn-00000007g6u-1XtH; Tue, 02 Jul 2024 18:50:03 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOiZa-00000007g3V-3T1V for linux-arm-kernel@lists.infradead.org; Tue, 02 Jul 2024 18:49:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 13DE6CE20E3; Tue, 2 Jul 2024 18:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B686FC116B1; Tue, 2 Jul 2024 18:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719946187; bh=muWQU8+tLHYzGQGeY25n5iq8cxrlarZsW8XJMLS/Raw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ila/O7rpP+ijC26sY6h7xSzfMIDBYSmHDcmLvOG77xWue3CiP6pokghGtdMbXkQQL bYX5frJx0Y2HtuMOUCQENjXbEQwKdV2sF6fOG86NBjzvnZJZJINzOGmHDMMvHKs7rZ lzLwu1FCeeRwXSutN/DzO04gMt+B3QikdkFcA6wiRwUrZzPg9tc7LXguIhaufFqoH4 0UVK2Q7v2pQlr9YLbzB11MDnh6xGVzqXIkqfCPfWW8aFSR/oazTBPbFKOHZfGCVPl5 OlklpSxLSSs6571NDVLV2/4hkOp993lbAzgta4/BjvK6N6E1zJt4Iij9bPQfKBRZT3 d2KQahfMenEwA== Date: Tue, 2 Jul 2024 19:49:42 +0100 From: Will Deacon To: Nicolin Chen Cc: robin.murphy@arm.com, joro@8bytes.org, jgg@nvidia.com, thierry.reding@gmail.com, vdumpa@nvidia.com, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH v9 4/6] iommu/arm-smmu-v3: Add CS_NONE quirk for CONFIG_TEGRA241_CMDQV Message-ID: <20240702184942.GD5167@willie-the-truck> References: <20240702174307.GB4740@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_114951_238708_68CAB0FA X-CRM114-Status: GOOD ( 29.69 ) 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 On Tue, Jul 02, 2024 at 11:19:56AM -0700, Nicolin Chen wrote: > Hi Will, > > On Tue, Jul 02, 2024 at 06:43:07PM +0100, Will Deacon wrote: > > On Wed, Jun 12, 2024 at 02:45:31PM -0700, Nicolin Chen wrote: > > > The CMDQV extension in NVIDIA Tegra241 SoC only supports CS_NONE in the > > > CS field of CMD_SYNC. Add a quirk flag to accommodate that. > > > > > > Reviewed-by: Jason Gunthorpe > > > Signed-off-by: Nicolin Chen > > > --- > > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 +++++++- > > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +++ > > > 2 files changed, 10 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > index c864c634cd23..ba0e24d5ffbf 100644 > > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > @@ -345,6 +345,11 @@ static void arm_smmu_cmdq_build_sync_cmd(u64 *cmd, struct arm_smmu_device *smmu, > > > FIELD_PREP(CMDQ_SYNC_0_MSH, ARM_SMMU_SH_ISH) | > > > FIELD_PREP(CMDQ_SYNC_0_MSIATTR, ARM_SMMU_MEMATTR_OIWB); > > > > > > + if (q->quirks & CMDQ_QUIRK_SYNC_CS_NONE_ONLY) { > > > + cmd[0] |= FIELD_PREP(CMDQ_SYNC_0_CS, CMDQ_SYNC_0_CS_NONE); > > > + return; > > > + } > > > + > > > if (!(smmu->options & ARM_SMMU_OPT_MSIPOLL)) { > > > cmd[0] |= FIELD_PREP(CMDQ_SYNC_0_CS, CMDQ_SYNC_0_CS_SEV); > > > return; > > > @@ -690,7 +695,8 @@ static int arm_smmu_cmdq_poll_until_sync(struct arm_smmu_device *smmu, > > > struct arm_smmu_cmdq *cmdq, > > > struct arm_smmu_ll_queue *llq) > > > { > > > - if (smmu->options & ARM_SMMU_OPT_MSIPOLL) > > > + if (smmu->options & ARM_SMMU_OPT_MSIPOLL && > > > + !(cmdq->q.quirks & CMDQ_QUIRK_SYNC_CS_NONE_ONLY)) > > > return __arm_smmu_cmdq_poll_until_msi(smmu, cmdq, llq); > > > > > > return __arm_smmu_cmdq_poll_until_consumed(smmu, cmdq, llq); > > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > > > index 180c0b1e0658..01227c0de290 100644 > > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > > > @@ -543,6 +543,9 @@ struct arm_smmu_queue { > > > > > > u32 __iomem *prod_reg; > > > u32 __iomem *cons_reg; > > > + > > > +#define CMDQ_QUIRK_SYNC_CS_NONE_ONLY BIT(0) /* CMD_SYNC CS field supports CS_NONE only */ > > > + u32 quirks; > > > > Please can you use the existing smmu->options field instead of adding > > another place to track quirks? Or do you need this only for some of the > > queues for a given SMMU device? > > VCMDQs are extension of a regular SMMU (with its own CMDQ). So, > SMMU CMDQ still supports SIG_IRQ for the CS field, while VCMDQs > could only support SIG_NONE. In another word, this quirk is not > per SMMU but per Queue. > > I can highlight this in the commit message, if that would make > it clear. I think we could still use smmu->options and have something like ARM_SMMU_OPT_SECONDARY_CMDQ_CS_NONE_ONLY which could be applied when the queue is != arm_smmu_get_cmdq(smmu). Will