public inbox for iommu@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Robin Murphy <robin.murphy@arm.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Joerg Roedel <joro@8bytes.org>
Cc: baolu.lu@linux.intel.com, ashok.raj@intel.com,
	jacob.jun.pan@intel.com, alan.cox@intel.com,
	kevin.tian@intel.com, mika.westerberg@linux.intel.com,
	pengfei.xu@intel.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 01/10] iommu: Add helper to get minimal page size of domain
Date: Tue, 30 Apr 2019 08:40:20 +0800	[thread overview]
Message-ID: <48ac694e-4551-40e2-f914-6942da810489@linux.intel.com> (raw)
In-Reply-To: <05eca601-0264-8141-ceeb-7ef7ad5d5650@arm.com>

Hi Robin,

On 4/29/19 6:55 PM, Robin Murphy wrote:
> On 21/04/2019 02:17, Lu Baolu wrote:
>> This makes it possible for other modules to know the minimal
>> page size supported by a domain without the knowledge of the
>> structure details.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>>   include/linux/iommu.h | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
>> index a5007d035218..46679ef19b7e 100644
>> --- a/include/linux/iommu.h
>> +++ b/include/linux/iommu.h
>> @@ -377,6 +377,14 @@ static inline void iommu_tlb_sync(struct 
>> iommu_domain *domain)
>>           domain->ops->iotlb_sync(domain);
>>   }
>> +static inline unsigned long domain_minimal_pgsize(struct iommu_domain 
>> *domain)
>> +{
>> +    if (domain && domain->pgsize_bitmap)
>> +        return 1 << __ffs(domain->pgsize_bitmap);
> 
> Nit: this would probably be more efficient on most architectures as:
> 
>      if (domain)
>          return domain->pgsize_bitmap & -domain->pgsize_bitmap;
> 

It looks reasonable to me.

> 
> I'd also suggest s/minimal/min/ in the name, just to stop it getting too 
> long. Otherwise, though, I like the idea, and there's at least one other 
> place (in iommu-dma) that can make use of it straight away.

Okay, I will change the name to domain_min_pgsize().

> 
> Robin.
> 

Best regards,
Lu Baolu

>> +
>> +    return 0;
>> +}
>> +
>>   /* PCI device grouping function */
>>   extern struct iommu_group *pci_device_group(struct device *dev);
>>   /* Generic device grouping function */
>> @@ -704,6 +712,11 @@ const struct iommu_ops 
>> *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
>>       return NULL;
>>   }
>> +static inline unsigned long domain_minimal_pgsize(struct iommu_domain 
>> *domain)
>> +{
>> +    return 0;
>> +}
>> +
>>   #endif /* CONFIG_IOMMU_API */
>>   #ifdef CONFIG_IOMMU_DEBUGFS
>>
> 

WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Robin Murphy <robin.murphy@arm.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Joerg Roedel <joro@8bytes.org>
Cc: kevin.tian@intel.com, ashok.raj@intel.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	alan.cox@intel.com, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, pengfei.xu@intel.com,
	jacob.jun.pan@intel.com, mika.westerberg@linux.intel.com,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v3 01/10] iommu: Add helper to get minimal page size of domain
Date: Tue, 30 Apr 2019 08:40:20 +0800	[thread overview]
Message-ID: <48ac694e-4551-40e2-f914-6942da810489@linux.intel.com> (raw)
Message-ID: <20190430004020.UvNwvJiRjnnMT8GMSwfyiCzLGJYnwk4Ek-r2WeQ2g2I@z> (raw)
In-Reply-To: <05eca601-0264-8141-ceeb-7ef7ad5d5650@arm.com>

Hi Robin,

On 4/29/19 6:55 PM, Robin Murphy wrote:
> On 21/04/2019 02:17, Lu Baolu wrote:
>> This makes it possible for other modules to know the minimal
>> page size supported by a domain without the knowledge of the
>> structure details.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>>   include/linux/iommu.h | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
>> index a5007d035218..46679ef19b7e 100644
>> --- a/include/linux/iommu.h
>> +++ b/include/linux/iommu.h
>> @@ -377,6 +377,14 @@ static inline void iommu_tlb_sync(struct 
>> iommu_domain *domain)
>>           domain->ops->iotlb_sync(domain);
>>   }
>> +static inline unsigned long domain_minimal_pgsize(struct iommu_domain 
>> *domain)
>> +{
>> +    if (domain && domain->pgsize_bitmap)
>> +        return 1 << __ffs(domain->pgsize_bitmap);
> 
> Nit: this would probably be more efficient on most architectures as:
> 
>      if (domain)
>          return domain->pgsize_bitmap & -domain->pgsize_bitmap;
> 

It looks reasonable to me.

> 
> I'd also suggest s/minimal/min/ in the name, just to stop it getting too 
> long. Otherwise, though, I like the idea, and there's at least one other 
> place (in iommu-dma) that can make use of it straight away.

Okay, I will change the name to domain_min_pgsize().

> 
> Robin.
> 

Best regards,
Lu Baolu

>> +
>> +    return 0;
>> +}
>> +
>>   /* PCI device grouping function */
>>   extern struct iommu_group *pci_device_group(struct device *dev);
>>   /* Generic device grouping function */
>> @@ -704,6 +712,11 @@ const struct iommu_ops 
>> *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
>>       return NULL;
>>   }
>> +static inline unsigned long domain_minimal_pgsize(struct iommu_domain 
>> *domain)
>> +{
>> +    return 0;
>> +}
>> +
>>   #endif /* CONFIG_IOMMU_API */
>>   #ifdef CONFIG_IOMMU_DEBUGFS
>>
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2019-04-30  0:40 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-21  1:17 [PATCH v3 00/10] iommu: Bounce page for untrusted devices Lu Baolu
2019-04-21  1:17 ` Lu Baolu
     [not found] ` <20190421011719.14909-1-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2019-04-21  1:17   ` [PATCH v3 01/10] iommu: Add helper to get minimal page size of domain Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-29 10:55     ` Robin Murphy
2019-04-29 10:55       ` Robin Murphy
2019-04-30  0:40       ` Lu Baolu [this message]
2019-04-30  0:40         ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 02/10] swiotlb: Factor out slot allocation and free Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-22 16:45     ` Christoph Hellwig
2019-04-22 16:45       ` Christoph Hellwig
2019-04-23  1:58       ` Lu Baolu
2019-04-23  1:58         ` Lu Baolu
2019-04-23  6:12         ` Christoph Hellwig
2019-04-23  6:12           ` Christoph Hellwig
2019-04-23  7:32           ` Lu Baolu
2019-04-23  7:32             ` Lu Baolu
2019-04-24 14:45             ` Christoph Hellwig
2019-04-24 14:45               ` Christoph Hellwig
     [not found]               ` <20190424144532.GA21480-jcswGhMUV9g@public.gmane.org>
2019-04-25  2:07                 ` Lu Baolu
2019-04-25  2:07                   ` Lu Baolu
2019-04-26 15:04                   ` Christoph Hellwig
2019-04-26 15:04                     ` Christoph Hellwig
2019-04-29  5:10                     ` Lu Baolu
2019-04-29  5:10                       ` Lu Baolu
2019-04-29 11:06                       ` Robin Murphy
2019-04-29 11:06                         ` Robin Murphy
2019-04-29 11:44                         ` Christoph Hellwig
2019-04-29 11:44                           ` Christoph Hellwig
2019-05-06  1:54                           ` Lu Baolu
2019-05-13  7:05                             ` Christoph Hellwig
2019-05-16  1:53                               ` Lu Baolu
2019-04-30  2:02                         ` Lu Baolu
2019-04-30  2:02                           ` Lu Baolu
2019-04-30  9:53                           ` Robin Murphy
2019-04-30  9:53                             ` Robin Murphy
2019-05-02  1:47                             ` Lu Baolu
2019-05-02  1:47                               ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 03/10] swiotlb: Limit tlb address range inside slot pool Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 04/10] swiotlb: Extend swiotlb to support page bounce Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 05/10] iommu: Add bounce page APIs Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 06/10] iommu/vt-d: Add trace events for domain map/unmap Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 07/10] iommu/vt-d: Keep swiotlb on if bounce page is necessary Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-22 16:47     ` Christoph Hellwig
2019-04-22 16:47       ` Christoph Hellwig
2019-04-23  2:00       ` Lu Baolu
2019-04-23  2:00         ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 08/10] iommu/vt-d: Check whether device requires bounce buffer Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-22 16:47     ` Christoph Hellwig
2019-04-22 16:47       ` Christoph Hellwig
     [not found]       ` <20190422164755.GC31181-jcswGhMUV9g@public.gmane.org>
2019-04-23  2:03         ` Lu Baolu
2019-04-23  2:03           ` Lu Baolu
2019-04-23  6:08           ` Christoph Hellwig
2019-04-23  6:08             ` Christoph Hellwig
2019-04-23  7:35             ` Lu Baolu
2019-04-23  7:35               ` Lu Baolu
     [not found]               ` <e11489cf-87cc-a956-7c6c-ffdd26a4e3ec-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2019-04-24 18:27                 ` Konrad Rzeszutek Wilk
2019-04-24 18:27                   ` Konrad Rzeszutek Wilk
2019-04-21  1:17   ` [PATCH v3 09/10] iommu/vt-d: Add dma sync ops for untrusted devices Lu Baolu
2019-04-21  1:17     ` Lu Baolu
2019-04-21  1:17   ` [PATCH v3 10/10] iommu/vt-d: Use bounce buffer " Lu Baolu
2019-04-21  1:17     ` Lu Baolu

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=48ac694e-4551-40e2-f914-6942da810489@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=alan.cox@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=dwmw2@infradead.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pengfei.xu@intel.com \
    --cc=robin.murphy@arm.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