From: Lu Baolu <baolu.lu@linux.intel.com>
To: "Liu, Yi L" <yi.l.liu@intel.com>, Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>,
Alex Williamson <alex.williamson@redhat.com>,
Kirti Wankhede <kwankhede@nvidia.com>
Cc: baolu.lu@linux.intel.com, "Raj, Ashok" <ashok.raj@intel.com>,
"Kumar, Sanjay K" <sanjay.k.kumar@intel.com>,
"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
Jean-Philippe Brucker <jean-philippe.brucker@arm.com>,
"Sun, Yi Y" <yi.y.sun@intel.com>,
"peterx@redhat.com" <peterx@redhat.com>,
"Bie, Tiwei" <tiwei.bie@intel.com>,
"Zeng, Xin" <xin.zeng@intel.com>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: Re: [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management
Date: Sun, 16 Dec 2018 09:20:38 +0800 [thread overview]
Message-ID: <63ba6b78-ab31-4f54-002c-4c3baf818d3e@linux.intel.com> (raw)
In-Reply-To: <A2975661238FB949B60364EF0F2C257439D8E060@SHSMSX104.ccr.corp.intel.com>
Hi,
On 12/16/18 6:38 AM, Liu, Yi L wrote:
>> From: Lu Baolu [mailto:baolu.lu@linux.intel.com]
>> Sent: Sunday, November 11, 2018 10:45 PM
>> Subject: [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management
>>
>> This adds APIs for IOMMU drivers and device drivers to manage the PASIDs used for
>> DMA transfer and translation. It bases on I/O ASID allocator for PASID namespace
>> management and relies on vendor specific IOMMU drivers for paravirtual PASIDs.
>>
>> Below APIs are added:
>>
>> * iommu_pasid_init(pasid)
>> - Initialize a PASID consumer. The vendor specific IOMMU
>> drivers are able to set the PASID range imposed by IOMMU
>> hardware through a callback in iommu_ops.
>>
>> * iommu_pasid_exit(pasid)
>> - The PASID consumer stops consuming any PASID.
>>
>> * iommu_pasid_alloc(pasid, min, max, private, *ioasid)
>> - Allocate a PASID and associate a @private data with this
>> PASID. The PASID value is stored in @ioaisd if returning
>> success.
>>
>> * iommu_pasid_free(pasid, ioasid)
>> - Free a PASID to the pool so that it could be consumed by
>> others.
>>
>> This also adds below helpers to lookup or iterate PASID items associated with a
>> consumer.
>>
>> * iommu_pasid_for_each(pasid, func, data)
>> - Iterate PASID items of the consumer identified by @pasid,
>> and call @func() against each item. An error returned from
>> @func() will break the iteration.
>>
>> * iommu_pasid_find(pasid, ioasid)
>> - Retrieve the private data associated with @ioasid.
>>
>> Cc: Ashok Raj <ashok.raj@intel.com>
>> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
>> Cc: Kevin Tian <kevin.tian@intel.com>
>> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>> drivers/iommu/Kconfig | 1 +
>> drivers/iommu/iommu.c | 89 +++++++++++++++++++++++++++++++++++++++++++
>> include/linux/iommu.h | 73 +++++++++++++++++++++++++++++++++++
>> 3 files changed, 163 insertions(+)
>>
>> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index
>> d9a25715650e..39f2bb76c7b8 100644
>> --- a/drivers/iommu/Kconfig
>> +++ b/drivers/iommu/Kconfig
>> @@ -1,6 +1,7 @@
>> # IOMMU_API always gets selected by whoever wants it.
>> config IOMMU_API
>> bool
>> + select IOASID
>>
>> menuconfig IOMMU_SUPPORT
>> bool "IOMMU Hardware Support"
>> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index
>> 0b7c96d1425e..570b244897bb 100644
>> --- a/drivers/iommu/iommu.c
>> +++ b/drivers/iommu/iommu.c
>> @@ -2082,3 +2082,92 @@ void iommu_detach_device_aux(struct iommu_domain
>> *domain, struct device *dev)
>> }
>> }
>> EXPORT_SYMBOL_GPL(iommu_detach_device_aux);
>> +
>> +/*
>> + * APIs for PASID used by IOMMU and the device drivers which depend
>> + * on IOMMU.
>> + */
>> +struct iommu_pasid *iommu_pasid_init(struct bus_type *bus) {
>
> I'm thinking about if using struct iommu_domain here is better
> than struct bus_type. The major purpose is to pass iommu_ops
> in it and route into iommu-sublayer. iommu_domain may be
> better since some modules like vfio_iommu_type1 would use
> iommu_domain more than bus type.
But drivers might call this during initialization when it doesn't has
any domain yet.
Best regards,
Lu Baolu
next prev parent reply other threads:[~2018-12-16 1:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 6:44 [RFC PATCH 0/5] iommu: APIs for paravirtual PASID allocation Lu Baolu
2018-11-12 6:44 ` [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management Lu Baolu
2018-12-15 22:38 ` Liu, Yi L
2018-12-16 1:20 ` Lu Baolu [this message]
2019-01-30 19:05 ` Jacob Pan
2019-02-15 17:33 ` Jean-Philippe Brucker
2018-11-12 6:44 ` [RFC PATCH 2/5] iommu/vt-d: Initialize a PASID consumer Lu Baolu
2018-11-12 6:44 ` [RFC PATCH 3/5] iommu/vt-d: Enlightened PASID allocation Lu Baolu
2018-11-12 6:45 ` [RFC PATCH 4/5] iommu/vt-d: Allocate and free a pasid Lu Baolu
2018-11-12 6:45 ` [RFC PATCH 5/5] iommu/vt-d: Use global pasid allocator Lu Baolu
2018-11-19 16:36 ` [RFC PATCH 0/5] iommu: APIs for paravirtual PASID allocation Konrad Rzeszutek Wilk
2018-11-20 2:29 ` Yi Sun
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=63ba6b78-ab31-4f54-002c-4c3baf818d3e@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=ashok.raj@intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@intel.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=jean-philippe.brucker@arm.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterx@redhat.com \
--cc=sanjay.k.kumar@intel.com \
--cc=tiwei.bie@intel.com \
--cc=xin.zeng@intel.com \
--cc=yi.l.liu@intel.com \
--cc=yi.y.sun@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
all inboxes | Powered by JetHome®