[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <948da337-128f-22ae-7b2e-730b4b8da446@linux.intel.com>
Date: Wed, 5 Feb 2020 09:28:09 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Jian-Hong Pan <jian-hong@...lessm.com>
Cc: David Woodhouse <dwmw2@...radead.org>,
Joerg Roedel <joro@...tes.org>,
iommu@...ts.linux-foundation.org,
Linux Kernel <linux-kernel@...r.kernel.org>,
Linux Upstreaming Team <linux@...lessm.com>
Subject: Re: [PATCH] iommu/intel-iommu: set as DUMMY_DEVICE_DOMAIN_INFO if no
IOMMU
Hi,
On 2020/2/4 17:25, Jian-Hong Pan wrote:
> Lu Baolu <baolu.lu@...ux.intel.com> 於 2020年2月4日 週二 下午2:11寫道:
>>
>> Hi,
>>
>> On 2020/2/3 17:10, Jian-Hong Pan wrote:
>>> If the device has no IOMMU, it still invokes iommu_need_mapping during
>>> intel_alloc_coherent. However, iommu_need_mapping can only check the
>>> device is DUMMY_DEVICE_DOMAIN_INFO or not. This patch marks the device
>>> is a DUMMY_DEVICE_DOMAIN_INFO if the device has no IOMMU.
>>>
>>> Signed-off-by: Jian-Hong Pan <jian-hong@...lessm.com>
>>> ---
>>> drivers/iommu/intel-iommu.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
>>> index 35a4a3abedc6..878bc986a015 100644
>>> --- a/drivers/iommu/intel-iommu.c
>>> +++ b/drivers/iommu/intel-iommu.c
>>> @@ -5612,8 +5612,10 @@ static int intel_iommu_add_device(struct device *dev)
>>> int ret;
>>>
>>> iommu = device_to_iommu(dev, &bus, &devfn);
>>> - if (!iommu)
>>> + if (!iommu) {
>>> + dev->archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
>>
>> Is this a DMA capable device?
>
> Do you mean is the device in DMA Remapping table?
> Dump DMAR from ACPI table. The device is not in the table.
> So, it does not support DMAR, Intel IOMMU.
>
> Or, should device_to_iommu be invoked in iommu_need_mapping to check
> IOMMU feature again?
>
Normally intel_iommu_add_device() should only be called for PCI devices
and APCI name space devices (reported in ACPI/DMAR table). In both
cases, device_to_iommu() should always return a corresponding iommu. I
just tried to understand why it failed for your case.
Best regards,
baolu
Powered by blists - more mailing lists