[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f673c178-b52d-29cc-b337-0d0aa761f101@linux.intel.com>
Date: Thu, 3 Aug 2023 11:17:49 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"joro@...tes.org" <joro@...tes.org>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"jgg@...dia.com" <jgg@...dia.com>,
"robin.murphy@....com" <robin.murphy@....com>
Cc: baolu.lu@...ux.intel.com, "cohuck@...hat.com" <cohuck@...hat.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>,
"nicolinc@...dia.com" <nicolinc@...dia.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"chao.p.peng@...ux.intel.com" <chao.p.peng@...ux.intel.com>,
"yi.y.sun@...ux.intel.com" <yi.y.sun@...ux.intel.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>,
"lulu@...hat.com" <lulu@...hat.com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"Duan, Zhenzhong" <zhenzhong.duan@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: Re: [PATCH v4 06/12] iommu/vt-d: Set the nested domain to a device
On 2023/8/2 15:22, Tian, Kevin wrote:
>> From: Liu, Yi L <yi.l.liu@...el.com>
>> Sent: Monday, July 24, 2023 7:13 PM
>> +
>> +static int intel_nested_attach_dev(struct iommu_domain *domain,
>> + struct device *dev)
>> +{
>> + struct device_domain_info *info = dev_iommu_priv_get(dev);
>> + struct dmar_domain *dmar_domain = to_dmar_domain(domain);
>> + struct intel_iommu *iommu = info->iommu;
>> + unsigned long flags;
>> + int ret = 0;
>> +
>> + if (info->domain)
>> + device_block_translation(dev);
>> +
>> + if (iommu->agaw < dmar_domain->s2_domain->agaw) {
>> + dev_err_ratelimited(dev, "Adjusted guest address width not
>> compatible\n");
>> + return -ENODEV;
>> + }
>
> this is the check duplicated with patch04.
Ack. No need for a check here.
>
>> +
>> + ret = domain_attach_iommu(dmar_domain, iommu);
>> + if (ret) {
>> + dev_err_ratelimited(dev, "Failed to attach domain to
>> iommu\n");
>> + return ret;
>> + }
>> +
>
> [...]
>
>> + domain_update_iommu_cap(dmar_domain);
>
> iommu_cap is already updated in domain_attach_iommu().
Ack. We will eventually remove this helper when every domain is
allocated for a specific device.
>>
>> static const struct iommu_domain_ops intel_nested_domain_ops = {
>> + .attach_dev = intel_nested_attach_dev,
>> .free = intel_nested_domain_free,
>> + .enforce_cache_coherency = intel_iommu_enforce_cache_coherency,
>
> this is not required. enforce_cache_coherency() will be called on parent
> hwpt when it's being created. patch04 should check parent's force_snooping
> to set pgsnp in the pasid entry.
>
> As Jason explained it should be done only for kernel owned page table.
Ack and thanks!
Best regards,
baolu
Powered by blists - more mailing lists