[lkml]   [2015]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v11 04/10] iommu/vt-d: functions to copy data from old mem
On Mon, 2015-06-08 at 17:21 +0200, Joerg Roedel wrote:
> Hi David,
> On Mon, Jun 08, 2015 at 03:15:35PM +0100, David Woodhouse wrote:
> > Surely this isn't specific to the Intel IOMMU? Shouldn't it live
> > elsewhere — either in generic IOMMU code or perhaps in generic kexec
> > support code?
> I put a bigger rework of this on-top of Zhen-Hua's patches, you can find
> the result in my x86/vt-d branch. With my patches I also removed this
> pointer collecting concept and do the iomap_cache and iounmap calls
> before the spin-lock is taken, so this problem is now solved
> differently.
> > And I think you're misusing VTD_PAGE_{SHIFT,MASK} when you should be
> > using the normal PAGE_{SHIFT,MASK}.
> I think VT_PAGE_* is correct, since the VT-d driver also runs on ia64.
> There the system page-size is different from the VT-d page-size.

That's the problem. In __iommu_load_from_oldmem we start with a
physical address in 'from', convert to a VT-d PFN in 'pfn':

+ pfn = from >> VTD_PAGE_SHIFT;

.. and then proceed to pass that pfn to non-VT-d functions like
page_is_ram() and pfn_to_kaddr() which really need their input pfn
values to be in terms of PAGE_SHIFT not VTD_PAGE_SHIFT.

But it looks like you've completely eliminated that now (including the
page_is_ram check). So although it *was* wrong, it doesn't matter now.

> > And shouldn't physical addresses be phys_addr_t?
> This is changed where appropriate, I hope.

OK. In fact once it's purely internal to intel-iommu.c it doesn't
matter as much since we don't put page tables in high memory on 32-bit

David Woodhouse Open Source Technology Centre Intel Corporation
[unhandled content-type:application/x-pkcs7-signature]
 \ /
  Last update: 2015-06-08 18:21    [W:0.080 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site