[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527652A8EB70FF1FEB0E74308C0BA@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 2 Aug 2023 07:22:19 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: "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>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>
CC: "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
> 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.
> +
> + 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().
>
> 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.
Powered by blists - more mailing lists