This commit is contained in:
emellor@leeni.uk.xensource.com committed 2005-11-21 13:17:29 +01:00
commit 5d1f08e233
29 files changed
+1526 -362

No files matched your search

+15 -2
View File
@@ -60,8 +60,8 @@ config ARCH_XEN
TEMP ONLY. Needs to be on for drivers/xen to build.
config XEN_PRIVILEGED_GUEST
bool
default y
bool "Privileged Guest"
default n
help
Used in drivers/xen/privcmd.c. Should go away?
@@ -80,6 +80,19 @@ config XEN_BLKDEV_FRONTEND
bool
default y
config XEN_VT
bool "Override for turning on CONFIG_VT for domU"
default y
help
Hack to turn off CONFIG_VT for domU
config VT
bool
default y if XEN && XEN_VT
default n if XEN && !XEN_VT
help
Hack to turn off CONFIG_VT for domU
config SCHED_NO_NO_OMIT_FRAME_POINTER
bool
default y
+6 -1
View File
@@ -60,10 +60,15 @@ core-$(CONFIG_IA64_GENERIC) += arch/ia64/dig/
core-$(CONFIG_IA64_HP_ZX1) += arch/ia64/dig/
core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/
core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/
core-$(CONFIG_XEN) += arch/ia64/xen/ arch/ia64/hp/sim/
core-$(CONFIG_XEN) += arch/ia64/xen/
drivers-$(CONFIG_PCI) += arch/ia64/pci/
ifneq ($(CONFIG_XEN),y)
drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/
endif
ifneq ($(CONFIG_IA64_GENERIC),y)
drivers-$(CONFIG_XEN) += arch/ia64/hp/sim/
endif
drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/
@@ -9,6 +9,7 @@ early_xen_console_setup (char *cmdline)
extern int running_on_xen;
if (running_on_xen) {
extern struct console hpsim_cons;
hpsim_cons.flags |= CON_BOOT;
register_console(&hpsim_cons);
return 0;
}
@@ -17,7 +17,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
#
# General setup
#
CONFIG_LOCALVERSION="xen"
CONFIG_LOCALVERSION=""
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set
@@ -68,10 +68,14 @@ CONFIG_TIME_INTERPOLATION=y
CONFIG_EFI=y
CONFIG_GENERIC_IOMAP=y
CONFIG_XEN=y
CONFIG_XEN_VT=y
CONFIG_ARCH_XEN=y
CONFIG_XEN_PRIVILEGED_GUEST=y
CONFIG_XEN_PHYSDEV_ACCESS=y
CONFIG_XEN_BLKDEV_GRANT=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_VGA_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=n
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
# CONFIG_IA64_GENERIC is not set
# CONFIG_IA64_DIG is not set
File diff suppressed because it is too large. Load diff
+15
View File
@@ -7,6 +7,21 @@
#include "xen/arch-ia64.h"
#include <xen/io/ioreq.h>
/* this is a very ugly way of getting FPSR_DEFAULT. struct ia64_fpreg is
* mysteriously declared in two places: /usr/include/asm/fpu.h and
* /usr/include/bits/sigcontext.h. The former also defines FPSR_DEFAULT,
* the latter doesn't but is included (indirectly) by xg_private.h */
#define __ASSEMBLY__
#include <asm/fpu.h>
#undef __IA64_UL
#define __IA64_UL(x) ((unsigned long)(x))
#undef __ASSEMBLY__
unsigned long xc_ia64_fpsr_default(void)
{
return FPSR_DEFAULT;
}
int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags)
{
+3 -2
View File
@@ -278,7 +278,8 @@ static int setup_pg_tables_64(int xc_handle, uint32_t dom,
#endif
#ifdef __ia64__
#include <asm/fpu.h> /* for FPSR_DEFAULT */
extern unsigned long xc_ia64_fpsr_default(void);
static int setup_guest(int xc_handle,
uint32_t dom,
char *image, unsigned long image_size,
@@ -780,7 +781,7 @@ int xc_linux_build(int xc_handle,
ctxt->regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */
ctxt->regs.cr_iip = vkern_entry;
ctxt->regs.cr_ifs = 1UL << 63;
ctxt->regs.ar_fpsr = FPSR_DEFAULT;
ctxt->regs.ar_fpsr = xc_ia64_fpsr_default();
/* currently done by hypervisor, should move here */
/* ctxt->regs.r28 = dom_fw_setup(); */
ctxt->vcpu.privregs = 0;
+1 -1
View File
@@ -158,7 +158,7 @@ static PyObject *xspy_ls(XsHandle *self, PyObject *args)
char *path;
char **xsval;
int xsval_n;
unsigned int xsval_n;
if (!parse_transaction_path(self, args, &xh, &th, &path))
return NULL;
+3 -3
View File
@@ -2,7 +2,7 @@ include $(BASEDIR)/Rules.mk
VPATH = xen vmx linux linux-xen
OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \
OBJS = xensetup.o setup.o time.o irq.o process.o smp.o \
xenmisc.o acpi.o hypercall.o \
machvec.o dom0_ops.o domain.o hpsimserial.o pcdp.o \
idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \
@@ -10,7 +10,7 @@ OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \
extable.o linuxextable.o sort.o xenirq.o xentime.o \
regionreg.o entry.o unaligned.o privop.o vcpu.o \
irq_ia64.o irq_lsapic.o vhpt.o xenasm.o hyperprivop.o dom_fw.o \
grant_table.o sn_console.o
grant_table.o sn_console.o # ia64_ksyms.o
OBJS += vmx_init.o vmx_virt.o vmx_vcpu.o vmx_process.o vmx_vsa.o vmx_ivt.o\
vmx_phy_mode.o vmx_utility.o vmx_interrupt.o vmx_entry.o vmmu.o \
@@ -45,7 +45,7 @@ asm-offsets.s: asm-offsets.c $(BASEDIR)/include/asm-ia64/.offsets.h.stamp $(BASE
asm-xsi-offsets.s: asm-xsi-offsets.c
$(CC) $(CFLAGS) -S -o $@ $<
$(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h: asm-xsi-offsets.s
@(set -e; \
echo "/*"; \
-187
View File
@@ -1,187 +0,0 @@
<Sign-Off: Fred.Yang@intel.com>
diff -r f2309ac2648a xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c Tue Sep 20 19:03:25 2005
+++ b/xen/arch/ia64/xen/dom_fw.c Tue Sep 20 20:10:36 2005
@@ -686,6 +686,12 @@
bp->console_info.orig_x = 0;
bp->console_info.orig_y = 24;
bp->fpswa = 0;
+ bp->initrd_start = (dom0_start+dom0_size) -
+ (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
+ bp->initrd_size = ia64_boot_param->initrd_size;
+ printf(" initrd start %0xlx", bp->initrd_start);
+ printf(" initrd size %0xlx", bp->initrd_size);
+
return bp;
}
diff -r f2309ac2648a xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c Tue Sep 20 19:03:25 2005
+++ b/xen/arch/ia64/xen/domain.c Tue Sep 20 20:10:36 2005
@@ -830,6 +830,7 @@
unsigned long pkern_start;
unsigned long pkern_entry;
unsigned long pkern_end;
+ unsigned long pinitrd_start = 0;
unsigned long ret, progress = 0;
//printf("construct_dom0: starting\n");
@@ -848,12 +849,6 @@
alloc_start = dom0_start;
alloc_end = dom0_start + dom0_size;
d->tot_pages = d->max_pages = dom0_size/PAGE_SIZE;
- image_start = __va(ia64_boot_param->initrd_start);
- image_len = ia64_boot_param->initrd_size;
-//printk("image_start=%lx, image_len=%lx\n",image_start,image_len);
-//printk("First word of image: %lx\n",*(unsigned long *)image_start);
-
-//printf("construct_dom0: about to call parseelfimage\n");
dsi.image_addr = (unsigned long)image_start;
dsi.image_len = image_len;
rc = parseelfimage(&dsi);
@@ -890,11 +885,18 @@
return -EINVAL;
}
+ if(initrd_start&&initrd_len){
+ pinitrd_start=(dom0_start+dom0_size) -
+ (PAGE_ALIGN(initrd_len) + 4*1024*1024);
+
+ memcpy(__va(pinitrd_start),initrd_start,initrd_len);
+ }
+
printk("METAPHYSICAL MEMORY ARRANGEMENT:\n"
" Kernel image: %lx->%lx\n"
" Entry address: %lx\n"
- " Init. ramdisk: (NOT IMPLEMENTED YET)\n",
- pkern_start, pkern_end, pkern_entry);
+ " Init. ramdisk: %lx len %lx\n",
+ pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len);
if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) )
{
diff -r f2309ac2648a xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c Tue Sep 20 19:03:25 2005
+++ b/xen/arch/ia64/xen/xensetup.c Tue Sep 20 20:10:36 2005
@@ -153,7 +153,8 @@
void *heap_start;
int i;
unsigned long max_mem, nr_pages, firsthole_start;
- unsigned long dom0_memory_start, dom0_memory_end;
+ unsigned long dom0_memory_start, dom0_memory_size;
+ unsigned long dom0_initrd_start, dom0_initrd_size;
unsigned long initial_images_start, initial_images_end;
running_on_sim = is_platform_hp_ski();
@@ -191,7 +192,18 @@
efi_memmap_walk(xen_find_first_hole, &firsthole_start);
initial_images_start = xenheap_phys_end;
- initial_images_end = initial_images_start + ia64_boot_param->initrd_size;
+ initial_images_end = initial_images_start +
+ PAGE_ALIGN(ia64_boot_param->domain_size);
+
+ /* also reserve space for initrd */
+ if (ia64_boot_param->initrd_start && ia64_boot_param->initrd_size)
+ initial_images_end += PAGE_ALIGN(ia64_boot_param->initrd_size);
+ else {
+ /* sanity cleanup */
+ ia64_boot_param->initrd_size = 0;
+ ia64_boot_param->initrd_start = 0;
+ }
+
/* Later may find another memory trunk, even away from xen image... */
if (initial_images_end > firsthole_start) {
@@ -203,11 +215,21 @@
/* This copy is time consuming, but elilo may load Dom0 image
* within xenheap range */
- printk("ready to move Dom0 to 0x%lx...", initial_images_start);
+ printk("ready to move Dom0 to 0x%lx with len %lx...", initial_images_start,
+ ia64_boot_param->domain_size);
+
memmove(__va(initial_images_start),
+ __va(ia64_boot_param->domain_start),
+ ia64_boot_param->domain_size);
+// ia64_boot_param->domain_start = initial_images_start;
+
+ printk("ready to move initrd to 0x%lx with len %lx...",
+ initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size),
+ ia64_boot_param->initrd_size);
+ memmove(__va(initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size)),
+
__va(ia64_boot_param->initrd_start),
ia64_boot_param->initrd_size);
- ia64_boot_param->initrd_start = initial_images_start;
printk("Done\n");
/* first find highest page frame number */
@@ -335,23 +357,26 @@
* above our heap. The second module, if present, is an initrd ramdisk.
*/
printk("About to call construct_dom0()\n");
- dom0_memory_start = __va(ia64_boot_param->initrd_start);
- dom0_memory_end = ia64_boot_param->initrd_size;
- if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
- 0,
- 0,
+ dom0_memory_start = __va(initial_images_start);
+ dom0_memory_size = ia64_boot_param->domain_size;
+ dom0_initrd_start = __va(initial_images_start +
+ PAGE_ALIGN(ia64_boot_param->domain_size));
+ dom0_initrd_size = ia64_boot_param->initrd_size;
+
+ if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_size,
+ dom0_initrd_start,dom0_initrd_size,
0) != 0)
panic("Could not set up DOM0 guest OS\n");
#ifdef CLONE_DOMAIN0
{
int i;
- dom0_memory_start = __va(ia64_boot_param->initrd_start);
- dom0_memory_end = ia64_boot_param->initrd_size;
+ dom0_memory_start = __va(ia64_boot_param->domain_start);
+ dom0_memory_size = ia64_boot_param->domain_size;
+
for (i = 0; i < CLONE_DOMAIN0; i++) {
printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
- if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
- 0,
- 0,
+ if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_size,
+ dom0_initrd_start,dom0_initrd_size,
0) != 0)
panic("Could not set up DOM0 clone %d\n",i);
}
@@ -359,8 +384,14 @@
#endif
/* The stash space for the initial kernel image can now be freed up. */
- init_domheap_pages(ia64_boot_param->initrd_start,
- ia64_boot_param->initrd_start + ia64_boot_param->initrd_size);
+ init_domheap_pages(ia64_boot_param->domain_start,
+ ia64_boot_param->domain_size);
+ /* throw away initrd area passed from elilo */
+ if (ia64_boot_param->initrd_size) {
+ init_domheap_pages(ia64_boot_param->initrd_start,
+ ia64_boot_param->initrd_size);
+ }
+
if (!running_on_sim) // slow on ski and pages are pre-initialized to zero
scrub_heap_pages();
diff -r f2309ac2648a xen/include/asm-ia64/linux-xen/asm/system.h
--- a/xen/include/asm-ia64/linux-xen/asm/system.h Tue Sep 20 19:03:25 2005
+++ b/xen/include/asm-ia64/linux-xen/asm/system.h Tue Sep 20 20:10:36 2005
@@ -56,6 +56,10 @@
__u64 fpswa; /* physical address of the fpswa interface */
__u64 initrd_start;
__u64 initrd_size;
+//for loading initrd for dom0
+ __u64 domain_start; /* virtual address where the boot time domain begins */
+ __u64 domain_size; /* how big is the boot domain */
+
} *ia64_boot_param;
/*
+2
View File
@@ -49,6 +49,8 @@ struct mmio_list *lookup_mmio(u64 gpa, struct mmio_list *mio_base)
#define PIB_OFST_INTA 0x1E0000
#define PIB_OFST_XTP 0x1E0008
static int write_ipi (VCPU *vcpu, uint64_t addr, uint64_t value);
static void pib_write(VCPU *vcpu, void *src, uint64_t pib_off, size_t s, int ma)
{
switch (pib_off) {
+8 -4
View File
@@ -157,11 +157,13 @@ static thash_cb_t *init_domain_vhpt(struct vcpu *d)
printk("Allocate domain vhpt at 0x%lx\n", (u64)vbase);
memset(vbase, 0, VCPU_TLB_SIZE);
vcur = (void*)((u64)vbase + VCPU_TLB_SIZE);
vhpt = --((thash_cb_t*)vcur);
vcur -= sizeof (thash_cb_t);
vhpt = vcur;
vhpt->ht = THASH_VHPT;
vhpt->vcpu = d;
vhpt->hash_func = machine_thash;
vs = --((vhpt_special *)vcur);
vs -= sizeof (vhpt_special);
vs = vcur;
/* Setup guest pta */
pta_value.val = 0;
@@ -199,10 +201,12 @@ thash_cb_t *init_domain_tlb(struct vcpu *d)
printk("Allocate domain tlb at 0x%lx\n", (u64)vbase);
memset(vbase, 0, VCPU_TLB_SIZE);
vcur = (void*)((u64)vbase + VCPU_TLB_SIZE);
tlb = --((thash_cb_t*)vcur);
vcur -= sizeof (thash_cb_t);
tlb = vcur;
tlb->ht = THASH_TLB;
tlb->vcpu = d;
ts = --((tlb_special_t *)vcur);
vcur -= sizeof (tlb_special_t);
ts = vcur;
tlb->ts = ts;
tlb->ts->vhpt = init_domain_vhpt(d);
tlb->hash_func = machine_thash;
+7 -4
View File
@@ -466,11 +466,8 @@ acpi_update_madt_checksum (unsigned long phys_addr, unsigned long size)
/* base is physical address of acpi table */
void touch_acpi_table(void)
{
u64 count = 0;
count = acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_update_lsapic, NR_CPUS);
if ( count < 1)
if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_update_lsapic, 0) < 0)
printk("Error parsing MADT - no LAPIC entires\n");
printk("Total %d lsapic entry\n", count);
acpi_table_parse(ACPI_APIC, acpi_update_madt_checksum);
return;
@@ -686,6 +683,12 @@ dom_fw_init (struct domain *d, char *args, int arglen, char *fw_mem, int fw_mem_
bp->console_info.orig_x = 0;
bp->console_info.orig_y = 24;
bp->fpswa = 0;
bp->initrd_start = (dom0_start+dom0_size) -
(PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
bp->initrd_size = ia64_boot_param->initrd_size;
printf(" initrd start %0xlx", bp->initrd_start);
printf(" initrd size %0xlx", bp->initrd_size);
return bp;
}
+64 -80
View File
@@ -11,6 +11,7 @@
*/
#include <xen/config.h>
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/sched.h>
@@ -48,15 +49,8 @@
#define CONFIG_DOMAIN0_CONTIGUOUS
unsigned long dom0_start = -1L;
unsigned long dom0_size = 512*1024*1024; //FIXME: Should be configurable
//FIXME: alignment should be 256MB, lest Linux use a 256MB page size
unsigned long dom0_align = 256*1024*1024;
#ifdef DOMU_BUILD_STAGING
unsigned long domU_staging_size = 32*1024*1024; //FIXME: Should be configurable
unsigned long domU_staging_start;
unsigned long domU_staging_align = 64*1024;
unsigned long *domU_staging_area;
#endif
unsigned long dom0_size = 512*1024*1024;
unsigned long dom0_align = 64*1024*1024;
// initialized by arch/ia64/setup.c:find_initrd()
unsigned long initrd_start = 0, initrd_end = 0;
@@ -750,46 +744,6 @@ void alloc_dom0(void)
}
#ifdef DOMU_BUILD_STAGING
void alloc_domU_staging(void)
{
domU_staging_size = 32*1024*1024; //FIXME: Should be configurable
printf("alloc_domU_staging: starting (initializing %d MB...)\n",domU_staging_size/(1024*1024));
domU_staging_start = alloc_boot_pages(
domU_staging_size >> PAGE_SHIFT, domU_staging_align >> PAGE_SHIFT);
domU_staging_start <<= PAGE_SHIFT;
if (!domU_staging_size) {
printf("alloc_domU_staging: can't allocate, spinning...\n");
while(1);
}
else domU_staging_area = (unsigned long *)__va(domU_staging_start);
printf("alloc_domU_staging: domU_staging_area=%p\n",domU_staging_area);
}
unsigned long
domU_staging_read_8(unsigned long at)
{
// no way to return errors so just do it
return domU_staging_area[at>>3];
}
unsigned long
domU_staging_write_32(unsigned long at, unsigned long a, unsigned long b,
unsigned long c, unsigned long d)
{
if (at + 32 > domU_staging_size) return -1;
if (at & 0x1f) return -1;
at >>= 3;
domU_staging_area[at++] = a;
domU_staging_area[at++] = b;
domU_staging_area[at++] = c;
domU_staging_area[at] = d;
return 0;
}
#endif
/*
* Domain 0 has direct access to all devices absolutely. However
@@ -823,6 +777,7 @@ int construct_dom0(struct domain *d,
unsigned long pkern_start;
unsigned long pkern_entry;
unsigned long pkern_end;
unsigned long pinitrd_start = 0;
unsigned long ret, progress = 0;
//printf("construct_dom0: starting\n");
@@ -841,12 +796,6 @@ int construct_dom0(struct domain *d,
alloc_start = dom0_start;
alloc_end = dom0_start + dom0_size;
d->tot_pages = d->max_pages = dom0_size/PAGE_SIZE;
image_start = __va(ia64_boot_param->initrd_start);
image_len = ia64_boot_param->initrd_size;
//printk("image_start=%lx, image_len=%lx\n",image_start,image_len);
//printk("First word of image: %lx\n",*(unsigned long *)image_start);
//printf("construct_dom0: about to call parseelfimage\n");
dsi.image_addr = (unsigned long)image_start;
dsi.image_len = image_len;
rc = parseelfimage(&dsi);
@@ -883,11 +832,18 @@ int construct_dom0(struct domain *d,
return -EINVAL;
}
if(initrd_start&&initrd_len){
pinitrd_start=(dom0_start+dom0_size) -
(PAGE_ALIGN(initrd_len) + 4*1024*1024);
memcpy(__va(pinitrd_start),initrd_start,initrd_len);
}
printk("METAPHYSICAL MEMORY ARRANGEMENT:\n"
" Kernel image: %lx->%lx\n"
" Entry address: %lx\n"
" Init. ramdisk: (NOT IMPLEMENTED YET)\n",
pkern_start, pkern_end, pkern_entry);
" Init. ramdisk: %lx len %lx\n",
pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len);
if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) )
{
@@ -1074,29 +1030,6 @@ void reconstruct_domU(struct vcpu *v)
}
#endif
// FIXME: When dom0 can construct domains, this goes away (or is rewritten)
int launch_domainU(unsigned long size)
{
#ifdef CLONE_DOMAIN0
static int next = CLONE_DOMAIN0+1;
#else
static int next = 1;
#endif
struct domain *d = do_createdomain(next,0);
if (!d) {
printf("launch_domainU: couldn't create\n");
return 1;
}
else next++;
if (construct_domU(d, (unsigned long)domU_staging_area, size,0,0,0)) {
printf("launch_domainU: couldn't construct(id=%d,%lx,%lx)\n",
d->domain_id,domU_staging_area,size);
return 2;
}
domain_unpause_by_systemcontroller(d);
}
void machine_restart(char * __unused)
{
if (platform_is_hp_ski()) dummy();
@@ -1154,3 +1087,54 @@ void sync_vcpu_execstate(struct vcpu *v)
}
// FIXME SMP: Anything else needed here for SMP?
}
// FIXME: It would be nice to print out a nice error message for bad
// values of these boot-time parameters, but it seems we are too early
// in the boot and attempts to print freeze the system?
#define abort(x...) do {} while(0)
#define warn(x...) do {} while(0)
static void parse_dom0_mem(char *s)
{
unsigned long bytes = parse_size_and_unit(s);
if (dom0_size < 4 * 1024 * 1024) {
abort("parse_dom0_mem: too small, boot aborted"
" (try e.g. dom0_mem=256M or dom0_mem=65536K)\n");
}
if (dom0_size % dom0_align) {
dom0_size = ((dom0_size / dom0_align) + 1) * dom0_align;
warn("parse_dom0_mem: dom0_size rounded up from"
" %lx to %lx bytes, due to dom0_align=%lx\n",
bytes,dom0_size,dom0_align);
}
else dom0_size = bytes;
}
custom_param("dom0_mem", parse_dom0_mem);
static void parse_dom0_align(char *s)
{
unsigned long bytes = parse_size_and_unit(s);
if ((bytes - 1) ^ bytes) { /* not a power of two */
abort("parse_dom0_align: dom0_align must be power of two, "
"boot aborted"
" (try e.g. dom0_align=256M or dom0_align=65536K)\n");
}
else if (bytes < PAGE_SIZE) {
abort("parse_dom0_align: dom0_align must be >= %ld, "
"boot aborted"
" (try e.g. dom0_align=256M or dom0_align=65536K)\n",
PAGE_SIZE);
}
else dom0_align = bytes;
if (dom0_size % dom0_align) {
dom0_size = (dom0_size / dom0_align + 1) * dom0_align;
warn("parse_dom0_align: dom0_size rounded up from"
" %ld to %ld bytes, due to dom0_align=%lx\n",
bytes,dom0_size,dom0_align);
}
}
custom_param("dom0_align", parse_dom0_align);
+2 -18
View File
@@ -123,32 +123,16 @@ ia64_hypercall (struct pt_regs *regs)
// FIXME: need fixes in efi.h from 2.6.9
regs->r8 = EFI_UNSUPPORTED;
break;
case 0xffff: // test dummy hypercall
case 0xffff:
regs->r8 = dump_privop_counts_to_user(
vcpu_get_gr(v,32),
vcpu_get_gr(v,33));
break;
case 0xfffe: // test dummy hypercall
case 0xfffe:
regs->r8 = zero_privop_counts_to_user(
vcpu_get_gr(v,32),
vcpu_get_gr(v,33));
break;
case 0xfffd: // test dummy hypercall
regs->r8 = launch_domainU(
vcpu_get_gr(v,32));
break;
case 0xfffc: // test dummy hypercall
regs->r8 = domU_staging_write_32(
vcpu_get_gr(v,32),
vcpu_get_gr(v,33),
vcpu_get_gr(v,34),
vcpu_get_gr(v,35),
vcpu_get_gr(v,36));
break;
case 0xfffb: // test dummy hypercall
regs->r8 = domU_staging_read_8(vcpu_get_gr(v,32));
break;
case __HYPERVISOR_dom0_op:
regs->r8 = do_dom0_op(regs->r14);
break;
+6
View File
@@ -1966,6 +1966,12 @@ ENTRY(hyper_itc_d)
ld8 r23=[r23];;
extr.u r24=r23,2,6;; // r24==logps
cmp.gt p7,p0=PAGE_SHIFT,r24
(p7) br.spnt.many dispatch_break_fault ;;
adds r21=XSI_IFA_OFS-XSI_PSR_IC_OFS,r18 ;;
ld8 r21=[r21];;
// for now, punt on region0 inserts
extr.u r21=r21,61,3;;
cmp.eq p7,p0=r21,r0
(p7) br.spnt.many dispatch_break_fault ;;
movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
ld8 r27=[r27];;
+9 -7
View File
@@ -698,13 +698,10 @@ ia64_handle_privop (unsigned long ifa, struct pt_regs *regs, unsigned long isr,
IA64FAULT vector;
struct domain *d = current->domain;
struct vcpu *v = current;
// FIXME: no need to pass itir in to this routine as we need to
// compute the virtual itir anyway (based on domain's RR.ps)
// AND ACTUALLY reflect_interruption doesn't use it anyway!
vector = priv_emulate(current,regs,isr);
if (vector != IA64_NO_FAULT && vector != IA64_RFI_IN_PROGRESS) {
PSCB(current,itir) =
vcpu_get_itir_on_fault(v,PSCB(current,ifa));
// Note: if a path results in a vector to reflect that requires
// iha/itir (e.g. vcpu_force_data_miss), they must be set there
reflect_interruption(isr,regs,vector);
}
}
@@ -743,10 +740,15 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i
vector = IA64_DISABLED_FPREG_VECTOR;
break;
case 26:
if (((isr >> 4L) & 0xfL) == 1) {
//regs->eml_unat = 0; FIXME: DO WE NEED THIS??
printf("ia64_handle_reflection: handling regNaT fault");
vector = IA64_NAT_CONSUMPTION_VECTOR; break;
}
printf("*** NaT fault... attempting to handle as privop\n");
printf("isr=%p, ifa=%p,iip=%p,ipsr=%p\n",isr,ifa,regs->cr_iip,psr);
regs->eml_unat = 0;
return;
//regs->eml_unat = 0; FIXME: DO WE NEED THIS???
// certain NaT faults are higher priority than privop faults
vector = priv_emulate(v,regs,isr);
if (vector == IA64_NO_FAULT) {
printf("*** Handled privop masquerading as NaT fault\n");
-6
View File
@@ -190,12 +190,6 @@ set_rr(unsigned long rr, unsigned long rrval)
ia64_srlz_d();
}
unsigned long
get_rr(unsigned long rr)
{
return vmUnmangleRID(ia64_get_rr(rr));
}
static inline int validate_page_size(unsigned long ps)
{
switch(ps) {
+38 -19
View File
@@ -147,6 +147,9 @@ void vcpu_load_kernel_regs(VCPU *vcpu)
ia64_set_kr(7, VCPU(vcpu, krs[7]));
}
/* GCC 4.0.2 seems not to be able to suppress this call!. */
#define ia64_setreg_unknown_kr() return IA64_ILLOP_FAULT
IA64FAULT vcpu_set_ar(VCPU *vcpu, UINT64 reg, UINT64 val)
{
if (reg == 44) return (vcpu_set_itc(vcpu,val));
@@ -342,19 +345,17 @@ IA64FAULT vcpu_set_psr_l(VCPU *vcpu, UINT64 val)
IA64FAULT vcpu_get_psr(VCPU *vcpu, UINT64 *pval)
{
UINT64 psr;
REGS *regs = vcpu_regs(vcpu);
struct ia64_psr newpsr;
// TODO: This needs to return a "filtered" view of
// the psr, not the actual psr. Probably the psr needs
// to be a field in regs (in addition to ipsr).
__asm__ __volatile ("mov %0=psr;;" : "=r"(psr) :: "memory");
newpsr = *(struct ia64_psr *)&psr;
newpsr = *(struct ia64_psr *)&regs->cr_ipsr;
if (newpsr.cpl == 2) newpsr.cpl = 0;
if (PSCB(vcpu,interrupt_delivery_enabled)) newpsr.i = 1;
else newpsr.i = 0;
if (PSCB(vcpu,interrupt_collection_enabled)) newpsr.ic = 1;
else newpsr.ic = 0;
if (PSCB(vcpu,metaphysical_mode)) newpsr.dt = 0;
else newpsr.dt = 1;
// FIXME: need new field in mapped_regs_t for virtual psr.pp (psr.be too?)
if (PSCB(vcpu,tmp[8])) newpsr.pp = 1;
else newpsr.pp = 0;
@@ -1183,6 +1184,8 @@ Privileged operation emulation routines
IA64FAULT vcpu_force_data_miss(VCPU *vcpu, UINT64 ifa)
{
PSCB(vcpu,ifa) = ifa;
PSCB(vcpu,itir) = vcpu_get_itir_on_fault(vcpu,ifa);
vcpu_thash(current, ifa, &PSCB(current,iha));
return (vcpu_get_rr_ve(vcpu,ifa) ? IA64_DATA_TLB_VECTOR : IA64_ALT_DATA_TLB_VECTOR);
}
@@ -1256,7 +1259,6 @@ IA64FAULT vcpu_thash(VCPU *vcpu, UINT64 vadr, UINT64 *pval)
UINT64 Mask = (1L << pta_sz) - 1;
UINT64 Mask_60_15 = (Mask >> 15) & 0x3fffffffffff;
UINT64 compMask_60_15 = ~Mask_60_15;
//UINT64 rr_ps = RR_TO_PS(get_rr(vadr));
UINT64 rr_ps = vcpu_get_rr_ps(vcpu,vadr);
UINT64 VHPT_offset = (vadr >> rr_ps) << 3;
UINT64 VHPT_addr1 = vadr & 0xe000000000000000L;
@@ -1287,29 +1289,39 @@ unsigned long fast_vhpt_translate_count = 0;
unsigned long recover_to_page_fault_count = 0;
unsigned long recover_to_break_fault_count = 0;
int warn_region0_address = 0; // FIXME later: tie to a boot parameter?
IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pteval, UINT64 *itir, UINT64 *iha)
{
unsigned long region = address >> 61;
unsigned long pta, pte, rid, rr;
int i;
TR_ENTRY *trp;
if (!(address >> 61)) {
if (!PSCB(vcpu,metaphysical_mode)) {
REGS *regs = vcpu_regs(vcpu);
unsigned long viip = PSCB(vcpu,iip);
unsigned long vipsr = PSCB(vcpu,ipsr);
unsigned long iip = regs->cr_iip;
unsigned long ipsr = regs->cr_ipsr;
printk("vcpu_translate: bad address %p, viip=%p, vipsr=%p, iip=%p, ipsr=%p continuing\n", address, viip, vipsr, iip, ipsr);
if (PSCB(vcpu,metaphysical_mode) && !(!is_data && region)) {
// dom0 may generate an uncacheable physical address (msb=1)
if (region && ((region != 4) || (vcpu->domain != dom0))) {
// FIXME: This seems to happen even though it shouldn't. Need to track
// this down, but since it has been apparently harmless, just flag it for now
// panic_domain(vcpu_regs(vcpu),
printk(
"vcpu_translate: bad physical address: %p\n",address);
}
*pteval = (address & _PAGE_PPN_MASK) | __DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX;
*itir = PAGE_SHIFT << 2;
phys_translate_count++;
return IA64_NO_FAULT;
}
else if (!region && warn_region0_address) {
REGS *regs = vcpu_regs(vcpu);
unsigned long viip = PSCB(vcpu,iip);
unsigned long vipsr = PSCB(vcpu,ipsr);
unsigned long iip = regs->cr_iip;
unsigned long ipsr = regs->cr_ipsr;
printk("vcpu_translate: bad address %p, viip=%p, vipsr=%p, iip=%p, ipsr=%p continuing\n", address, viip, vipsr, iip, ipsr);
}
rr = PSCB(vcpu,rrs)[address>>61];
rr = PSCB(vcpu,rrs)[region];
rid = rr & RR_RID_MASK;
if (is_data) {
if (vcpu_quick_region_check(vcpu->arch.dtr_regions,address)) {
@@ -1685,7 +1697,7 @@ static void vcpu_set_tr_entry(TR_ENTRY *trp, UINT64 pte, UINT64 itir, UINT64 ifa
UINT64 ps;
trp->itir = itir;
trp->rid = virtualize_rid(current, get_rr(ifa) & RR_RID_MASK);
trp->rid = VCPU(current,rrs[ifa>>61]) & RR_RID_MASK;
trp->p = 1;
ps = trp->ps;
trp->page_flags = pte;
@@ -1760,7 +1772,8 @@ void vcpu_itc_no_srlz(VCPU *vcpu, UINT64 IorD, UINT64 vaddr, UINT64 pte, UINT64
// PAGE_SIZE mapping in the vhpt for now, else purging is complicated
else vhpt_insert(vaddr,pte,PAGE_SHIFT<<2);
#endif
if ((mp_pte == -1UL) || (IorD & 0x4)) return; // don't place in 1-entry TLB
if ((mp_pte == -1UL) || (IorD & 0x4)) // don't place in 1-entry TLB
return;
if (IorD & 0x1) {
vcpu_set_tr_entry(&PSCBX(vcpu,itlb),pte,ps<<2,vaddr);
PSCBX(vcpu,itlb_pte) = mp_pte;
@@ -1775,6 +1788,7 @@ IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
{
unsigned long pteval, logps = (itir >> 2) & 0x3f;
unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode));
if (logps < PAGE_SHIFT) {
printf("vcpu_itc_d: domain trying to use smaller page size!\n");
@@ -1784,7 +1798,9 @@ IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
//itir = (itir & ~0xfc) | (PAGE_SHIFT<<2); // ignore domain's pagesize
pteval = translate_domain_pte(pte,ifa,itir);
if (!pteval) return IA64_ILLOP_FAULT;
if (swap_rr0) set_one_rr(0x0,PSCB(vcpu,rrs[0]));
vcpu_itc_no_srlz(vcpu,2,ifa,pteval,pte,logps);
if (swap_rr0) set_metaphysical_rr0();
return IA64_NO_FAULT;
}
@@ -1792,6 +1808,7 @@ IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
{
unsigned long pteval, logps = (itir >> 2) & 0x3f;
unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode));
// FIXME: validate ifa here (not in Xen space), COULD MACHINE CHECK!
if (logps < PAGE_SHIFT) {
@@ -1803,7 +1820,9 @@ IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
pteval = translate_domain_pte(pte,ifa,itir);
// FIXME: what to do if bad physical address? (machine check?)
if (!pteval) return IA64_ILLOP_FAULT;
if (swap_rr0) set_one_rr(0x0,PSCB(vcpu,rrs[0]));
vcpu_itc_no_srlz(vcpu, 1,ifa,pteval,pte,logps);
if (swap_rr0) set_metaphysical_rr0();
return IA64_NO_FAULT;
}
+62 -23
View File
@@ -153,7 +153,8 @@ void start_kernel(void)
void *heap_start;
int i;
unsigned long max_mem, nr_pages, firsthole_start;
unsigned long dom0_memory_start, dom0_memory_end;
unsigned long dom0_memory_start, dom0_memory_size;
unsigned long dom0_initrd_start, dom0_initrd_size;
unsigned long initial_images_start, initial_images_end;
running_on_sim = is_platform_hp_ski();
@@ -190,8 +191,30 @@ void start_kernel(void)
firsthole_start = 0;
efi_memmap_walk(xen_find_first_hole, &firsthole_start);
if (ia64_boot_param->domain_start == 0
|| ia64_boot_param->domain_size == 0) {
/* This is possible only with the old elilo, which does not support
a vmm. Fix now, and continue without initrd. */
printk ("Your elilo is not Xen-aware. Bootparams fixed\n");
ia64_boot_param->domain_start = ia64_boot_param->initrd_start;
ia64_boot_param->domain_size = ia64_boot_param->initrd_size;
ia64_boot_param->initrd_start = 0;
ia64_boot_param->initrd_size = 0;
}
initial_images_start = xenheap_phys_end;
initial_images_end = initial_images_start + ia64_boot_param->initrd_size;
initial_images_end = initial_images_start +
PAGE_ALIGN(ia64_boot_param->domain_size);
/* also reserve space for initrd */
if (ia64_boot_param->initrd_start && ia64_boot_param->initrd_size)
initial_images_end += PAGE_ALIGN(ia64_boot_param->initrd_size);
else {
/* sanity cleanup */
ia64_boot_param->initrd_size = 0;
ia64_boot_param->initrd_start = 0;
}
/* Later may find another memory trunk, even away from xen image... */
if (initial_images_end > firsthole_start) {
@@ -203,11 +226,21 @@ void start_kernel(void)
/* This copy is time consuming, but elilo may load Dom0 image
* within xenheap range */
printk("ready to move Dom0 to 0x%lx...", initial_images_start);
printk("ready to move Dom0 to 0x%lx with len %lx...", initial_images_start,
ia64_boot_param->domain_size);
memmove(__va(initial_images_start),
__va(ia64_boot_param->domain_start),
ia64_boot_param->domain_size);
// ia64_boot_param->domain_start = initial_images_start;
printk("ready to move initrd to 0x%lx with len %lx...",
initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size),
ia64_boot_param->initrd_size);
memmove(__va(initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size)),
__va(ia64_boot_param->initrd_start),
ia64_boot_param->initrd_size);
ia64_boot_param->initrd_start = initial_images_start;
printk("Done\n");
/* first find highest page frame number */
@@ -235,9 +268,6 @@ void start_kernel(void)
__ia64_init_fpu();
alloc_dom0();
#ifdef DOMU_BUILD_STAGING
alloc_domU_staging();
#endif
end_boot_allocator();
@@ -329,13 +359,16 @@ printk("About to call do_createdomain()\n");
* We're going to setup domain0 using the module(s) that we stashed safely
* above our heap. The second module, if present, is an initrd ramdisk.
*/
printk("About to call construct_dom0()\n");
dom0_memory_start = __va(ia64_boot_param->initrd_start);
dom0_memory_end = ia64_boot_param->initrd_size;
if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
0,
0,
0) != 0)
printk("About to call construct_dom0()\n");
dom0_memory_start = __va(initial_images_start);
dom0_memory_size = ia64_boot_param->domain_size;
dom0_initrd_start = __va(initial_images_start +
PAGE_ALIGN(ia64_boot_param->domain_size));
dom0_initrd_size = ia64_boot_param->initrd_size;
if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_size,
dom0_initrd_start,dom0_initrd_size,
0) != 0)
panic("Could not set up DOM0 guest OS\n");
/* PIN domain0 on CPU 0. */
@@ -345,22 +378,28 @@ printk("About to call construct_dom0()\n");
#ifdef CLONE_DOMAIN0
{
int i;
dom0_memory_start = __va(ia64_boot_param->initrd_start);
dom0_memory_end = ia64_boot_param->initrd_size;
dom0_memory_start = __va(ia64_boot_param->domain_start);
dom0_memory_size = ia64_boot_param->domain_size;
for (i = 0; i < CLONE_DOMAIN0; i++) {
printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
0,
0,
0) != 0)
printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_size,
dom0_initrd_start,dom0_initrd_size,
0) != 0)
panic("Could not set up DOM0 clone %d\n",i);
}
}
#endif
/* The stash space for the initial kernel image can now be freed up. */
init_domheap_pages(ia64_boot_param->initrd_start,
ia64_boot_param->initrd_start + ia64_boot_param->initrd_size);
init_domheap_pages(ia64_boot_param->domain_start,
ia64_boot_param->domain_size);
/* throw away initrd area passed from elilo */
if (ia64_boot_param->initrd_size) {
init_domheap_pages(ia64_boot_param->initrd_start,
ia64_boot_param->initrd_size);
}
if (!running_on_sim) // slow on ski and pages are pre-initialized to zero
scrub_heap_pages();
+1 -1
View File
@@ -5,7 +5,7 @@
// control flags for turning on/off features under test
#undef CLONE_DOMAIN0
//#define CLONE_DOMAIN0 1
#define DOMU_BUILD_STAGING
#undef DOMU_BUILD_STAGING
#define VHPT_GLOBAL
#define DOMU_AUTO_RESTART
@@ -56,6 +56,10 @@ extern struct ia64_boot_param {
__u64 fpswa; /* physical address of the fpswa interface */
__u64 initrd_start;
__u64 initrd_size;
//for loading initrd for dom0
__u64 domain_start; /* virtual address where the boot time domain begins */
__u64 domain_size; /* how big is the boot domain */
} *ia64_boot_param;
/*
@@ -6,5 +6,6 @@
# easily updated to future versions of the corresponding Linux files.
cpumask.h -> linux/include/linux/cpumask.h
gfp.h -> linux/include/linux/gfp.h
hardirq.h -> linux/include/linux/hardirq.h
interrupt.h -> linux/include/linux/interrupt.h
@@ -1,6 +1,9 @@
#ifndef __LINUX_GFP_H
#define __LINUX_GFP_H
#ifdef XEN
#include <asm/bitops.h>
#endif
#include <linux/mmzone.h>
#include <linux/stddef.h>
#include <linux/linkage.h>
@@ -131,7 +131,9 @@ extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *d
extern void softirq_init(void);
#define __raise_softirq_irqoff(nr) do { local_softirq_pending() |= 1UL << (nr); } while (0)
extern void FASTCALL(raise_softirq_irqoff(unsigned int nr));
#ifndef XEN
extern void FASTCALL(raise_softirq(unsigned int nr));
#endif
/* Tasklets --- multithreaded analogue of BHs.
-1
View File
@@ -10,7 +10,6 @@ bitops.h ->linux/include/linux/bitops.h
dma-mapping.h ->linux/include/linux/dma-mapping.h
efi.h ->linux/include/linux/efi.h
err.h ->linux/include/linux/err.h
gfp.h ->linux/include/linux/gfp.h
initrd.h ->linux/include/linux/initrd.h
jiffies.h ->linux/include/linux/jiffies.h
kmalloc_sizes.h ->linux/include/linux/kmalloc_sizes.h
+1 -1
View File
@@ -3,7 +3,7 @@
#include <xen/config.h>
#ifdef LINUX_2_6
#include <xen/gfp.h>
#include <linux/gfp.h>
#endif
#include <xen/list.h>
#include <xen/spinlock.h>
+4 -1
View File
@@ -222,7 +222,10 @@ typedef struct thash_cb {
#define ITR(hcb,id) ((hcb)->ts->itr[id])
#define DTR(hcb,id) ((hcb)->ts->dtr[id])
#define INVALIDATE_HASH(hcb,hash) { \
INVALID_ENTRY(hcb, hash) = 1; \
if ((hcb)->ht==THASH_TLB) \
INVALID_TLB(hash) = 1; \
else \
INVALID_VHPT(hash) = 1; \
hash->next = NULL; }
#define PURGABLE_ENTRY(hcb,en) 1
+2
View File
@@ -71,7 +71,9 @@ extern thash_cb_t *vmx_vcpu_get_vtlb(VCPU *vcpu);
extern thash_cb_t *vmx_vcpu_get_vhpt(VCPU *vcpu);
extern ia64_rr vmx_vcpu_rr(VCPU *vcpu,UINT64 vadr);
extern IA64FAULT vmx_vcpu_set_rr(VCPU *vcpu, UINT64 reg, UINT64 val);
#if 0
extern IA64FAULT vmx_vcpu_get_rr(VCPU *vcpu, UINT64 reg, UINT64 *pval);
#endif
extern IA64FAULT vmx_vcpu_get_pkr(VCPU *vcpu, UINT64 reg, UINT64 *pval);
IA64FAULT vmx_vcpu_set_pkr(VCPU *vcpu, UINT64 reg, UINT64 val);
extern IA64FAULT vmx_vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.