All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Kumar, Sanjay K" <sanjay.k.kumar@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>, Barry Song <21cnbao@gmail.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	"Zanussi, Tom" <tom.zanussi@intel.com>
Subject: Re: [PATCH 2/4] iommu: Add PASID support for DMA mapping API users
Date: Thu, 9 Dec 2021 08:32:49 -0800	[thread overview]
Message-ID: <20211209083249.7d775512@jacob-builder> (raw)
In-Reply-To: <1b3ee13d-0148-1156-52ad-b96bca51cb6f@linux.intel.com>

Hi Lu,

On Thu, 9 Dec 2021 10:21:38 +0800, Lu Baolu <baolu.lu@linux.intel.com>
wrote:

> On 12/9/21 9:56 AM, Tian, Kevin wrote:
> >> From: Jacob Pan <jacob.jun.pan@linux.intel.com>
> >> Sent: Thursday, December 9, 2021 2:50 AM
> >>  
> >>> Can a device issue DMA requests with PASID even there's no system  
> >> IOMMU  
> >>> or the system IOMMU is disabled?
> >>>  
> >> Good point.
> >> If IOMMU is not enabled, device cannot issue DMA requests with PASID.
> >> This API will not be available. Forgot to add dummy functions to the
> >> header. 
> > 
> > PASID is a PCI thing, not defined by IOMMU.
> > 
> > I think the key is physically if IOMMU is disabled, how will root
> > complex handle a PCI memory request including a PASID TLP prefix? Does
> > it block such request due to no IOMMU to consume PASID or simply ignore
> > PASID and continue routing the request to the memory controller?
> > 
> > If block, then having an iommu interface makes sense.
> > 
> > If ignore, possibly a DMA API call makes more sense instead, implying
> > that this extension can be used even when iommu is disabled.
> > 
> > I think that is what Baolu wants to point out.  
> 
Thanks for clarifying, very good point.
Looking at the PCIe spec. I don't see specific rules for RC to ignore or
block PASID TLP if not enabled.
"- A Root Complex that supports PASID TLP Prefixes must have a device
specific mechanism for enabling them. By default usage of PASID TLP
Prefixes is disabled
 - Root Complexes may optionally support TLPs with PASID TLP Prefixes. The
mechanism used to detect whether a Root Complex supports the PASID TLP
Prefix is implementation specific
"
For all practical purposes, why would someone sets up PASID for DMA just to
be ignored? An IOMMU interface makes sense to me.

> Yes, exactly. Imagining in the VM guest environment, do we require a
> vIOMMU for this functionality? vIOMMU is not performance friendly if we
> put aside the security considerations.
> 
The primary use case for accelerators to use in-kernel DMA will be in
pass-through mode. vIOMMU should be able to do PT with good performance,
right? no nesting, IO page faults.

> Best regards,
> baolu


Thanks,

Jacob
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	"Kumar, Sanjay K" <sanjay.k.kumar@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>, Barry Song <21cnbao@gmail.com>,
	"Zanussi, Tom" <tom.zanussi@intel.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH 2/4] iommu: Add PASID support for DMA mapping API users
Date: Thu, 9 Dec 2021 08:32:49 -0800	[thread overview]
Message-ID: <20211209083249.7d775512@jacob-builder> (raw)
In-Reply-To: <1b3ee13d-0148-1156-52ad-b96bca51cb6f@linux.intel.com>

Hi Lu,

On Thu, 9 Dec 2021 10:21:38 +0800, Lu Baolu <baolu.lu@linux.intel.com>
wrote:

> On 12/9/21 9:56 AM, Tian, Kevin wrote:
> >> From: Jacob Pan <jacob.jun.pan@linux.intel.com>
> >> Sent: Thursday, December 9, 2021 2:50 AM
> >>  
> >>> Can a device issue DMA requests with PASID even there's no system  
> >> IOMMU  
> >>> or the system IOMMU is disabled?
> >>>  
> >> Good point.
> >> If IOMMU is not enabled, device cannot issue DMA requests with PASID.
> >> This API will not be available. Forgot to add dummy functions to the
> >> header. 
> > 
> > PASID is a PCI thing, not defined by IOMMU.
> > 
> > I think the key is physically if IOMMU is disabled, how will root
> > complex handle a PCI memory request including a PASID TLP prefix? Does
> > it block such request due to no IOMMU to consume PASID or simply ignore
> > PASID and continue routing the request to the memory controller?
> > 
> > If block, then having an iommu interface makes sense.
> > 
> > If ignore, possibly a DMA API call makes more sense instead, implying
> > that this extension can be used even when iommu is disabled.
> > 
> > I think that is what Baolu wants to point out.  
> 
Thanks for clarifying, very good point.
Looking at the PCIe spec. I don't see specific rules for RC to ignore or
block PASID TLP if not enabled.
"- A Root Complex that supports PASID TLP Prefixes must have a device
specific mechanism for enabling them. By default usage of PASID TLP
Prefixes is disabled
 - Root Complexes may optionally support TLPs with PASID TLP Prefixes. The
mechanism used to detect whether a Root Complex supports the PASID TLP
Prefix is implementation specific
"
For all practical purposes, why would someone sets up PASID for DMA just to
be ignored? An IOMMU interface makes sense to me.

> Yes, exactly. Imagining in the VM guest environment, do we require a
> vIOMMU for this functionality? vIOMMU is not performance friendly if we
> put aside the security considerations.
> 
The primary use case for accelerators to use in-kernel DMA will be in
pass-through mode. vIOMMU should be able to do PT with good performance,
right? no nesting, IO page faults.

> Best regards,
> baolu


Thanks,

