From: Jason Gunthorpe <jgg@ziepe.ca>
To: Vasant Hegde <vasant.hegde@amd.com>
Cc: iommu@lists.linux.dev, joro@8bytes.org,
suravee.suthikulpanit@amd.com, wei.huang2@amd.com,
jsnitsel@redhat.com
Subject: Re: [PATCH RESEND 03/10] iommu/amd: Initial SVA support for AMD IOMMU
Date: Mon, 11 Sep 2023 09:41:07 -0300 [thread overview]
Message-ID: <ZP8K40ASDPAcp+/X@ziepe.ca> (raw)
In-Reply-To: <14ab1dbd-26f1-3935-65d7-1d1835cb062d@amd.com>
On Mon, Sep 11, 2023 at 05:46:39PM +0530, Vasant Hegde wrote:
> Jason,
>
> On 9/5/2023 11:44 PM, Jason Gunthorpe wrote:
> > On Tue, Sep 05, 2023 at 08:09:39PM +0530, Vasant Hegde wrote:
> >>>> - set_dev_pasid() will check the compatibility and bind device/pasid only if
> >>>> its compatibility. In AMD case we will check against protection domain. Ex:
> >>>> If we have two devices (devA and devB) in two different protection domain then:
> >>>> set_dev_pasid(sva_domain, devA, pasidX) - SUCCESS
> >>>> set_dev_pasid(sva_domain, devB, pasidX) - Compatibility check fail
> >>
> >> Here I expect it to fails as devB is in different protection domain. From
> >> invalidation point of view, devA and devB are not compatible. Hence I think it
> >> should fail binding.
> >
> > No, that isn't the best thing to do - you could do this, but it will
> > be more inefficient.
>
> What inefficiency are you referring? Allocating extra SVA domain -OR- mmu
> notifier getting called for each SVA domain -OR- something else?
Primarily multiple mmu notifiers is not so great
> Then I am wondering why not just create single SVA domain for a PASID and let
> individual driver handle underneath requirement like target invalidation? Am I
> missing here?
domains are not connected to PASIDs - PASID is part of the attachment.
We want drivers to support one domain per IOPTE table and allow all
possible combinations of compatible attachments.
> > We have use cases to share a KVM page table with PRI.
> >
> > Google apparently has some usecase since they are fixing it in ARM.
> >
> > Besides that, it is the IOMMU API, drivers have to implement it, you
> > don't get to pick and choose.
>
> Is there any documentation on the mentioned use case and the
> required IOMMU API because this is new to me. I would like to
> understand things better before making the change in AMD IOMMU
> driver.
Just the API definitions we have been working toward and the
dicussions on the list.
It is not a complex concept, UNMANAGED paging domains need to support
PRI and PASID.
> > You are not going to get SVA without also properly doing all
> > infrastructure to enable paging and unmanaged - I won't support
> > another shortcut hackjob for SVA that needs unwinding like ARM has.
>
> The goal of this series is to introduce the SVA support for AMD IOMMU driver.
>
> So far we have been accommodating all the review comments.
> - Dropping iommu_v2 module before getting SVA
> - Reworking SVA top of Tina's series
> - Reworking IOPF on top of Baolu's IOPF enhancement
If you would prefer to have a more stable base to work on then wait a
few months until ARM and Intel drviers are fully fixed. Otherwise you
are going to have to keep pace with the advancing work.
> Adding PASID support for the unmanaged domain is a new requirement
> and not relevant to this series.
It is not. It is what the iommu API is designed to do, ARM got
grandfathered in with their half implementation because it already
existed. New drivers must implement the API properly and not take
shortcuts.
> It will also require a considerable amount of changes
> in AMD IOMMU driver that we need to further investigate to better
> understand.
Exactly. I do not want to see new drivers follow down the path of
ARM at exctly the same time we are trying to fix ARM to work properly!
This undermines all the progress we are making! The API has been
defined, please follow it!
On ARM unwinding the bad design without breaking SVA is proving very
hard after the fact. You even say it will be hard on AMD, so NO, do it
right to start with.
Every single thing you need to implement to support SVA is also needed
to support generic PRI+PASID. The request here is to layer the code
correctly so that the PASID and PRI bits are not linked to SVA.
You don't need to *test* PRI+PASID but you do need to layer the code
correctly so that it is trivial to implement.
Jason
next prev parent reply other threads:[~2023-09-11 12:41 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 14:04 [PATCH RESEND 00/10] iommu/amd: SVA Support (Part 4) - SVA and IOPF Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 01/10] iommu/amd: Rename amd_iommu_v2_supported() as amd_iommu_sva_supported() Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 02/10] iommu/amd: Add support for enabling/disabling IOMMU features Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 03/10] iommu/amd: Initial SVA support for AMD IOMMU Vasant Hegde
2023-08-23 14:28 ` Jason Gunthorpe
2023-08-28 10:39 ` Vasant Hegde
2023-08-30 17:07 ` Jason Gunthorpe
2023-09-05 6:18 ` Vasant Hegde
2023-09-05 12:26 ` Jason Gunthorpe
2023-09-05 14:39 ` Vasant Hegde
2023-09-05 18:14 ` Jason Gunthorpe
2023-09-11 12:16 ` Vasant Hegde
2023-09-11 12:41 ` Jason Gunthorpe [this message]
2023-08-23 14:04 ` [PATCH RESEND 04/10] iommu/amd: Add support to enable/disable SVA feature Vasant Hegde
2023-08-23 15:28 ` Jason Gunthorpe
2023-08-28 10:45 ` Vasant Hegde
2023-08-30 17:09 ` Jason Gunthorpe
2023-08-30 19:00 ` Vasant Hegde
2023-08-30 23:46 ` Jason Gunthorpe
2023-09-07 7:15 ` Vasant Hegde
2023-09-07 12:04 ` Jason Gunthorpe
2023-08-23 14:04 ` [PATCH RESEND 05/10] iommu/amd: Move PPR-related functions into ppr.c Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 06/10] iommu/amd: Define per-IOMMU iopf_queue Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 07/10] iommu/amd: Add support for page response Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 08/10] iommu/amd: Add support for add/remove device for IOPF Vasant Hegde
2023-08-23 15:33 ` Jason Gunthorpe
2023-08-30 14:34 ` Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 09/10] iommu/amd: Add IO page fault notifier handler Vasant Hegde
2023-08-23 14:04 ` [PATCH RESEND 10/10] iommu/amd: Introduce logic to enable/disable IOPF Vasant Hegde
2023-08-23 15:36 ` 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=ZP8K40ASDPAcp+/X@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=jsnitsel@redhat.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.com \
--cc=wei.huang2@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.