[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB52762BCC8AC154A601B6EBCA8C232@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Mon, 4 Mar 2024 07:48:27 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, "Will
Deacon" <will@...nel.org>, Robin Murphy <robin.murphy@....com>, "Jason
Gunthorpe" <jgg@...pe.ca>, "Badger, Eric" <ebadger@...estorage.com>
CC: "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/3] iommu/vt-d: Setup scalable mode context entry in
probe path
> From: Lu Baolu <baolu.lu@...ux.intel.com>
> Sent: Thursday, February 29, 2024 5:48 PM
>
> +static int device_pasid_table_setup(struct device *dev, u8 bus, u8 devfn)
> +{
> + struct device_domain_info *info = dev_iommu_priv_get(dev);
> + struct intel_iommu *iommu = info->iommu;
> + struct context_entry *context;
> +
> + spin_lock(&iommu->lock);
> + context = iommu_context_addr(iommu, bus, devfn, true);
> + if (!context) {
> + spin_unlock(&iommu->lock);
> + return -ENOMEM;
> + }
> +
> + if (context_present(context) && !context_copied(iommu, bus, devfn))
> {
> + spin_unlock(&iommu->lock);
> + return 0;
> + }
> +
> + /*
> + * For kdump case, at this point, the device is supposed to finish
> + * reset at its driver probe stage, so no in-flight DMA will exist,
> + * and we don't need to worry anymore hereafter.
> + */
> + if (context_copied(iommu, bus, devfn)) {
> + context_clear_entry(context);
> + if (!ecap_coherent(iommu->ecap))
> + clflush_cache_range(context, sizeof(*context));
> + sm_context_flush_caches(dev);
> + clear_context_copied(iommu, bus, devfn);
> + }
it's unclear to me why this doesn't need refer to old did as done in the
existing code. If scalable mode makes any difference could you extend
the comment to explain so people can avoid similar confusion when
comparing the different paths between legacy and sm?
anyway it's kind of a semantics change probably worth a separate patch
to special case sm for bisect and then doing cleanup...
Powered by blists - more mailing lists