Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533958

Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device gets context mapped

From Joerg Roedel <joro@8bytes.org>
Newsgroups linux.kernel
Subject Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device gets context mapped
Date 2016-12-01 11:40 +0100
Message-ID <sJwWu-2GE-11@gated-at.bofh.it> (permalink)
References (5 earlier) <sJ93Q-49f-3@gated-at.bofh.it> <sJ9Qf-4q9-59@gated-at.bofh.it> <sJajg-4SL-29@gated-at.bofh.it> <sJe3v-7fx-17@gated-at.bofh.it> <sJp8C-612-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 01, 2016 at 10:15:45AM +0800, Xunlei Pang wrote:
> index 3965e73..624eac9 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -2024,6 +2024,25 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
>         if (context_present(context))
>                 goto out_unlock;
>  
> +       /*
> +        * For kdump cases, old valid entries may be cached due to the
> +        * in-flight DMA and copied pgtable, but there is no unmapping
> +        * behaviour for them, thus we need an explicit cache flush for
> +        * the newly-mapped device. For kdump, at this point, the device
> +        * is supposed to finish reset at its driver probe stage, so no
> +        * in-flight DMA will exist, and we don't need to worry anymore
> +        * hereafter.
> +        */
> +       if (context_copied(context)) {
> +               u16 did_old = context_domain_id(context);
> +
> +               if (did_old >= 0 && did_old < cap_ndoms(iommu->cap))
> +                       iommu->flush.flush_context(iommu, did_old,
> +                                                  (((u16)bus) << 8) | devfn,
> +                                                  DMA_CCMD_MASK_NOBIT,
> +                                                  DMA_CCMD_DEVICE_INVL);
> +       }
> +
>         pgd = domain->pgd;

Yes, this looks better. Have you tested it the same way as the old
patch?


	Joerg

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Joerg Roedel <joro@8bytes.org> - 2016-11-29 15:40 +0100
  Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Xunlei Pang <xpang@redhat.com> - 2016-11-30 09:20 +0100
    Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Baoquan He <bhe@redhat.com> - 2016-11-30 10:10 +0100
      Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Baoquan He <bhe@redhat.com> - 2016-11-30 11:00 +0100
        Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Baoquan He <bhe@redhat.com> - 2016-11-30 11:30 +0100
          Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Joerg Roedel <joro@8bytes.org> - 2016-11-30 15:30 +0100
            Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Xunlei Pang <xpang@redhat.com> - 2016-12-01 03:20 +0100
              Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Joerg Roedel <joro@8bytes.org> - 2016-12-01 11:40 +0100
                Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device  gets context mapped Xunlei Pang <xpang@redhat.com> - 2016-12-01 13:00 +0100

csiph-web