# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 39c113fb84aca68b902d96aba8a57b36c9f6d42a
# Parent a1b47efc03df15203be97a788b66650db90e7bfa
# Parent f328519053f5a444af475ec10dc8089a0b176e3f
[POWERPC] merge with http://xenbits.xensource.com/xen-unstable.hg
---
tools/firmware/vmxassist/setup.c | 8 ++++----
tools/firmware/vmxassist/util.h | 20 +++-----------------
tools/libxc/xc_hvm_build.c | 22 +---------------------
xen/arch/x86/e820.c | 12 ++----------
xen/arch/x86/hvm/hvm.c | 1 +
xen/arch/x86/mm.c | 32 +-------------------------------
xen/arch/x86/traps.c | 3 ---
xen/common/domain.c | 6 ------
xen/common/grant_table.c | 36 +++++++++++++++++++-----------------
xen/include/asm-ia64/mm.h | 2 --
xen/include/asm-powerpc/mm.h | 4 +---
xen/include/asm-x86/e820.h | 31 +------------------------------
xen/include/asm-x86/hvm/domain.h | 1 -
xen/include/asm-x86/mm.h | 2 --
xen/include/asm-x86/page.h | 5 ++++-
xen/include/public/hvm/e820.h | 27 +++++++++++++++++++++++++++
16 files changed, 64 insertions(+), 148 deletions(-)
diff -r a1b47efc03df -r 39c113fb84ac tools/firmware/vmxassist/setup.c
--- a/tools/firmware/vmxassist/setup.c Mon Aug 14 09:53:46 2006 -0400
+++ b/tools/firmware/vmxassist/setup.c Mon Aug 14 10:03:58 2006 -0400
@@ -56,7 +56,7 @@ struct e820entry e820map[] = {
{ 0x00000000000A0000ULL, 0x0000000000020000ULL, E820_IO },
{ 0x00000000000C0000ULL, 0x0000000000040000ULL, E820_RESERVED },
{ 0x0000000000100000ULL, 0x0000000000000000ULL, E820_RAM },
- { 0x0000000000000000ULL, 0x0000000000001000ULL, E820_SHARED },
+ { 0x0000000000000000ULL, 0x0000000000001000ULL, E820_SHARED_PAGE },
{ 0x0000000000000000ULL, 0x0000000000003000ULL, E820_NVS },
{ 0x0000000000003000ULL, 0x000000000000A000ULL, E820_ACPI },
{ 0x00000000FEC00000ULL, 0x0000000001400000ULL, E820_IO },
@@ -94,13 +94,13 @@ banner(void)
e820map[6].addr = memory_size;
e820map[7].addr += memory_size;
- *LINUX_E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
- memcpy(LINUX_E820_MAP, e820map, sizeof(e820map));
+ *E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
+ memcpy(E820_MAP, e820map, sizeof(e820map));
#endif
printf("Memory size %ld MB\n", memory_size >> 20);
printf("E820 map:\n");
- print_e820_map(LINUX_E820_MAP, *LINUX_E820_MAP_NR);
+ print_e820_map(E820_MAP, *E820_MAP_NR);
printf("\n");
}
diff -r a1b47efc03df -r 39c113fb84ac tools/firmware/vmxassist/util.h
--- a/tools/firmware/vmxassist/util.h Mon Aug 14 09:53:46 2006 -0400
+++ b/tools/firmware/vmxassist/util.h Mon Aug 14 10:03:58 2006 -0400
@@ -23,23 +23,9 @@
#include <stdarg.h>
#include <vm86.h>
-
-#define LINUX_E820_MAP_NR ((unsigned char *)0x901E8)
-#define LINUX_E820_MAP ((struct e820entry *)0x902D0)
-
-#define E820_RAM 1
-#define E820_RESERVED 2
-#define E820_ACPI 3
-#define E820_NVS 4
-#define E820_IO 16
-#define E820_SHARED 17
-
-struct e820entry {
- unsigned long long addr;
- unsigned long long size;
- unsigned long type;
-} __attribute__((packed));
-
+#include <xen/hvm/e820.h>
+#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
+#define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
#define offsetof(type, member) ((unsigned) &((type *)0)->member)
diff -r a1b47efc03df -r 39c113fb84ac tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Mon Aug 14 09:53:46 2006 -0400
+++ b/tools/libxc/xc_hvm_build.c Mon Aug 14 10:03:58 2006 -0400
@@ -14,29 +14,9 @@
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/ioreq.h>
#include <xen/hvm/params.h>
+#include <xen/hvm/e820.h>
#define HVM_LOADER_ENTR_ADDR 0x00100000
-
-#define E820MAX 128
-
-#define E820_RAM 1
-#define E820_RESERVED 2
-#define E820_ACPI 3
-#define E820_NVS 4
-#define E820_IO 16
-#define E820_SHARED_PAGE 17
-#define E820_XENSTORE 18
-#define E820_BUFFERED_IO 19
-
-#define E820_MAP_PAGE 0x00090000
-#define E820_MAP_NR_OFFSET 0x000001E8
-#define E820_MAP_OFFSET 0x000002D0
-
-struct e820entry {
- uint64_t addr;
- uint64_t size;
- uint32_t type;
-} __attribute__((packed));
static int
parseelfimage(
diff -r a1b47efc03df -r 39c113fb84ac xen/arch/x86/e820.c
--- a/xen/arch/x86/e820.c Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/arch/x86/e820.c Mon Aug 14 10:03:58 2006 -0400
@@ -2,6 +2,7 @@
#include <xen/init.h>
#include <xen/lib.h>
#include <asm/e820.h>
+#include <asm/page.h>
/* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */
unsigned long long opt_mem;
@@ -30,16 +31,7 @@ static void __init add_memory_region(uns
}
} /* add_memory_region */
-#define E820_DEBUG 1
-
-#ifndef NDEBUG
-#define __init_unless_debugging
-#else
-#define __init_unless_debugging __init
-#endif
-
-void __init_unless_debugging
-print_e820_memory_map(struct e820entry *map, int entries)
+static void __init print_e820_memory_map(struct e820entry *map, int entries)
{
int i;
diff -r a1b47efc03df -r 39c113fb84ac xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/arch/x86/hvm/hvm.c Mon Aug 14 10:03:58 2006 -0400
@@ -31,6 +31,7 @@
#include <xen/guest_access.h>
#include <xen/event.h>
#include <asm/current.h>
+#include <asm/e820.h>
#include <asm/io.h>
#include <asm/shadow.h>
#include <asm/regs.h>
diff -r a1b47efc03df -r 39c113fb84ac xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/arch/x86/mm.c Mon Aug 14 10:03:58 2006 -0400
@@ -105,6 +105,7 @@
#include <asm/io.h>
#include <asm/ldt.h>
#include <asm/x86_emulate.h>
+#include <asm/e820.h>
#include <public/memory.h>
#ifdef VERBOSE
@@ -1656,26 +1657,6 @@ int get_page_type(struct page_info *page
{
if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
{
- if ( (current->domain == page_get_owner(page)) &&
- ((x & PGT_type_mask) == PGT_writable_page) )
- {
- /*
- * This ensures functions like set_gdt() see up-to-date
- * type info without needing to clean up writable p.t.
- * state on the fast path. We take this path only
- * when the current type is writable because:
- * 1. It's the only type that this path can decrement.
- * 2. If we take this path more liberally then we can
- * enter a recursive loop via get_page_from_l1e()
- * during pagetable revalidation.
- */
- sync_pagetable_state(current->domain);
- y = page->u.inuse.type_info;
- /* Can we make progress now? */
- if ( ((y & PGT_type_mask) == (type & PGT_type_mask)) ||
- ((y & PGT_count_mask) == 0) )
- goto again;
- }
if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
((type & PGT_type_mask) != PGT_l1_page_table) )
MEM_LOG("Bad type (saw %" PRtype_info
@@ -1936,8 +1917,6 @@ int do_mmuext_op(
LOCK_BIGLOCK(d);
- sync_pagetable_state(d);
-
if ( unlikely(count & MMU_UPDATE_PREEMPTED) )
{
count &= ~MMU_UPDATE_PREEMPTED;
@@ -2188,8 +2167,6 @@ int do_mmu_update(
struct domain_mmap_cache mapcache, sh_mapcache;
LOCK_BIGLOCK(d);
-
- sync_pagetable_state(d);
if ( unlikely(shadow_mode_enabled(d)) )
check_pagetable(v, "pre-mmu"); /* debug */
@@ -2700,8 +2677,6 @@ int do_update_va_mapping(unsigned long v
LOCK_BIGLOCK(d);
- sync_pagetable_state(d);
-
if ( unlikely(shadow_mode_enabled(d)) )
check_pagetable(v, "pre-va"); /* debug */
@@ -3334,11 +3309,6 @@ int ptwr_do_page_fault(struct domain *d,
bail:
UNLOCK_BIGLOCK(d);
return 0;
-}
-
-void sync_pagetable_state(struct domain *d)
-{
- shadow_sync_all(d);
}
int map_pages_to_xen(
diff -r a1b47efc03df -r 39c113fb84ac xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/arch/x86/traps.c Mon Aug 14 10:03:58 2006 -0400
@@ -713,7 +713,6 @@ static int handle_gdt_ldt_mapping_fault(
{
/* LDT fault: Copy a mapping from the guest's LDT, if it is valid. */
LOCK_BIGLOCK(d);
- sync_pagetable_state(d);
ret = map_ldt_shadow_page(offset >> PAGE_SHIFT);
UNLOCK_BIGLOCK(d);
@@ -849,7 +848,6 @@ static int spurious_page_fault(
int is_spurious;
LOCK_BIGLOCK(d);
- sync_pagetable_state(d);
is_spurious = __spurious_page_fault(addr, regs);
UNLOCK_BIGLOCK(d);
@@ -1302,7 +1300,6 @@ static int emulate_privileged_op(struct
case 3: /* Write CR3 */
LOCK_BIGLOCK(v->domain);
- sync_pagetable_state(v->domain);
(void)new_guest_cr3(gmfn_to_mfn(v->domain, xen_cr3_to_pfn(*reg)));
UNLOCK_BIGLOCK(v->domain);
break;
diff -r a1b47efc03df -r 39c113fb84ac xen/common/domain.c
--- a/xen/common/domain.c Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/common/domain.c Mon Aug 14 10:03:58 2006 -0400
@@ -266,8 +266,6 @@ static void domain_shutdown_finalise(voi
vcpu_sleep_sync(v);
BUG_ON(!cpus_empty(d->domain_dirty_cpumask));
- sync_pagetable_state(d);
-
/* Don't set DOMF_shutdown until execution contexts are sync'ed. */
if ( !test_and_set_bit(_DOMF_shutdown, &d->domain_flags) )
send_guest_global_virq(dom0, VIRQ_DOM_EXC);
@@ -406,8 +404,6 @@ void domain_pause(struct domain *d)
for_each_vcpu( d, v )
vcpu_sleep_sync(v);
-
- sync_pagetable_state(d);
}
void domain_unpause(struct domain *d)
@@ -439,8 +435,6 @@ void domain_pause_by_systemcontroller(st
for_each_vcpu ( d, v )
vcpu_sleep_sync(v);
}
-
- sync_pagetable_state(d);
}
void domain_unpause_by_systemcontroller(struct domain *d)
diff -r a1b47efc03df -r 39c113fb84ac xen/common/grant_table.c
--- a/xen/common/grant_table.c Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/common/grant_table.c Mon Aug 14 10:03:58 2006 -0400
@@ -33,13 +33,6 @@
#include <xen/domain_page.h>
#include <acm/acm_hooks.h>
-/*
- * This file uses a special method for clearing bit in the flags called:
- * gnttab_clear_flag()
- * We redefine it here to catch offenders early.
- */
-#define clear_bit(flags, ptr) please_use_gnttab_clear_flag();
-
/* The first to members of a grant entry are updated as a combined
* pair. The following union allows that to happen in an endian
* neutral fashion. */
@@ -845,14 +838,23 @@ __gnttab_copy(
{
struct domain *sd = NULL, *dd = NULL;
unsigned long s_frame, d_frame;
- void *sp, *dp;
+ char *sp, *dp;
s16 rc = GNTST_okay;
- int have_d_grant = 0, have_s_grant = 0;
+ int have_d_grant = 0, have_s_grant = 0, have_s_ref = 0;
+ int src_is_gref, dest_is_gref;
if ( ((op->source.offset + op->len) > PAGE_SIZE) ||
((op->dest.offset + op->len) > PAGE_SIZE) )
PIN_FAIL(error_out, GNTST_bad_copy_arg, "copy beyond page area.\n");
+ src_is_gref = op->flags & GNTCOPY_source_gref;
+ dest_is_gref = op->flags & GNTCOPY_dest_gref;
+
+ if ( (op->source.domid != DOMID_SELF && !src_is_gref ) ||
+ (op->dest.domid != DOMID_SELF && !dest_is_gref) )
+ PIN_FAIL(error_out, GNTST_permission_denied,
+ "only allow copy-by-mfn for DOMID_SELF.\n");
+
if ( op->source.domid == DOMID_SELF )
{
sd = current->domain;
@@ -875,7 +877,7 @@ __gnttab_copy(
"couldn't find %d\n", op->dest.domid);
}
- if ( op->flags & GNTCOPY_source_gref )
+ if ( src_is_gref )
{
rc = __acquire_grant_for_copy(sd, op->source.u.ref, 1, &s_frame);
if ( rc != GNTST_okay )
@@ -889,8 +891,9 @@ __gnttab_copy(
if ( !get_page(mfn_to_page(s_frame), sd) )
PIN_FAIL(error_out, GNTST_general_error,
"could not get source frame %lx.\n", s_frame);
-
- if ( op->flags & GNTCOPY_dest_gref )
+ have_s_ref = 1;
+
+ if ( dest_is_gref )
{
rc = __acquire_grant_for_copy(dd, op->dest.u.ref, 0, &d_frame);
if ( rc != GNTST_okay )
@@ -908,14 +911,15 @@ __gnttab_copy(
sp = map_domain_page(s_frame);
dp = map_domain_page(d_frame);
- memcpy((void *)((ulong)dp + op->dest.offset),
- (void *)((ulong)sp + op->source.offset),
- op->len);
+ memcpy(dp + op->dest.offset, sp + op->source.offset, op->len);
unmap_domain_page(dp);
unmap_domain_page(sp);
+ put_page_and_type(mfn_to_page(d_frame));
error_out:
+ if ( have_s_ref )
+ put_page(mfn_to_page(s_frame));
if ( have_s_grant )
__release_grant_for_copy(sd, op->source.u.ref, 1);
if ( have_d_grant )
@@ -957,8 +961,6 @@ do_grant_table_op(
LOCK_BIGLOCK(d);
- sync_pagetable_state(d);
-
rc = -EFAULT;
switch ( cmd )
{
diff -r a1b47efc03df -r 39c113fb84ac xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/include/asm-ia64/mm.h Mon Aug 14 10:03:58 2006 -0400
@@ -500,6 +500,4 @@ int steal_page(
int steal_page(
struct domain *d, struct page_info *page, unsigned int memflags);
-#define sync_pagetable_state(d) ((void)0)
-
#endif /* __ASM_IA64_MM_H__ */
diff -r a1b47efc03df -r 39c113fb84ac xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/include/asm-powerpc/mm.h Mon Aug 14 10:03:58 2006 -0400
@@ -224,6 +224,4 @@ extern int steal_page(struct domain *d,
extern int steal_page(struct domain *d, struct page_info *page,
unsigned int memflags);
-#define sync_pagetable_state(d) ((void)0)
-
-#endif
+#endif
diff -r a1b47efc03df -r 39c113fb84ac xen/include/asm-x86/e820.h
--- a/xen/include/asm-x86/e820.h Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/include/asm-x86/e820.h Mon Aug 14 10:03:58 2006 -0400
@@ -1,29 +1,9 @@
#ifndef __E820_HEADER
#define __E820_HEADER
-#include <asm/page.h>
+#include <public/hvm/e820.h>
#define E820MAX 128
-
-#define E820_RAM 1
-#define E820_RESERVED 2
-#define E820_ACPI 3
-#define E820_NVS 4
-#define E820_IO 16
-#define E820_SHARED_PAGE 17
-#define E820_XENSTORE 18
-#define E820_BUFFERED_IO 19
-
-#define E820_MAP_PAGE 0x00090000
-#define E820_MAP_NR_OFFSET 0x000001E8
-#define E820_MAP_OFFSET 0x000002D0
-
-#ifndef __ASSEMBLY__
-struct e820entry {
- u64 addr;
- u64 size;
- u32 type;
-} __attribute__((packed));
struct e820map {
int nr_map;
@@ -33,13 +13,4 @@ extern unsigned long init_e820(struct e8
extern unsigned long init_e820(struct e820entry *, int *);
extern struct e820map e820;
-#ifndef NDEBUG
-extern void print_e820_memory_map(struct e820entry *map, int entries);
-#endif
-
-#endif /*!__ASSEMBLY__*/
-
-#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
-#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
-
#endif /*__E820_HEADER*/
diff -r a1b47efc03df -r 39c113fb84ac xen/include/asm-x86/hvm/domain.h
--- a/xen/include/asm-x86/hvm/domain.h Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/include/asm-x86/hvm/domain.h Mon Aug 14 10:03:58 2006 -0400
@@ -22,7 +22,6 @@
#ifndef __ASM_X86_HVM_DOMAIN_H__
#define __ASM_X86_HVM_DOMAIN_H__
-#include <asm/e820.h>
#include <asm/hvm/vpic.h>
#include <asm/hvm/vpit.h>
#include <asm/hvm/vlapic.h>
diff -r a1b47efc03df -r 39c113fb84ac xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/include/asm-x86/mm.h Mon Aug 14 10:03:58 2006 -0400
@@ -312,8 +312,6 @@ int ptwr_do_page_fault(struct domain *,
struct cpu_user_regs *);
int revalidate_l1(struct domain *, l1_pgentry_t *, l1_pgentry_t *);
-void sync_pagetable_state(struct domain *d);
-
int audit_adjust_pgtables(struct domain *d, int dir, int noisy);
#ifndef NDEBUG
diff -r a1b47efc03df -r 39c113fb84ac xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h Mon Aug 14 09:53:46 2006 -0400
+++ b/xen/include/asm-x86/page.h Mon Aug 14 10:03:58 2006 -0400
@@ -354,7 +354,10 @@ map_pages_to_xen(
#endif /* !__ASSEMBLY__ */
-#endif /* __I386_PAGE_H__ */
+#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
+#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
+
+#endif /* __X86_PAGE_H__ */
/*
* Local variables:
diff -r a1b47efc03df -r 39c113fb84ac xen/include/public/hvm/e820.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/hvm/e820.h Mon Aug 14 10:03:58 2006 -0400
@@ -0,0 +1,27 @@
+#ifndef __XEN_PUBLIC_HVM_E820_H__
+#define __XEN_PUBLIC_HVM_E820_H__
+
+/* PC BIOS standard E820 types. */
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3
+#define E820_NVS 4
+
+/* Xen HVM extended E820 types. */
+#define E820_IO 16
+#define E820_SHARED_PAGE 17
+#define E820_XENSTORE 18
+#define E820_BUFFERED_IO 19
+
+/* E820 location in HVM virtual address space. */
+#define E820_MAP_PAGE 0x00090000
+#define E820_MAP_NR_OFFSET 0x000001E8
+#define E820_MAP_OFFSET 0x000002D0
+
+struct e820entry {
+ uint64_t addr;
+ uint64_t size;
+ uint32_t type;
+} __attribute__((packed));
+
+#endif /* __XEN_PUBLIC_HVM_E820_H__ */
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|