Index: xen/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c =================================================================== --- xen.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c +++ xen/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c @@ -297,9 +297,8 @@ int _packet_write(struct packet *pak, pfn = __pa(MMAP_VADDR(tpmif, i)) >> PAGE_SHIFT; mfn = FOREIGN_FRAME(map_op.dev_bus_addr >> PAGE_SHIFT); - mfn_orig = phys_to_machine_mapping[pfn]; - set_phys_to_machine(pfn, mfn); + mfn_orig = set_phys_to_machine(pfn, mfn); tocopy = MIN(size - offset, PAGE_SIZE); Index: xen/xen-unstable.hg/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h =================================================================== --- xen.orig/xen-unstable.hg/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h +++ xen/xen-unstable.hg/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h @@ -137,13 +137,17 @@ static inline unsigned long mfn_to_local return pfn; } -static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn) +static inline +unsigned long set_phys_to_machine(unsigned long pfn, unsigned long mfn) { + unsigned long mfn_orig; if (xen_feature(XENFEAT_auto_translated_physmap)) { BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); - return; + return phys_to_machine_mapping[pfn]; } + mfn_orig = phys_to_machine_mapping[pfn]; phys_to_machine_mapping[pfn] = mfn; + return mfn_orig; } /* Definitions for machine and pseudophysical addresses. */