Re: [PATCH v2 02/16] iommu/vt-d: add bind_pasid_table function
From: Joerg Roedel
Date: Tue Oct 10 2017 - 09:21:27 EST
On Thu, Oct 05, 2017 at 04:03:30PM -0700, Jacob Pan wrote:
> + pdev = to_pci_dev(dev);
> + if (!pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI))
> + return -EINVAL;
> + sid = PCI_DEVID(bus, devfn);
Okay, you search for the PRI capability ...
> +
> + info = dev->archdata.iommu;
> + if (!info || !info->pasid_supported) {
> + dev_err(dev, "No PASID support\n");
> + ret = -EINVAL;
> + goto out;
> + }
> + if (!info->pasid_enabled) {
> + ret = pci_enable_pasid(pdev, info->pasid_supported & ~1);
> + if (ret)
> + goto out;
... and you enable PASID in bind_pasid_table() ...
> + /*
> + * REVISIT: we might want to clear the PASID table pointer
> + * as part of context clear operation. Currently, it leaves
> + * stale data but should be ignored by hardware since PASIDE
> + * is clear.
> + */
> + /* ATS will be reenabled when remapping is restored */
> + pci_disable_ats(to_pci_dev(dev));
.. while you disable ATS in unbind_pasid_table(). Where does this
asymmetry come from?
> #define CONTEXT_DINVE (1ULL << 8)
> #define CONTEXT_PRS (1ULL << 9)
> +#define CONTEXT_NESTE (1ULL << 10)
Missing 'D' at the end?