Linux IOMMU Development
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "Liu, Yi L" <yi.l.liu@intel.com>,
	Robin Murphy <robin.murphy@arm.com>,
	"jgg@nvidia.com" <jgg@nvidia.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>,
	"shameerali.kolothum.thodi@huawei.com"
	<shameerali.kolothum.thodi@huawei.com>,
	"jean-philippe@linaro.org" <jean-philippe@linaro.org>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"peterx@redhat.com" <peterx@redhat.com>
Subject: Re: Cache Invalidation Solution for Nested IOMMU
Date: Mon, 3 Apr 2023 08:24:20 -0700	[thread overview]
Message-ID: <ZCrvpFqrUZH/9pYI@Asurada-Nvidia> (raw)
In-Reply-To: <BN9PR11MB5276462BC1879715BC15380F8C929@BN9PR11MB5276.namprd11.prod.outlook.com>

On Mon, Apr 03, 2023 at 08:39:02AM +0000, Tian, Kevin wrote:
> External email: Use caution opening links or attachments
> 
> 
> > From: Liu, Yi L <yi.l.liu@intel.com>
> > Sent: Monday, April 3, 2023 3:26 PM
> >
> > For VT-d, except for the device-TLB invalidation, there is no RID
> > information in the invalidation command submitted by iommu driver.
> > Device-TLB invalidation would be somehow an included operation in
> > IOTLB invalidation if the page table is used by devices that has
> > enabled ATS. So guest VT-d iommu driver may not use the Device-TLB
> > invalidation. So vRID->pRID conversion may not happen for VT-d side.
> 
> Guest can still submit a device-tlb invalidation descriptor. Just that it
> could be skipped as a nop here if the host always invalidates device-tlb
> when handling the iotlb invalidation request.

In either case, it sounds like RID isn't needed in VT-d case?

SMMU needs vSID<->pSID info to verify an ATS invalidation.

> > VT-d side requires vPASID->pPASID and vDomain_id->pDomain_id
> > conversion.
> > vPASID conversion may be needed later as we may disable guest PASID
> 
> vPASID conversion is mandatory when we enable vSVA on SIOV device.

vPASID is allocated at runtime, so the hypercall timing is a
bit different than SMMU's vSID. But I think it could go with
this uAPI too? We'd just need to turn the uAPI to a shareable
one.

> > support at this moment. For vDomain_id conversion, there is a gap.
> > Domain_id is not global today. So if there are multiple vIOMMU instance
> > exposed to guest, the vDomain_id would have conflict between the
> > invalidation commands submitted via different vIOMMU instances. Even
> > we may make its allocation global, I'm also curious when and how should
> > we build up the vDomain_id->pDomain_id relationship in kernel. Maybe a
> > new iommufd uapi just like the vRID set? or it may be part of the
> > device driver's attach_hwpt uapi (e.g. VFIO) as this relationship should
> > just exist when the hwpt and device are attached.
> >
> 
> IMHO we need a vDID->hwpt conversion i.e. the kernel wants to know
> which s1 hwpt is covered by a vDID. From this angle adding vDID at
> attach_hwpt makes more sense.

I share the same view. A "vDID" is HWPT oriented, while that
set/unset_rid_user uAPI is for passthrough devices. So, it'd
be probably better to go with a different uAPI at least.

> But honestly speaking I'm hesitating to introduce native format and those
> assistant APIs for VT-d at this point. Supporting in-kernel short path
> won't happen in short term. What we defined now may not fit the
> requirement when it comes.
>
> With that let's continue to define a customized simple format for VT-d iotlb
> invalidation, plus allowing the user to batch the request. Having extra
> packing/unpacking overhead is negligible compared to the long invalidation
> path at this moment. Then we can consider native format as a 2nd
> supported format later when in-kernel acceleration is being worked on.

It'd be okay to do it later for VT-d, so long as the uAPI we
add for SMMUv3 would potentially fit VT-d too :)

Thanks
Nicolin

  reply	other threads:[~2023-04-03 15:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03  0:33 Cache Invalidation Solution for Nested IOMMU Nicolin Chen
2023-04-03  7:26 ` Liu, Yi L
2023-04-03  8:39   ` Tian, Kevin
2023-04-03 15:24     ` Nicolin Chen [this message]
2023-04-04  2:42       ` Tian, Kevin
2023-04-04  3:12         ` Nicolin Chen
2023-04-03 12:23   ` Jason Gunthorpe
2023-04-03  8:00 ` Tian, Kevin
2023-04-03 14:29   ` Nicolin Chen
2023-04-04  2:15     ` Tian, Kevin
2023-04-04  2:47       ` Nicolin Chen
2023-04-03 14:08 ` Jason Gunthorpe
2023-04-03 14:51   ` Nicolin Chen
2023-04-03 19:15     ` Robin Murphy
2023-04-04  0:02       ` Nicolin Chen
2023-04-04 16:20         ` Jason Gunthorpe
2023-04-04 16:50           ` Shameerali Kolothum Thodi
2023-04-05 11:57             ` Jason Gunthorpe
2023-04-06  6:23             ` Zhangfei Gao
2023-04-06  6:39               ` Nicolin Chen
2023-04-06 11:40               ` Jason Gunthorpe
2023-04-10  1:08                 ` Nicolin Chen
2023-04-11  9:07                   ` Jean-Philippe Brucker
2023-04-11 11:57                     ` Jason Gunthorpe
2023-04-11 18:39                       ` Nicolin Chen
2023-04-11 18:41                         ` Jason Gunthorpe
2023-04-11 19:02                           ` Nicolin Chen
2023-04-11 18:43                     ` Nicolin Chen
2023-04-12  2:47                   ` Zhangfei Gao
2023-04-12  5:47                     ` Nicolin Chen
2023-05-03 15:14                     ` Shameerali Kolothum Thodi
2023-05-03 23:44                       ` Nicolin Chen
2023-04-05  5:45           ` Nicolin Chen
2023-04-05 11:37             ` Jason Gunthorpe
2023-04-05 15:34               ` Nicolin Chen

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=ZCrvpFqrUZH/9pYI@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=jean-philippe@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=peterx@redhat.com \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=yi.l.liu@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