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=-15.5 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,USER_AGENT_SANE_1 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 4FB8EC433ED for ; Tue, 6 Apr 2021 12:00:12 +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 8516561019 for ; Tue, 6 Apr 2021 12:00:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8516561019 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: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=1Veqv/PHiXe8cycuTzB/nQKj0U0ZxCFEhl5MhoAN6gI=; b=lyFnQOGKPqrRwle300HKnn92/ NGWlzJtbp2mJn9wU6V4TyXj/kOjYQa++7dO72l/8R5la2NAiOeJQfPOng8CP0U1lXdp/IktzNZEXn gTEg0Mi7RtI18OdpOiOUm5KD4hmmq08dtccIdlRDFfG2Ek+2a/hbWq5+Osd4VaDOokkZfusu21fKs KKSkKMQiqRTCgAfBWvogIYI7zB3t6SGBjo7df1k8gNa3MFSMLxptUqA0H9eGy8jWxd9kPduRJ45M7 wH+/iPsrjGHMsIP2FHZelu2k86ID1b2f8o3bPrW+dl+WIcFCfhJ4S05yPRBmceFVMN2wcVyPb8ABp 8dbp0CFZg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTkLI-002TNO-Sn; Tue, 06 Apr 2021 11:58:01 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lTkL3-002TIH-Uu for linux-arm-kernel@lists.infradead.org; Tue, 06 Apr 2021 11:57:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 508D6613B3; Tue, 6 Apr 2021 11:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617710264; bh=kMBq36ttYBn25xInlOZKxP1/qXt+qqhvwqWmyd1Dln8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gXev4GvIBjXhDbxah9AysmMr/0AW/8gbpH7tY4WisGKlQ+ef9ieu5n6GjrrOlfaxs tjb1B8KyfF+qtWhDI13tyQ3n4AtODS8/H8RVxjMb5+BouYxAumKQ9X4Jut4THk6myO 90elXiUc9HXI7u2r5eza1zY8s+89HVRdZ++wBFtK1aZ+7vLDZUZ8qXdHtcc0yir906 QhAchivm6Hewn7MIk9QNhkPg/BwIpq2VKFwOX0VOI6uoD36RrnzvcjVNQSjToCp7cD P8GpkziCOaM9MbkYyCQowk57ghPAaO1eOYUNZQsJOgYnNQKLpu8Si128S9O+ysXr8+ +yX9hVdlSo6cw== Date: Tue, 6 Apr 2021 12:57:40 +0100 From: Will Deacon To: "Isaac J. Manjarres" Cc: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, robin.murphy@arm.com, pratikp@codeaurora.org Subject: Re: [RFC PATCH v3 03/12] iommu/io-pgtable: Introduce map_pages() as a page table op Message-ID: <20210406115739.GD13747@willie-the-truck> References: <20210405191112.28192-1-isaacm@codeaurora.org> <20210405191112.28192-4-isaacm@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210405191112.28192-4-isaacm@codeaurora.org> 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-20210406_125746_744231_B762AC45 X-CRM114-Status: GOOD ( 17.98 ) 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 Mon, Apr 05, 2021 at 12:11:03PM -0700, Isaac J. Manjarres wrote: > Mapping memory into io-pgtables follows the same semantics > that unmapping memory used to follow (i.e. a buffer will be > mapped one page block per call to the io-pgtable code). This > means that it can be optimized in the same way that unmapping > memory was, so add a map_pages() callback to the io-pgtable > ops structure, so that a range of pages of the same size > can be mapped within the same call. > > Signed-off-by: Isaac J. Manjarres > Suggested-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 2ed0c057d9e7..019149b204b8 100644 > --- a/include/linux/io-pgtable.h > +++ b/include/linux/io-pgtable.h > @@ -143,6 +143,7 @@ struct io_pgtable_cfg { > * struct io_pgtable_ops - Page table manipulation API for IOMMU drivers. > * > * @map: Map a physically contiguous memory region. > + * @map_pages: Map a physically contiguous range of pages of the same size. > * @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. > @@ -153,6 +154,9 @@ struct io_pgtable_cfg { > struct io_pgtable_ops { > int (*map)(struct io_pgtable_ops *ops, unsigned long iova, > phys_addr_t paddr, size_t size, int prot, gfp_t gfp); > + int (*map_pages)(struct io_pgtable_ops *ops, unsigned long iova, > + phys_addr_t paddr, size_t pgsize, size_t pgcount, > + int prot, gfp_t gfp, size_t *mapped); How about returning 'size_t' and using IS_ERR_VALUE() instead of adding the extra 'mapped' argument (i.e. return the size of the region mapped or an error code)? I don't think we realistically need to care about map sizes that overlap with the error region. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel