Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"De Marchi, Lucas" <lucas.demarchi@intel.com>,
	"Kurmi, Suresh Kumar" <suresh.kumar.kurmi@intel.com>,
	"Saarinen, Jani" <jani.saarinen@intel.com>,
	"Auld, Matthew" <matthew.auld@intel.com>,
	"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>
Subject: Re: REGRESSION on linux-next (next-20251106)
Date: Wed, 19 Nov 2025 14:51:19 -0400	[thread overview]
Message-ID: <20251119185119.GP120075@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB52760A6BE22F89D29685690F8CD7A@BN9PR11MB5276.namprd11.prod.outlook.com>

On Wed, Nov 19, 2025 at 09:31:50AM +0000, Tian, Kevin wrote:

> old way:
> 
> 	if (first_stage)
> 		domain->domain.geometry.aperture_end = __DOMAIN_MAX_ADDR(domain->gaw - 1);
> 	else
> 		domain->domain.geometry.aperture_end = __DOMAIN_MAX_ADDR(domain->gaw);
> 
> i.e. both are initialized around domain->gaw.
> 
> but the new way has difference between first-stage and second-stage as
> Jason pointed out already.
> 
> Baolu, what is the number in "Using xxx-bit DMA addresses" when
> using second-stage?

He said 42.

Indeed Chaitanya's dmesg has this:

[    0.079787] DMAR: Host address width 42

Which I think explains the bug. The dmar->width is being ignored by
the driver except for that print.

> my  understanding of various 'gaw' fields are only about second stage, but
> maybe there is something we overlooked...

That is what the spec says:

  MGAW: Maximum Guest Address Width

  This field indicates the maximum guest physical address width
  supported by second-stage translation in remapping hardware. The
  Maximum Guest Address Width (MGAW) is computed as (N+1),
  where N is the valued reported in this field. For example, a hardware
  implementation supporting 48-bit MGAW reports a value of 47
  (101111b) in this fiel

Seems very clear it is related to the second stage in that paragraph..

So, I think what has happened here is the old driver mis-used mgaw for
the first stage:

	addr_width = agaw_to_width(iommu->agaw);
	if (addr_width > cap_mgaw(iommu->cap))
		addr_width = cap_mgaw(iommu->cap);
	domain->gaw = addr_width;

And fully ignored dmar->width, which happened to work because mgaw < dmar->width

So we should be using dmar->width to constrain the first stage and
expect that mgaw is less than dmar->width ?

Jason

  reply	other threads:[~2025-11-19 18:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  6:36 REGRESSION on linux-next (next-20251106) Borah, Chaitanya Kumar
2025-11-12 22:32 ` Jason Gunthorpe
2025-11-13  2:00   ` Tian, Kevin
2025-11-17 15:24     ` Jason Gunthorpe
2025-11-17 12:54   ` Baolu Lu
2025-11-17 15:22     ` Jason Gunthorpe
2025-11-18  1:29 ` Jason Gunthorpe
2025-11-18  4:04   ` Tian, Kevin
2025-11-18  6:19     ` Baolu Lu
2025-11-18  6:23     ` Baolu Lu
2025-11-18  7:47       ` Tian, Kevin
2025-11-18 11:29         ` Baolu Lu
2025-11-18 12:35           ` Jason Gunthorpe
2025-11-19  7:25             ` Baolu Lu
2025-11-18 10:30   ` Baolu Lu
2025-11-18 15:16   ` Borah, Chaitanya Kumar
2025-11-18 16:13     ` Jason Gunthorpe
2025-11-19  7:40       ` Borah, Chaitanya Kumar
2025-11-19  9:31         ` Tian, Kevin
2025-11-19 18:51           ` Jason Gunthorpe [this message]
2025-11-19 23:56             ` Tian, Kevin
2025-11-20  2:18               ` Jason Gunthorpe
2025-11-20  2:24                 ` Baolu Lu
2025-11-20  7:27                 ` Baolu Lu
2025-11-20  0:19             ` Tian, Kevin
2025-11-19  9:29       ` Baolu Lu

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=20251119185119.GP120075@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=iommu@lists.linux.dev \
    --cc=jani.saarinen@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=suresh.kumar.kurmi@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