From: Jason Gunthorpe <jgg@ziepe.ca>
To: Calvin Owens <calvin@wbinvd.org>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
Lu Baolu <baolu.lu@linux.intel.com>,
Nicolin Chen <nicolinc@nvidia.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH next] iommu/vt-d: Use shallowest supported table depth in sagaw
Date: Thu, 27 Nov 2025 14:32:10 -0400 [thread overview]
Message-ID: <20251127183210.GC738503@ziepe.ca> (raw)
In-Reply-To: <8f257d2651eb8a4358fcbd47b0145002e5f1d638.1764237717.git.calvin@wbinvd.org>
On Thu, Nov 27, 2025 at 09:06:35AM -0800, Calvin Owens wrote:
> The failing condition in paging_domain_compatible_second_stage() is:
>
> /* Page table level is supported. */
> if (!(cap_sagaw(iommu->cap) & BIT(pt_info.aw)))
> return -EINVAL;
>
> This happens because, for many domains on this machine, MGAW=39 but
> SAGAW=0x04: that claims a 39-bit maximum address width, but also claims
> to only support 48-bit/4-level paging, which seems odd.
This logic was intended to deal with this:
static int compute_vasz_lg2_ss(struct intel_iommu *iommu)
{
unsigned int sagaw = cap_sagaw(iommu->cap);
unsigned int mgaw = cap_mgaw(iommu->cap);
/*
* Find the largest table size that both the mgaw and sagaw support.
* This sets both the number of table levels and the valid range of
* IOVA.
*/
if (mgaw >= 48 && (sagaw & BIT(3)))
return min(57, mgaw);
else if (mgaw >= 39 && (sagaw & BIT(2)))
return min(48, mgaw);
else if (mgaw >= 30 && (sagaw & BIT(1)))
return min(39, mgaw);
Though it is not right..
I didn't consider that this would come up, the only way to solve it is
to pass in more information so the tree can be higher than the vasz
requires..
Can you try these two commits?
https://github.com/jgunthorpe/linux/commits/iommu_pt_vtd/
Thanks,
Jason
next prev parent reply other threads:[~2025-11-27 18:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 17:06 [PATCH next] iommu/vt-d: Use shallowest supported table depth in sagaw Calvin Owens
2025-11-27 18:32 ` Jason Gunthorpe [this message]
2025-11-27 20:39 ` Calvin Owens
2025-11-28 0:04 ` Jason Gunthorpe
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=20251127183210.GC738503@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=baolu.lu@linux.intel.com \
--cc=calvin@wbinvd.org \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.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