ChangeSet 1.1267, 2005/04/04 17:13:17+01:00, mafetter@xxxxxxxxxxxxxxxx
Hand merged
Signed-off-by: michael.fetterman@xxxxxxxxxxxx
tools/libxc/xc.h | 5
tools/misc/Makefile | 5
xen/arch/x86/domain.c | 97 +---
xen/arch/x86/domain_build.c | 58 ++
xen/arch/x86/mm.c | 1006 +++++++++++++-------------------------------
xen/arch/x86/shadow.c | 18
xen/arch/x86/traps.c | 11
xen/arch/x86/vmx.c | 31 -
xen/arch/x86/vmx_io.c | 2
xen/common/grant_table.c | 25 -
xen/common/page_alloc.c | 17
xen/common/schedule.c | 3
xen/drivers/char/console.c | 19
xen/include/asm-x86/mm.h | 84 +++
xen/include/asm-x86/page.h | 15
xen/include/xen/sched.h | 1
16 files changed, 553 insertions(+), 844 deletions(-)
diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h
--- a/tools/libxc/xc.h 2005-04-05 12:21:46 -04:00
+++ b/tools/libxc/xc.h 2005-04-05 12:21:46 -04:00
@@ -381,6 +381,11 @@
u32 op,
xc_perfc_desc_t *desc);
+/* read/write msr */
+long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
+int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
+ unsigned int high);
+
/**
* Memory maps a range within one domain to a local address range. Mappings
* should be unmapped with munmap and should follow the same rules as mmap
diff -Nru a/tools/misc/Makefile b/tools/misc/Makefile
--- a/tools/misc/Makefile 2005-04-05 12:21:46 -04:00
+++ b/tools/misc/Makefile 2005-04-05 12:21:46 -04:00
@@ -13,7 +13,7 @@
HDRS = $(wildcard *.h)
-TARGETS = xenperf
+TARGETS = xenperf xc_shadow
INSTALL_BIN = $(TARGETS) xencons
INSTALL_SBIN = netfix xm xend xensv xenperf
@@ -21,6 +21,7 @@
all: build
build: $(TARGETS)
$(MAKE) -C miniterm
+ $(MAKE) -C cpuperf
$(MAKE) -C mbootpack
install: build
@@ -28,6 +29,7 @@
[ -d $(DESTDIR)/usr/sbin ] || $(INSTALL_DIR) $(DESTDIR)/usr/sbin
$(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
$(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin
+ $(MAKE) -C cpuperf install
# No sense in installing miniterm on the Xen box.
# $(MAKE) -C miniterm install
# Likewise mbootpack
@@ -36,6 +38,7 @@
clean:
$(RM) *.o $(TARGETS) *~
$(MAKE) -C miniterm clean
+ $(MAKE) -C cpuperf clean
$(MAKE) -C mbootpack clean
%.o: %.c $(HDRS) Makefile
diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c 2005-04-05 12:21:46 -04:00
+++ b/xen/arch/x86/domain.c 2005-04-05 12:21:46 -04:00
@@ -259,12 +259,14 @@
machine_to_phys_mapping[virt_to_phys(d->arch.mm_perdomain_pt) >>
PAGE_SHIFT] = INVALID_M2P_ENTRY;
ed->arch.perdomain_ptes = d->arch.mm_perdomain_pt;
-#if 0 /* don't need this yet, but maybe soon! */
- ed->arch.guest_vtable = linear_l2_table;
- ed->arch.shadow_vtable = shadow_linear_l2_table;
-#endif
+
+ ed->arch.guest_vtable = __linear_l2_table;
+ ed->arch.shadow_vtable = __shadow_linear_l2_table;
#ifdef __x86_64__
+ ed->arch.guest_vl3table = __linear_l3_table;
+ ed->arch.guest_vl4table = __linear_l4_table;
+
d->arch.mm_perdomain_l2 = (l2_pgentry_t *)alloc_xenheap_page();
memset(d->arch.mm_perdomain_l2, 0, PAGE_SIZE);
d->arch.mm_perdomain_l2[l2_table_offset(PERDOMAIN_VIRT_START)] =
@@ -276,6 +278,7 @@
#endif
shadow_lock_init(d);
+ INIT_LIST_HEAD(&d->arch.free_shadow_frames);
}
}
@@ -307,70 +310,6 @@
reset_stack_and_jump(vmx_asm_do_launch);
}
-unsigned long alloc_monitor_pagetable(struct exec_domain *ed)
-{
- unsigned long mmfn;
- l2_pgentry_t *mpl2e;
- struct pfn_info *mmfn_info;
- struct domain *d = ed->domain;
-
- ASSERT(pagetable_val(ed->arch.monitor_table) == 0);
-
- mmfn_info = alloc_domheap_page(NULL);
- ASSERT(mmfn_info != NULL);
-
- mmfn = (unsigned long) (mmfn_info - frame_table);
- mpl2e = (l2_pgentry_t *) map_domain_mem(mmfn << PAGE_SHIFT);
- memset(mpl2e, 0, PAGE_SIZE);
-
- memcpy(&mpl2e[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
- &idle_pg_table[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
- HYPERVISOR_ENTRIES_PER_L2_PAGETABLE * sizeof(l2_pgentry_t));
-
- mpl2e[l2_table_offset(PERDOMAIN_VIRT_START)] =
- mk_l2_pgentry((__pa(d->arch.mm_perdomain_pt) & PAGE_MASK)
- | __PAGE_HYPERVISOR);
-
- ed->arch.monitor_vtable = mpl2e;
-
- /* Map the p2m map into the Read-Only MPT space for this domain. */
- mpl2e[l2_table_offset(RO_MPT_VIRT_START)] =
- mk_l2_pgentry(pagetable_val(ed->arch.phys_table) | __PAGE_HYPERVISOR);
-
- return mmfn;
-}
-
-/*
- * Free the pages for monitor_table and hl2_table
- */
-static void free_monitor_pagetable(struct exec_domain *ed)
-{
- l2_pgentry_t *mpl2e;
- unsigned long mfn;
-
- ASSERT( pagetable_val(ed->arch.monitor_table) );
-
- mpl2e = ed->arch.monitor_vtable;
-
- /*
- * First get the mfn for hl2_table by looking at monitor_table
- */
- mfn = l2_pgentry_val(mpl2e[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT])
- >> PAGE_SHIFT;
-
- free_domheap_page(&frame_table[mfn]);
- unmap_domain_mem(mpl2e);
-
- /*
- * Then free monitor_table.
- */
- mfn = (pagetable_val(ed->arch.monitor_table)) >> PAGE_SHIFT;
- free_domheap_page(&frame_table[mfn]);
-
- ed->arch.monitor_table = mk_pagetable(0);
- ed->arch.monitor_vtable = 0;
-}
-
static int vmx_final_setup_guest(struct exec_domain *ed,
full_execution_context_t *full_context)
{
@@ -421,8 +360,6 @@
shadow_mode_enable(ed->domain, SHM_enable|SHM_translate|SHM_external);
}
- update_pagetables(ed);
-
return 0;
out:
@@ -509,7 +446,7 @@
d->vm_assist = c->vm_assist;
phys_basetab = c->pt_base;
- ed->arch.guest_table = ed->arch.phys_table = mk_pagetable(phys_basetab);
+ ed->arch.guest_table = mk_pagetable(phys_basetab);
if ( !get_page_and_type(&frame_table[phys_basetab>>PAGE_SHIFT], d,
PGT_base_page_table) )
@@ -528,8 +465,22 @@
}
#ifdef CONFIG_VMX
- if (c->flags & ECF_VMX_GUEST)
- return vmx_final_setup_guest(ed, c);
+ if ( c->flags & ECF_VMX_GUEST )
+ {
+ int error;
+
+ // VMX uses the initially provided page tables as the P2M map.
+ //
+ // XXX: This creates a security issue -- Xen can't necessarily
+ // trust the VMX domain builder. Xen should validate this
+ // page table, and/or build the table itself, or ???
+ //
+ if ( !pagetable_val(d->arch.phys_table) )
+ d->arch.phys_table = ed->arch.guest_table;
+
+ if ( (error = vmx_final_setup_guest(ed, c)) )
+ return error;
+ }
#endif
update_pagetables(ed);
diff -Nru a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c 2005-04-05 12:21:46 -04:00
+++ b/xen/arch/x86/domain_build.c 2005-04-05 12:21:46 -04:00
@@ -25,6 +25,12 @@
static unsigned int opt_dom0_mem = 0;
integer_param("dom0_mem", opt_dom0_mem);
+static unsigned int opt_dom0_shadow = 0;
+boolean_param("dom0_shadow", opt_dom0_shadow);
+
+static unsigned int opt_dom0_translate = 0;
+boolean_param("dom0_translate", opt_dom0_translate);
+
#if defined(__i386__)
/* No ring-3 access in initial leaf page tables. */
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
@@ -103,6 +109,7 @@
unsigned long mpt_alloc;
extern void physdev_init_dom0(struct domain *);
+ extern void translate_l2pgtable(struct domain *d, l1_pgentry_t *p2m,
unsigned long l2mfn);
/* Sanity! */
if ( d->id != 0 )
@@ -270,8 +277,13 @@
l1tab += l1_table_offset(vpt_start);
for ( count = 0; count < nr_pt_pages; count++ )
{
- *l1tab = mk_l1_pgentry(l1_pgentry_val(*l1tab) & ~_PAGE_RW);
page = &frame_table[l1_pgentry_to_pfn(*l1tab)];
+ if ( !opt_dom0_shadow )
+ *l1tab = mk_l1_pgentry(l1_pgentry_val(*l1tab) & ~_PAGE_RW);
+ else
+ if ( !get_page_type(page, PGT_writable_page) )
+ BUG();
+
if ( count == 0 )
{
page->u.inuse.type_info &= ~PGT_type_mask;
@@ -414,7 +426,7 @@
d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
d->shared_info->n_vcpu = smp_num_cpus;
- /* Set up shadow and monitor tables. */
+ /* Set up monitor table */
update_pagetables(ed);
/* Install the new page tables. */
@@ -434,12 +446,24 @@
init_domheap_pages(
_initrd_start, (_initrd_start+initrd_len+PAGE_SIZE-1) & PAGE_MASK);
}
-
+
+ d->next_io_page = max_page;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|