Commit Graph
8434 Commits
Author SHA1 Message Date
Ian.Campbell@xensource.com 40924689a9 Add support to xenctx for printing stack traces on x86_32 and x86_64.
To support this add xc_translate_foreign_address to libxc. This function
walks page tables and translates virtual addresses using a given domain
and vcpu page table.

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
2005-12-22 14:33:19 +00:00
kaf24@firebug.cl.cam.ac.uk 4f27f31a47 Remove acpi_count_madt functions. Only appear to be used
for diagnostic tracing in xen/ia64.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 20:18:19 +01:00
kaf24@firebug.cl.cam.ac.uk b20f22d5c4 Remove unused local variables (from removed REASIGN_PAGE
function).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 20:17:22 +01:00
kaf24@firebug.cl.cam.ac.uk e82f519465 Merge with xen-ia64-unstable.hg. 2005-12-21 19:52:00 +01:00
kaf24@firebug.cl.cam.ac.uk 93a7173714 Remove obsolete MMUEXT_REASSIGN_PAGE. It's not used by
anyone and is superceded by grant transfers.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 19:10:53 +01:00
djm@kirby.fc.hp.com a220ae9a8d Merge 2005-12-21 11:56:19 -06:00
kaf24@firebug.cl.cam.ac.uk db74dfce16 Fix gnttab_release_mappings -- it doesn't need to drop
page refcnts for host mappings as they are already
destroyed by put_page_from_l1e(). Also call
gnttab_release_mappings later (after destroying
page-table references) and from common code rather than
arch/x86.

Also a few other misc gnttab cleanups.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 18:45:43 +01:00
kaf24@firebug.cl.cam.ac.uk d9af6ba2e0 Increment page reference count for every host/device
mapping created via a grant reference, rather than one
increment for all uses of a single grant reference.
This avoids a nasty situation in put_page_from_l1e()
where we cannot reliably determine whether a mapping was
created via a grant reference and so we must always
decrement the mapped page's reference count.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 18:25:34 +01:00
kaf24@firebug.cl.cam.ac.uk f1e0d84148 Declare kasprintf before use.
Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 18:16:31 +01:00
djm@kirby.fc.hp.com 82a32ebf85 Disable chatty translate_domain_pte messages for normal grant table traffic 2005-12-21 10:30:10 -06:00
djm@kirby.fc.hp.com 6c9ee8bb99 Facilitate to debug VTI-domain issue.
Signed-off-by Anthony Xu <anthony.xu@intel.com>
2005-12-21 09:33:45 -06:00
djm@kirby.fc.hp.com 94f556c210 Support domU initrd and cmdline (previous cset also)
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2005-12-21 09:31:05 -06:00
djm@kirby.fc.hp.com 08b3de8dee diff -r 545ba1b126ca tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Tue Dec 20 20:11:17 2005
+++ b/tools/libxc/xc_linux_build.c      Wed Dec 21 11:50:08 2005
@@ -296,9 +296,13 @@
     unsigned long *page_array = NULL;
     struct load_funcs load_funcs;
     struct domain_setup_info dsi;
+    unsigned long vinitrd_start;
+    unsigned long vinitrd_end;
+    unsigned long v_end;
     unsigned long start_page, pgnr;
     start_info_t *start_info;
     int rc;
+    unsigned long i;
 
     rc = probeimageformat(image, image_size, &load_funcs);
     if ( rc != 0 )
@@ -310,11 +314,13 @@
     if ( rc != 0 )
         goto error_out;
 
-    dsi.v_start = round_pgdown(dsi.v_start);
-    dsi.v_end   = round_pgup(dsi.v_end);
+    dsi.v_start      = round_pgdown(dsi.v_start);
+    vinitrd_start    = round_pgup(dsi.v_end);
+    vinitrd_end      = vinitrd_start + initrd_len;
+    v_end            = round_pgup(vinitrd_end);
 
     start_page = dsi.v_start >> PAGE_SHIFT;
-    pgnr = (dsi.v_end - dsi.v_start) >> PAGE_SHIFT;
+    pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
     if ( (page_array = malloc(pgnr * sizeof(unsigned long))) == NULL )
     {
         PERROR("Could not allocate memory");
@@ -326,9 +332,38 @@
         PERROR("Could not get the page frame list");
         goto error_out;
     }
