Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3936251ybb; Mon, 23 Mar 2020 10:22:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsBnpRgolNNjn1ePtqxtRWnMdZldIuWSTSdDBlZ7Ja3XihRCeJ8cpGliDnhg+hM5IvcoJ/g X-Received: by 2002:a05:6830:1f54:: with SMTP id u20mr19136188oth.322.1584984166407; Mon, 23 Mar 2020 10:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584984166; cv=none; d=google.com; s=arc-20160816; b=vHwET8R6Ws9ujTK6UvcasUmxXyPFsmqmSEhMYwi9eRlW9oVsA36aFMJrrJciT/ct1p uP1joo9naGlCFgki2ahpa352VAGUr+VEQxJ/R8GrUav/uzTFxgtQ7AX9MGLiBF2Pk6Gz m3/XJ1RpVe0zmge3Y8kwGo9Ok9Qqn7dIt20vwlBit+WZg6Ref5U4Mh29+p1hK1vwkwjO iD64M/wpwGfZID1dF+ZbnP7EXaD+fd29r780ZSwoEVCGBMVlFA+bV5huyuIj31SAfCwx cI8Jc+3HdyH9TTkU/C5yhN9JdZ9FIutgGvEF4w9c928moect7I1NIHQHRyY82wBaHP9W KuIQ== 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=WlPaNWi0IyGQ3OFglP1uJ0gdceAEEtQY+EEhL7FilOY=; b=wlJYFFc0GDPajulDBfBfQn2UJxGCnkGupZ8YDKl2HyYfNyNDJG79HwcA2y1BRL8zZ9 Gr4IXrVOcOJViDtv87ri/NCE2x7JeCZXnQ+m4rO17A0a/NU9rYTnJ5fg3jVqEZWtah8k purEx1e1xT1+rueIQ2o8irHuD3575/2tvHHcFKRvnsh0zxwUuiZxfOCSPc4QNFvuwpUZ CKXANbLY5tE7gX30Lca6UGcak0embOJ6pBeZtBlX7V5KHZNXBKno0/R/dQku7iJZgdpZ sjk0ooXCHB/OZyB6UNSWQI//Qz9WulWlS5zKiU7/KqrvMnCl/mKNz3UxOLbGqL6C0vWW 3B6w== 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 c2si10541282ots.188.2020.03.23.10.22.33; Mon, 23 Mar 2020 10:22:46 -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 S1727647AbgCWRUU (ORCPT + 99 others); Mon, 23 Mar 2020 13:20:20 -0400 Received: from verein.lst.de ([213.95.11.211]:59637 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728088AbgCWRUR (ORCPT ); Mon, 23 Mar 2020 13:20:17 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id C11FA68BEB; Mon, 23 Mar 2020 18:20:14 +0100 (CET) Date: Mon, 23 Mar 2020 18:20:14 +0100 From: Christoph Hellwig To: Alexey Kardashevskiy Cc: Christoph Hellwig , iommu@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, Lu Baolu , Greg Kroah-Hartman , Joerg Roedel , Robin Murphy , linux-kernel@vger.kernel.org, "Aneesh Kumar K.V" Subject: Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device Message-ID: <20200323172014.GA31269@lst.de> References: <20200320141640.366360-1-hch@lst.de> <20200320141640.366360-2-hch@lst.de> <2f31d0dd-aa7e-8b76-c8a1-5759fda5afc9@ozlabs.ru> <20200323083705.GA31245@lst.de> <37ce1b7e-264d-292d-32b1-093b24b3525c@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37ce1b7e-264d-292d-32b1-093b24b3525c@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 Mon, Mar 23, 2020 at 07:58:01PM +1100, Alexey Kardashevskiy wrote: > >> 0x100.0000.0000 .. 0x101.0000.0000 > >> > >> 2x4G, each is 1TB aligned. And we can map directly only the first 4GB > >> (because of the maximum IOMMU table size) but not the other. And 1:1 on > >> that "pseries" is done with offset=0x0800.0000.0000.0000. > >> > >> So we want to check every bus address against dev->bus_dma_limit, not > >> dev->coherent_dma_mask. In the example above I'd set bus_dma_limit to > >> 0x0800.0001.0000.0000 and 1:1 mapping for the second 4GB would not be > >> tried. Does this sound reasonable? Thanks, > > > > bus_dma_limit is just another limiting factor applied on top of > > coherent_dma_mask or dma_mask respectively. > > This is not enough for the task: in my example, I'd set bus limit to > 0x0800.0001.0000.0000 but this would disable bypass for all RAM > addresses - the first and the second 4GB blocks. So what about something like the version here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-bypass.3