From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751663AbbIQTYg (ORCPT ); Thu, 17 Sep 2015 15:24:36 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31447 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbbIQTYf (ORCPT ); Thu, 17 Sep 2015 15:24:35 -0400 Date: Thu, 17 Sep 2015 15:24:25 -0400 From: Konrad Rzeszutek Wilk To: Jerome Glisse Cc: Alex Deucher , Dave Airlie , iommu@lists.linux-foundation.org, Joerg Roedel , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] dma/swiotlb: Add helper for device driver to opt-out from swiotlb. Message-ID: <20150917192424.GB21496@x230.dumpdata.com> References: <1442514158-30281-1-git-send-email-jglisse@redhat.com> <20150917190251.GE20952@x230.dumpdata.com> <20150917190656.GF20952@x230.dumpdata.com> <20150917191113.GB6699@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150917191113.GB6699@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2015 at 03:11:14PM -0400, Jerome Glisse wrote: > On Thu, Sep 17, 2015 at 03:06:57PM -0400, Konrad Rzeszutek Wilk wrote: > > On Thu, Sep 17, 2015 at 03:02:51PM -0400, Konrad Rzeszutek Wilk wrote: > > > On Thu, Sep 17, 2015 at 02:22:38PM -0400, jglisse@redhat.com wrote: > > > > From: Jérôme Glisse > > > > > > > > The swiotlb dma backend is not appropriate for some devices like > > > > GPU where bounce buffer or slow dma page allocations is just not > > > > acceptable. With that helper device drivers can opt-out from the > > > > swiotlb and just do sane things without wasting CPU cycles inside > > > > the swiotlb code. > > > > > > What if SWIOTLB is the only one available? > > > > > > And what can't the devices use the TTM DMA backend which sets up > > > buffers which don't need bounce buffer or slow dma page allocations? > > > > And then the followup question. If it opts out - how can it do > > sane things without an DMA API available? It would assume physical > > addresses match the bus addresses which is not always the sane > > thing. > > This is why this is an arch specific function, on x86 with pci device, > the driver knows what is the dma mask and thus if it can access directly > all the memory or not. So in the end swiotlb vs no_mmu gives the same > physical address to the device so there is no difference there. Not with Intel or AMD IOMMUs. The bus address it gives is not the same as the physical address. > > Obviously device driver needs to know what it is doing depending on the > arch and bus the device is use in. > > Cheers, > Jérôme