From: Baolu Lu <baolu.lu@linux.intel.com>
To: "tina.zhang" <tina.zhang@intel.com>, iommu@lists.linux.dev
Cc: baolu.lu@linux.intel.com
Subject: Re: [PATCH] iommu/vt-d: Set SRE bit when hardware has SRS cap
Date: Tue, 15 Nov 2022 09:40:44 +0800 [thread overview]
Message-ID: <c063e57d-6703-911a-4042-2e58fd91e3b2@linux.intel.com> (raw)
In-Reply-To: <adfe9835-2a05-95d8-5506-5fb6163bed43@intel.com>
On 11/15/22 7:55 AM, tina.zhang wrote:
>
> On 11/14/22 20:00, Baolu Lu wrote:
>> On 2022/11/14 16:55, Tina Zhang wrote:
>>> SRS cap is the hardware cap telling if the hardware IOMMU can support
>>> requests seeking supervisor privilege or not. SRE bit in scalable-mode
>>> PASID table entry is treated as Reserved(0) for implementation not
>>> supporting SRS cap.
>>>
>>> Checking SRS cap before setting SRE bit can avoid the non-recoverable
>>> fault of "Non-zero reserved field set in PASID Table Entry" caused by
>>> setting SRE bit while there is no SRS cap support.
>>>
>>> Currently, both intel_pasid_setup_first_level() and
>>> intel_pasid_setup_second_level() implicitly take care about of it. The
>>> only missing SRS cap checking is in intel_pasid_setup_pass_through().
>>>
>>> Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table
>>> interface")
>>> Signed-off-by: Tina Zhang<tina.zhang@intel.com>
>>
>> Nice catch! Tina.
>>
>> Can you please double check intel_pasid_setup_second_level()? Its seems
>> that we missed such check there as well.
> Hi Baolu,
>
> Yes, I thought about it.
>
> In current kernel code, the intel_pasid_setup_second_level() is called
> only in one place and value of the pasid parameter is PASID_RID2PASID.
> In the body of intel_pasid_setup_second_level, the pasid_set_sre() won't
> be called if pasid == PASID_RID2PASID, see:
>
> intel_pasid_setup_second_level(..., pasid) {
> ...
> if (pasid != PASID_RID2PASID)
> pasid_set_sre(pte);
> ...
>
> }
>
> IIUC, in the current kernel code we don't have the case which can test
> pasid_set_sre(pte) for second_level PASID_ENTRY_PGTT_SL_ONLY. But in
> feature, if we add more points to invoke
> intel_pasid_setup_second_level(), we may need to checkout this SRS cap.
>
> So, do you think we should include the checking in
> intel_pasid_setup_second_level() as well in this patch?
I guess the purpose of this patch is to make sure that software never
sets the pasid entry fields that are treated by the hardware as
Reserved(0). If so, let's make it explicit in all places. :-)
Best regards,
baolu
next prev parent reply other threads:[~2022-11-15 1:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 8:55 [PATCH] iommu/vt-d: Set SRE bit when hardware has SRS cap Tina Zhang
2022-11-14 12:00 ` Baolu Lu
2022-11-14 23:55 ` tina.zhang
2022-11-15 1:40 ` Baolu Lu [this message]
2022-11-15 2:12 ` tina.zhang
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=c063e57d-6703-911a-4042-2e58fd91e3b2@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=tina.zhang@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