[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <58400D00.6070708@redhat.com>
Date: Thu, 1 Dec 2016 19:44:00 +0800
From: Xunlei Pang <xpang@...hat.com>
To: Joerg Roedel <joro@...tes.org>, xlpang@...hat.com
Cc: Baoquan He <bhe@...hat.com>, Don Brace <don.brace@...rosemi.com>,
Myron Stowe <myron.stowe@...hat.com>,
kexec@...ts.infradead.org, LKML <linux-kernel@...r.kernel.org>,
iommu@...ts.linux-foundation.org,
Myron Stowe <myron.stowe@...il.com>,
Dave Young <dyoung@...hat.com>,
David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH] iommu/vt-d: Flush old iotlb for kdump when the device
gets context mapped
On 12/01/2016 at 06:33 PM, Joerg Roedel wrote:
> 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?
Yes, I have tested and it works, will send v3 later.
Regards,
Xunlei
Powered by blists - more mailing lists