public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kyung Min Park <kyung.min.park@intel.com>
To: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Cc: baolu.lu@linux.intel.com, dwmw2@infradead.org, joro@8bytes.org,
	will@kernel.org, jacob.jun.pan@linux.intel.com,
	ashok.raj@intel.com, ravi.v.shankar@intel.com,
	yian.chen@intel.com, sohil.mehta@intel.com,
	Kyung Min Park <kyung.min.park@intel.com>
Subject: [PATCH] iommu/vt-d: Disable SVM when ATS/PRI/PASID are not enabled in the device
Date: Sun, 14 Mar 2021 13:15:34 -0700	[thread overview]
Message-ID: <20210314201534.918-1-kyung.min.park@intel.com> (raw)

Currently, the Intel VT-d supports Shared Virtual Memory (SVM) only when
IO page fault is supported. Otherwise, shared memory pages can not be
swapped out and need to be pinned. The device needs the Address Translation
Service (ATS), Page Request Interface (PRI) and Process Address Space
Identifier (PASID) capabilities to be enabled to support IO page fault.

Disable SVM when ATS, PRI and PASID are not enabled in the device.

Signed-off-by: Kyung Min Park <kyung.min.park@intel.com>
---
 drivers/iommu/intel/iommu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index ee0932307d64..956a02eb40b4 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -5380,6 +5380,9 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
 		if (!info)
 			return -EINVAL;
 
+		if (!info->pasid_enabled || !info->pri_enabled || !info->ats_enabled)
+			return -EINVAL;
+
 		if (info->iommu->flags & VTD_FLAG_SVM_CAPABLE)
 			return 0;
 	}
-- 
2.17.1


             reply	other threads:[~2021-03-14 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-14 20:15 Kyung Min Park [this message]
2021-03-15  0:30 ` [PATCH] iommu/vt-d: Disable SVM when ATS/PRI/PASID are not enabled in the device Lu Baolu
2021-03-18 10:24 ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210314201534.918-1-kyung.min.park@intel.com \
    --to=kyung.min.park@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=sohil.mehta@intel.com \
    --cc=will@kernel.org \
    --cc=yian.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox