All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	Vijay Kilary <vkilari@codeaurora.org>,
	Jon Masters <jcm@redhat.com>, Jan Glauber <jglauber@marvell.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	iommu@lists.linux-foundation.org,
	Jayachandran Chandrasekharan Nair <jnair@marvell.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 10/13] iommu/io-pgtable: Replace ->tlb_add_flush() with ->tlb_add_page()
Date: Wed, 21 Aug 2019 13:33:22 +0100	[thread overview]
Message-ID: <279efc69-6ddb-14ce-01c1-3cc8b4bbf206@arm.com> (raw)
In-Reply-To: <20190821120512.4ihfyh4eqsnst6xh@willie-the-truck>

On 21/08/2019 13:05, Will Deacon wrote:
> Hi Robin,
> 
> Thanks for looking at this.
> 
> On Wed, Aug 21, 2019 at 12:42:11PM +0100, Robin Murphy wrote:
>> On 14/08/2019 18:56, Will Deacon wrote:
>>> The ->tlb_add_flush() callback in the io-pgtable API now looks a bit
>>> silly:
>>>
>>>     - It takes a size and a granule, which are always the same
>>>     - It takes a 'bool leaf', which is always true
>>>     - It only ever flushes a single page
>>>
>>> With that in mind, replace it with an optional ->tlb_add_page() callback
>>> that drops the useless parameters.
>>>
>>> Signed-off-by: Will Deacon <will@kernel.org>
> 
> [...]
> 
>>> -static const struct iommu_flush_ops arm_smmu_s2_tlb_ops_v2 = {
>>> -	.tlb_flush_all	= arm_smmu_tlb_inv_context_s2,
>>> -	.tlb_flush_walk	= arm_smmu_tlb_inv_walk,
>>> -	.tlb_flush_leaf	= arm_smmu_tlb_inv_leaf,
>>> -	.tlb_add_flush	= arm_smmu_tlb_inv_range_nosync,
>>> -	.tlb_sync	= arm_smmu_tlb_sync_context,
>>> +static const struct arm_smmu_flush_ops arm_smmu_s2_tlb_ops_v2 = {
>>> +	.tlb = {
>>> +		.tlb_flush_all	= arm_smmu_tlb_inv_context_s2,
>>> +		.tlb_flush_walk	= arm_smmu_tlb_inv_walk,
>>> +		.tlb_flush_leaf	= arm_smmu_tlb_inv_leaf,
>>> +		.tlb_add_page	= arm_smmu_tlb_add_page,
>>> +		.tlb_sync	= arm_smmu_tlb_sync_context,
>>> +	},
>>> +	.tlb_inv_range		= arm_smmu_tlb_inv_range_nosync,
>>>    };
>>> -static const struct iommu_flush_ops arm_smmu_s2_tlb_ops_v1 = {
>>> -	.tlb_flush_all	= arm_smmu_tlb_inv_context_s2,
>>> -	.tlb_flush_walk	= arm_smmu_tlb_inv_walk,
>>> -	.tlb_flush_leaf	= arm_smmu_tlb_inv_leaf,
>>> -	.tlb_add_flush	= arm_smmu_tlb_inv_vmid_nosync,
>>> -	.tlb_sync	= arm_smmu_tlb_sync_vmid,
>>> +static const struct arm_smmu_flush_ops arm_smmu_s2_tlb_ops_v1 = {
>>> +	.tlb = {
>>> +		.tlb_flush_all	= arm_smmu_tlb_inv_context_s2,
>>> +		.tlb_flush_walk	= arm_smmu_tlb_inv_walk,
>>> +		.tlb_flush_leaf	= arm_smmu_tlb_inv_leaf,
>>
>> Urgh, that ain't right... :(
>>
>> Sorry I've only spotted it now while trying to rebase onto Joerg's queue,
>> but we can't use either of those callbacks for v1 stage 2 since the
>> registers they access don't exist. I'll spin a fixup patch first, then come
>> back to the question of whether it's more practical to attempt merging my v2
>> or concede to rebasing a v3.
> 
> Although the code is quite difficult to follow, I think it's alright because
> the tlb_flush_{walk,leaf} functions just indirect back through the
> tlb_inv_range callback. This patch is supposed to be a big NOP moving
> drivers over to the new API, but not actually exploiting its benefits.

Ah, sorry, I did indeed fail the reading comprehension test - too many 
levels of indirection...

On second reading I agree that this probably should work out OK (other 
than perhaps a performance hit from chaining more indirect branches). 
I've noted on my to-do list to come back and clean up arm_smmu_flush_ops 
for next cycle, but for now I'll get back to the more pressing matters.

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

  reply	other threads:[~2019-08-21 12:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 17:56 [PATCH 00/13] Rework IOMMU API to allow for batching of invalidation Will Deacon
2019-08-14 17:56 ` [PATCH 01/13] iommu: Remove empty iommu_tlb_range_add() callback from iommu_ops Will Deacon
2019-08-14 17:56 ` [PATCH 02/13] iommu/io-pgtable-arm: Remove redundant call to io_pgtable_tlb_sync() Will Deacon
2019-08-15 12:43   ` Robin Murphy
2019-08-15 13:57     ` Will Deacon
2019-08-15 14:23       ` Robin Murphy
2019-08-14 17:56 ` [PATCH 03/13] iommu/io-pgtable: Rename iommu_gather_ops to iommu_flush_ops Will Deacon
2019-08-14 17:56 ` [PATCH 04/13] iommu: Introduce struct iommu_iotlb_gather for batching TLB flushes Will Deacon
2019-08-14 17:56 ` [PATCH 05/13] iommu: Introduce iommu_iotlb_gather_add_page() Will Deacon
2019-08-14 17:56 ` [PATCH 06/13] iommu: Pass struct iommu_iotlb_gather to ->unmap() and ->iotlb_sync() Will Deacon
2019-08-14 17:56 ` [PATCH 07/13] iommu/io-pgtable: Introduce tlb_flush_walk() and tlb_flush_leaf() Will Deacon
2019-08-21 16:01   ` Robin Murphy
2019-08-14 17:56 ` [PATCH 08/13] iommu/io-pgtable: Hook up ->tlb_flush_walk() and ->tlb_flush_leaf() in drivers Will Deacon
2019-08-14 17:56 ` [PATCH 09/13] iommu/io-pgtable-arm: Call ->tlb_flush_walk() and ->tlb_flush_leaf() Will Deacon
2019-08-14 17:56 ` [PATCH 10/13] iommu/io-pgtable: Replace ->tlb_add_flush() with ->tlb_add_page() Will Deacon
2019-08-21 11:42   ` Robin Murphy
2019-08-21 12:05     ` Will Deacon
2019-08-21 12:33       ` Robin Murphy [this message]
2019-08-14 17:56 ` [PATCH 11/13] iommu/io-pgtable: Remove unused ->tlb_sync() callback Will Deacon
2019-08-14 17:56 ` [PATCH 12/13] iommu/io-pgtable: Pass struct iommu_iotlb_gather to ->unmap() Will Deacon
2019-08-14 17:56 ` [PATCH 13/13] iommu/io-pgtable: Pass struct iommu_iotlb_gather to ->tlb_add_page() Will Deacon
2019-08-15 11:19 ` [PATCH 00/13] Rework IOMMU API to allow for batching of invalidation John Garry
2019-08-15 13:55   ` Will Deacon
2019-08-16 10:11     ` John Garry

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=279efc69-6ddb-14ce-01c1-3cc8b4bbf206@arm.com \
    --to=robin.murphy@arm.com \
    --cc=alex.williamson@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jcm@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=jglauber@marvell.com \
    --cc=jnair@marvell.com \
    --cc=vkilari@codeaurora.org \
    --cc=will@kernel.org \
    /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.