Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm/xen: implement correctly pfn_to_mfn

After the commit introducing convertion between DMA and guest addresses,
all the callers of pfn_to_mfn are expecting to get a GFN (Guest Frame
Number). On ARM, all the guests are auto-translated so the GFN is equal
to the Linux PFN (Pseudo-physical Frame Number).

The current implementation may return an MFN if the caller is passing a
PFN associated to a mapped foreign grant. In pratice, I haven't seen
the problem on running guest but we should fix it for the sake of
correctness.

Correct the implementation by always returning the pfn passed in parameter.

A follow-up patch will take care to rename pfn_to_mfn to a suitable
name.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>

-8
-8
arch/arm/include/asm/xen/page.h
··· 36 36 37 37 static inline unsigned long pfn_to_mfn(unsigned long pfn) 38 38 { 39 - unsigned long mfn; 40 - 41 - if (phys_to_mach.rb_node != NULL) { 42 - mfn = __pfn_to_mfn(pfn); 43 - if (mfn != INVALID_P2M_ENTRY) 44 - return mfn; 45 - } 46 - 47 39 return pfn; 48 40 } 49 41