Jacob

  reply	other threads:[~2021-12-09 16:31 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 13:47 [PATCH 0/4] Enable PASID for DMA API users Jacob Pan
2021-12-07 13:47 ` Jacob Pan
2021-12-07 13:47 ` [PATCH 1/4] ioasid: Reserve a global PASID for in-kernel DMA Jacob Pan
2021-12-07 13:47   ` Jacob Pan
2021-12-09 11:03   ` Jean-Philippe Brucker
2021-12-09 11:03     ` Jean-Philippe Brucker
2021-12-09 18:14     ` Jacob Pan
2021-12-09 18:14       ` Jacob Pan
2021-12-10  9:06       ` Jean-Philippe Brucker
2021-12-10  9:06         ` Jean-Philippe Brucker
2021-12-10 12:31         ` Jason Gunthorpe via iommu
2021-12-10 12:31           ` Jason Gunthorpe
2021-12-10 18:05           ` Jacob Pan
2021-12-10 18:05             ` Jacob Pan
2021-12-11  8:39             ` Tian, Kevin
2021-12-11  8:39               ` Tian, Kevin
2021-12-12 23:34               ` Jason Gunthorpe via iommu
2021-12-12 23:34                 ` Jason Gunthorpe
2021-12-07 13:47 ` [PATCH 2/4] iommu: Add PASID support for DMA mapping API users Jacob Pan
2021-12-07 13:47   ` Jacob Pan
2021-12-08  2:31   ` Lu Baolu
2021-12-08  2:31     ` Lu Baolu
2021-12-08 18:49     ` Jacob Pan
2021-12-08 18:49       ` Jacob Pan
2021-12-09  1:56       ` Tian, Kevin
2021-12-09  1:56         ` Tian, Kevin
2021-12-09  2:21         ` Lu Baolu
2021-12-09  2:21           ` Lu Baolu
2021-12-09 16:32           ` Jacob Pan [this message]
2021-12-09 16:32             ` Jacob Pan
2021-12-09 16:57             ` Raj, Ashok
2021-12-09 16:57               ` Raj, Ashok
2021-12-09 17:34               ` Jacob Pan
2021-12-09 17:34                 ` Jacob Pan
2021-12-07 13:47 ` [PATCH 3/4] iommu/vt-d: Support PASID DMA for in-kernel usage Jacob Pan
2021-12-07 13:47   ` Jacob Pan
2021-12-08 13:22   ` Jason Gunthorpe via iommu
2021-12-08 13:22     ` Jason Gunthorpe
2021-12-08 19:16     ` Jacob Pan
2021-12-08 19:16       ` Jacob Pan
2021-12-09  2:32       ` Lu Baolu
2021-12-09  2:32         ` Lu Baolu
2021-12-09 23:21         ` Jacob Pan
2021-12-09 23:21           ` Jacob Pan
2021-12-09 23:41           ` Jason Gunthorpe via iommu
2021-12-09 23:41             ` Jason Gunthorpe
2021-12-10  6:46           ` Lu Baolu
2021-12-10  6:46             ` Lu Baolu
2021-12-10 17:50             ` Jacob Pan
2021-12-10 17:50               ` Jacob Pan
2021-12-10 17:48               ` Jason Gunthorpe via iommu
2021-12-10 17:48                 ` Jason Gunthorpe
2021-12-10 18:18                 ` Jacob Pan
2021-12-10 18:18                   ` Jacob Pan
2021-12-10 18:53                   ` Jason Gunthorpe via iommu
2021-12-10 18:53                     ` Jason Gunthorpe
2021-12-07 13:47 ` [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID Jacob Pan
2021-12-07 13:47   ` Jacob Pan
2021-12-07 23:27   ` Dave Jiang
2021-12-07 23:27     ` Dave Jiang
2021-12-08  4:56     ` Vinod Koul
2021-12-08  4:56       ` Vinod Koul
2021-12-08 17:36       ` Jacob Pan
2021-12-08 17:36         ` Jacob Pan
2021-12-08 13:13   ` Jason Gunthorpe via iommu
2021-12-08 13:13     ` Jason Gunthorpe
2021-12-08 15:35     ` Dave Jiang
2021-12-08 15:35       ` Dave Jiang
2021-12-08 17:51       ` Jason Gunthorpe via iommu
2021-12-08 17:51         ` Jason Gunthorpe
2021-12-09  1:48         ` Tian, Kevin
2021-12-09  1:48           ` Tian, Kevin
2021-12-09 19:18           ` Jacob Pan
2021-12-09 19:18             ` Jacob Pan
2021-12-08 19:55     ` Jacob Pan
2021-12-08 19:55       ` Jacob Pan
2021-12-08 20:30       ` Jason Gunthorpe via iommu
2021-12-08 20:30         ` Jason Gunthorpe
2021-12-08 21:59         ` Jacob Pan
2021-12-08 21:59           ` Jacob Pan
2021-12-08 23:39           ` Jason Gunthorpe via iommu
2021-12-08 23:39             ` Jason Gunthorpe
2021-12-09  0:12             ` Dave Jiang
2021-12-09  0:12               ` Dave Jiang
2021-12-09  2:06               ` Tian, Kevin
2021-12-09  2:06                 ` Tian, Kevin
2021-12-08 18:37   ` kernel test robot
2021-12-08 18:37     ` kernel test robot
2021-12-08 18:37     ` kernel test robot
2021-12-08 13:10 ` [PATCH 0/4] Enable PASID for DMA API users Jason Gunthorpe via iommu
2021-12-08 13:10   ` Jason Gunthorpe
2021-12-08 18:15   ` Jacob Pan
2021-12-08 18:15     ` Jacob Pan

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=20211209083249.7d775512@jacob-builder \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=21cnbao@gmail.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jean-philippe@linaro.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanjay.k.kumar@intel.com \
    --cc=tom.zanussi@intel.com \
    --cc=tony.luck@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 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.