lkml.org 
[lkml]   [2018]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH v2 2/2] iommu/amd: Add support for fast IOTLB flushing
From
Date
Hi Joerg,

On 12/27/17 4:20 PM, Suravee Suthikulpanit wrote:
> Implement the newly added IOTLB flushing interface for AMD IOMMU.
>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> drivers/iommu/amd_iommu.c | 73 ++++++++++++++++++++++++++++++++++++++++-
> drivers/iommu/amd_iommu_init.c | 7 ++++
> drivers/iommu/amd_iommu_types.h | 7 ++++
> 3 files changed, 86 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 7d5eb00..42fe365 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> ...
> @@ -3163,6 +3168,69 @@ static bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
> return dev_data->defer_attach;
> }
>
> +static void amd_iommu_flush_iotlb_all(struct iommu_domain *domain)
> +{
> + struct protection_domain *dom = to_pdomain(domain);
> +
> + domain_flush_tlb_pde(dom);
> +}

I made a mistake here ...

> ...
> +static void amd_iommu_iotlb_sync(struct iommu_domain *domain)
> +{
> + struct protection_domain *pdom = to_pdomain(domain);
> + struct amd_iommu_flush_entries *entry, *next;
> + unsigned long flags;
> +
> + /* Note:
> + * Currently, IOMMU driver just flushes the whole IO/TLB for
> + * a given domain. So, just remove entries from the list here.
> + */
> + spin_lock_irqsave(&amd_iommu_flush_list_lock, flags);
> + list_for_each_entry_safe(entry, next, &amd_iommu_flush_list, list) {
> + list_del(&entry->list);
> + kfree(entry);
> + }
> + spin_unlock_irqrestore(&amd_iommu_flush_list_lock, flags);
> +
> + domain_flush_tlb_pde(pdom);
> +}

... and here where I should also call domain_flush_complete() after
domain_flush_tlb_pde(). I'll send out a new version (v3) as a separate patch
from the series.

Thanks,
Suravee

\
 
 \ /
  Last update: 2018-01-24 12:44    [W:0.122 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site