+
+#define _p(a) ((void *) (a))
+
+    printf("VIRTUAL MEMORY ARRANGEMENT:\n"
+           " Loaded kernel: %p->%p\n"
+           " Init. ramdisk: %p->%p\n"
+           " TOTAL:         %p->%p\n",
+           _p(dsi.v_kernstart), _p(dsi.v_kernend), 
+           _p(vinitrd_start),   _p(vinitrd_end),
+           _p(dsi.v_start),     _p(v_end));
+    printf(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
 
     (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
                            &dsi);
+
+    /* Load the initial ramdisk image. */
+    if ( initrd_len != 0 )
+    {
+        for ( i = (vinitrd_start - dsi.v_start);
+              i < (vinitrd_end - dsi.v_start); i += PAGE_SIZE )
+        {
+            char page[PAGE_SIZE];
+            if ( gzread(initrd_gfd, page, PAGE_SIZE) == -1 )
+            {
+                PERROR("Error reading initrd image, could not");
+                goto error_out;
+            }
+            xc_copy_to_domain_page(xc_handle, dom,
+                                   page_array[i>>PAGE_SHIFT], page);
+        }
+    }
+
 
     *pvke = dsi.v_kernentry;
 
@@ -358,6 +393,13 @@
     start_info->store_evtchn = store_evtchn;
     start_info->console_mfn   = nr_pages - 1;
     start_info->console_evtchn = console_evtchn;
+    if ( initrd_len != 0 )
+    {
+        ctxt->initrd.start    = vinitrd_start;
+        ctxt->initrd.size     = initrd_len;
+    }
+    strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
+    ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
     munmap(start_info, PAGE_SIZE);
 
     free(page_array);
diff -r 545ba1b126ca xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c        Tue Dec 20 20:11:17 2005
+++ b/xen/arch/ia64/xen/dom_fw.c        Wed Dec 21 11:50:08 2005
@@ -861,9 +861,14 @@
        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;
+        if (d == dom0){
+                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;
+        }else{
+                bp->initrd_start = d->arch.initrd_start;
+                bp->initrd_size  = d->arch.initrd_len;
+       }
                 printf(" initrd start %0xlx", bp->initrd_start);
                 printf(" initrd size %0xlx", bp->initrd_size);
 
diff -r 545ba1b126ca xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Tue Dec 20 20:11:17 2005
+++ b/xen/arch/ia64/xen/domain.c        Wed Dec 21 11:50:08 2005
@@ -297,6 +297,9 @@
 
        *regs = c->regs;
        d->arch.sys_pgnr = c->sys_pgnr;
+        d->arch.initrd_start = c->initrd.start;
+        d->arch.initrd_len   = c->initrd.size;
+        d->arch.cmdline      = c->cmdline;
        new_thread(v, regs->cr_iip, 0, 0);
 
        v->vcpu_info->arch.evtchn_vector = c->vcpu.evtchn_vector;
@@ -365,7 +368,7 @@
                    regs->r28 = dom_fw_setup(d,saved_command_line,256L);
                else {
                    regs->ar_rsc |= (2 << 2); /* force PL2/3 */
-                   regs->r28 = dom_fw_setup(d,"nomca nosmp xencons=tty0 console=tty0 root=/dev/hda1",256L);  //FIXME
+                   regs->r28 = dom_fw_setup(d,d->arch.cmdline,256L);
                }
                VCPU(v, banknum) = 1;
                VCPU(v, metaphysical_mode) = 1;
diff -r 545ba1b126ca xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Tue Dec 20 20:11:17 2005
+++ b/xen/include/asm-ia64/domain.h     Wed Dec 21 11:50:08 2005
@@ -38,6 +38,9 @@
     u64 image_len;
     u64 entry;
 #endif
+    unsigned long initrd_start;
+    unsigned long initrd_len;
+    char *cmdline;
 };
 #define xen_vastart arch.xen_vastart
 #define xen_vaend arch.xen_vaend
diff -r 545ba1b126ca xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Tue Dec 20 20:11:17 2005
+++ b/xen/include/public/arch-ia64.h    Wed Dec 21 11:50:08 2005
@@ -276,6 +276,12 @@
     unsigned long start_info_pfn;
 } arch_shared_info_t;
 
