Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3224761ybb; Mon, 6 Apr 2020 04:51:06 -0700 (PDT) X-Google-Smtp-Source: APiQypKMNuozaqPy/7SbwLh6XsEUkOaOPMdEx260nsO6nK+ns0IWnL36oonDYkzi/upVGrM/gJdh X-Received: by 2002:a4a:a126:: with SMTP id i38mr17215199ool.11.1586173865985; Mon, 06 Apr 2020 04:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586173865; cv=none; d=google.com; s=arc-20160816; b=QJ4ilTP7eibIdn7IzprgT1ayoN6PHhcTfFWCU5LTopKBa84mW6VZnSCvLJosrc5wZZ kICn2sgP8gqgO2TpA3qQm75HMD3qNAUu1tcRUFYKkTZvQp+9vnXRpG8G/rI7Q44GD0Ji ThMcA7T+US7+9Dp/ezLh9Z3UrRxJyY9S2EUaHj796++FxVS2FQH/1VAkI7qf8M8jtgO7 nFm2ejjaEiDBq55KUhQx5SjFyyEgbHpjA+zh9/N+GcEyBvjjjJiapeoBJa+TFtyuf25l Y/RhWeQDzGHv+Y+u4ZkJZylOkQ1p4e+182vHjWVOYNAHeiEUMEYcHXYqMfZlXEDuUaDs jPjQ== 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=ISy0o9erml7x/WxBGsozuw2amnN7ZDjRsM1k/uxjlB0=; b=Z0YXXgoxosWBdq3LtzkGwG+njnFi+yWSr4AeeT/rMlj0a1Wzdjv6FHb00mWua/pOug u87Td7IX+fnVBojThbSAtxcQl3Tt5wKnOcQcjkrb8neSBj7DXtN+f1x9hwf9sNnM8hSf Z5JnOu50MnRZCr+Z47O9z1Qnuw8OY6l623ZTe4bCq9Ns9hqiWXm/VYg7uq3aD+OviI4e QsATdkLTDc3+/QqpRJxIQ4kStUgb3JmQ9T4ukpthVjc9l/xhT7fC7ALY1wBOrj+kcx1W ikqOeLFPKwFcPyo0ZDkSwP12/wX/lwYRi9SGwd29arvVVBZJmC7IFoxUV+d/ntceJNoT JLHA== 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 u25si8243507otg.199.2020.04.06.04.50.54; Mon, 06 Apr 2020 04:51:05 -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 S1727699AbgDFLuW (ORCPT + 99 others); Mon, 6 Apr 2020 07:50:22 -0400 Received: from verein.lst.de ([213.95.11.211]:33172 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727515AbgDFLuW (ORCPT ); Mon, 6 Apr 2020 07:50:22 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 35D0268C4E; Mon, 6 Apr 2020 13:50:17 +0200 (CEST) Date: Mon, 6 Apr 2020 13:50:16 +0200 From: Christoph Hellwig To: Alexey Kardashevskiy Cc: Christoph Hellwig , "Aneesh Kumar K.V" , iommu@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, Lu Baolu , Greg Kroah-Hartman , Joerg Roedel , Robin Murphy , linux-kernel@vger.kernel.org, Michael Ellerman Subject: Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device Message-ID: <20200406115016.GA10941@lst.de> References: <20200323083705.GA31245@lst.de> <20200323085059.GA32528@lst.de> <87sghz2ibh.fsf@linux.ibm.com> <20200323172256.GB31269@lst.de> <20200324075402.GJ23447@lst.de> <41975da3-3a4a-fc3c-2b90-8d607cf220e6@ozlabs.ru> <20200325083740.GC21605@lst.de> <213b0c7d-f908-b4f4-466d-6240c3622cd6@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <213b0c7d-f908-b4f4-466d-6240c3622cd6@ozlabs.ru> 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 On Fri, Apr 03, 2020 at 07:38:11PM +1100, Alexey Kardashevskiy wrote: > > > On 26/03/2020 12:26, Alexey Kardashevskiy wrote: > > > > > > On 25/03/2020 19:37, Christoph Hellwig wrote: > >> On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashevskiy wrote: > >>>>> This is for persistent memory which you can DMA to/from but yet it does > >>>>> not appear in the system as a normal memory and therefore requires > >>>>> special handling anyway (O_DIRECT or DAX, I do not know the exact > >>>>> mechanics). All other devices in the system should just run as usual, > >>>>> i.e. use 1:1 mapping if possible. > >>>> > >>>> On other systems (x86 and arm) pmem as long as it is page backed does > >>>> not require any special handling. This must be some weird way powerpc > >>>> fucked up again, and I suspect you'll have to suffer from it. > >>> > >>> > >>> It does not matter if it is backed by pages or not, the problem may also > >>> appear if we wanted for example p2p PCI via IOMMU (between PHBs) and > >>> MMIO might be mapped way too high in the system address space and make > >>> 1:1 impossible. > >> > >> How can it be mapped too high for a direct mapping with a 64-bit DMA > >> mask? > > > > The window size is limited and often it is not even sparse. It requires > > an 8 byte entry per an IOMMU page (which is most commonly is 64k max) so > > 1TB limit (a guest RAM size) is a quite real thing. MMIO is mapped to > > guest physical address space outside of this 1TB (on PPC). > > > > > > I am trying now this approach on top of yours "dma-bypass.3" (it is > "wip", needs an upper boundary check): > > https://github.com/aik/linux/commit/49d73c7771e3f6054804f6cfa80b4e320111662d > > Do you see any serious problem with this approach? Thanks! Do you have a link to the whole branch? The github UI is unfortunately unusable for that (or I'm missing something).