[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc831f88-5b19-7531-00aa-a7577dd5c1ac@linux.intel.com>
Date: Thu, 25 Jul 2019 15:18:03 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Christoph Hellwig <hch@....de>
Cc: baolu.lu@...ux.intel.com, 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
Hi Christoph,
On 7/25/19 1:44 PM, Christoph Hellwig wrote:
>> /* Check if the dev needs to go through non-identity map and unmap process.*/
>> static bool iommu_need_mapping(struct device *dev)
>> {
>> - int ret;
>> -
>> if (iommu_dummy(dev))
>> return false;
>>
>> - ret = identity_mapping(dev);
>> - if (ret) {
>> - u64 dma_mask = *dev->dma_mask;
>> -
>> - if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask)
>> - dma_mask = dev->coherent_dma_mask;
>> -
>> - if (dma_mask >= dma_get_required_mask(dev))
>> - return false;
>
> 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;
}
Best regards,
Baolu
Powered by blists - more mailing lists