Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3484712ybb; Mon, 23 Mar 2020 01:52:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvh+BrZ4rtxRftDw2K0c/s7ptodLHIcHrhuupSoYkkP4pl/XcFSrVt9hBHYfjYt/WtXk9su X-Received: by 2002:a9d:2963:: with SMTP id d90mr16070498otb.149.1584953542195; Mon, 23 Mar 2020 01:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584953542; cv=none; d=google.com; s=arc-20160816; b=b6b4ERb+CqdEKQrV7cRW/KVuXKihtgPDQcfHcmQGGB1Jc3eioRVOoHsPFzWTA05hQy XHXCyX9XSsl/bp/Q6ZclLSQ/1jv0uMdAGEJemrzThdpiLFxy4BdxGpnbDF9OWN9+2xhz a9WLPlxyz9ipkorBi2w/mg/yMpkqHUFwYOid3yssa2knRhXjHTi/qNVSH4ZOVsCHnau6 cJmMdfbR21kD3oaxx9hSOxNFtgyDDJyht+OsDjmK5yxVsGjH97sGUXOuChyLpPUPZgVW HnCUXig4CWe/Z8cW8pAl8wOcoz9Wlz25kovs6QZcwpguccbtvaat77GmZUA82ARzC6Ir EkdQ== 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=IjlcCRrhYf2j6ZgsSfvWsa5YX1sPu/5xQqtlQNYIZLQ=; b=dNt5FC2CRDNb2hdSRDaUPTE2AtYo9KvtImZnBz/wvBzMnrakWgwnKDhj9dDiOtzJ88 OY93oib7sb4xcNIY2J/QItLHsLKrpoE+vWPBRU5sYZD/tiQip5zSmrNtq2R/dmFUJiii p9+UBd7YE6gU5N3WwoyPmzMdPzmJgG3mYCxa5riyYtSrK/eWjN0PgbIXUN4wGf3TXnQg aNbH/xvTj3bytmfRb60Iz/+34lBUEOkeu9SRt4ljx5zIL6LUu1VqHJ4aj6//RApOcMmO 65r2Z+SRR61yflBpJ/diOVGYQFY6jIOs1BqNoEi0Cmv6SqGmpHV1vKeqSUAQS/FQwxyR +zIw== 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 n62si7401517oig.196.2020.03.23.01.52.09; Mon, 23 Mar 2020 01:52:22 -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 S1727611AbgCWIvF (ORCPT + 99 others); Mon, 23 Mar 2020 04:51:05 -0400 Received: from verein.lst.de ([213.95.11.211]:57618 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbgCWIvF (ORCPT ); Mon, 23 Mar 2020 04:51:05 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id D778468BEB; Mon, 23 Mar 2020 09:50:59 +0100 (CET) Date: Mon, 23 Mar 2020 09:50:59 +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: <20200323085059.GA32528@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200323083705.GA31245@lst.de> 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 09:37:05AM +0100, Christoph Hellwig wrote: > > > + /* > > > + * Allows IOMMU drivers to bypass dynamic translations if the DMA mask > > > + * is large enough. > > > + */ > > > + if (dev->dma_ops_bypass) { > > > + if (min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit) >= > > > + dma_direct_get_required_mask(dev)) > > > + return true; > > > + } > > > > > > Why not do this in dma_map_direct() as well? > > Mostly beacuse it is a relatively expensive operation, including a > fls64. Which I guess isn't too bad compared to a dynamic IOMMU mapping. Can you just send a draft patch for what you'd like to see for ppc?