Re: [PATCH v2 08/11] iommu/vt-d: Use pci_ats_supported()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020/3/12 15:54, Jean-Philippe Brucker wrote:
Hi Baolu,

On Thu, Mar 12, 2020 at 09:44:16AM +0800, Lu Baolu wrote:
Hi Jean,

On 2020/3/11 20:45, Jean-Philippe Brucker wrote:
The pci_ats_supported() function checks if a device supports ATS and is
allowed to use it.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx>
---
   drivers/iommu/intel-iommu.c | 9 +++------
   1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6fa6de2b6ad5..17208280ef5c 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1454,8 +1454,7 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info)
   	    !pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32))
   		info->pri_enabled = 1;
   #endif
-	if (!pdev->untrusted && info->ats_supported &&
-	    pci_ats_page_aligned(pdev) &&
+	if (info->ats_supported && pci_ats_page_aligned(pdev) &&
   	    !pci_enable_ats(pdev, VTD_PAGE_SHIFT)) {
   		info->ats_enabled = 1;
   		domain_update_iotlb(info->domain);
@@ -2611,10 +2610,8 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
   	if (dev && dev_is_pci(dev)) {
   		struct pci_dev *pdev = to_pci_dev(info->dev);
-		if (!pdev->untrusted &&
-		    !pci_ats_disabled() &&

The pci_ats_disabled() couldn't be replaced by pci_ats_supported(). Even
pci_ats_supported() returns true, user still can disable it. Or move
ats_disabled into pci_ats_supported()?

It is already there, but hidden behind the "if (!dev->ats_cap)":
pci_ats_init() only sets dev->ats_cap after checking that
pci_ats_disabled() returns false.


Ah! Yes.

Acked-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>

Thanks,
Jean

Best regards,
baolu



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux