|
@@ -26,15 +26,15 @@ typedef struct xpaddr {
|
|
#define FOREIGN_FRAME_BIT (1UL<<31)
|
|
#define FOREIGN_FRAME_BIT (1UL<<31)
|
|
#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
|
|
#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
|
|
|
|
|
|
-extern unsigned long *phys_to_machine_mapping;
|
|
|
|
|
|
+extern unsigned long get_phys_to_machine(unsigned long pfn);
|
|
|
|
+extern void set_phys_to_machine(unsigned long pfn, unsigned long mfn);
|
|
|
|
|
|
static inline unsigned long pfn_to_mfn(unsigned long pfn)
|
|
static inline unsigned long pfn_to_mfn(unsigned long pfn)
|
|
{
|
|
{
|
|
if (xen_feature(XENFEAT_auto_translated_physmap))
|
|
if (xen_feature(XENFEAT_auto_translated_physmap))
|
|
return pfn;
|
|
return pfn;
|
|
|
|
|
|
- return phys_to_machine_mapping[(unsigned int)(pfn)] &
|
|
|
|
- ~FOREIGN_FRAME_BIT;
|
|
|
|
|
|
+ return get_phys_to_machine(pfn) & ~FOREIGN_FRAME_BIT;
|
|
}
|
|
}
|
|
|
|
|
|
static inline int phys_to_machine_mapping_valid(unsigned long pfn)
|
|
static inline int phys_to_machine_mapping_valid(unsigned long pfn)
|
|
@@ -42,7 +42,7 @@ static inline int phys_to_machine_mapping_valid(unsigned long pfn)
|
|
if (xen_feature(XENFEAT_auto_translated_physmap))
|
|
if (xen_feature(XENFEAT_auto_translated_physmap))
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
- return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
|
|
|
|
|
|
+ return get_phys_to_machine(pfn) != INVALID_P2M_ENTRY;
|
|
}
|
|
}
|
|
|
|
|
|
static inline unsigned long mfn_to_pfn(unsigned long mfn)
|
|
static inline unsigned long mfn_to_pfn(unsigned long mfn)
|
|
@@ -106,20 +106,12 @@ static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
|
|
unsigned long pfn = mfn_to_pfn(mfn);
|
|
unsigned long pfn = mfn_to_pfn(mfn);
|
|
if ((pfn < max_mapnr)
|
|
if ((pfn < max_mapnr)
|
|
&& !xen_feature(XENFEAT_auto_translated_physmap)
|
|
&& !xen_feature(XENFEAT_auto_translated_physmap)
|
|
- && (phys_to_machine_mapping[pfn] != mfn))
|
|
|
|
|
|
+ && (get_phys_to_machine(pfn) != mfn))
|
|
return max_mapnr; /* force !pfn_valid() */
|
|
return max_mapnr; /* force !pfn_valid() */
|
|
|
|
+ /* XXX fixme; not true with sparsemem */
|
|
return pfn;
|
|
return pfn;
|
|
}
|
|
}
|
|
|
|
|
|
-static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
|
|
|
|
-{
|
|
|
|
- if (xen_feature(XENFEAT_auto_translated_physmap)) {
|
|
|
|
- BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- phys_to_machine_mapping[pfn] = mfn;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/* VIRT <-> MACHINE conversion */
|
|
/* VIRT <-> MACHINE conversion */
|
|
#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
|
|
#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
|
|
#define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v))))
|
|
#define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v))))
|