From: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: "Liu, Yi L" <yi.l.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org"
<joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
"dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org"
<dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
Date: Fri, 20 Oct 2017 08:48:55 +0800 [thread overview]
Message-ID: <59E947F7.4030402@linux.intel.com> (raw)
In-Reply-To: <A2975661238FB949B60364EF0F2C257439AFB902-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
Hi Yi,
On 10/19/2017 02:40 PM, Liu, Yi L wrote:
>
>> -----Original Message-----
>> From: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org [mailto:iommu-
>> bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org] On Behalf Of Lu Baolu
>> Sent: Thursday, October 19, 2017 8:39 AM
>> To: joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org; dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
>> Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Subject: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
>>
>> intel_svm_alloc_pasid_tables() might return an error but never be checked by the
>> callers. Later when intel_svm_bind_mm() is called, there are no checks for valid pasid
>> tables before enabling them.
>>
>> Signed-off-by: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> ---
>> drivers/iommu/intel-svm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index
>> f6697e5..43280ca 100644
>> --- a/drivers/iommu/intel-svm.c
>> +++ b/drivers/iommu/intel-svm.c
>> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int
>> flags, struct svm_dev_
>> int pasid_max;
>> int ret;
>>
>> - if (WARN_ON(!iommu))
>> + if (WARN_ON(!iommu || !iommu->pasid_table))
> [Liu, Yi L] Hi Baolu, I guess there also need a check to iommu->ecap , see if the pasid bit
> is reported. thoughts?
>
If pasid bit is not set in ecap register, iommu->pasid_table won't be set.
We did this by:
if (pasid_enabled(iommu))
intel_svm_alloc_pasid_tables(iommu);
Best regards,
Lu Baolu
next prev parent reply other threads:[~2017-10-20 0:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 0:39 [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails Lu Baolu
2017-10-19 0:39 ` [PATCH 2/3] iommu/vt-d: Clear Page Request Overflow fault bit Lu Baolu
2017-10-19 0:39 ` [PATCH 3/3] iommu/vt-d: Clear pasid table entry when memory unbound Lu Baolu
2017-10-19 6:40 ` [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails Liu, Yi L
[not found] ` <A2975661238FB949B60364EF0F2C257439AFB902-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-10-20 0:48 ` Lu Baolu [this message]
[not found] ` <59E947F7.4030402-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-10-20 6:32 ` Liu, Yi L
[not found] ` <1508373556-5340-1-git-send-email-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-11-06 20:13 ` Alex Williamson
[not found] ` <20171106131309.6bc1084a-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2017-11-07 2:57 ` Lu Baolu
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=59E947F7.4030402@linux.intel.com \
--to=baolu.lu-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=yi.l.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).