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 83BA6C04A6A for ; Wed, 9 Aug 2023 14:56:18 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yFgeSKwVsyfHiciA94wM1+YTD37CtlYprhRSJRohlkg=; b=v0ftjytK50g4u3 hB8Sz3nsNxA4NxqryhX6wHkcLTirl+LBvSsssAIjopZNCkQCoRSgMMp11CcBk8HuyRBgizPWvp970 B5yawZX3MxXRQWnmmDzbaccwcLQtefDcXsEfBkVx/dI2iuXom4gPGQN6FxcJeKSyAsWfjoxTyjuw5 enFsvL27H1ylmH7eu+ARWT1EgIdL7uL2JrEd3vwj0OlSlv92+goXhuzv1P2lGC6f4awDKMe/9wibM ArpCuZx5lOHmSlTUfpcwrbVYR06YtRm5SQcqYushYpYEOaXI2tq358l1S9GDqzkR4QbIiGkZ849Nn YeiJB59QutPDXKCguncg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTkbI-005FA7-1A; Wed, 09 Aug 2023 14:55:52 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTkbF-005F9L-1W for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 14:55:50 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7DB06393B; Wed, 9 Aug 2023 14:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1117C433C9; Wed, 9 Aug 2023 14:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691592948; bh=RstcmDjitf3VE+sqHRb0jBKHbUC65fA41JgJoreOdZU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vMkhiJrDNXcnOWjqeCiE879G8K15cFnCSkPW83MJZ3fWKmd82APotaJrQXuS7/2Jm 5w17xvX8DmRulfCXAHIGs2k/1tyg+MPCZ6M2jCg2NL6NFiDiC9dVuHM2pnnKjkkzRL bGL9/gsGEQtoS0au4gvLF0UNbJ4hQ0kXLcCpxJoTnIjbJG/DzsZq7IBXy6E2vDfWOv MEhrE9LlUjthDXWXNpEQfwGroiN8UJPUgPGLyK2jJuhcnICswnklKRz+Zjbd1oCYR3 kVPkCvLf+BWe5adeW4hzqib36cVpmepCO93Q82hS+Di0wK0KGP/bSi/69o9kdIp73T IlS3S0icFNiWQ== Date: Wed, 9 Aug 2023 15:55:43 +0100 From: Will Deacon To: Jason Gunthorpe Cc: Michael Shavit , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com, nicolinc@nvidia.com, jean-philippe@linaro.org Subject: Re: [PATCH v5 2/9] iommu/arm-smmu-v3: Replace s1_cfg with cdtab_cfg Message-ID: <20230809145542.GB4472@willie-the-truck> References: <20230808171446.2187795-1-mshavit@google.com> <20230809011204.v5.2.I1ef1ed19d7786c8176a0d05820c869e650c8d68f@changeid> <20230809134941.GA4226@willie-the-truck> MIME-Version: 1.0 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-20230809_075549_573682_ED988570 X-CRM114-Status: GOOD ( 19.38 ) 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 Wed, Aug 09, 2023 at 10:59:33AM -0300, Jason Gunthorpe wrote: > On Wed, Aug 09, 2023 at 02:49:41PM +0100, Will Deacon wrote: > > > > @@ -1360,10 +1357,14 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, > > > !master->stall_enabled) > > > dst[1] |= cpu_to_le64(STRTAB_STE_1_S1STALLD); > > > > > > - val |= (s1_cfg->cdcfg.cdtab_dma & STRTAB_STE_0_S1CTXPTR_MASK) | > > > - FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_S1_TRANS) | > > > - FIELD_PREP(STRTAB_STE_0_S1CDMAX, s1_cfg->s1cdmax) | > > > - FIELD_PREP(STRTAB_STE_0_S1FMT, s1_cfg->s1fmt); > > > + val |= (cd_table->cdtab_dma & STRTAB_STE_0_S1CTXPTR_MASK) | > > > + FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_S1_TRANS) | > > > + FIELD_PREP(STRTAB_STE_0_S1CDMAX, > > > + cd_table->max_cds_bits) | > > > + FIELD_PREP(STRTAB_STE_0_S1FMT, > > > + cd_table->l1_desc ? > > > + STRTAB_STE_0_S1FMT_64K_L2 : > > > + STRTAB_STE_0_S1FMT_LINEAR); > > > > magically know that we're using 64k tables. > > > > Why is this an improvement to the driver? > > Put the above in a function > > arm_smmu_get_cd_ste(struct arm_smmu_ctx_desc_cfg *cdtab, void *ste) > > And it makes more sense. Sorry, but I'm not seeing it :/ > We don't need the driver to precompute the "s1_cfg" parameters and > store them in a redundant struct along side the ctx_desc_cfg when we > can compute those same values on the fly with no cost. But the computation isn't happening -- the STRTAB_STE_0_S1FMT_64K_L2 constant is hardcoded here. If we want to use 4k leaf tables in some cases, how would you add that? Such a change shouldn't need the low-level strtab creation code to change. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel