Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1653968ybz; Sat, 18 Apr 2020 05:43:44 -0700 (PDT) X-Google-Smtp-Source: APiQypJ49CztpdjLwpJ1QMfZY63anLn7ecwPCGvULOgDPmb0DV9X0o8HErky+HQoUVbgjCz0XfDA X-Received: by 2002:a17:906:3481:: with SMTP id g1mr7368604ejb.305.1587213824045; Sat, 18 Apr 2020 05:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587213824; cv=none; d=google.com; s=arc-20160816; b=SKYfgmHDoT3V7e3vuysYBI8TrBRgWgASDvuK0/cieIkmOFggzSld3Oo4TXN4XIXTj/ f4oUzvNoeMRI2onZg6BdhrRvJ/ipRAwrMiIDTm9zetf2ENBEtnDV6ioxJndF3VbgK1Jl OQqTjw/hF/k6O6GzX7pL2XcAuWNuDfnVtb4fjYO8GePNfFSNWSv0uZutmLv33MNy/WtV 1w1xAMBriPlJp1b8Op57N1K5f/FTOnY4ZoTeDlctSSmQvX5xZ3F2HALm5XGVyRwOD/lP ROW+3sjdeO8TEgFtDKG6ORkj9mSLEdmblWItNI5nbF7WrLrjyZ2l35Vyc32M9X5jpbo4 rCzw== 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=g7+GczStEuGZtSr315PRCsl6HWZJygzH8hoDDLsr9BY=; b=V3Z+4t6vZAOPo1jYZYdu6qXRRgT2vxMNVSbMKuIcC0+TLUd2AHF7XV2ezUFWyWSXH2 W8JzWO9DyM3ZnN6rmXXe3S1Qg2iTmNr7YxHNJR3/px3RYGSuPVvAoQ5g46hlg9sN57Lj ipGMo3YtlYLeEN16iNFsH1O+zmIOjNXGoamdHmEaijIX8jHkJ+ylUNx+DKyMuzSl5K0h IZkLERF/X8b9RVgPVTf/qyhmGMuqYmREF/y1bb+noUYbaZhJZP7d7LZolRmg7Ho36Ryy sBog1a/qnkL3wk5CdWi4HF65axITa8fR2eIFJqWV6RJmS8ZBZS/PuH6cGMVoHQQfJ/IF ZCIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck5si15780971ejb.12.2020.04.18.05.43.21; Sat, 18 Apr 2020 05:43:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725932AbgDRMmJ (ORCPT + 99 others); Sat, 18 Apr 2020 08:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725804AbgDRMmJ (ORCPT ); Sat, 18 Apr 2020 08:42:09 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F7EFC061A0C for ; Sat, 18 Apr 2020 05:42:09 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id B57C0342; Sat, 18 Apr 2020 14:42:06 +0200 (CEST) Date: Sat, 18 Apr 2020 14:42:05 +0200 From: Joerg Roedel To: Christoph Hellwig Cc: iommu@lists.linux-foundation.org, Alexey Kardashevskiy , linuxppc-dev@lists.ozlabs.org, Lu Baolu , Greg Kroah-Hartman , Robin Murphy , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] dma-mapping: add a dma_ops_bypass flag to struct device Message-ID: <20200418124205.GD6113@8bytes.org> References: <20200414122506.438134-1-hch@lst.de> <20200414122506.438134-4-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200414122506.438134-4-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christoph, On Tue, Apr 14, 2020 at 02:25:05PM +0200, Christoph Hellwig wrote: > +static inline bool dma_map_direct(struct device *dev, > + const struct dma_map_ops *ops) > +{ > + if (likely(!ops)) > + return true; > + if (!dev->dma_ops_bypass) > + return false; > + > + return min_not_zero(*dev->dma_mask, dev->bus_dma_limit) >= > + dma_direct_get_required_mask(dev); Why is the dma-mask check done here? The dma-direct code handles memory outside of the devices dma-mask with swiotlb, no? I also don't quite get what the difference between setting the dma_ops_bypass flag non-zero and setting ops to NULL is. Joerg