+typedef struct {
+    unsigned long start;
+    unsigned long size; 
+} arch_initrd_info_t;
+
+#define IA64_COMMAND_LINE_SIZE 512
 typedef struct vcpu_guest_context {
 #define VGCF_FPU_VALID (1<<0)
 #define VGCF_VMX_GUEST (1<<1)
@@ -289,6 +295,8 @@
     cpu_user_regs_t regs;
     arch_vcpu_info_t vcpu;
     arch_shared_info_t shared;
+    arch_initrd_info_t initrd;
+    char cmdline[IA64_COMMAND_LINE_SIZE];
 } vcpu_guest_context_t;
 
 #endif /* !__ASSEMBLY__ */
2005-12-21 09:07:09 -06:00
djm@kirby.fc.hp.com 511d7dce64 This patch is intended to correct the number of CPUs.
Our IPF machines are the following configurations.
 - Total logical cpus = 16
  -- 4 sockets
  -- 2 cores
  -- 2 threads

I changed the setting of BIOS, and invalidated the hyperthread, and I built Xen with NR_CPUS=8.
As a result, it became like attached file xendmesg1.txt.
 - Available cpus 3
 - Total cpus 8

Next, I built Xen with NR_CPUS=16.
As a result, it became like attached file xendmesg2.txt.
 - Available cpus 8
 - Total cpus 16

I thought not to match the analysis of the lsapic entry to the value of NR_CPUS. 

It is an outline of patch as follows.
 1. Count up the lsapic entry by using acpi_table_count_madt()/acpi_table_count_madt_family().
 2. Call acpi_parse_lsapic() by using the number of lsapic entries.
 3. Count up the available_cpus by using acpi_parse_lsapic(), however NR_CPUS is not exceeded.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>

Best Regards,
 Kan
2005-12-21 08:53:40 -06:00
djm@kirby.fc.hp.com bfb1a9b2ac New default config file that works on both tiger4 and HP boxes 2005-12-21 08:49:31 -06:00
djm@kirby.fc.hp.com 2d2a310ebe Fix smp_processor_id to be linked to correct processor id under vcpu, which is
the exact one updated by scheduler. Or else easy to think how things get
messed under SMP environment. One phenomenon observed is about softirq.
Exit path on CPU1 checks pending indicator by local_cpu_data, and then
goto do_softirq if pending true. However do_softirq uses cpu_data(cpu)
to query pending bit again. Cpu index is aquired from smp_processor_id,
with thread_info->cpu not cared by scheduler. Finally do_softirq on CPU1
tries to operate percpu data on CPU0 then.

Also disable several prints within critical path, like sending IPI. Due to
slow serial speed, this will slow down overall performance heavily since
event channels among CPUs are in traffic.

This patch is necessary for host SMP.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
2005-12-21 08:40:16 -06:00
djm@kirby.fc.hp.com 4649e71f3f Certain faults should not be reflected if caused with priv=0
Signed-off-by Kevin Tian <kevin.tian@intel.com>
2005-12-21 08:36:03 -06:00
djm@kirby.fc.hp.com 7c191eedcd More pal_flush_cache calls for split cache machines (by Anthony Xu) 2005-12-21 08:27:09 -06:00
kaf24@firebug.cl.cam.ac.uk c19d7d7430 Add support for MOVSX/MOVSXD/MOVZX (move-with-extend)
instructions to the generic x86 emulator. Also add
preliminary support for 16-bit addressing: decode the
ModR/M byte properly but still need to access and update
implicit memory operands (esp,esi,edi) with correct width.
Work is also needed to support real-mode addressing.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-21 14:29:23 +01:00
vhanquez@kneesa.uk.xensource.com 8e0091cac0 remove duplicate code to allocate a string ala printf (using kasprintf)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
2005-12-21 11:14:37 +00:00
djm@kirby.fc.hp.com 541bcd7e26 Important domU/vbd fix. Reserve top granule of machine memory for dom0. 2005-12-20 14:11:17 -06:00
kaf24@firebug.cl.cam.ac.uk 2eb236c17e Remove FIX_RSDP_PAGE. Access RSDP via the 'isamap' of low 1MB.
Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-20 18:45:29 +01:00
kaf24@firebug.cl.cam.ac.uk 3f60590ca4 Remove automatic I/O-fault handling in XenLinux. It's now
handled by Xen itself.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-20 18:34:58 +01:00
emellor@leeni.uk.xensource.com 9f929dc9af Merged. 2005-12-20 17:16:24 +00:00
emellor@leeni.uk.xensource.com c5ea66cfd2 Changed UUID / Xen handle formatting to be compatible with the OSF DCE UUIDs.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-20 17:16:15 +00:00
kaf24@firebug.cl.cam.ac.uk 34c31a402c Allow unknown NMIs to be propagated to domain0 via new
VIRQ_NMI. Also simplify x86_32 NMI handling -- there's
no need to greedily consume IO/parity errors in
assembly code as they can be deferred without causing
an interrupt storm (the NMI pin is always edge-triggered
even though the sources are level-asserted).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-20 17:55:20 +01:00
kaf24@firebug.cl.cam.ac.uk 4cbd6b3272 Add sound blaster support to VMX device model.
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
2005-12-20 12:55:19 +01:00
kaf24@firebug.cl.cam.ac.uk ee5168b91f Currently there is no generic configure file to compile xenlinux on
ia64, since there're several different system types like HP-ZX, DIG,
etc. Current Makefile can't meet this need and default one
(xen0_defconfig_ia64) is only for HP-ZX type. Hence, this patch can
append an additional param to configuration file name to differentiate
system types when make.

Signed-off-by Zhang Xiantao <xiantao.zhang@intel.com>
2005-12-20 12:52:38 +01:00
kaf24@firebug.cl.cam.ac.uk b5bdea9ad6 This patch fix several issue to support >2G 64bit vmx guest in IA-32e
platform, it includes:
1) One fix on xc_vmx_build.c
2) Change ram_size/phys_ram_size in qemu from int to uint64_t
3) One fix on pcnet unsigned short to unsigned long conversion.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Xin Li           <xin.b.li@intel.com>
2005-12-20 12:50:09 +01:00
kaf24@firebug.cl.cam.ac.uk 814a93dc4c Remove direct references to frame_table array. Use
pfn_to_page (or page_to_pfn) instead.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-20 12:46:56 +01:00
djm@kirby.fc.hp.com 75cb131680 Fix simulator boot (uses old bootparam format with no initrd) 2005-12-19 15:18:54 -06:00
kaf24@firebug.cl.cam.ac.uk 9417fb2fb0 Avoid div-by-zero crash if vmx guest specifies bogus timer
divisor.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
2005-12-18 20:29:43 +01:00
kaf24@firebug.cl.cam.ac.uk 310773bcd1 Allow a domain to specify DOMID_SELF to DOM0_GETDOMAININFO dom0_op.
This is primarily useful to allow a privileged domain to determine
its domid, where the preferred method of quering xenstore cannot be
used.

Signed-off-by: joseph.cihula@intel.com
2005-12-18 20:27:42 +01:00
kaf24@firebug.cl.cam.ac.uk 2cafb4b4e9 Small fix to the error-return path after calling
__copy_to_user in the swiotlb sync function. We cannot
immediately exit the sync function as there may be tail work
to do (e.g., kunmap_atomic). In fact, doing nothing is the
right thing to do and is sufficient to avoid compiler
warnings about not checking the __copy_to_user return value.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-17 02:11:54 +01:00
kaf24@firebug.cl.cam.ac.uk 97c947f209 Work aroudn swiotlb issue where a read-only host buffer is
mapped for DMA_BIDIRECTIONAL streaming access by certain
low-level drivers. This causes an unnecessary copy to the
host buffer that previously caused a fatal kernel page fault.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-17 00:43:00 +01:00
kaf24@firebug.cl.cam.ac.uk 8e19e0e370 This patch removes the GPL licence from the acm public header files so
that they match the BSD licence in xen/include/public.

Signed-off by: Reiner Sailer <sailer@us.ibm.com>
2005-12-17 00:28:27 +01:00
kaf24@firebug.cl.cam.ac.uk d137e75e4f Hide 64bit-mode feature on i386 hypervisor.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
2005-12-16 18:58:21 +01:00
kaf24@firebug.cl.cam.ac.uk 41a6310c5e Move some useful cryptographic enveloping code into their own
functions so they can be used by other parts of the VTPM code.

