Linux IOMMU Development
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>, Joerg Roedel <jroedel@suse.de>,
	Jerry Snitselaar <jsnitsel@redhat.com>,
	patches@lists.linux.dev,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH rc] iommu/amd: Fix geometry.aperture_end for V2 tables
Date: Thu, 12 Jun 2025 10:27:21 +0530	[thread overview]
Message-ID: <434ce0b9-e562-47de-80a3-ffa111f598fc@amd.com> (raw)
In-Reply-To: <20250528115708.GQ61950@nvidia.com>

Jason,


On 5/28/2025 5:27 PM, Jason Gunthorpe wrote:
> On Wed, May 28, 2025 at 02:17:56PM +0530, Vasant Hegde wrote:
>>> Yes, it should use bit 56 for address translation, that is part of the
>>> page table architecture.
>>
>> I have checked with HW architects.
>>
>> In DMA API mode (PASID=0), IOMMU HW does not use canonical
>> addresses. 
> 
> Do you really mean PASID=0 but still using a AMDv2 table with the
> GCR3? That seems wild that only PASID0 would break the normal rules
> for x86 page tables...

Right . AMD V2 (guest page table) with PASID zero (DMA API Mode).

> 
> We already know AMDv1 is different and that is documented, and it only
> works on PASID0.
> 
>> It's safe to use bit 56 (5 level page table) -OR- bit 47 (4 level
>> page table) for address translation (we don't need sign
>> extension). 
> 
> But does it validate that the upper bits are zero or does it ignore
> them? As I mentioned previously ignoring them breaks ATS.

I believe HW will validate and handle ATS requests properly.

> 
>> However when PASID is *enabled* (PASID != 0), then IOMMU
>> expects canonical address bit[63-57] should match bit[56]. Otherwise
>> it will abort the request.
> 
> Okay that's great at least.
> 
> But this is a pain.. Since iommu_domains don't act differently
> depending on what PASID they are linked to we have to use the least
> common denominator, meaning we should disable use of the top bit
> entirely, and disable use of sign extension.

That should be fine. We can limit to `page level - 1` bits.

> 
>> I have requested spec writer to add details in the spec.
> 
> Yes please, this special behavior for PASID0 is very shocking.

yep!

-Vasant


      reply	other threads:[~2025-06-12  4:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 16:21 [PATCH rc] iommu/amd: Fix geometry.aperture_end for V2 tables Jason Gunthorpe
2025-04-24  7:56 ` Vasant Hegde
2025-04-24 14:06   ` Jason Gunthorpe
2025-04-29  6:03     ` Vasant Hegde
2025-05-28  8:47     ` Vasant Hegde
2025-05-28 11:57       ` Jason Gunthorpe
2025-06-12  4:57         ` Vasant Hegde [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=434ce0b9-e562-47de-80a3-ffa111f598fc@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=jsnitsel@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.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