[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190725114348.GA30957@lst.de>
Date: Thu, 25 Jul 2019 13:43:48 +0200
From: Christoph Hellwig <hch@....de>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Christoph Hellwig <hch@....de>,
David Woodhouse <dwmw2@...radead.org>,
Joerg Roedel <joro@...tes.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, ashok.raj@...el.com,
jacob.jun.pan@...el.com, alan.cox@...el.com, kevin.tian@...el.com,
mika.westerberg@...ux.intel.com, Ingo Molnar <mingo@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
pengfei.xu@...el.com,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Jonathan Corbet <corbet@....net>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: Re: [PATCH v5 02/10] iommu/vt-d: Use per-device dma_ops
On Thu, Jul 25, 2019 at 03:18:03PM +0800, Lu Baolu wrote:
>> Don't we need to keep this bit so that we still allow the IOMMU
>> to act if the device has a too small DMA mask to address all memory in
>> the system, even if if it should otherwise be identity mapped?
>>
>
> This checking happens only when device is using an identity mapped
> domain. If the device has a small DMA mask, swiotlb will be used for
> high memory access.
>
> This is supposed to be handled in dma_direct_map_page():
>
> if (unlikely(!dma_direct_possible(dev, dma_addr, size)) &&
> !swiotlb_map(dev, &phys, &dma_addr, size, dir, attrs)) {
> report_addr(dev, dma_addr, size);
> return DMA_MAPPING_ERROR;
> }
Well, yes. But the point is that the current code uses dynamic iommu
mappings even if the devices is in the identity mapped domain when the
dma mask іs too small to map all memory directly. Your change means it
will now use swiotlb which is most likely going to be a lot more
expensive. I don't think that this change is a good idea, and even if
we decide that this is a good idea after all that should be done in a
separate prep patch that explains the rationale.
> Best regards,
> Baolu
---end quoted text---
Powered by blists - more mailing lists