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 X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7407DC433ED for ; Thu, 1 Apr 2021 16:50:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C4A061389 for ; Thu, 1 Apr 2021 16:50:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C4A061389 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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: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:List-Owner; bh=BC5hBRWzkR+Kd5t3qoj9oprRikRm0a3VVISAQlFUixg=; b=Ojnf/0/RGxz+GryccQZL/8rHd ovKTbsc/2yqqyD4pyORZJq2A7lAAaTjdoGvfBdfNMJmRp9zS61+kEi5lGRKq3puCkrXHPcfqpaa0r 5U4Z1VLOgD3e4vXNJfnXBl2BDzKW2Ol/6p3L4+shq/xSlvbuePoRB0NALKHojF6SK4iV3oH21jm4a 0p4BkO2XZ1NqaIP8srVBd1Q3DXtTfzgmt+5NS6ss8oCJjX7U1vM6fojH2B+k6V9ZrJohisVGjMoy+ 15kAmBDkdpYfoHWiAFW53JshihHAGfsx9YSAEoujERbyZ69fylmBk/Tg4wNoKKXokEEQBf5EHpo1x YdxqWrhMA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lS0Us-00ANjj-BE; Thu, 01 Apr 2021 16:48:42 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lS0Ul-00ANi7-E6 for linux-arm-kernel@lists.infradead.org; Thu, 01 Apr 2021 16:48:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E527761382; Thu, 1 Apr 2021 16:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617295714; bh=sT6+Td6tnAXtRRYdO8fsQ55JCnLxj+SLLHhf7/QPLgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KSb8ii2ppv2mF8vBxF0OCjLP8ZcATsDmg6EiZi4GbeXuPK86p2he/8WFSIsseUsxX 9/7AwZ5w1q9mN+552kDlDeLGTmA46rCURAupIFTdKN9ayFlSm5PRPBngmD5KcCsh+v HjtKd6tar5UZW+PZvdZkiCF3Xr+J8BmSNyBuAuiqZIQgXjIKEAU+P2ilKKEerTzYFH VzLXTp+kd6aioAWdor7fu0lmr969vRt4iXTme8NpbQxiPBFgFGqa6YoH85lK6XdSJ+ 2/TzrP0vKFE+aniahiBoZI5KAQz3s3WthCbANsV+akPxtbGQAsE1NdT1pRysw4BZ3A h2foJF1F6B+vw== From: Will Deacon To: iommu@lists.linux-foundation.org Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , "Isaac J. Manjarres" , Pratik Patel , Robin Murphy , Lu Baolu Subject: [RFC PATCH 1/6] iommu/io-pgtable: Introduce unmap_pages() as a page table op Date: Thu, 1 Apr 2021 17:47:33 +0100 Message-Id: <20210401164738.9513-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210401164738.9513-1-will@kernel.org> References: <20210401164738.9513-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210401_174835_713416_45812500 X-CRM114-Status: GOOD ( 11.96 ) 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 From: "Isaac J. Manjarres" The io-pgtable code expects to operate on a single block or granule of memory that is supported by the IOMMU hardware when unmapping memory. This means that when a large buffer that consists of multiple such blocks is unmapped, the io-pgtable code will walk the page tables to the correct level to unmap each block, even for blocks that are virtually contiguous and at the same level, which can incur an overhead in performance. Introduce the unmap_pages() page table op to express to the io-pgtable code that it should unmap a number of blocks of the same size, instead of a single block. Doing so allows multiple blocks to be unmapped in one call to the io-pgtable code, reducing the number of page table walks, and indirect calls. Signed-off-by: Isaac J. Manjarres Suggested-by: Will Deacon Signed-off-by: Will Deacon --- include/linux/io-pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index a4c9ca2c31f1..2ed0c057d9e7 100644 --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h @@ -144,6 +144,7 @@ struct io_pgtable_cfg { * * @map: Map a physically contiguous memory region. * @unmap: Unmap a physically contiguous memory region. + * @unmap_pages: Unmap a range of virtually contiguous pages of the same size. * @iova_to_phys: Translate iova to physical address. * * These functions map directly onto the iommu_ops member functions with @@ -154,6 +155,9 @@ struct io_pgtable_ops { phys_addr_t paddr, size_t size, int prot, gfp_t gfp); size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova, size_t size, struct iommu_iotlb_gather *gather); + size_t (*unmap_pages)(struct io_pgtable_ops *ops, unsigned long iova, + size_t pgsize, size_t pgcount, + struct iommu_iotlb_gather *gather); phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops, unsigned long iova); }; -- 2.31.0.291.g576ba9dcdaf-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel