[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211209111817.6a84a55c@jacob-builder>
Date: Thu, 9 Dec 2021 11:18:17 -0800
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
Cc: Jason Gunthorpe <jgg@...dia.com>,
"Jiang, Dave" <dave.jiang@...el.com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Joerg Roedel <joro@...tes.org>,
"Christoph Hellwig" <hch@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"Lu Baolu" <baolu.lu@...ux.intel.com>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Kumar, Sanjay K" <sanjay.k.kumar@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>, Barry Song <21cnbao@...il.com>,
"Zanussi, Tom" <tom.zanussi@...el.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with
PASID
Hi Kevin,
On Thu, 9 Dec 2021 01:48:09 +0000, "Tian, Kevin" <kevin.tian@...el.com>
wrote:
> > From: Jason Gunthorpe <jgg@...dia.com>
> > Sent: Thursday, December 9, 2021 1:51 AM
> >
> > > > > + /*
> > > > > + * Try to enable both in-kernel and user DMA request
> > > > > with PASID.
> > > > > + * PASID is supported unless both user and kernel PASID
> > > > > are
> > > > > + * supported. Do not fail probe here in that idxd can
> > > > > still be
> > > > > + * used w/o PASID or IOMMU.
> > > > > + */
> > > > > + if (iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) ||
> > > > > + idxd_enable_system_pasid(idxd)) {
> > > > > + dev_warn(dev, "Failed to enable PASID\n");
> > > > > + } else {
> > > > > + set_bit(IDXD_FLAG_PASID_ENABLED, &idxd->flags);
> > > > > }
> > > > Huh? How can the driver keep going if PASID isn't supported? I
> > > > thought the whole point of this was because the device cannot do
> > > > DMA without PASID at all?
> > >
> > > There are 2 types of WQ supported with the DSA devices. A dedicated
> > > WQ
> > type
> > > and a shared WQ type. The dedicated WQ type can support DMA with and
> > without
> > > PASID. The shared wq type must have a PASID to operate. The driver can
> > > support dedicated WQ only without PASID usage when there is no PASID
> > > support.
> >
> > Can you add to the cover letter why does the kernel require to use the
> > shared WQ?
> >
> > Jason
>
> Two reasons:
>
> On native the shared WQ is useful when the kernel wants to offload
> some memory operations (e.g. page-zeroing) to DSA. When #CPUs are
> more than #WQs, this allows per-cpu lock-less submissions using
> ENQCMD(PASID, payload) instruction.
>
> In guest the virtual DSA HW may only contain a WQ in shared mode
> (unchangeable by the guest) when the host admin wants to share
> the limited WQ resource among many VMs. Then there is no choice
> in guest regardless whether it's for user or kernel controlled DMA.
I will add these to the next cover letter.
Thanks,
Jacob
Powered by blists - more mailing lists