Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp683034yba; Wed, 24 Apr 2019 08:00:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqylA6SwtgT12WUZG06ZbPlK48b4HYiB819I7YtkQRqotEIndyibVdvidC0Sz0b7WTZ5R8QU X-Received: by 2002:a63:44d:: with SMTP id 74mr17606625pge.149.1556118024789; Wed, 24 Apr 2019 08:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556118024; cv=none; d=google.com; s=arc-20160816; b=oA4y7aqFsSQcu0YZtTbBKJ01RJaG4ALBpF0rt239M20eWaaIgCpyyY1OGC76gi4Q+D wVwtDhXjz4k4cUCPOZZiYfDy4DzUGs2krDXAlw8eNsMTaozj57hbtWBOSr0I6mU7V1NK hxJbWhN5cHVm7zJGLoT2ZZbtDcM+JHvUWhMuux6Z3ybilEbzfthI0CsYNQ4ohOaVQEI9 7Hmgi8dqad0OBQODjWXDxXwuHm8ju1/08W4wGw4QG9UI4zRbe6/ryO8HcpBDtGspRZY2 uH3D9pX4Ntw4sLtrvNWsoP7TUKD0tCeSP6NhtydiZTGXtfu5P4XiyCgkLM93C2RR5aGy UJUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=191itLsaNW+Bv1ABF4fUJY/5eYJljX4mesfEnYK2nzk=; b=XnamlJtZrLKabCdruGix1fYqNODvcXnu206qqBr55AE+TZHmI6kKO5WH2I39I+t2Pi PLy0zRQdvWNaVgKoNavryR4zxMjEIPRASgckRX4zhtC7rz5C0/4H9IJWWCTMyPOnZVjC CeBzgvQh44lgrByJC3qT5c6IyFxHs/sTT43Aj8/3D6yAgFBUwD5Sh6q74WZeJBzsZTU4 4aYKtaCZvsEwDD/imQ1qt3yrMCJaWrgrbeXHHN5GzB8uHVyQmBXjeHPBzZQI8SnIxJ5y 3PMvmXQA7PT2pgnoVV8N5RNFWcdHi6FtS1eOotrBRep/jOK4EtJwXEt9aIEx57UDw3fF XwIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si17915681pgr.24.2019.04.24.08.00.08; Wed, 24 Apr 2019 08:00:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733016AbfDXO5Z (ORCPT + 99 others); Wed, 24 Apr 2019 10:57:25 -0400 Received: from verein.lst.de ([213.95.11.211]:54463 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732498AbfDXO5W (ORCPT ); Wed, 24 Apr 2019 10:57:22 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 5CBC367358; Wed, 24 Apr 2019 16:57:06 +0200 (CEST) Date: Wed, 24 Apr 2019 16:57:05 +0200 From: Christoph Hellwig To: Laurentiu Tudor Cc: Christoph Hellwig , "robin.murphy@arm.com" , "m.szyprowski@samsung.com" , "iommu@lists.linux-foundation.org" , Leo Li , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH] dma-mapping: create iommu mapping for newly allocated dma coherent mem Message-ID: <20190424145705.GB21480@lst.de> References: <20190422165125.21704-1-laurentiu.tudor@nxp.com> <20190422181100.GB32490@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'd be happy to offload all of the mentioned tasks to you if you volunteer. I think the first step is to move the two USB controller that can only DMA to their own BAR off the existing DMA coherent infrastructure. The controllers are already identified using the HCD_LOCAL_MEM flag, so we just need to key off that in the hcd_buffer_* routines and call into a genalloc that has been fed using the bar, replacing the current dma_declare_coherent usage. Take a look at drivers/pci/p2pdma.c for another example of allocating bits of a BAR using genalloc. Another issue in that are just popped up, which is remoteproc_virtio.c, which looks like a complete trainwreck. I'll need to spend time to figure out what the hell they are trying to first, though. Then we need to kill the dma_declare_coherent_memory and dma_release_declared_memory exports ASAP to avoid growing more users. Next is figuring out how we want to plumb the OF / early boot coherent regions into the iommu drivers. I think I want to handle them similar to the per-device CMA regions, that is each of the DMA ops has to manually call into it instead of the page allocator. Fortunately we are down to only about a hand full of instances that are relevant for the reserved memory now.