# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 8aeb417387caa0dc0e6d0b1bc733a3303fcfd965
# Parent f20c10ecef94e0aa4fef6f5fb802a4ad01034312
Fix some more pfn/mfn/gmfn/gpfn inconsistencies. Fix some direct
uses of max_page variable to use the mfn_valid() predicate.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r f20c10ecef94 -r 8aeb417387ca
linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c Thu Feb 2
10:59:20 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c Thu Feb 2
11:18:28 2006
@@ -17,8 +17,8 @@
op.u.read_memtype.reg = reg;
(void)HYPERVISOR_dom0_op(&op);
- *size = op.u.read_memtype.nr_pfns;
- *base = op.u.read_memtype.pfn;
+ *size = op.u.read_memtype.nr_mfns;
+ *base = op.u.read_memtype.mfn;
*type = op.u.read_memtype.type;
}
@@ -64,8 +64,8 @@
dom0_op_t op;
op.cmd = DOM0_ADD_MEMTYPE;
- op.u.add_memtype.pfn = base;
- op.u.add_memtype.nr_pfns = size;
+ op.u.add_memtype.mfn = base;
+ op.u.add_memtype.nr_mfns = size;
op.u.add_memtype.type = type;
error = HYPERVISOR_dom0_op(&op);
if (error) {
diff -r f20c10ecef94 -r 8aeb417387ca tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Thu Feb 2 10:59:20 2006
+++ b/tools/libxc/xc_domain.c Thu Feb 2 11:18:28 2006
@@ -421,16 +421,16 @@
int xc_domain_iomem_permission(int xc_handle,
uint32_t domid,
- unsigned long first_pfn,
- unsigned long nr_pfns,
+ unsigned long first_mfn,
+ unsigned long nr_mfns,
uint8_t allow_access)
{
dom0_op_t op;
op.cmd = DOM0_IOMEM_PERMISSION;
op.u.iomem_permission.domain = domid;
- op.u.iomem_permission.first_pfn = first_pfn;
- op.u.iomem_permission.nr_pfns = nr_pfns;
+ op.u.iomem_permission.first_mfn = first_mfn;
+ op.u.iomem_permission.nr_mfns = nr_mfns;
op.u.iomem_permission.allow_access = allow_access;
return do_dom0_op(xc_handle, &op);
diff -r f20c10ecef94 -r 8aeb417387ca tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Thu Feb 2 10:59:20 2006
+++ b/tools/libxc/xc_linux_build.c Thu Feb 2 11:18:28 2006
@@ -767,7 +767,7 @@
PERROR("Cannot find shared info pfn");
goto error_out;
}
- guest_shared_info_mfn = xrpa.first_pfn;
+ guest_shared_info_mfn = xrpa.first_gpfn;
}
else
{
diff -r f20c10ecef94 -r 8aeb417387ca tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Thu Feb 2 10:59:20 2006
+++ b/tools/libxc/xc_private.c Thu Feb 2 11:18:28 2006
@@ -83,7 +83,7 @@
{
DECLARE_DOM0_OP;
op.cmd = DOM0_GETPAGEFRAMEINFO;
- op.u.getpageframeinfo.pfn = mfn;
+ op.u.getpageframeinfo.mfn = mfn;
op.u.getpageframeinfo.domain = (domid_t)dom;
if ( do_dom0_op(xc_handle, &op) < 0 )
{
diff -r f20c10ecef94 -r 8aeb417387ca tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Thu Feb 2 10:59:20 2006
+++ b/tools/libxc/xenctrl.h Thu Feb 2 11:18:28 2006
@@ -386,8 +386,8 @@
int xc_domain_iomem_permission(int xc_handle,
uint32_t domid,
- unsigned long first_pfn,
- unsigned long nr_pfns,
+ unsigned long first_mfn,
+ unsigned long nr_mfns,
uint8_t allow_access);
unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/audit.c
--- a/xen/arch/x86/audit.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/audit.c Thu Feb 2 11:18:28 2006
@@ -239,16 +239,16 @@
{
if ( l2e_get_flags(pt[i]) & _PAGE_PRESENT )
{
- unsigned long gmfn = l2e_get_pfn(pt[i]);
- struct page_info *gpage = mfn_to_page(gmfn);
-
- if ( gmfn < 0x100 )
+ unsigned long mfn = l2e_get_pfn(pt[i]);
+ struct page_info *gpage = mfn_to_page(mfn);
+
+ if ( mfn < 0x100 )
{
lowmem_mappings++;
continue;
}
- if ( gmfn > max_page )
+ if ( !mfn_valid(mfn) )
{
io_mappings++;
continue;
@@ -264,7 +264,7 @@
d->domain_id, hl2mfn, i,
page_get_owner(gpage),
page_get_owner(gpage)->domain_id,
- gmfn,
+ mfn,
gpage->count_info,
gpage->u.inuse.type_info);
continue;
@@ -286,16 +286,16 @@
{
if ( l1e_get_flags(pt[i]) & _PAGE_PRESENT )
{
- unsigned long gmfn = l1e_get_pfn(pt[i]);
- struct page_info *gpage = mfn_to_page(gmfn);
-
- if ( gmfn < 0x100 )
+ unsigned long mfn = l1e_get_pfn(pt[i]);
+ struct page_info *gpage = mfn_to_page(mfn);
+
+ if ( mfn < 0x100 )
{
lowmem_mappings++;
continue;
}
- if ( gmfn > max_page )
+ if ( !mfn_valid(mfn) )
{
io_mappings++;
continue;
@@ -313,7 +313,7 @@
printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW "
"t=%" PRtype_info " mfn=%lx\n",
d->domain_id, l1mfn, i,
- gpage->u.inuse.type_info, gmfn);
+ gpage->u.inuse.type_info, mfn);
errors++;
}
@@ -322,8 +322,8 @@
! page_out_of_sync(gpage) )
{
printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW of "
- "page table gmfn=%lx\n",
- d->domain_id, l1mfn, i, gmfn);
+ "page table mfn=%lx\n",
+ d->domain_id, l1mfn, i, mfn);
errors++;
}
}
@@ -336,7 +336,7 @@
d->domain_id, l1mfn, i,
page_get_owner(gpage),
page_get_owner(gpage)->domain_id,
- gmfn,
+ mfn,
gpage->count_info,
gpage->u.inuse.type_info);
continue;
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/dom0_ops.c Thu Feb 2 11:18:28 2006
@@ -98,8 +98,8 @@
case DOM0_ADD_MEMTYPE:
{
ret = mtrr_add_page(
- op->u.add_memtype.pfn,
- op->u.add_memtype.nr_pfns,
+ op->u.add_memtype.mfn,
+ op->u.add_memtype.nr_mfns,
op->u.add_memtype.type,
1);
if (ret > 0)
@@ -128,16 +128,16 @@
case DOM0_READ_MEMTYPE:
{
- unsigned long pfn;
- unsigned int nr_pfns;
+ unsigned long mfn;
+ unsigned int nr_mfns;
mtrr_type type;
ret = -EINVAL;
if ( op->u.read_memtype.reg < num_var_ranges )
{
- mtrr_if->get(op->u.read_memtype.reg, &pfn, &nr_pfns, &type);
- (void)__put_user(pfn, &u_dom0_op->u.read_memtype.pfn);
- (void)__put_user(nr_pfns, &u_dom0_op->u.read_memtype.nr_pfns);
+ mtrr_if->get(op->u.read_memtype.reg, &mfn, &nr_mfns, &type);
+ (void)__put_user(mfn, &u_dom0_op->u.read_memtype.mfn);
+ (void)__put_user(nr_mfns, &u_dom0_op->u.read_memtype.nr_mfns);
(void)__put_user(type, &u_dom0_op->u.read_memtype.type);
ret = 0;
}
@@ -200,17 +200,17 @@
case DOM0_GETPAGEFRAMEINFO:
{
struct page_info *page;
- unsigned long pfn = op->u.getpageframeinfo.pfn;
+ unsigned long mfn = op->u.getpageframeinfo.mfn;
domid_t dom = op->u.getpageframeinfo.domain;
struct domain *d;
ret = -EINVAL;
- if ( unlikely(pfn >= max_page) ||
+ if ( unlikely(!mfn_valid(mfn)) ||
unlikely((d = find_domain_by_id(dom)) == NULL) )
break;
- page = mfn_to_page(pfn);
+ page = mfn_to_page(mfn);
if ( likely(get_page(page, d)) )
{
@@ -337,7 +337,7 @@
int i;
struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
unsigned long max_pfns = op->u.getmemlist.max_pfns;
- unsigned long pfn;
+ unsigned long mfn;
unsigned long *buffer = op->u.getmemlist.buffer;
struct list_head *list_ent;
@@ -350,14 +350,14 @@
list_ent = d->page_list.next;
for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
{
- pfn = page_to_mfn(list_entry(list_ent, struct page_info,
list));
- if ( put_user(pfn, buffer) )
+ mfn = page_to_mfn(list_entry(list_ent, struct page_info,
list));
+ if ( put_user(mfn, buffer) )
{
ret = -EFAULT;
break;
}
buffer++;
- list_ent = mfn_to_page(pfn)->list.next;
+ list_ent = mfn_to_page(mfn)->list.next;
}
spin_unlock(&d->page_alloc_lock);
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/domain_build.c Thu Feb 2 11:18:28 2006
@@ -644,7 +644,7 @@
if ( opt_dom0_translate )
{
si->shared_info = max_page << PAGE_SHIFT;
- set_pfn_from_mfn(virt_to_maddr(d->shared_info) >> PAGE_SHIFT,
max_page);
+ set_gpfn_from_mfn(virt_to_maddr(d->shared_info) >> PAGE_SHIFT,
max_page);
}
si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
@@ -664,7 +664,7 @@
mfn = alloc_epfn - (pfn - REVERSE_START);
#endif
((unsigned long *)vphysmap_start)[pfn] = mfn;
- set_pfn_from_mfn(mfn, pfn);
+ set_gpfn_from_mfn(mfn, pfn);
}
while ( pfn < nr_pages )
{
@@ -677,7 +677,7 @@
#define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
#endif
((unsigned long *)vphysmap_start)[pfn] = mfn;
- set_pfn_from_mfn(mfn, pfn);
+ set_gpfn_from_mfn(mfn, pfn);
#undef pfn
page++; pfn++;
}
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/hvm/hvm.c Thu Feb 2 11:18:28 2006
@@ -64,7 +64,7 @@
local_flush_tlb_pge();
- mfn = get_mfn_from_pfn(E820_MAP_PAGE >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(E820_MAP_PAGE >> PAGE_SHIFT);
if (mfn == INVALID_MFN) {
printk("Can not find E820 memory map page for HVM domain.\n");
domain_crash_synchronous();
@@ -97,7 +97,7 @@
unmap_domain_page(p);
/* Initialise shared page */
- mfn = get_mfn_from_pfn(gpfn);
+ mfn = get_mfn_from_gpfn(gpfn);
if (mfn == INVALID_MFN) {
printk("Can not find io request shared page for HVM domain.\n");
domain_crash_synchronous();
@@ -143,7 +143,7 @@
unsigned long mfn;
struct hvm_info_table *t;
- mfn = get_mfn_from_pfn(HVM_INFO_PFN);
+ mfn = get_mfn_from_gpfn(HVM_INFO_PFN);
if ( mfn == INVALID_MFN ) {
printk("Can not get info page mfn for HVM domain.\n");
domain_crash_synchronous();
@@ -255,9 +255,9 @@
if (hvm_paging_enabled(current)) {
gpa = gva_to_gpa(vaddr);
- mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(gpa >> PAGE_SHIFT);
} else
- mfn = get_mfn_from_pfn(vaddr >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(vaddr >> PAGE_SHIFT);
if (mfn == INVALID_MFN)
return 0;
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/hvm/svm/svm.c Thu Feb 2 11:18:28 2006
@@ -1364,7 +1364,7 @@
{
/* The guest CR3 must be pointing to the guest physical. */
if (!VALID_MFN(mfn =
- get_mfn_from_pfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT))
+ get_mfn_from_gpfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT))
|| !get_page(mfn_to_page(mfn), v->domain))
{
printk("Invalid CR3 value = %lx\n", v->arch.hvm_svm.cpu_cr3);
@@ -1557,7 +1557,7 @@
* removed some translation or changed page attributes.
* We simply invalidate the shadow.
*/
- mfn = get_mfn_from_pfn(value >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
if (mfn != pagetable_get_pfn(v->arch.guest_table))
__hvm_bug(regs);
shadow_sync_all(v->domain);
@@ -1570,7 +1570,7 @@
*/
HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
if (((value >> PAGE_SHIFT) > v->domain->max_pages)
- || !VALID_MFN(mfn = get_mfn_from_pfn(value >> PAGE_SHIFT))
+ || !VALID_MFN(mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT))
|| !get_page(mfn_to_page(mfn), v->domain))
{
printk("Invalid CR3 value=%lx\n", value);
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/hvm/vmx/vmx.c Thu Feb 2 11:18:28 2006
@@ -968,7 +968,7 @@
* removed some translation or changed page attributes.
* We simply invalidate the shadow.
*/
- mfn = get_mfn_from_pfn(c->cr3 >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(c->cr3 >> PAGE_SHIFT);
if (mfn != pagetable_get_pfn(v->arch.guest_table)) {
printk("Invalid CR3 value=%x", c->cr3);
domain_crash_synchronous();
@@ -986,7 +986,7 @@
domain_crash_synchronous();
return 0;
}
- mfn = get_mfn_from_pfn(c->cr3 >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(c->cr3 >> PAGE_SHIFT);
if(!get_page(mfn_to_page(mfn), v->domain))
return 0;
old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
@@ -1157,7 +1157,7 @@
/*
* The guest CR3 must be pointing to the guest physical.
*/
- if ( !VALID_MFN(mfn = get_mfn_from_pfn(
+ if ( !VALID_MFN(mfn = get_mfn_from_gpfn(
v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT)) ||
!get_page(mfn_to_page(mfn), v->domain) )
{
@@ -1232,7 +1232,7 @@
if(!((value & X86_CR0_PE) && (value & X86_CR0_PG)) && paging_enabled)
if(v->arch.hvm_vmx.cpu_cr3) {
- put_page(mfn_to_page(get_mfn_from_pfn(
+ put_page(mfn_to_page(get_mfn_from_gpfn(
v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT)));
v->arch.guest_table = mk_pagetable(0);
}
@@ -1366,7 +1366,7 @@
* removed some translation or changed page attributes.
* We simply invalidate the shadow.
*/
- mfn = get_mfn_from_pfn(value >> PAGE_SHIFT);
+ mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
if (mfn != pagetable_get_pfn(v->arch.guest_table))
__hvm_bug(regs);
shadow_sync_all(v->domain);
@@ -1377,7 +1377,7 @@
*/
HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
if ( ((value >> PAGE_SHIFT) > v->domain->max_pages ) ||
- !VALID_MFN(mfn = get_mfn_from_pfn(value >> PAGE_SHIFT)) ||
+ !VALID_MFN(mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT)) ||
!get_page(mfn_to_page(mfn), v->domain) )
{
printk("Invalid CR3 value=%lx", value);
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/mm.c Thu Feb 2 11:18:28 2006
@@ -475,7 +475,7 @@
{
MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte
" for dom%d",
- mfn, get_pfn_from_mfn(mfn), l1e_get_intpte(l1e), d->domain_id);
+ mfn, get_gpfn_from_mfn(mfn), l1e_get_intpte(l1e),
d->domain_id);
}
return okay;
@@ -1507,7 +1507,7 @@
" != exp %" PRtype_info ") "
"for mfn %lx (pfn %lx)",
x, type, page_to_mfn(page),
- get_pfn_from_mfn(page_to_mfn(page)));
+ get_gpfn_from_mfn(page_to_mfn(page)));
return 0;
}
else if ( (x & PGT_va_mask) == PGT_va_mutable )
@@ -1547,7 +1547,7 @@
{
MEM_LOG("Error while validating mfn %lx (pfn %lx) for type %"
PRtype_info ": caf=%08x taf=%" PRtype_info,
- page_to_mfn(page), get_pfn_from_mfn(page_to_mfn(page)),
+ page_to_mfn(page), get_gpfn_from_mfn(page_to_mfn(page)),
type, page->count_info, page->u.inuse.type_info);
/* Noone else can get a reference. We hold the only ref. */
page->u.inuse.type_info = 0;
@@ -2152,7 +2152,8 @@
case MMU_MACHPHYS_UPDATE:
- if (shadow_mode_translate(FOREIGNDOM)) {
+ if ( shadow_mode_translate(FOREIGNDOM) )
+ {
MEM_LOG("can't mutate m2p table of translate mode guest");
break;
}
@@ -2166,7 +2167,7 @@
break;
}
- set_pfn_from_mfn(mfn, gpfn);
+ set_gpfn_from_mfn(mfn, gpfn);
okay = 1;
mark_dirty(FOREIGNDOM, mfn);
@@ -2626,7 +2627,7 @@
struct domain *d = v->domain;
/* NB. There are 512 8-byte entries per GDT page. */
int i, nr_pages = (entries + 511) / 512;
- unsigned long pfn;
+ unsigned long mfn;
if ( entries > FIRST_RESERVED_GDT_ENTRY )
return -EINVAL;
@@ -2635,9 +2636,9 @@
/* Check the pages in the new GDT. */
for ( i = 0; i < nr_pages; i++ ) {
- pfn = frames[i] = gmfn_to_mfn(d, frames[i]);
- if ((pfn >= max_page) ||
- !get_page_and_type(mfn_to_page(pfn), d, PGT_gdt_page) )
+ mfn = frames[i] = gmfn_to_mfn(d, frames[i]);
+ if ( !mfn_valid(mfn) ||
+ !get_page_and_type(mfn_to_page(mfn), d, PGT_gdt_page) )
goto fail;
}
@@ -2704,7 +2705,7 @@
if ( !VALID_MFN(mfn = gmfn_to_mfn(dom, gmfn)) ||
(((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
- (mfn >= max_page) ||
+ !mfn_valid(mfn) ||
!check_descriptor(&d) )
{
UNLOCK_BIGLOCK(dom);
@@ -2805,8 +2806,8 @@
}
UNLOCK_BIGLOCK(d);
- xrpa.first_pfn = d->arch.first_reserved_pfn;
- xrpa.nr_pfns = 32;
+ xrpa.first_gpfn = d->arch.first_reserved_pfn;
+ xrpa.nr_gpfns = 32;
put_domain(d);
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/shadow32.c Thu Feb 2 11:18:28 2006
@@ -870,7 +870,7 @@
{
page = list_entry(list_ent, struct page_info, list);
mfn = page_to_mfn(page);
- pfn = get_pfn_from_mfn(mfn);
+ pfn = get_gpfn_from_mfn(mfn);
ASSERT(pfn != INVALID_M2P_ENTRY);
ASSERT(pfn < (1u<<20));
@@ -884,7 +884,7 @@
{
page = list_entry(list_ent, struct page_info, list);
mfn = page_to_mfn(page);
- pfn = get_pfn_from_mfn(mfn);
+ pfn = get_gpfn_from_mfn(mfn);
if ( (pfn != INVALID_M2P_ENTRY) &&
(pfn < (1u<<20)) )
{
@@ -1410,7 +1410,7 @@
}
unsigned long
-get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_gpfn_foreign(struct domain *d, unsigned long gpfn)
{
unsigned long va, tabpfn;
l1_pgentry_t *l1, l1e;
@@ -1418,7 +1418,7 @@
ASSERT(shadow_mode_translate(d));
- perfc_incrc(get_mfn_from_pfn_foreign);
+ perfc_incrc(get_mfn_from_gpfn_foreign);
va = gpfn << PAGE_SHIFT;
tabpfn = pagetable_get_pfn(d->arch.phys_table);
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/shadow_public.c Thu Feb 2 11:18:28 2006
@@ -1397,7 +1397,7 @@
{
page = list_entry(list_ent, struct page_info, list);
mfn = page_to_mfn(page);
- pfn = get_pfn_from_mfn(mfn);
+ pfn = get_gpfn_from_mfn(mfn);
ASSERT(pfn != INVALID_M2P_ENTRY);
ASSERT(pfn < (1u<<20));
@@ -1411,7 +1411,7 @@
{
page = list_entry(list_ent, struct page_info, list);
mfn = page_to_mfn(page);
- pfn = get_pfn_from_mfn(mfn);
+ pfn = get_gpfn_from_mfn(mfn);
if ( (pfn != INVALID_M2P_ENTRY) &&
(pfn < (1u<<20)) )
{
@@ -1599,7 +1599,7 @@
}
unsigned long
-get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_gpfn_foreign(struct domain *d, unsigned long gpfn)
{
unsigned long va, tabpfn;
l1_pgentry_t *l1, l1e;
@@ -1607,7 +1607,7 @@
ASSERT(shadow_mode_translate(d));
- perfc_incrc(get_mfn_from_pfn_foreign);
+ perfc_incrc(get_mfn_from_gpfn_foreign);
va = gpfn << PAGE_SHIFT;
tabpfn = pagetable_get_pfn(d->arch.phys_table);
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/x86_32/mm.c Thu Feb 2 11:18:28 2006
@@ -108,7 +108,7 @@
/* Fill with an obvious debug pattern. */
for ( i = 0; i < (mpt_size / BYTES_PER_LONG); i++)
- set_pfn_from_mfn(i, 0x55555555);
+ set_gpfn_from_mfn(i, 0x55555555);
/* Create page tables for ioremap(). */
for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
diff -r f20c10ecef94 -r 8aeb417387ca xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c Thu Feb 2 10:59:20 2006
+++ b/xen/arch/x86/x86_32/traps.c Thu Feb 2 11:18:28 2006
@@ -84,7 +84,7 @@
#ifdef CONFIG_X86_PAE
ptab = map_domain_page(mfn);
ent = ptab[l3_table_offset(addr)];
- pfn = get_pfn_from_mfn((u32)(ent >> PAGE_SHIFT));
+ pfn = get_gpfn_from_mfn((u32)(ent >> PAGE_SHIFT));
printk(" L3 = %"PRIpte" %08lx\n", ent, pfn);
unmap_domain_page(ptab);
if ( !(ent & _PAGE_PRESENT) )
@@ -94,7 +94,7 @@
ptab = map_domain_page(mfn);
ent = ptab[l2_table_offset(addr)];
- pfn = get_pfn_from_mfn((u32)(ent >> PAGE_SHIFT));
+ pfn = get_gpfn_from_mfn((u32)(ent >> PAGE_SHIFT));
printk(" L2 = %"PRIpte" %08lx %s\n", ent, pfn,
(ent & _PAGE_PSE) ? "(PSE)" : "");
unmap_domain_page(ptab);
@@ -104,7 +104,7 @@
ptab = map_domain_page(ent >> PAGE_SHIFT);
ent = ptab[l1_table_offset(addr)];
- pfn = get_pfn_from_mfn((u32)(ent >> PAGE_SHIFT));
+ pfn = get_gpfn_from_mfn((u32)(ent >> PAGE_SHIFT));
printk(" L1 = %"PRIpte" %08lx\n", ent, pfn);
unmap_domain_page(ptab);
}
diff -r f20c10ecef94 -r 8aeb417387ca xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c Thu Feb 2 10:59:20 2006
+++ b/xen/common/dom0_ops.c Thu Feb 2 11:18:28 2006
@@ -628,11 +628,11 @@
case DOM0_IOMEM_PERMISSION:
{
struct domain *d;
- unsigned long pfn = op->u.iomem_permission.first_pfn;
- unsigned long nr_pfns = op->u.iomem_permission.nr_pfns;
+ unsigned long mfn = op->u.iomem_permission.first_mfn;
+ unsigned long nr_mfns = op->u.iomem_permission.nr_mfns;
ret = -EINVAL;
- if ( (pfn + nr_pfns - 1) < pfn ) /* wrap? */
+ if ( (mfn + nr_mfns - 1) < mfn ) /* wrap? */
break;
ret = -ESRCH;
@@ -641,9 +641,9 @@
break;
if ( op->u.iomem_permission.allow_access )
- ret = iomem_permit_access(d, pfn, pfn + nr_pfns - 1);
+ ret = iomem_permit_access(d, mfn, mfn + nr_mfns - 1);
else
- ret = iomem_deny_access(d, pfn, pfn + nr_pfns - 1);
+ ret = iomem_deny_access(d, mfn, mfn + nr_mfns - 1);
put_domain(d);
}
diff -r f20c10ecef94 -r 8aeb417387ca xen/common/grant_table.c
--- a/xen/common/grant_table.c Thu Feb 2 10:59:20 2006
+++ b/xen/common/grant_table.c Thu Feb 2 11:18:28 2006
@@ -629,7 +629,6 @@
u16 sflags;
u32 scombo, prev_scombo;
int retries = 0;
- unsigned long target_pfn;
if ( unlikely((rgt = rd->grant_table) == NULL) ||
unlikely(ref >= NR_GRANT_ENTRIES) )
@@ -648,14 +647,6 @@
for ( ; ; )
{
- target_pfn = sha->frame;
-
- if ( unlikely(target_pfn >= max_page ) )
- {
- DPRINTK("Bad pfn (%lx)\n", target_pfn);
- goto fail;
- }
-
if ( unlikely(sflags != GTF_accept_transfer) ||
unlikely(sdom != ld->domain_id) )
{
diff -r f20c10ecef94 -r 8aeb417387ca xen/common/memory.c
--- a/xen/common/memory.c Thu Feb 2 10:59:20 2006
+++ b/xen/common/memory.c Thu Feb 2 11:18:28 2006
@@ -76,7 +76,7 @@
int *preempted)
{
struct page_info *page;
- unsigned long i, j, pfn, mfn;
+ unsigned long i, j, gpfn, mfn;
if ( !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
return 0;
@@ -104,18 +104,18 @@
mfn = page_to_mfn(page);
- if ( unlikely(__get_user(pfn, &extent_list[i]) != 0) )
+ if ( unlikely(__get_user(gpfn, &extent_list[i]) != 0) )
goto out;
if ( unlikely(shadow_mode_translate(d)) )
{
for ( j = 0; j < (1 << extent_order); j++ )
- guest_physmap_add_page(d, pfn + j, mfn + j);
+ guest_physmap_add_page(d, gpfn + j, mfn + j);
}
else
{
for ( j = 0; j < (1 << extent_order); j++ )
- set_pfn_from_mfn(mfn + j, pfn + j);
+ set_gpfn_from_mfn(mfn + j, gpfn + j);
/* Inform the domain of the new page's machine address. */
if ( __put_user(mfn, &extent_list[i]) != 0 )
@@ -156,10 +156,10 @@
for ( j = 0; j < (1 << extent_order); j++ )
{
mfn = gmfn_to_mfn(d, gmfn + j);
- if ( unlikely(mfn >= max_page) )
+ if ( unlikely(!mfn_valid(mfn)) )
{
- DPRINTK("Domain %u page number out of range (%lx >= %lx)\n",
- d->domain_id, mfn, max_page);
+ DPRINTK("Domain %u page number %lx invalid\n",
+ d->domain_id, mfn);
return i;
}
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-ia64/config.h Thu Feb 2 11:18:28 2006
@@ -216,7 +216,7 @@
#define page_info page
// see common/memory.c
-#define set_pfn_from_mfn(x,y) do { } while (0)
+#define set_gpfn_from_mfn(x,y) do { } while (0)
// see common/keyhandler.c
#define nop() asm volatile ("nop 0")
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-ia64/mm.h Thu Feb 2 11:18:28 2006
@@ -415,8 +415,8 @@
#define VALID_M2P(_e) (!((_e) & (1U<<63)))
#define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
-#define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
-#define get_pfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)])
+#define set_gpfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
+#define get_gpfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)])
/* If pmt table is provided by control pannel later, we need __get_user
* here. However if it's allocated by HV, we should access it directly
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-x86/grant_table.h Thu Feb 2 11:18:28 2006
@@ -25,7 +25,7 @@
do { \
SHARE_PFN_WITH_DOMAIN( \
virt_to_page((char *)(t)->shared + ((i) * PAGE_SIZE)), (d)); \
- set_pfn_from_mfn( \
+ set_gpfn_from_mfn( \
(virt_to_maddr((t)->shared) >> PAGE_SHIFT) + (i), \
INVALID_M2P_ENTRY); \
} while ( 0 )
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-x86/hvm/io.h
--- a/xen/include/asm-x86/hvm/io.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-x86/hvm/io.h Thu Feb 2 11:18:28 2006
@@ -154,7 +154,7 @@
extern int cpu_get_interrupt(struct vcpu *v, int *type);
// XXX - think about this, maybe use bit 30 of the mfn to signify an MMIO
frame.
-#define mmio_space(gpa) (!VALID_MFN(get_mfn_from_pfn((gpa) >> PAGE_SHIFT)))
+#define mmio_space(gpa) (!VALID_MFN(get_mfn_from_gpfn((gpa) >> PAGE_SHIFT)))
#endif /* __ASM_X86_HVM_IO_H__ */
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-x86/mm.h Thu Feb 2 11:18:28 2006
@@ -262,8 +262,8 @@
#define VALID_M2P(_e) (!((_e) & (1UL<<(BITS_PER_LONG-1))))
#define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
-#define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
-#define get_pfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)])
+#define set_gpfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
+#define get_gpfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)])
/*
* The phys_to_machine_mapping is the reversed mapping of MPT for full
@@ -275,8 +275,8 @@
#define INVALID_MFN (~0UL)
#define VALID_MFN(_mfn) (!((_mfn) & (1U<<31)))
-#define set_mfn_from_pfn(pfn, mfn) (phys_to_machine_mapping[(pfn)] = (mfn))
-static inline unsigned long get_mfn_from_pfn(unsigned long pfn)
+#define set_mfn_from_gpfn(pfn, mfn) (phys_to_machine_mapping[(pfn)] = (mfn))
+static inline unsigned long get_mfn_from_gpfn(unsigned long pfn)
{
unsigned long mfn;
l1_pgentry_t pte;
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-x86/shadow.h Thu Feb 2 11:18:28 2006
@@ -285,19 +285,19 @@
#define mfn_to_gmfn(_d, mfn) \
( (shadow_mode_translate(_d)) \
- ? get_pfn_from_mfn(mfn) \
+ ? get_gpfn_from_mfn(mfn) \
: (mfn) )
#define gmfn_to_mfn(_d, gpfn) \
({ \
unlikely(shadow_mode_translate(_d)) \
? (likely(current->domain == (_d)) \
- ? get_mfn_from_pfn(gpfn) \
- : get_mfn_from_pfn_foreign(_d, gpfn)) \
+ ? get_mfn_from_gpfn(gpfn) \
+ : get_mfn_from_gpfn_foreign(_d, gpfn)) \
: (gpfn); \
})
-extern unsigned long get_mfn_from_pfn_foreign(
+extern unsigned long get_mfn_from_gpfn_foreign(
struct domain *d, unsigned long gpfn);
/************************************************************************/
@@ -471,7 +471,7 @@
ASSERT(d->arch.shadow_dirty_bitmap != NULL);
/* We /really/ mean PFN here, even for non-translated guests. */
- pfn = get_pfn_from_mfn(mfn);
+ pfn = get_gpfn_from_mfn(mfn);
/*
* Values with the MSB set denote MFNs that aren't really part of the
@@ -488,7 +488,7 @@
d->arch.shadow_dirty_count++;
}
#ifndef NDEBUG
- else if ( mfn < max_page )
+ else if ( mfn_valid(mfn) )
{
SH_VLOG("mark_dirty OOR! mfn=%lx pfn=%lx max=%x (dom %p)",
mfn, pfn, d->arch.shadow_dirty_bitmap_size, d);
@@ -567,7 +567,7 @@
old_hl2e = v->arch.hl2_vtable[index];
if ( (l2e_get_flags(gl2e) & _PAGE_PRESENT) &&
- VALID_MFN(mfn = get_mfn_from_pfn(l2e_get_pfn(gl2e))) )
+ VALID_MFN(mfn = get_mfn_from_gpfn(l2e_get_pfn(gl2e))) )
new_hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
else
new_hl2e = l1e_empty();
@@ -649,7 +649,7 @@
shadow_lock(d);
shadow_sync_and_drop_references(d, mfn_to_page(mfn));
set_p2m_entry(d, gpfn, mfn, &c1, &c2);
- set_pfn_from_mfn(mfn, gpfn);
+ set_gpfn_from_mfn(mfn, gpfn);
shadow_unlock(d);
domain_mmap_cache_destroy(&c1);
domain_mmap_cache_destroy(&c2);
@@ -668,7 +668,7 @@
shadow_lock(d);
shadow_sync_and_drop_references(d, mfn_to_page(mfn));
set_p2m_entry(d, gpfn, -1, &c1, &c2);
- set_pfn_from_mfn(mfn, INVALID_M2P_ENTRY);
+ set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
shadow_unlock(d);
domain_mmap_cache_destroy(&c1);
domain_mmap_cache_destroy(&c2);
@@ -894,7 +894,7 @@
if ( l2e_get_flags(gpde) & _PAGE_PRESENT )
{
mfn = gmfn_to_mfn(d, pfn);
- if ( VALID_MFN(mfn) && (mfn < max_page) )
+ if ( VALID_MFN(mfn) && mfn_valid(mfn) )
hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
}
@@ -1233,7 +1233,7 @@
static inline unsigned long __shadow_status(
struct domain *d, unsigned long gpfn, unsigned long stype)
{
- unsigned long gmfn = ((current->domain == d)
+ unsigned long mfn = ((current->domain == d)
? gmfn_to_mfn(d, gpfn)
: INVALID_MFN);
@@ -1241,22 +1241,22 @@
ASSERT(gpfn == (gpfn & PGT_mfn_mask));
ASSERT(stype && !(stype & ~PGT_type_mask));
- if ( VALID_MFN(gmfn) && (gmfn < max_page) &&
+ if ( VALID_MFN(mfn) && mfn_valid(mfn) &&
(stype != PGT_writable_pred) &&
((stype == PGT_snapshot)
- ? !mfn_out_of_sync(gmfn)
- : !mfn_is_page_table(gmfn)) )
+ ? !mfn_out_of_sync(mfn)
+ : !mfn_is_page_table(mfn)) )
{
perfc_incrc(shadow_status_shortcut);
#ifndef NDEBUG
if ( ___shadow_status(d, gpfn, stype) != 0 )
{
- printk("d->id=%d gpfn=%lx gmfn=%lx stype=%lx c=%x t=%" PRtype_info
" "
- "mfn_out_of_sync(gmfn)=%d mfn_is_page_table(gmfn)=%d\n",
- d->domain_id, gpfn, gmfn, stype,
- mfn_to_page(gmfn)->count_info,
- mfn_to_page(gmfn)->u.inuse.type_info,
- mfn_out_of_sync(gmfn), mfn_is_page_table(gmfn));
+ printk("d->id=%d gpfn=%lx mfn=%lx stype=%lx c=%x t=%" PRtype_info
" "
+ "mfn_out_of_sync(mfn)=%d mfn_is_page_table(mfn)=%d\n",
+ d->domain_id, gpfn, mfn, stype,
+ mfn_to_page(mfn)->count_info,
+ mfn_to_page(mfn)->u.inuse.type_info,
+ mfn_out_of_sync(mfn), mfn_is_page_table(mfn));
BUG();
}
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/asm-x86/shadow_64.h
--- a/xen/include/asm-x86/shadow_64.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/asm-x86/shadow_64.h Thu Feb 2 11:18:28 2006
@@ -176,7 +176,7 @@
}
mfn = entry_get_pfn(*le_e);
if ( (flag & GUEST_ENTRY) && shadow_mode_translate(d) )
- mfn = get_mfn_from_pfn(mfn);
+ mfn = get_mfn_from_gpfn(mfn);
if ( le_p )
unmap_domain_page(le_p);
le_p = (pgentry_64_t *)map_domain_page(mfn);
@@ -301,7 +301,7 @@
if (unlikely(!(l2e_get_flags_32(gl2e) & _PAGE_PRESENT)))
return 0;
- l1mfn = get_mfn_from_pfn(
+ l1mfn = get_mfn_from_gpfn(
l2e_get_pfn(gl2e));
l1va = (l1_pgentry_32_t *)map_domain_page(l1mfn);
@@ -343,7 +343,7 @@
return 0;
- l1mfn = get_mfn_from_pfn(
+ l1mfn = get_mfn_from_gpfn(
l2e_get_pfn(gl2e));
l1va = (l1_pgentry_32_t *) map_domain_page(l1mfn);
if (gl1e)
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/public/dom0_ops.h Thu Feb 2 11:18:28 2006
@@ -141,11 +141,11 @@
typedef struct dom0_getpageframeinfo {
/* IN variables. */
- unsigned long pfn; /* Machine page frame number to query. */
+ unsigned long mfn; /* Machine page frame number to query. */
domid_t domain; /* To which domain does the frame belong? */
/* OUT variables. */
/* Is the page PINNED to a type? */
- uint32_t type; /* see above type defs */
+ uint32_t type; /* see above type defs */
} dom0_getpageframeinfo_t;
/*
@@ -263,7 +263,7 @@
} dom0_getpageframeinfo2_t;
/*
- * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
+ * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
* On x86, @type is an architecture-defined MTRR memory type.
* On success, returns the MTRR that was used (@reg) and a handle that can
* be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
@@ -272,8 +272,8 @@
#define DOM0_ADD_MEMTYPE 31
typedef struct dom0_add_memtype {
/* IN variables. */
- unsigned long pfn;
- unsigned long nr_pfns;
+ unsigned long mfn;
+ unsigned long nr_mfns;
uint32_t type;
/* OUT variables. */
uint32_t handle;
@@ -300,8 +300,8 @@
/* IN variables. */
uint32_t reg;
/* OUT variables. */
- unsigned long pfn;
- unsigned long nr_pfns;
+ unsigned long mfn;
+ unsigned long nr_mfns;
uint32_t type;
} dom0_read_memtype_t;
@@ -419,8 +419,8 @@
#define DOM0_IOMEM_PERMISSION 47
typedef struct dom0_iomem_permission {
domid_t domain; /* domain to be affected */
- unsigned long first_pfn; /* first page (physical page number) in range */
- unsigned long nr_pfns; /* number of pages in range (>0) */
+ unsigned long first_mfn; /* first page (physical page number) in range */
+ unsigned long nr_mfns; /* number of pages in range (>0) */
uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
} dom0_iomem_permission_t;
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/public/memory.h
--- a/xen/include/public/memory.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/public/memory.h Thu Feb 2 11:18:28 2006
@@ -21,12 +21,12 @@
/*
* XENMEM_increase_reservation:
- * OUT: MFN bases of extents that were allocated
+ * OUT: MFN (*not* GMFN) bases of extents that were allocated
* XENMEM_decrease_reservation:
- * IN: MFN bases of extents to free
+ * IN: GMFN bases of extents to free
* XENMEM_populate_physmap:
- * IN: PFN bases of extents to populate with memory
- * OUT: MFN bases of extents that were allocated
+ * IN: GPFN bases of extents to populate with memory
+ * OUT: GMFN bases of extents that were allocated
* (NB. This command also updates the mach_to_phys translation table)
*/
unsigned long *extent_start;
@@ -36,7 +36,7 @@
unsigned int extent_order;
/*
- * Mmaximum # bits addressable by the user of the allocated region (e.g.,
+ * Maximum # bits addressable by the user of the allocated region (e.g.,
* I/O devices often have a 32-bit limitation even in 64-bit systems). If
* zero then the user has no addressing restriction.
* This field is not used by XENMEM_decrease_reservation.
@@ -111,7 +111,7 @@
unsigned int idx;
/* Base and size of the specified reserved area. */
- unsigned long first_pfn, nr_pfns;
+ unsigned long first_gpfn, nr_gpfns;
} xen_reserved_phys_area_t;
#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff -r f20c10ecef94 -r 8aeb417387ca xen/include/xen/perfc_defn.h
--- a/xen/include/xen/perfc_defn.h Thu Feb 2 10:59:20 2006
+++ b/xen/include/xen/perfc_defn.h Thu Feb 2 11:18:28 2006
@@ -114,7 +114,7 @@
PERFCOUNTER_CPU(validate_hl2e_calls, "calls to validate_hl2e_change")
PERFCOUNTER_CPU(validate_hl2e_changes, "validate_hl2e makes changes")
PERFCOUNTER_CPU(exception_fixed, "pre-exception fixed")
-PERFCOUNTER_CPU(get_mfn_from_pfn_foreign, "calls to get_mfn_from_pfn_foreign")
+PERFCOUNTER_CPU(get_mfn_from_gpfn_foreign, "calls to
get_mfn_from_gpfn_foreign")
PERFCOUNTER_CPU(remove_all_access, "calls to remove_all_access")
PERFCOUNTER_CPU(remove_write_access, "calls to remove_write_access")
PERFCOUNTER_CPU(remove_write_access_easy, "easy outs of remove_write_access")
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|