From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>
Cc: baolu.lu@linux.intel.com, Joerg Roedel <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
"Srinivasan, Raghunathan" <raghunathan.srinivasan@intel.com>,
Jacob Pan <jacob.jun.pan@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] iommu/vt-d: Allow zero SAGAW if second-stage not supported
Date: Fri, 24 Mar 2023 16:50:22 +0800 [thread overview]
Message-ID: <62b2ee87-642c-d951-3c5e-9d6f035b5717@linux.intel.com> (raw)
In-Reply-To: <BN9PR11MB52768EB838F5E7219BE058F08C849@BN9PR11MB5276.namprd11.prod.outlook.com>
On 2023/3/24 12:49, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@linux.intel.com>
>> Sent: Saturday, March 18, 2023 10:48 AM
>>
>> The VT-d spec states (section 11.4.2) that hardware implementations
>> reporting second-stage translation support (SSTS) field as Clear also
>> report the SAGAW field as 0. Reflect this in the sanity check of
>> alloc_iommu().
>>
>> Fixes: 792fb43ce2c9 ("iommu/vt-d: Enable Intel IOMMU scalable mode by
>> default")
>> Suggested-by: Raghunathan Srinivasan <raghunathan.srinivasan@intel.com>
>> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>> drivers/iommu/intel/dmar.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
>> index 6acfe879589c..23828d189c2a 100644
>> --- a/drivers/iommu/intel/dmar.c
>> +++ b/drivers/iommu/intel/dmar.c
>> @@ -1071,7 +1071,8 @@ static int alloc_iommu(struct dmar_drhd_unit
>> *drhd)
>> }
>>
>> err = -EINVAL;
>> - if (cap_sagaw(iommu->cap) == 0) {
>> + if (!cap_sagaw(iommu->cap) &&
>> + (!ecap_smts(iommu->ecap) || ecap_slts(iommu->ecap))) {
>> pr_info("%s: No supported address widths. Not attempting
>> DMA translation.\n",
>> iommu->name);
>> drhd->ignored = 1;
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
>
> btw I wonder whether it's cleaner to record separate agaw values for
> stage1/stage2 instead of picking a minimal set from both in
> __iommu_calculate_sagaw().
That's better. The agaw could be picked according to which stage the
domain is used for translation.
Best regards,
baolu
prev parent reply other threads:[~2023-03-24 8:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-18 2:48 [PATCH 1/1] iommu/vt-d: Allow zero SAGAW if second-stage not supported Lu Baolu
2023-03-24 4:49 ` Tian, Kevin
2023-03-24 8:50 ` Baolu Lu [this message]
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=62b2ee87-642c-d951-3c5e-9d6f035b5717@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.jun.pan@linux.intel.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=raghunathan.srinivasan@intel.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.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