[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7431e18-a999-51db-2a3a-1f633e81c309@linux.intel.com>
Date: Fri, 9 Aug 2019 08:48:36 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: baolu.lu@...ux.intel.com, Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>, ashok.raj@...el.com,
jacob.jun.pan@...el.com, kevin.tian@...el.com,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: Re: [PATCH 1/2] iommu/vt-d: Detach domain before using a private one
Hi Alex,
On 8/9/19 4:10 AM, Alex Williamson wrote:
> On Tue, 6 Aug 2019 08:14:08 +0800
> Lu Baolu <baolu.lu@...ux.intel.com> wrote:
>
>> When the default domain of a group doesn't work for a device,
>> the iommu driver will try to use a private domain. The domain
>> which was previously attached to the device must be detached.
>>
>> Cc: Ashok Raj <ashok.raj@...el.com>
>> Cc: Jacob Pan <jacob.jun.pan@...ux.intel.com>
>> Cc: Kevin Tian <kevin.tian@...el.com>
>> Cc: Alex Williamson <alex.williamson@...hat.com>
>> Fixes: 942067f1b6b97 ("iommu/vt-d: Identify default domains replaced with private")
>> Reported-by: Alex Williamson <alex.williamson@...hat.com>
>> Link: https://lkml.org/lkml/2019/8/2/1379
>> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
>> ---
>
> Tested-by: Alex Williamson <alex.williamson@...hat.com>
>
> This series resolves the issue I reported against:
> iommu/vt-d: Cleanup get_valid_domain_for_dev()
Thank you for testing it.
Best regards,
Baolu
>
> Thanks,
> Alex
>
>> drivers/iommu/intel-iommu.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
>> index 3e22fa6ae8c8..37259b7f95a7 100644
>> --- a/drivers/iommu/intel-iommu.c
>> +++ b/drivers/iommu/intel-iommu.c
>> @@ -3449,6 +3449,7 @@ static bool iommu_need_mapping(struct device *dev)
>> dmar_domain = to_dmar_domain(domain);
>> dmar_domain->flags |= DOMAIN_FLAG_LOSE_CHILDREN;
>> }
>> + dmar_remove_one_dev_info(dev);
>> get_private_domain_for_dev(dev);
>> }
>>
>> @@ -4803,7 +4804,8 @@ static void dmar_remove_one_dev_info(struct device *dev)
>>
>> spin_lock_irqsave(&device_domain_lock, flags);
>> info = dev->archdata.iommu;
>> - __dmar_remove_one_dev_info(info);
>> + if (info)
>> + __dmar_remove_one_dev_info(info);
>> spin_unlock_irqrestore(&device_domain_lock, flags);
>> }
>>
>> @@ -5281,6 +5283,7 @@ static int intel_iommu_add_device(struct device *dev)
>> if (device_def_domain_type(dev) == IOMMU_DOMAIN_IDENTITY) {
>> ret = iommu_request_dm_for_dev(dev);
>> if (ret) {
>> + dmar_remove_one_dev_info(dev);
>> dmar_domain->flags |= DOMAIN_FLAG_LOSE_CHILDREN;
>> domain_add_dev_info(si_domain, dev);
>> dev_info(dev,
>> @@ -5291,6 +5294,7 @@ static int intel_iommu_add_device(struct device *dev)
>> if (device_def_domain_type(dev) == IOMMU_DOMAIN_DMA) {
>> ret = iommu_request_dma_domain_for_dev(dev);
>> if (ret) {
>> + dmar_remove_one_dev_info(dev);
>> dmar_domain->flags |= DOMAIN_FLAG_LOSE_CHILDREN;
>> if (!get_private_domain_for_dev(dev)) {
>> dev_warn(dev,
>
>
Powered by blists - more mailing lists