Signed-off-by: Vinnie Scarlata <vincent.r.scarlata@intel.com>
2005-12-16 18:54:57 +01:00
stekloff@elm3b216.beaverton.ibm.com 6bcfa6dc80 Changed create_disk_image to default to making "disk.img", which is what
xm-test is looking for by default.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
2005-12-16 11:51:06 +00:00
stekloff@elm3b216.beaverton.ibm.com 5ad4f375ad Added information for running xm-test in HVM / VMX mode.
Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
2005-12-16 11:50:27 +00:00
nivedita@hex b212532248 Xend http access turned off by default.
Signed-off-by: Nivedita Singhvi (niv@us.ibm.com)
2005-12-16 11:46:58 +00:00
kaf24@firebug.cl.cam.ac.uk d42bb1640f Slight fix to BIOS e820 bug workaround. Remove the check
for whether e820 list is below 1MB: all bootloaders place
it below 1MB so teh check is ineffective and, in any case,
SYSLINUX has the same issue as GRUB (does not pre-initialize
the memory area that e820 function writes to).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-16 04:57:27 +01:00
kaf24@firebug.cl.cam.ac.uk 8bdba00165 Work around a nasty BIOS/GRUB bug which causes fields in
the e820 map to not be initialized to zero when they should be.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-12-16 04:11:41 +01:00
chris@ubuntu.eng.hq.xensource.com 3c10a56738 Add and use write_ldt_entry, as seen in later linux kernel versions.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-12-15 16:17:13 -07:00
djm@kirby.fc.hp.com ad06a3d5ed Turn off debug output for NaTpage consumption when ifa==0.
In RHEL4, __strcpy_from_user seems to do this a lot (legally)
and the massive debug output may hide other errors.
2005-12-15 17:17:06 -06:00
djm@kirby.fc.hp.com 7e7ba7c6b5 Turn off ia64_pal_cache_flush for domU (temp, until failure understood) 2005-12-15 16:17:04 -06:00
djm@kirby.fc.hp.com a478840f94 Remove some unused VTI code segments
Signed-off-by Anthony Xu <anthony.xu@intel.com>
2005-12-15 16:10:22 -06:00
djm@kirby.fc.hp.com e896859fb5 Cleanup VTLB code
Signed-off-by Anthony Xu <anthony.xu@intel.com>
2005-12-15 16:09:19 -06:00
djm@kirby.fc.hp.com 02c380ede6 Under some specific conditions, dom0 will lose guest timer interrupt.
Signed-off-by Anthony Xu <anthony.xu@intel.com>
Signed-off-by Kevin Tian <kevin.tian@intel.com>
The reason is that Xen/ia64 will try to pend guest timer interrupt to dom0
within each machine timer interrupt handler. To avoid duplicated delivery, 
domain_itm_last recorded domain_itm of last injection. If two are identical,
it means interrupt injected but guest has not set new itm value. Or else
corresponding pending irr bit will be turned on. That works in most cases.

However currently guest linux may try to set itm multiple times within one
handler before turn on psr.i again. Among first few settings, new guest timer
interrupt may be pended. Then once guest linux enables interrupt, a new
timer interrupt will be injected immediately. However this injection may have
itc still smaller than the domain_itm set at the last round of last handle.
In this case, guest linux will set same domain_itm as last again. However
since domain_itm_last already equals to domain_itm at last read ivr, later
no guest timer interrupt can be injected any more since Xen always thinks
an instance already injected without guest's response.

Attahced patch fixed this issue by adding sanity check upon guest timer
vector when deciding to inject interrupt into dom0. We always compare current
itc with latest domain_itm that guest really wants. So if itc < domain_itm
at this point, we simply clear the pending bit and no injection.

There's also a small fix to vcpu_read_ivr, where domain_itm_last should
be updated before clearing irr bit. Or els a small window still remains
to add a duplicate interrupt.
2005-12-15 16:07:47 -06:00
djm@kirby.fc.hp.com 2137b122b6 Small patch to avoid a stack overflow (VTI only).
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
2005-12-15 14:51:10 -06:00