# HG changeset patch
# User ack@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5de3bc3c6297e3553cad92a2df0a699da0f7ca9d
# Parent d48842f924d0e0c8e6e52887914850f4c7c02585
# Parent 438ed1c4b3916058a183d6c8e731566d2f4ca1da
merge
---
.hgignore | 5 -
tools/firmware/vmxassist/head.S | 5 -
tools/firmware/vmxassist/vm86.c | 103 ++++++++++++++++++++++++++++----
tools/python/xen/xend/XendDomainInfo.py | 7 --
tools/xenmon/xenbaked.c | 19 ++---
xen/arch/powerpc/Makefile | 8 +-
xen/arch/powerpc/boot_of.c | 49 +++++++++------
xen/arch/powerpc/domain.c | 47 ++++++++------
xen/arch/powerpc/domain_build.c | 6 -
xen/arch/powerpc/htab.c | 13 +---
xen/arch/powerpc/mm.c | 20 +++++-
xen/arch/powerpc/ofd_fixup.c | 8 +-
xen/arch/powerpc/papr/xlate.c | 2
xen/arch/powerpc/powerpc64/ppc970.c | 7 +-
xen/arch/powerpc/setup.c | 41 ++++++++----
xen/include/asm-powerpc/config.h | 1
xen/include/asm-powerpc/domain.h | 13 ++--
xen/include/asm-powerpc/grant_table.h | 2
xen/include/asm-powerpc/htab.h | 8 --
xen/include/asm-powerpc/mm.h | 2
xen/include/asm-powerpc/shadow.h | 15 ++++
21 files changed, 260 insertions(+), 121 deletions(-)
diff -r d48842f924d0 -r 5de3bc3c6297 .hgignore
--- a/.hgignore Tue Aug 15 11:13:04 2006 +0100
+++ b/.hgignore Tue Aug 15 11:16:46 2006 +0100
@@ -199,5 +199,6 @@
^xen/xen\..*$
^xen/arch/powerpc/dom0\.bin$
^xen/arch/powerpc/asm-offsets\.s$
-^xen/arch/powerpc/firmware
-^xen/arch/powerpc/firmware_image
+^xen/arch/powerpc/firmware$
+^xen/arch/powerpc/firmware_image$
+^xen/arch/powerpc/xen\.lds$
diff -r d48842f924d0 -r 5de3bc3c6297 tools/firmware/vmxassist/head.S
--- a/tools/firmware/vmxassist/head.S Tue Aug 15 11:13:04 2006 +0100
+++ b/tools/firmware/vmxassist/head.S Tue Aug 15 11:16:46 2006 +0100
@@ -114,8 +114,6 @@ _start:
#ifdef TEST
xorl %edx, %edx
#endif
- movl %edx, booting_cpu
- movl %ebx, booting_vector
/* clear bss */
cld
@@ -124,6 +122,9 @@ _start:
movl $_ebss, %ecx
subl %edi, %ecx
rep stosb
+
+ movl %edx, booting_cpu
+ movl %ebx, booting_vector
/* make sure we are in a sane world */
clts
diff -r d48842f924d0 -r 5de3bc3c6297 tools/firmware/vmxassist/vm86.c
--- a/tools/firmware/vmxassist/vm86.c Tue Aug 15 11:13:04 2006 +0100
+++ b/tools/firmware/vmxassist/vm86.c Tue Aug 15 11:16:46 2006 +0100
@@ -983,7 +983,9 @@ set_mode(struct regs *regs, enum vm86_mo
case VM86_PROTECTED:
if (mode == VM86_REAL_TO_PROTECTED) {
protected_mode(regs);
- break;
+// printf("<VM86_PROTECTED>\n");
+ mode = newmode;
+ return;
} else
panic("unexpected protected mode transition");
break;
@@ -1170,6 +1172,26 @@ inbyte(struct regs *regs, unsigned prefi
return 1;
}
+static void
+pushrm(struct regs *regs, int prefix, unsigned modrm)
+{
+ unsigned n = regs->eip;
+ unsigned addr;
+ unsigned data;
+
+ addr = operand(prefix, regs, modrm);
+
+ if (prefix & DATA32) {
+ data = read32(addr);
+ push32(regs, data);
+ } else {
+ data = read16(addr);
+ push16(regs, data);
+ }
+
+ TRACE((regs, (regs->eip - n) + 1, "push *0x%x", addr));
+}
+
enum { OPC_INVALID, OPC_EMULATED };
/*
@@ -1186,6 +1208,14 @@ opcode(struct regs *regs)
for (;;) {
switch ((opc = fetch8(regs))) {
+ case 0x07:
+ if (prefix & DATA32)
+ regs->ves = pop32(regs);
+ else
+ regs->ves = pop16(regs);
+ TRACE((regs, regs->eip - eip, "pop %%es"));
+ return OPC_EMULATED;
+
case 0x0F: /* two byte opcode */
if (mode == VM86_PROTECTED)
goto invalid;
@@ -1288,6 +1318,22 @@ opcode(struct regs *regs)
return OPC_EMULATED;
case 0x89: /* addr32 mov r16, r/m16 */
+ if (mode == VM86_PROTECTED_TO_REAL) {
+ unsigned modrm = fetch8(regs);
+ unsigned addr = operand(prefix, regs, modrm);
+ unsigned val, r = (modrm >> 3) & 7;
+
+ if (prefix & DATA32) {
+ val = getreg16(regs, r);
+ write32(addr, val);
+ } else {
+ val = getreg32(regs, r);
+ write16(addr, MASK16(val));
+ }
+ TRACE((regs, regs->eip - eip,
+ "mov %%%s, *0x%x", rnames[r], addr));
+ return OPC_EMULATED;
+ }
case 0x8B: /* addr32 mov r/m16, r16 */
if (mode != VM86_REAL && mode != VM86_REAL_TO_PROTECTED)
goto invalid;
@@ -1324,6 +1370,37 @@ opcode(struct regs *regs)
regs->eflags = (regs->eflags & 0xFFFF0000L) |
pop16(regs);
regs->eflags |= EFLAGS_VM;
+ return OPC_EMULATED;
+
+ case 0xA1: /* mov ax, r/m16 */
+ {
+ int addr, data;
+ int seg = segment(prefix, regs, regs->vds);
+ if (prefix & DATA32) {
+ addr = address(regs, seg,
fetch32(regs));
+ data = read32(addr);
+ setreg32(regs, 0, data);
+ } else {
+ addr = address(regs, seg,
fetch16(regs));
+ data = read16(addr);
+ setreg16(regs, 0, data);
+ }
+ TRACE((regs, regs->eip - eip, "mov *0x%x,
%%ax", addr));
+ }
+ return OPC_EMULATED;
+
+ case 0xBB: /* mov bx, imm16 */
+ {
+ int data;
+ if (prefix & DATA32) {
+ data = fetch32(regs);
+ setreg32(regs, 3, data);
+ } else {
+ data = fetch16(regs);
+ setreg16(regs, 3, data);
+ }
+ TRACE((regs, regs->eip - eip, "mov $0x%x,
%%bx", data));
+ }
return OPC_EMULATED;
case 0xC6: /* addr32 movb $imm, r/m8 */
@@ -1380,21 +1457,25 @@ opcode(struct regs *regs)
goto invalid;
case 0xFF: /* jmpl (indirect) */
- if ((mode == VM86_REAL_TO_PROTECTED) ||
- (mode == VM86_PROTECTED_TO_REAL)) {
- unsigned modrm = fetch8(regs);
-
+ {
+ unsigned modrm = fetch8(regs);
switch((modrm >> 3) & 7) {
- case 5:
- jmpl_indirect(regs, prefix, modrm);
- return OPC_INVALID;
+ case 5: /* jmpl (indirect) */
+ if ((mode == VM86_REAL_TO_PROTECTED) ||
+ (mode == VM86_PROTECTED_TO_REAL)) {
+ jmpl_indirect(regs, prefix,
modrm);
+ return OPC_INVALID;
+ }
+ goto invalid;
+
+ case 6: /* push r/m16 */
+ pushrm(regs, prefix, modrm);
+ return OPC_EMULATED;
default:
- break;
+ goto invalid;
}
-
}
- goto invalid;
case 0xEB: /* short jump */
if ((mode == VM86_REAL_TO_PROTECTED) ||
diff -r d48842f924d0 -r 5de3bc3c6297 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Tue Aug 15 11:13:04 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Tue Aug 15 11:16:46 2006 +0100
@@ -1272,12 +1272,9 @@ class XendDomainInfo:
# repin domain vcpus if a restricted cpus list is provided
# this is done prior to memory allocation to aide in memory
# distribution for NUMA systems.
- cpus = self.info['cpus']
- if cpus is not None and len(cpus) > 0:
+ if self.info['cpus'] is not None and len(self.info['cpus']) > 0:
for v in range(0, self.info['max_vcpu_id']+1):
- # pincpu takes a list of ints
- cpu = [ int( cpus[v % len(cpus)] ) ]
- xc.vcpu_setaffinity(self.domid, v, cpu)
+ xc.vcpu_setaffinity(self.domid, v, self.info['cpus'])
# set domain maxmem in KiB
xc.domain_setmaxmem(self.domid, self.info['maxmem'] * 1024)
diff -r d48842f924d0 -r 5de3bc3c6297 tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c Tue Aug 15 11:13:04 2006 +0100
+++ b/tools/xenmon/xenbaked.c Tue Aug 15 11:16:46 2006 +0100
@@ -444,14 +444,11 @@ struct t_rec **init_rec_ptrs(struct t_bu
*/
unsigned int get_num_cpus(void)
{
- dom0_op_t op;
+ xc_physinfo_t physinfo;
int xc_handle = xc_interface_open();
int ret;
- op.cmd = DOM0_PHYSINFO;
- op.interface_version = DOM0_INTERFACE_VERSION;
-
- ret = xc_dom0_op(xc_handle, &op);
+ ret = xc_physinfo(xc_handle, &physinfo);
if ( ret != 0 )
{
@@ -460,12 +457,12 @@ unsigned int get_num_cpus(void)
}
xc_interface_close(xc_handle);
- opts.cpu_freq = (double)op.u.physinfo.cpu_khz/1000.0;
-
- return (op.u.physinfo.threads_per_core *
- op.u.physinfo.cores_per_socket *
- op.u.physinfo.sockets_per_node *
- op.u.physinfo.nr_nodes);
+ opts.cpu_freq = (double)physinfo.cpu_khz/1000.0;
+
+ return (physinfo.threads_per_core *
+ physinfo.cores_per_socket *
+ physinfo.sockets_per_node *
+ physinfo.nr_nodes);
}
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/Makefile Tue Aug 15 11:16:46 2006 +0100
@@ -49,7 +49,7 @@ PPC_C_WARNINGS += -Wundef -Wmissing-prot
PPC_C_WARNINGS += -Wundef -Wmissing-prototypes -Wmissing-declarations
CFLAGS += $(PPC_C_WARNINGS)
-LINK=0x3000000
+LINK=0x400000
boot32_link_base = $(LINK)
xen_link_offset = 100
xen_link_base = $(patsubst %000,%$(xen_link_offset),$(LINK))
@@ -83,8 +83,10 @@ physdev.o: ../x86/physdev.c
HDRS += $(wildcard *.h)
-CMDLINE = "xen"
-boot_of.o: CFLAGS += -DCMDLINE="\"$(CMDLINE)\""
+# The first token in the arguments will be silently dropped.
+IMAGENAME = xen
+CMDLINE = ""
+boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
start.o: boot/start.S
$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/boot_of.c Tue Aug 15 11:16:46 2006 +0100
@@ -13,7 +13,7 @@
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
*
* Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
*/
@@ -304,12 +304,11 @@ static int __init of_instance_to_path(in
static int __init of_start_cpu(int cpu, u32 pc, u32 reg)
{
- int rets[1] = { OF_FAILURE };
-
- if ( of_call("start-cpu", 3, 0, rets, cpu, pc, reg) == OF_FAILURE )
- return OF_FAILURE;
-
- return rets[0];
+ int ret;
+
+ ret = of_call("start-cpu", 3, 0, NULL, cpu, pc, reg);
+
+ return ret;
}
static void __init of_test(const char *of_method_name)
@@ -760,19 +759,30 @@ static int __init boot_of_serial(void *o
if (n == OF_FAILURE) {
of_panic("instance-to-package of /chosen/stdout: failed\n");
}
-
- /* prune this from the oftree */
- rc = of_package_to_path(n, buf, sizeof(buf));
- if (rc == OF_FAILURE) {
- of_panic("package-to-path of /chosen/stdout: failed\n");
- }
- of_printf("Pruning from devtree: %s\n"
- " since Xen will be using it for console\n", buf);
- rc = ofd_prune_path(oftree, buf);
- if (rc < 0) {
- of_panic("prune path \"%s\" failed\n", buf);
- }
+ /* Prune all serial devices from the device tree, including the
+ * one pointed to by /chosen/stdout, because a guest domain can
+ * initialize them and in so doing corrupt our console output.
+ */
+ for (p = n; p > 0; p = of_getpeer(p)) {
+ char type[32];
+
+ rc = of_package_to_path(p, buf, sizeof(buf));
+ if (rc == OF_FAILURE)
+ of_panic("package-to-path failed\n");
+
+ rc = of_getprop(p, "device_type", type, sizeof (type));
+ if (rc == OF_FAILURE)
+ of_panic("fetching device type failed\n");
+
+ if (strcmp(type, "serial") != 0)
+ continue;
+
+ of_printf("pruning `%s' from devtree\n", buf);
+ rc = ofd_prune_path(oftree, buf);
+ if (rc < 0)
+ of_panic("prune of `%s' failed\n", buf);
+ }
p = of_getparent(n);
if (p == OF_FAILURE) {
@@ -799,7 +809,6 @@ static int __init boot_of_serial(void *o
if (rc == OF_FAILURE) {
of_panic("%s: no location for serial port\n", __func__);
}
- ns16550.io_base = val[1];
ns16550.baud = BAUD_AUTO;
ns16550.data_bits = 8;
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/domain.c Tue Aug 15 11:16:46 2006 +0100
@@ -73,10 +73,9 @@ unsigned long hypercall_create_continuat
int arch_domain_create(struct domain *d)
{
- struct page_info *rma;
unsigned long rma_base;
- unsigned long rma_size;
- unsigned int rma_order;
+ unsigned long rma_sz;
+ uint htab_order;
if (d->domain_id == IDLE_DOMAIN_ID) {
d->shared_info = (void *)alloc_xenheap_page();
@@ -85,25 +84,21 @@ int arch_domain_create(struct domain *d)
return 0;
}
- rma_order = cpu_rma_order();
- rma_size = 1UL << rma_order << PAGE_SHIFT;
+ d->arch.rma_order = cpu_rma_order();
+ rma_sz = rma_size(d->arch.rma_order);
/* allocate the real mode area */
- d->max_pages = 1UL << rma_order;
- rma = alloc_domheap_pages(d, rma_order, 0);
- if (NULL == rma)
+ d->max_pages = 1UL << d->arch.rma_order;
+ d->tot_pages = 0;
+ d->arch.rma_page = alloc_domheap_pages(d, d->arch.rma_order, 0);
+ if (NULL == d->arch.rma_page)
return 1;
- rma_base = page_to_maddr(rma);
-
- BUG_ON(rma_base & (rma_size-1)); /* check alignment */
-
- d->arch.rma_base = rma_base;
- d->arch.rma_size = rma_size;
-
- printk("clearing RMO: 0x%lx[0x%lx]\n", rma_base, rma_size);
- memset((void *)rma_base, 0, rma_size);
-
- htab_alloc(d, LOG_DEFAULT_HTAB_BYTES);
+ rma_base = page_to_maddr(d->arch.rma_page);
+
+ BUG_ON(rma_base & (rma_sz - 1)); /* check alignment */
+
+ printk("clearing RMO: 0x%lx[0x%lx]\n", rma_base, rma_sz);
+ memset((void *)rma_base, 0, rma_sz);
d->shared_info = (shared_info_t *)
(rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base);
@@ -111,12 +106,22 @@ int arch_domain_create(struct domain *d)
d->arch.large_page_sizes = 1;
d->arch.large_page_shift[0] = 24; /* 16 M for 970s */
+ /* FIXME: we need to the the maximum addressible memory for this
+ * domain to calculate this correctly. It should probably be set
+ * by the managment tools */
+ htab_order = d->arch.rma_order - 6; /* (1/64) */
+ if (test_bit(_DOMF_privileged, &d->domain_flags)) {
+ /* bump the htab size of privleged domains */
+ ++htab_order;
+ }
+ htab_alloc(d, htab_order);
+
return 0;
}
void arch_domain_destroy(struct domain *d)
{
- unimplemented();
+ htab_free(d);
}
void machine_halt(void)
@@ -258,7 +263,7 @@ void sync_vcpu_execstate(struct vcpu *v)
void domain_relinquish_resources(struct domain *d)
{
- /* nothing to do? */
+ free_domheap_pages(d->arch.rma_page, d->arch.rma_order);
}
void arch_dump_domain_info(struct domain *d)
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/domain_build.c Tue Aug 15 11:16:46 2006 +0100
@@ -105,8 +105,8 @@ int construct_dom0(struct domain *d,
struct domain_setup_info dsi;
ulong dst;
u64 *ofh_tree;
- ulong rma_sz = d->arch.rma_size;
- ulong rma = d->arch.rma_base;
+ ulong rma_sz = rma_size(d->arch.rma_order);
+ ulong rma = page_to_maddr(d->arch.rma_page);
start_info_t *si;
ulong eomem;
int am64 = 1;
@@ -145,7 +145,7 @@ int construct_dom0(struct domain *d,
/* By default DOM0 is allocated all available memory. */
d->max_pages = ~0U;
- d->tot_pages = (d->arch.rma_size >> PAGE_SHIFT);
+ d->tot_pages = 1UL << d->arch.rma_order;
ASSERT( image_len < rma_sz );
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/htab.c
--- a/xen/arch/powerpc/htab.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/htab.c Tue Aug 15 11:16:46 2006 +0100
@@ -34,36 +34,35 @@ static ulong htab_calc_sdr1(ulong htab_a
return (htab_addr | (sdr1_htabsize & SDR1_HTABSIZE_MASK));
}
-void htab_alloc(struct domain *d, int log_htab_bytes)
+void htab_alloc(struct domain *d, uint order)
{
ulong htab_raddr;
+ ulong log_htab_bytes = order + PAGE_SHIFT;
ulong htab_bytes = 1UL << log_htab_bytes;
/* XXX use alloc_domheap_pages instead? */
- htab_raddr = (ulong)alloc_xenheap_pages(log_htab_bytes - PAGE_SHIFT);
+ htab_raddr = (ulong)alloc_xenheap_pages(order);
ASSERT(htab_raddr != 0);
/* XXX check alignment guarantees */
- ASSERT((htab_raddr & (htab_bytes-1)) == 0);
+ ASSERT((htab_raddr & (htab_bytes - 1)) == 0);
/* XXX slow. move memset out to service partition? */
memset((void *)htab_raddr, 0, htab_bytes);
+ d->arch.htab.order = order;
d->arch.htab.log_num_ptes = log_htab_bytes - LOG_PTE_SIZE;
d->arch.htab.sdr1 = htab_calc_sdr1(htab_raddr, log_htab_bytes);
d->arch.htab.map = (union pte *)htab_raddr;
d->arch.htab.shadow = xmalloc_array(ulong,
1UL << d->arch.htab.log_num_ptes);
ASSERT(d->arch.htab.shadow != NULL);
-
- printf("%s: dom%x sdr1: %lx\n", __func__, d->domain_id, d->arch.htab.sdr1);
}
void htab_free(struct domain *d)
{
ulong htab_raddr = GET_HTAB(d);
- free_xenheap_pages((void *)htab_raddr,
- (1UL << d->arch.htab.log_num_ptes) << LOG_PTE_SIZE);
+ free_xenheap_pages((void *)htab_raddr, d->arch.htab.order);
xfree(d->arch.htab.shadow);
}
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/mm.c Tue Aug 15 11:16:46 2006 +0100
@@ -20,6 +20,7 @@
#include <xen/config.h>
#include <xen/mm.h>
+#include <xen/shadow.h>
#include <xen/kernel.h>
#include <xen/sched.h>
#include <asm/misc.h>
@@ -108,8 +109,8 @@ extern void copy_page(void *dp, void *sp
ulong pfn2mfn(struct domain *d, long pfn, int *type)
{
- ulong rma_base_mfn = d->arch.rma_base >> PAGE_SHIFT;
- ulong rma_size_mfn = d->arch.rma_size >> PAGE_SHIFT;
+ ulong rma_base_mfn = page_to_mfn(d->arch.rma_page);
+ ulong rma_size_mfn = 1UL << d->arch.rma_order;
ulong mfn;
int t;
@@ -139,3 +140,18 @@ ulong pfn2mfn(struct domain *d, long pfn
return mfn;
}
+
+void guest_physmap_add_page(
+ struct domain *d, unsigned long gpfn, unsigned long mfn)
+{
+ panic("%s\n", __func__);
+}
+void guest_physmap_remove_page(
+ struct domain *d, unsigned long gpfn, unsigned long mfn)
+{
+ panic("%s\n", __func__);
+}
+void shadow_drop_references(
+ struct domain *d, struct page_info *page)
+{
+}
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/ofd_fixup.c Tue Aug 15 11:16:46 2006 +0100
@@ -359,8 +359,8 @@ static ofdn_t ofd_memory_props(void *m,
ofdn_t n = -1;
ulong start = 0;
static char name[] = "memory";
- ulong mem_size = d->arch.rma_size;
- ulong chunk_size = d->arch.rma_size;
+ ulong mem_size = rma_size(d->arch.rma_order);
+ ulong chunk_size = rma_size(d->arch.rma_order);
/* Remove all old memory props */
do {
@@ -424,12 +424,12 @@ static ofdn_t ofd_xen_props(void *m, str
ASSERT(xl < sizeof (xen));
ofd_prop_add(m, n, "version", xen, xl + 1);
- val[0] = (ulong)si - d->arch.rma_base;
+ val[0] = (ulong)si - page_to_maddr(d->arch.rma_page);
val[1] = PAGE_SIZE;
ofd_prop_add(m, n, "start-info", val, sizeof (val));
val[1] = RMA_LAST_DOM0 * PAGE_SIZE;
- val[0] = d->arch.rma_size - val[1];
+ val[0] = rma_size(d->arch.rma_order) - val[1];
ofd_prop_add(m, n, "reserved", val, sizeof (val));
n = ofd_node_add(m, n, console, sizeof (console));
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/papr/xlate.c Tue Aug 15 11:16:46 2006 +0100
@@ -258,8 +258,10 @@ static void h_enter(struct cpu_user_regs
}
}
+#ifdef DEBUG
/* If the PTEG is full then no additional values are returned. */
printk("%s: PTEG FULL\n", __func__);
+#endif
regs->gprs[3] = H_PTEG_Full;
}
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/powerpc64/ppc970.c Tue Aug 15 11:16:46 2006 +0100
@@ -34,7 +34,8 @@ unsigned int cpu_rma_order(void)
unsigned int cpu_rma_order(void)
{
/* XXX what about non-HV mode? */
- return 14; /* 1<<14<<PAGE_SIZE = 64M */
+ uint rma_log_size = 6 + 20; /* 64M */
+ return rma_log_size - PAGE_SHIFT;
}
void cpu_initialize(void)
@@ -114,8 +115,8 @@ void cpu_init_vcpu(struct vcpu *v)
{
struct domain *d = v->domain;
union hid4 hid4;
- ulong rma_base = d->arch.rma_base;
- ulong rma_size = d->arch.rma_size;
+ ulong rma_base = page_to_maddr(d->arch.rma_page);
+ ulong rma_size = rma_size(d->arch.rma_order);
hid4.word = mfhid4();
diff -r d48842f924d0 -r 5de3bc3c6297 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/arch/powerpc/setup.c Tue Aug 15 11:16:46 2006 +0100
@@ -214,7 +214,11 @@ static void __init __start_xen(multiboot
if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
cmdline_parse(__va((ulong)mbi->cmdline));
+ /* We initialise the serial devices very early so we can get debugging. */
+ ns16550.io_base = 0x3f8;
ns16550_init(0, &ns16550);
+ ns16550.io_base = 0x2f8;
+ ns16550_init(1, &ns16550);
serial_init_preirq();
init_console();
@@ -273,11 +277,25 @@ static void __init __start_xen(multiboot
printk("System RAM: %luMB (%lukB)\n", eomem >> 20, eomem >> 10);
+ /* top of memory */
max_page = PFN_DOWN(ALIGN_DOWN(eomem, PAGE_SIZE));
total_pages = max_page;
- /* skip the exception handlers */
+ /* Architecturally the first 4 pages are exception hendlers, we
+ * will also be copying down some code there */
heap_start = init_boot_allocator(4 << PAGE_SHIFT);
+
+ /* we give the first RMA to the hypervisor */
+ xenheap_phys_end = rma_size(cpu_rma_order());
+
+ /* allow everything else to be allocated */
+ init_boot_pages(xenheap_phys_end, eomem);
+ init_frametable();
+ end_boot_allocator();
+
+ /* Add memory between the beginning of the heap and the beginning
+ * of out text */
+ init_xenheap_pages(heap_start, (ulong)_start);
/* move the modules to just after _end */
if (modules_start) {
@@ -293,26 +311,21 @@ static void __init __start_xen(multiboot
modules_start + modules_size);
}
+ /* the rest of the xenheap, starting at the end of modules */
+ init_xenheap_pages(freemem, xenheap_phys_end);
+
+
#ifdef OF_DEBUG
printk("ofdump:\n");
/* make sure the OF devtree is good */
ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
#endif
+ heap_size = xenheap_phys_end - heap_start;
+
+ printk("Xen heap: %luMB (%lukB)\n", heap_size >> 20, heap_size >> 10);
+
percpu_init_areas();
-
- /* mark all memory from modules onward as unused */
- init_boot_pages(freemem, eomem);
-
- init_frametable();
- end_boot_allocator();
-
- /* place the heap from after the allocator bitmap to _start */
- xenheap_phys_end = (ulong)_start;
- init_xenheap_pages(heap_start, xenheap_phys_end);
- heap_size = xenheap_phys_end - heap_start;
-
- printk("Xen heap: %luMB (%lukB)\n", heap_size >> 20, heap_size >> 10);
cpu_initialize();
diff -r d48842f924d0 -r 5de3bc3c6297 xen/include/asm-powerpc/config.h
--- a/xen/include/asm-powerpc/config.h Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/include/asm-powerpc/config.h Tue Aug 15 11:16:46 2006 +0100
@@ -47,6 +47,7 @@ extern char __bss_start[];
/* this should be per processor, but for now */
#define CACHE_LINE_SIZE 128
+#define CONFIG_SHADOW 1
#define CONFIG_GDB 1
#define CONFIG_SMP 1
#define CONFIG_PCI 1
diff -r d48842f924d0 -r 5de3bc3c6297 xen/include/asm-powerpc/domain.h
--- a/xen/include/asm-powerpc/domain.h Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/include/asm-powerpc/domain.h Tue Aug 15 11:16:46 2006 +0100
@@ -32,10 +32,11 @@
struct arch_domain {
struct domain_htab htab;
- /* The RMO area is fixed to the domain and is accessible while the
+
+ /* The Real Mode area is fixed to the domain and is accessible while the
* processor is in real mode */
- ulong rma_base;
- ulong rma_size;
+ struct page_info *rma_page;
+ uint rma_order;
/* This is regular memory, only available thru translataion */
ulong logical_base_pfn;
@@ -106,9 +107,11 @@ extern void load_float(struct vcpu *);
#define RMA_CONSOLE 3
#define RMA_LAST_DOMU 3
-static inline ulong rma_addr(struct arch_domain *d, int type)
+#define rma_size(rma_order) (1UL << ((rma_order) + PAGE_SHIFT))
+
+static inline ulong rma_addr(struct arch_domain *ad, int type)
{
- return d->rma_size - (type * PAGE_SIZE);
+ return rma_size(ad->rma_order) - (type * PAGE_SIZE);
}
#endif
diff -r d48842f924d0 -r 5de3bc3c6297 xen/include/asm-powerpc/grant_table.h
--- a/xen/include/asm-powerpc/grant_table.h Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/include/asm-powerpc/grant_table.h Tue Aug 15 11:16:46 2006 +0100
@@ -47,7 +47,7 @@ int destroy_grant_host_mapping(
#define gnttab_shared_gmfn(d, t, i) \
(mfn_to_gmfn(d, gnttab_shared_mfn(d, t, i)))
-#define gnttab_log_dirty(d, f) ((void )0)
+#define gnttab_log_dirty(d, f) mark_dirty((d), (f))
static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
{
diff -r d48842f924d0 -r 5de3bc3c6297 xen/include/asm-powerpc/htab.h
--- a/xen/include/asm-powerpc/htab.h Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/include/asm-powerpc/htab.h Tue Aug 15 11:16:46 2006 +0100
@@ -25,9 +25,6 @@
#include <xen/types.h>
/***** general PowerPC architecture limits ******/
-
-#define LOG_DEFAULT_HTAB_BYTES 20
-#define DEFAULT_HTAB_BYTES (1UL << LOG_HTAB_BYTES)
/* 256KB, from PowerPC Architecture specification */
#define HTAB_MIN_LOG_SIZE 18
@@ -131,12 +128,13 @@ union ptel {
struct domain_htab {
ulong sdr1;
- ulong log_num_ptes; /* log number of PTEs in HTAB. */
+ uint log_num_ptes; /* log number of PTEs in HTAB. */
+ uint order; /* order for freeing. */
union pte *map; /* access the htab like an array */
ulong *shadow; /* idx -> logical translation array */
};
struct domain;
-extern void htab_alloc(struct domain *d, int log_htab_bytes);
+extern void htab_alloc(struct domain *d, uint order);
extern void htab_free(struct domain *d);
#endif
diff -r d48842f924d0 -r 5de3bc3c6297 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/include/asm-powerpc/mm.h Tue Aug 15 11:16:46 2006 +0100
@@ -33,7 +33,7 @@
#define memguard_unguard_range(_p,_l) ((void)0)
extern unsigned long xenheap_phys_end;
-#define IS_XEN_HEAP_FRAME(_pfn) (page_to_mfn(_pfn) < xenheap_phys_end)
+#define IS_XEN_HEAP_FRAME(_pfn) (page_to_maddr(_pfn) < xenheap_phys_end)
/*
* Per-page-frame information.
diff -r d48842f924d0 -r 5de3bc3c6297 xen/include/asm-powerpc/shadow.h
--- a/xen/include/asm-powerpc/shadow.h Tue Aug 15 11:13:04 2006 +0100
+++ b/xen/include/asm-powerpc/shadow.h Tue Aug 15 11:16:46 2006 +0100
@@ -23,7 +23,8 @@
#include <xen/sched.h>
-#define shadow_mode_translate(_d) 1
+#define shadow_mode_translate(_d) (1)
+#define shadow_mode_refcounts(_d) (1)
#define __translate_gpfn_to_mfn(_d, gpfn) \
( (shadow_mode_translate(_d)) \
@@ -41,5 +42,17 @@ translate_gpfn_to_mfn(struct domain *rd,
trap();
return 0;
}
+extern void guest_physmap_add_page(
+ struct domain *d, unsigned long gpfn, unsigned long mfn);
+extern void guest_physmap_remove_page(
+ struct domain *d, unsigned long gpfn, unsigned long mfn);
+
+extern void shadow_drop_references(
+ struct domain *d, struct page_info *page);
+
+static inline void mark_dirty(struct domain *d, unsigned int mfn)
+{
+ return;
+}
#endif
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|