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 50C5EEE4993 for ; Tue, 22 Aug 2023 09:20:08 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F9Tlo9N+siCicIpPTMIitWDP+J4odAiP5XD9mdxfi+8=; b=JrlFHOGS74ydcJ UsRIjVKm9xkTutHbSyvbeHzuzZRYpdtYsXUshhCfOGGddSFLrsvOeAk9N8WkO5DKtXt7Kuki9QysU zFocAeLuVbY0WYxIhLH1w4U7nBRWg2bqGVI1JHWrMtLKAYKe89LPZJLRyoZ7CNCxMpDyMqBeeHJfW zxorCYRV65CVhhO88Dlx1qmRrxLFyr4t4DGWc7GXtLbc+V29kEckxuiiozQhqHwREuLOoJ+/sSQxb ctlFC1IvgUBQqrYGFRBYiZS9lnmrlz5DRkle0WGOhhBBl/bQC04RwZr0bOiYDnUbsjyK9ZS/5WPJD gSxnhBLzsve4cT/FNKFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYNY5-00FXeO-1o; Tue, 22 Aug 2023 09:19:41 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYNY4-00FXdr-1E for linux-arm-kernel@bombadil.infradead.org; Tue, 22 Aug 2023 09:19:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=LifN5Et/s6S/+7W6AGwYf2ajFKOTUapL7MI2+bW/6lA=; b=QLpR0gmeRzKoOj29dU9A+/wvh6 QAB7dbyBTsQ40HHA6JENcbZgq1cpeIbtGTEdGdOXzuNXxGIL65uR491LUXSyDrQykbnbd2iTLyxxl oYk0Eo5AiEMXWuP6mY7qwcPHmmDh69hY4ZmbVrl+UhGr7/QYhjAOc/jEFzypXPL6wds3J0DRM4y+r OCrLEBL1LcQnd4Bd07bZtPEKQbxC2Pqz1CWQLa7zISrWHLKEB86oBi3/YeT5BczT/ABuJFK208vUc 82piOTkP36h3j+tGvL+HbdrX5r22DzOxru+VeGdbQIl5p6uIRtvGw8xNk7QCB3H8yNNcnZFeP4yG+ waFNBwPg==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYNXz-002dQn-0f for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2023 09:19:38 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 031D911FB; Tue, 22 Aug 2023 02:20:09 -0700 (PDT) Received: from [10.57.5.95] (unknown [10.57.5.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF3EC3F64C; Tue, 22 Aug 2023 02:19:26 -0700 (PDT) Message-ID: Date: Tue, 22 Aug 2023 10:19:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH 1/3] iommu/io-pgtable-arm: Add nents_per_pgtable in struct io_pgtable_cfg Content-Language: en-GB To: Nicolin Chen , will@kernel.org, jgg@nvidia.com Cc: joro@8bytes.org, jean-philippe@linaro.org, apopple@nvidia.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev References: <0fe68babdb3a07adf024ed471fead4e3eb7e703f.1692693557.git.nicolinc@nvidia.com> From: Robin Murphy In-Reply-To: <0fe68babdb3a07adf024ed471fead4e3eb7e703f.1692693557.git.nicolinc@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_101935_413933_81EEA982 X-CRM114-Status: GOOD ( 18.00 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2023-08-22 09:45, Nicolin Chen wrote: > Add a new nents_per_pgtable in struct io_pgtable_cfg to store the number > of entries per IO pagetable, so it can be passed back to an IOMMU driver. > It will be used by one of the following changes to set the maximum number > of TLBI operations in the arm-smmu-v3 driver. > > Signed-off-by: Nicolin Chen > --- > drivers/iommu/io-pgtable-arm.c | 3 +++ > include/linux/io-pgtable.h | 2 ++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c > index 72dcdd468cf3..7583d9ecca2b 100644 > --- a/drivers/iommu/io-pgtable-arm.c > +++ b/drivers/iommu/io-pgtable-arm.c > @@ -891,6 +891,7 @@ arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg *cfg, void *cookie) > > /* TTBR */ > cfg->arm_lpae_s1_cfg.ttbr = virt_to_phys(data->pgd); > + cfg->nents_per_pgtable = 1 << data->bits_per_level; > return &data->iop; > > out_free_data: > @@ -993,6 +994,7 @@ arm_64_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie) > > /* VTTBR */ > cfg->arm_lpae_s2_cfg.vttbr = virt_to_phys(data->pgd); > + cfg->nents_per_pgtable = 1 << data->bits_per_level; > return &data->iop; > > out_free_data: > @@ -1071,6 +1073,7 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) > ARM_MALI_LPAE_TTBR_ADRMODE_TABLE; > if (cfg->coherent_walk) > cfg->arm_mali_lpae_cfg.transtab |= ARM_MALI_LPAE_TTBR_SHARE_OUTER; > + cfg->nents_per_pgtable = 1 << data->bits_per_level; The result of this highly complex and expensive calculation is clearly redundant with the existing bits_per_level field, so why do we need to waste space storing when the driver could simply use bits_per_level? Thanks, Robin. > return &data->iop; > > diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h > index 1b7a44b35616..4b55a327abc1 100644 > --- a/include/linux/io-pgtable.h > +++ b/include/linux/io-pgtable.h > @@ -55,6 +55,7 @@ struct iommu_flush_ops { > * tables. > * @ias: Input address (iova) size, in bits. > * @oas: Output address (paddr) size, in bits. > + * @nents_per_pgtable: Number of entries per page table. > * @coherent_walk A flag to indicate whether or not page table walks made > * by the IOMMU are coherent with the CPU caches. > * @tlb: TLB management callbacks for this set of tables. > @@ -96,6 +97,7 @@ struct io_pgtable_cfg { > unsigned long pgsize_bitmap; > unsigned int ias; > unsigned int oas; > + unsigned int nents_per_pgtable; > bool coherent_walk; > const struct iommu_flush_ops *tlb; > struct device *iommu_dev; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel