[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ddc8aff-783a-97b9-f5cc-9e27990de278@linux.intel.com>
Date: Thu, 14 Nov 2019 13:14:11 +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 11/13/19 5:53 PM, Christoph Hellwig wrote:
> On Wed, Nov 13, 2019 at 08:03:12AM +0100, Christoph Hellwig wrote:
>> Indeed. And one idea would be to lift the code in the powerpc
>> dma_iommu_ops that check a flag and use the direct ops to the generic
>> dma code and a flag in struct device. We can then switch the intel
>> iommu ops (and AMD Gart) over to it.
>
> Let me know what you think of the branch below. Only compile tested
> and booted on qemu with an emulated intel iommu:
>
> http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-bypass
>
I took a quick look at the related patches on the branch. Most of them
look good to me. But I would like to understand more about below logic.
static int intel_dma_supported(struct device *dev, u64 mask)
{
struct device_domain_info *info = dev->archdata.iommu;
int ret;
ret = dma_direct_supported(dev, mask);
if (ret < 0)
return ret;
if (!info || info == DUMMY_DEVICE_DOMAIN_INFO ||
info == DEFER_DEVICE_DOMAIN_INFO) {
dev->dma_ops_bypass = true;
} else if (info->domain == si_domain) {
if (mask < dma_direct_get_required_mask(dev)) {
dev->dma_ops_bypass = false;
intel_iommu_set_dma_domain(dev);
dev_info(dev, "32bit DMA uses non-identity mapping\n");
} else {
dev->dma_ops_bypass = true;
}
} else {
dev->dma_ops_bypass = false;
}
return 0;
}
Could you please educate me what dma_supported() is exactly for? Will
it always get called during boot? When will it be called?
In above implementation, why do we need to check dma_direct_supported()
at the beginning? And why
if (!info || info == DUMMY_DEVICE_DOMAIN_INFO ||
info == DEFER_DEVICE_DOMAIN_INFO) {
dev->dma_ops_bypass = true;
Best regards,
baolu
Powered by blists - more mailing lists