[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Replace hvm_setup_platform() with hvm_domain_initialise()



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 2368e779f89fdac0330d12a2109fd29b93ad32c6
# Parent  e3abede54214b35d06e988b321432bd1f4597c79
[XEN] Replace hvm_setup_platform() with hvm_domain_initialise()
and extra code in hvm_vcpu_initialise(). Remove 'apic' config
option -- HVM CPUs will always have an APIC (which should be
set up in virtual wire mode for backward compatibility, just as
in a real system).
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/examples/xmexample.hvm         |    3 -
 tools/firmware/hvmloader/hvmloader.c |    7 ---
 tools/libxc/ia64/xc_ia64_hvm_build.c |    2 
 tools/libxc/xc_hvm_build.c           |   11 +---
 tools/libxc/xenguest.h               |    2 
 tools/libxc/xg_private.c             |    1 
 tools/python/README.XendConfig       |    1 
 tools/python/README.sxpcfg           |    1 
 tools/python/xen/lowlevel/xc/xc.c    |    9 +---
 tools/python/xen/xend/image.py       |    5 --
 tools/python/xen/xm/create.py        |    6 --
 tools/xm-test/lib/XmTestLib/arch.py  |    1 
 xen/arch/x86/domain.c                |   19 --------
 xen/arch/x86/hvm/hvm.c               |   78 ++++++++++++++++++++++-------------
 xen/arch/x86/hvm/i8254.c             |    4 -
 xen/arch/x86/hvm/i8259.c             |   12 ++---
 xen/arch/x86/hvm/intercept.c         |   25 +++++------
 xen/arch/x86/hvm/pmtimer.c           |    2 
 xen/arch/x86/hvm/rtc.c               |    2 
 xen/arch/x86/hvm/svm/svm.c           |    3 -
 xen/arch/x86/hvm/svm/vmcb.c          |    6 --
 xen/arch/x86/hvm/vioapic.c           |   12 -----
 xen/arch/x86/hvm/vlapic.c            |    8 ---
 xen/arch/x86/hvm/vmx/vmcs.c          |    7 +--
 xen/arch/x86/hvm/vmx/vmx.c           |   10 ----
 xen/arch/x86/mm.c                    |    2 
 xen/include/asm-ia64/vmx_platform.h  |    2 
 xen/include/asm-x86/hvm/hvm.h        |   12 -----
 xen/include/asm-x86/hvm/io.h         |   13 +++--
 xen/include/asm-x86/hvm/support.h    |    1 
 xen/include/asm-x86/hvm/vlapic.h     |    2 
 xen/include/asm-x86/hvm/vpic.h       |    2 
 xen/include/public/hvm/params.h      |    1 
 33 files changed, 105 insertions(+), 167 deletions(-)

diff -r e3abede54214 -r 2368e779f89f tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/examples/xmexample.hvm      Sun Nov 05 20:17:40 2006 +0000
@@ -47,9 +47,6 @@ name = "ExampleHVMDomain"
 
 # enable/disable HVM guest ACPI, default=0 (disabled)
 #acpi=0
-
-# enable/disable HVM guest APIC, default=0 (disabled)
-#apic=0
 
 # List of which CPUS this domain is allowed to use, default Xen picks
 #cpus = ""         # leave to Xen to pick
diff -r e3abede54214 -r 2368e779f89f tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Sun Nov 05 20:17:40 2006 +0000
@@ -165,8 +165,6 @@ int
 int
 main(void)
 {
-       struct xen_hvm_param hvm_param;
-
        puts("HVM Loader\n");
 
        init_hypercalls();
@@ -177,10 +175,7 @@ main(void)
        puts("Loading ROMBIOS ...\n");
        memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
 
-       hvm_param.domid = DOMID_SELF;
-       hvm_param.index = HVM_PARAM_APIC_ENABLED;
-       if (!hypercall_hvm_op(HVMOP_get_param, &hvm_param) && hvm_param.value)
-               create_mp_tables();
+        create_mp_tables();
        
        if (cirrus_check()) {
                puts("Loading Cirrus VGABIOS ...\n");
diff -r e3abede54214 -r 2368e779f89f tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c      Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c      Sun Nov 05 20:17:40 2006 +0000
@@ -618,7 +618,7 @@ int
 int
 xc_hvm_build(int xc_handle, uint32_t domid, int memsize,
              const char *image_name, unsigned int vcpus, unsigned int pae,
-             unsigned int acpi, unsigned int apic, unsigned int store_evtchn,
+             unsigned int acpi, unsigned int store_evtchn,
              unsigned long *store_mfn)
 {
     struct xen_domctl launch_domctl, domctl;
diff -r e3abede54214 -r 2368e779f89f tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/libxc/xc_hvm_build.c        Sun Nov 05 20:17:40 2006 +0000
@@ -157,7 +157,6 @@ static int setup_guest(int xc_handle,
                        unsigned int vcpus,
                        unsigned int pae,
                        unsigned int acpi,
-                       unsigned int apic,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn)
 {
@@ -248,7 +247,6 @@ static int setup_guest(int xc_handle,
     }
 
     xc_set_hvm_param(xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae);
-    xc_set_hvm_param(xc_handle, dom, HVM_PARAM_APIC_ENABLED, apic);
 
     if ( (e820_page = xc_map_foreign_range(
               xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
@@ -307,7 +305,6 @@ static int xc_hvm_build_internal(int xc_
                                  unsigned int vcpus,
                                  unsigned int pae,
                                  unsigned int acpi,
-                                 unsigned int apic,
                                  unsigned int store_evtchn,
                                  unsigned long *store_mfn)
 {
@@ -340,7 +337,7 @@ static int xc_hvm_build_internal(int xc_
 
     if ( setup_guest(xc_handle, domid, memsize, image, image_size,
                      ctxt, domctl.u.getdomaininfo.shared_info_frame,
-                     vcpus, pae, acpi, apic, store_evtchn, store_mfn) < 0)
+                     vcpus, pae, acpi, store_evtchn, store_mfn) < 0)
     {
         ERROR("Error constructing guest OS");
         goto error_out;
@@ -531,7 +528,6 @@ int xc_hvm_build(int xc_handle,
                  unsigned int vcpus,
                  unsigned int pae,
                  unsigned int acpi,
-                 unsigned int apic,
                  unsigned int store_evtchn,
                  unsigned long *store_mfn)
 {
@@ -545,7 +541,7 @@ int xc_hvm_build(int xc_handle,
 
     sts = xc_hvm_build_internal(xc_handle, domid, memsize,
                                 image, image_size,
-                                vcpus, pae, acpi, apic,
+                                vcpus, pae, acpi,
                                 store_evtchn, store_mfn);
 
     free(image);
@@ -567,7 +563,6 @@ int xc_hvm_build_mem(int xc_handle,
                      unsigned int vcpus,
                      unsigned int pae,
                      unsigned int acpi,
-                     unsigned int apic,
                      unsigned int store_evtchn,
                      unsigned long *store_mfn)
 {
@@ -592,7 +587,7 @@ int xc_hvm_build_mem(int xc_handle,
 
     sts = xc_hvm_build_internal(xc_handle, domid, memsize,
                                 img, img_len,
-                                vcpus, pae, acpi, apic,
+                                vcpus, pae, acpi,
                                 store_evtchn, store_mfn);
 
     /* xc_inflate_buffer may return the original buffer pointer (for
diff -r e3abede54214 -r 2368e779f89f tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/libxc/xenguest.h    Sun Nov 05 20:17:40 2006 +0000
@@ -113,7 +113,6 @@ int xc_hvm_build(int xc_handle,
                  unsigned int vcpus,
                  unsigned int pae,
                  unsigned int acpi,
-                 unsigned int apic,
                  unsigned int store_evtchn,
                  unsigned long *store_mfn);
 
@@ -125,7 +124,6 @@ int xc_hvm_build_mem(int xc_handle,
                      unsigned int vcpus,
                      unsigned int pae,
                      unsigned int acpi,
-                     unsigned int apic,
                      unsigned int store_evtchn,
                      unsigned long *store_mfn);
 
diff -r e3abede54214 -r 2368e779f89f tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c  Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/libxc/xg_private.c  Sun Nov 05 20:17:40 2006 +0000
@@ -196,7 +196,6 @@ __attribute__((weak)) int xc_hvm_build(
     unsigned int vcpus,
     unsigned int pae,
     unsigned int acpi,
-    unsigned int apic,
     unsigned int store_evtchn,
     unsigned long *store_mfn)
 {
diff -r e3abede54214 -r 2368e779f89f tools/python/README.XendConfig
--- a/tools/python/README.XendConfig    Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/python/README.XendConfig    Sun Nov 05 20:17:40 2006 +0000
@@ -123,7 +123,6 @@ otherConfig
                                 image.hvm.vncconsole
                                 image.hvm.pae
                                 image.hvm.acpi (also in image.devices)
-                                image.hvm.apic
                                 image.hvm.devices.boot
                                 image.hvm.devices.fda
                                 image.hvm.devices.fdb
diff -r e3abede54214 -r 2368e779f89f tools/python/README.sxpcfg
--- a/tools/python/README.sxpcfg        Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/python/README.sxpcfg        Sun Nov 05 20:17:40 2006 +0000
@@ -56,7 +56,6 @@ image
   - vncconsole
   - pae
   - acpi
-  - apic
   (parseDeviceModel)
   - boot
   - fda
diff -r e3abede54214 -r 2368e779f89f tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Sun Nov 05 20:17:40 2006 +0000
@@ -377,19 +377,18 @@ static PyObject *pyxc_hvm_build(XcObject
     int vcpus = 1;
     int pae  = 0;
     int acpi = 0;
-    int apic = 0;
     unsigned long store_mfn = 0;
 
     static char *kwd_list[] = { "domid", "store_evtchn",
-                               "memsize", "image", "vcpus", "pae", "acpi", 
"apic",
+                               "memsize", "image", "vcpus", "pae", "acpi",
                                NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiii", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiii", kwd_list,
                                       &dom, &store_evtchn, &memsize,
-                                      &image, &vcpus, &pae, &acpi, &apic) )
+                                      &image, &vcpus, &pae, &acpi) )
         return NULL;
 
     if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
-                      vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
+                      vcpus, pae, acpi, store_evtchn, &store_mfn) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
     return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
diff -r e3abede54214 -r 2368e779f89f tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/python/xen/xend/image.py    Sun Nov 05 20:17:40 2006 +0000
@@ -275,7 +275,6 @@ class HVMImageHandler(ImageHandler):
         self.pae  = int(sxp.child_value(imageConfig, 'pae', 0))
 
         self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0))
-        self.apic = int(sxp.child_value(imageConfig, 'apic', 0))
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
@@ -289,7 +288,6 @@ class HVMImageHandler(ImageHandler):
         log.debug("vcpus          = %d", self.vm.getVCpuCount())
         log.debug("pae            = %d", self.pae)
         log.debug("acpi           = %d", self.acpi)
-        log.debug("apic           = %d", self.apic)
 
         self.register_shutdown_watch()
 
@@ -299,8 +297,7 @@ class HVMImageHandler(ImageHandler):
                             memsize        = mem_mb,
                             vcpus          = self.vm.getVCpuCount(),
                             pae            = self.pae,
-                            acpi           = self.acpi,
-                            apic           = self.apic)
+                            acpi           = self.acpi)
 
     # Return a list of cmd line args to the device models based on the
     # xm config file
diff -r e3abede54214 -r 2368e779f89f tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/python/xen/xm/create.py     Sun Nov 05 20:17:40 2006 +0000
@@ -180,10 +180,6 @@ gopts.var('acpi', val='ACPI',
 gopts.var('acpi', val='ACPI',
           fn=set_int, default=0,
           use="Disable or enable ACPI of HVM domain.")
-
-gopts.var('apic', val='APIC',
-          fn=set_int, default=0,
-          use="Disable or enable APIC of HVM domain.")
 
 gopts.var('vcpus', val='VCPUS',
           fn=set_int, default=1,
@@ -664,7 +660,7 @@ def configure_hvm(config_image, vals):
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
              'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
              'sdl', 'display', 'xauthority',
-             'acpi', 'apic', 'usb', 'usbdevice' ]
+             'acpi', 'usb', 'usbdevice' ]
     for a in args:
         if (vals.__dict__[a]):
             config_image.append([a, vals.__dict__[a]])
diff -r e3abede54214 -r 2368e779f89f tools/xm-test/lib/XmTestLib/arch.py
--- a/tools/xm-test/lib/XmTestLib/arch.py       Sat Nov 04 20:13:22 2006 +0000
+++ b/tools/xm-test/lib/XmTestLib/arch.py       Sun Nov 05 20:17:40 2006 +0000
@@ -71,7 +71,6 @@ ia_HVMDefaults =      {"memory"       : 
 ia_HVMDefaults =      {"memory"       : 64,
                        "vcpus"        : 1,
                        "acpi"         : 0,
-                       "apic"         : 0,
                        "disk"         : ["file:%s/disk.img,ioemu:%s,w!" %
                                          (getRdPath(), BLOCK_ROOT_DEV)],
                        "kernel"       : "/usr/lib/xen/boot/hvmloader",
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/domain.c     Sun Nov 05 20:17:40 2006 +0000
@@ -233,24 +233,7 @@ int arch_domain_create(struct domain *d)
             virt_to_page(d->shared_info), d, XENSHARE_writable);
     }
 
-    if ( is_hvm_domain(d) )
-    {
-        if ( !hvm_enabled )
-        {
-            gdprintk(XENLOG_WARNING, "Attempt to create a HVM guest "
-                     "on a non-VT/AMDV platform.\n");
-            rc = -EINVAL;
-            goto fail;
-        }
-
-        spin_lock_init(&d->arch.hvm_domain.pbuf_lock);
-
-        rc = shadow_enable(d, SHM2_refcounts|SHM2_translate|SHM2_external);
-        if ( rc != 0 )
-            goto fail;
-    }
-
-    return 0;
+    return hvm_domain_initialise(d);
 
  fail:
     free_xenheap_page(d->shared_info);
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/hvm.c    Sun Nov 05 20:17:40 2006 +0000
@@ -57,14 +57,6 @@ integer_param("hvm_debug", opt_hvm_debug
 
 struct hvm_function_table hvm_funcs;
 
-void hvm_create_event_channel(struct vcpu *v)
-{
-    v->arch.hvm_vcpu.xen_port = alloc_unbound_xen_event_channel(v, 0);
-    if ( get_sp(v->domain) && get_vio(v->domain, v->vcpu_id) )
-        get_vio(v->domain, v->vcpu_id)->vp_eport =
-            v->arch.hvm_vcpu.xen_port;
-}
-
 void hvm_stts(struct vcpu *v)
 {
     /* FPU state already dirty? Then no need to setup_fpu() lazily. */
@@ -123,26 +115,56 @@ void hvm_release_assist_channel(struct v
     free_xen_event_channel(v, v->arch.hvm_vcpu.xen_port);
 }
 
-
-void hvm_setup_platform(struct domain *d)
+int hvm_domain_initialise(struct domain *d)
+{
+    struct hvm_domain *platform = &d->arch.hvm_domain;
+    int rc;
+
+    if ( !is_hvm_domain(d) )
+        return 0;
+
+    if ( !hvm_enabled )
+    {
+        gdprintk(XENLOG_WARNING, "Attempt to create a HVM guest "
+                 "on a non-VT/AMDV platform.\n");
+        return -EINVAL;
+    }
+
+    spin_lock_init(&d->arch.hvm_domain.pbuf_lock);
+    spin_lock_init(&d->arch.hvm_domain.round_robin_lock);
+    spin_lock_init(&d->arch.hvm_domain.buffered_io_lock);
+
+    rc = shadow_enable(d, SHM2_refcounts|SHM2_translate|SHM2_external);
+    if ( rc != 0 )
+        return rc;
+
+    pic_init(&platform->vpic, pic_irq_request, &platform->interrupt_request);
+    register_pic_io_hook(d);
+
+    hvm_vioapic_init(d);
+
+    return 0;
+}
+
+int hvm_vcpu_initialise(struct vcpu *v)
 {
     struct hvm_domain *platform;
-    struct vcpu *v = current;
-
-    if ( !is_hvm_domain(d) || (v->vcpu_id != 0) )
-        return;
-
-    platform = &d->arch.hvm_domain;
-    pic_init(&platform->vpic, pic_irq_request, &platform->interrupt_request);
-    register_pic_io_hook();
-
-    if ( hvm_apic_support(d) )
-    {
-        spin_lock_init(&d->arch.hvm_domain.round_robin_lock);
-        hvm_vioapic_init(d);
-    }
-
-    spin_lock_init(&d->arch.hvm_domain.buffered_io_lock);
+    int rc;
+
+    if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 )
+        return rc;
+
+    /* Create ioreq event channel. */
+    v->arch.hvm_vcpu.xen_port = alloc_unbound_xen_event_channel(v, 0);
+    if ( get_sp(v->domain) && get_vio(v->domain, v->vcpu_id) )
+        get_vio(v->domain, v->vcpu_id)->vp_eport =
+            v->arch.hvm_vcpu.xen_port;
+
+    if ( v->vcpu_id != 0 )
+        return 0;
+
+    /* XXX Below should happen in hvm_domain_initialise(). */
+    platform = &v->domain->arch.hvm_domain;
 
     init_timer(&platform->pl_time.periodic_tm.timer,
                pt_timer_fn, v, v->processor);
@@ -150,8 +172,10 @@ void hvm_setup_platform(struct domain *d
     rtc_init(v, RTC_PORT(0), RTC_IRQ);
     pmtimer_init(v, ACPI_PM_TMR_BLK_ADDRESS); 
 
-    /* init guest tsc to start from 0 */
+    /* Init guest TSC to start from zero. */
     hvm_set_guest_time(v, 0);
+
+    return 0;
 }
 
 void pic_irq_request(void *data, int level)
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/i8254.c
--- a/xen/arch/x86/hvm/i8254.c  Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/i8254.c  Sun Nov 05 20:17:40 2006 +0000
@@ -374,9 +374,9 @@ void pit_init(struct vcpu *v, unsigned l
     s++; s->vcpu = v;
     s++; s->vcpu = v;
 
-    register_portio_handler(PIT_BASE, 4, handle_pit_io);
+    register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io);
     /* register the speaker port */
-    register_portio_handler(0x61, 1, handle_speaker_io);
+    register_portio_handler(v->domain, 0x61, 1, handle_speaker_io);
     ticks_per_sec(v) = cpu_khz * (int64_t)1000;
 #ifdef DEBUG_PIT
     printk("HVM_PIT: guest frequency =%lld\n", (long long)ticks_per_sec(v));
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/i8259.c
--- a/xen/arch/x86/hvm/i8259.c  Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/i8259.c  Sun Nov 05 20:17:40 2006 +0000
@@ -548,12 +548,12 @@ static int intercept_elcr_io(ioreq_t *p)
     return 1;
 }
 
-void register_pic_io_hook (void)
-{
-    register_portio_handler(0x20, 2, intercept_pic_io);
-    register_portio_handler(0x4d0, 1, intercept_elcr_io);
-    register_portio_handler(0xa0, 2, intercept_pic_io);
-    register_portio_handler(0x4d1, 1, intercept_elcr_io);
+void register_pic_io_hook(struct domain *d)
+{
+    register_portio_handler(d, 0x20, 2, intercept_pic_io);
+    register_portio_handler(d, 0x4d0, 1, intercept_elcr_io);
+    register_portio_handler(d, 0xa0, 2, intercept_pic_io);
+    register_portio_handler(d, 0x4d1, 1, intercept_elcr_io);
 }
 
 
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/intercept.c
--- a/xen/arch/x86/hvm/intercept.c      Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/intercept.c      Sun Nov 05 20:17:40 2006 +0000
@@ -208,18 +208,17 @@ int hvm_mmio_intercept(ioreq_t *p)
     struct vcpu *v = current;
     int i;
 
-    /* XXX currently only APIC use intercept */
-    if ( !hvm_apic_support(v->domain) )
-        return 0;
-
-    for ( i = 0; i < HVM_MMIO_HANDLER_NR; i++ ) {
-        if ( hvm_mmio_handlers[i]->check_handler(v, p->addr) ) {
+    for ( i = 0; i < HVM_MMIO_HANDLER_NR; i++ )
+    {
+        if ( hvm_mmio_handlers[i]->check_handler(v, p->addr) )
+        {
             hvm_mmio_access(v, p,
                             hvm_mmio_handlers[i]->read_handler,
                             hvm_mmio_handlers[i]->write_handler);
             return 1;
         }
     }
+
     return 0;
 }
 
@@ -247,15 +246,15 @@ int hvm_io_intercept(ioreq_t *p, int typ
     return 0;
 }
 
-int register_io_handler(unsigned long addr, unsigned long size,
-                        intercept_action_t action, int type)
-{
-    struct vcpu *v = current;
-    struct hvm_io_handler *handler =
-                             &(v->domain->arch.hvm_domain.io_handler);
+int register_io_handler(
+    struct domain *d, unsigned long addr, unsigned long size,
+    intercept_action_t action, int type)
+{
+    struct hvm_io_handler *handler = &d->arch.hvm_domain.io_handler;
     int num = handler->num_slot;
 
-    if (num >= MAX_IO_HANDLER) {
+    if ( num >= MAX_IO_HANDLER )
+    {
         printk("no extra space, register io interceptor failed!\n");
         domain_crash_synchronous();
     }
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/pmtimer.c
--- a/xen/arch/x86/hvm/pmtimer.c        Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/pmtimer.c        Sun Nov 05 20:17:40 2006 +0000
@@ -52,7 +52,7 @@ void pmtimer_init(struct vcpu *v, int ba
     /* ACPI supports a 32-bit power management timer */
     set_timer(&s->timer, NOW() + (1000000000ULL << 31) / FREQUENCE_PMTIMER);
     
-    register_portio_handler(base, 4, handle_pmt_io);
+    register_portio_handler(v->domain, base, 4, handle_pmt_io);
 }
 
 void pmtimer_deinit(struct domain *d)
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/rtc.c
--- a/xen/arch/x86/hvm/rtc.c    Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/rtc.c    Sun Nov 05 20:17:40 2006 +0000
@@ -381,7 +381,7 @@ void rtc_init(struct vcpu *v, int base, 
     s->next_second_time = NOW() + 1000000000ULL;
     set_timer(&s->second_timer2, s->next_second_time);
 
-    register_portio_handler(base, 2, handle_rtc_io);
+    register_portio_handler(v->domain, base, 2, handle_rtc_io);
 }
 
 void rtc_deinit(struct domain *d)
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Sun Nov 05 20:17:40 2006 +0000
@@ -1046,8 +1046,7 @@ static void svm_vmexit_do_cpuid(struct v
         cpuid(input, &eax, &ebx, &ecx, &edx);       
         if (input == 0x00000001 || input == 0x80000001 )
         {
-            if ( !hvm_apic_support(v->domain) ||
-                 !vlapic_global_enabled((VLAPIC(v))) )
+            if ( !vlapic_global_enabled((VLAPIC(v))) )
             {
                 /* Since the apic is disabled, avoid any confusion 
                    about SMP cpus being available */
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Sun Nov 05 20:17:40 2006 +0000
@@ -355,11 +355,7 @@ void svm_do_launch(struct vcpu *v)
     if ( !asidpool_assign_next( vmcb, 0, core, core ))
         BUG();
 
-    if (v->vcpu_id == 0)
-        hvm_setup_platform(v->domain);
-
-    if (hvm_apic_support(v->domain))
-        vlapic_init(v);
+    vlapic_init(v);
     init_timer(&v->arch.hvm_vcpu.hlt_timer, hlt_timer_fn, v, v->processor);
 
     vmcb->ldtr.sel = 0;
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/vioapic.c
--- a/xen/arch/x86/hvm/vioapic.c        Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/vioapic.c        Sun Nov 05 20:17:40 2006 +0000
@@ -530,9 +530,6 @@ void hvm_vioapic_do_irqs(struct domain *
 {
     hvm_vioapic_t *s = &(d->arch.hvm_domain.vioapic);
 
-    if (!hvm_apic_support(d))
-        return;
-
     s->irr |= irqs & ~s->imr;
     service_ioapic(s);
 }
@@ -541,9 +538,6 @@ void hvm_vioapic_do_irqs_clear(struct do
 {
     hvm_vioapic_t *s = &(d->arch.hvm_domain.vioapic);
 
-    if (!hvm_apic_support(d))
-        return;
-
     s->irr &= ~irqs;
     service_ioapic(s);
 }
@@ -552,8 +546,7 @@ void hvm_vioapic_set_xen_irq(struct doma
 {
     hvm_vioapic_t *s = &d->arch.hvm_domain.vioapic;
 
-    if (!hvm_apic_support(d) || !IOAPICEnabled(s) ||
-       s->redirtbl[irq].RedirForm.mask)
+    if (!IOAPICEnabled(s) || s->redirtbl[irq].RedirForm.mask)
         return;
 
     if (s->redirtbl[irq].RedirForm.trigmod != IOAPIC_LEVEL_TRIGGER)
@@ -568,9 +561,6 @@ void hvm_vioapic_set_irq(struct domain *
 void hvm_vioapic_set_irq(struct domain *d, int irq, int level)
 {
     hvm_vioapic_t *s = &(d->arch.hvm_domain.vioapic);
-
-    if (!hvm_apic_support(d))
-        return ;
 
     HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_set_irq "
       "irq %x level %x\n", irq, level);
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Sun Nov 05 20:17:40 2006 +0000
@@ -155,17 +155,11 @@ int vlapic_set_irq(struct vlapic *vlapic
     return ret;
 }
 
-int hvm_apic_support(struct domain *d)
-{
-    return d->arch.hvm_domain.params[HVM_PARAM_APIC_ENABLED];
-}
-
 s_time_t get_apictime_scheduled(struct vcpu *v)
 {
     struct vlapic *vlapic = VLAPIC(v);
 
-    if ( !hvm_apic_support(v->domain) ||
-         !vlapic_lvt_enabled(vlapic, APIC_LVTT) )
+    if ( !vlapic_lvt_enabled(vlapic, APIC_LVTT) )
         return -1;
 
     return vlapic->vlapic_timer.expires;
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Sun Nov 05 20:17:40 2006 +0000
@@ -307,9 +307,8 @@ static void vmx_do_launch(struct vcpu *v
     unsigned int  error = 0;
     unsigned long cr0, cr4;
 
-    if ( v->vcpu_id == 0 )
-        hvm_setup_platform(v->domain);
-    else {
+    if ( v->vcpu_id != 0 )
+    {
         /* Sync AP's TSC with BSP's */
         v->arch.hvm_vcpu.cache_tsc_offset = 
             v->domain->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset;
@@ -333,7 +332,7 @@ static void vmx_do_launch(struct vcpu *v
 
     hvm_stts(v);
 
-    if( hvm_apic_support(v->domain) && (vlapic_init(v) == 0) )
+    if ( vlapic_init(v) == 0 )
     {
 #ifdef __x86_64__ 
         u32 *cpu_exec_control = &v->arch.hvm_vcpu.u.vmx.exec_control;
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Sun Nov 05 20:17:40 2006 +0000
@@ -905,17 +905,11 @@ static void vmx_do_cpuid(struct cpu_user
 
         if ( input == CPUID_LEAF_0x1 )
         {
-            /* mask off reserved bits */
+            /* Mask off reserved bits. */
             ecx &= ~VMX_VCPU_CPUID_L1_ECX_RESERVED;
 
-            if ( !hvm_apic_support(v->domain) ||
-                 !vlapic_global_enabled((VLAPIC(v))) )
-            {
-                /* Since the apic is disabled, avoid any 
-                confusion about SMP cpus being available */
-
+            if ( !vlapic_global_enabled((VLAPIC(v))) )
                 clear_bit(X86_FEATURE_APIC, &edx);
-            }
     
 #if CONFIG_PAGING_LEVELS >= 3
             if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] )
diff -r e3abede54214 -r 2368e779f89f xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/arch/x86/mm.c Sun Nov 05 20:17:40 2006 +0000
@@ -572,7 +572,7 @@ get_page_from_l1e(
 
         if ( !iomem_access_permitted(d, mfn, mfn) )
         {
-            if ( mfn != INVALID_MFN )
+            if ( mfn != (PADDR_MASK >> PAGE_SHIFT) ) /* INVALID_MFN? */
                 MEM_LOG("Non-privileged (%u) attempt to map I/O space %08lx", 
                         d->domain_id, mfn);
             return 0;
diff -r e3abede54214 -r 2368e779f89f xen/include/asm-ia64/vmx_platform.h
--- a/xen/include/asm-ia64/vmx_platform.h       Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/asm-ia64/vmx_platform.h       Sun Nov 05 20:17:40 2006 +0000
@@ -73,9 +73,7 @@ enum ioapic_irq_destination_types {
        dest_ExtINT = 7
 };
 
-/* As long as we register vlsapic to ioapic controller, it's said enabled */
 #define vlapic_enabled(l) 1
-#define hvm_apic_support(d) 1
 
 #define VLAPIC_DELIV_MODE_FIXED                0x0
 #define VLAPIC_DELIV_MODE_REDIR                0x1
diff -r e3abede54214 -r 2368e779f89f xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/asm-x86/hvm/hvm.h     Sun Nov 05 20:17:40 2006 +0000
@@ -91,16 +91,8 @@ hvm_disable(void)
         hvm_funcs.disable();
 }
 
-void hvm_create_event_channel(struct vcpu *v);
-
-static inline int
-hvm_vcpu_initialise(struct vcpu *v)
-{
-    int rc;
-    if ( (rc = hvm_funcs.vcpu_initialise(v)) == 0 )
-        hvm_create_event_channel(v);
-    return rc;
-}
+int hvm_domain_initialise(struct domain *d);
+int hvm_vcpu_initialise(struct vcpu *v);
 
 static inline void
 hvm_relinquish_guest_resources(struct domain *d)
diff -r e3abede54214 -r 2368e779f89f xen/include/asm-x86/hvm/io.h
--- a/xen/include/asm-x86/hvm/io.h      Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/asm-x86/hvm/io.h      Sun Nov 05 20:17:40 2006 +0000
@@ -116,8 +116,9 @@ struct hvm_mmio_handler {
 
 /* global io interception point in HV */
 extern int hvm_io_intercept(ioreq_t *p, int type);
-extern int register_io_handler(unsigned long addr, unsigned long size,
-                               intercept_action_t action, int type);
+extern int register_io_handler(
+    struct domain *d, unsigned long addr, unsigned long size,
+    intercept_action_t action, int type);
 
 static inline int hvm_portio_intercept(ioreq_t *p)
 {
@@ -127,11 +128,11 @@ extern int hvm_mmio_intercept(ioreq_t *p
 extern int hvm_mmio_intercept(ioreq_t *p);
 extern int hvm_buffered_io_intercept(ioreq_t *p);
 
-static inline int register_portio_handler(unsigned long addr,
-                                          unsigned long size,
-                                          intercept_action_t action)
+static inline int register_portio_handler(
+    struct domain *d, unsigned long addr,
+    unsigned long size, intercept_action_t action)
 {
-    return register_io_handler(addr, size, action, HVM_PORTIO);
+    return register_io_handler(d, addr, size, action, HVM_PORTIO);
 }
 
 #if defined(__i386__) || defined(__x86_64__)
diff -r e3abede54214 -r 2368e779f89f xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/asm-x86/hvm/support.h Sun Nov 05 20:17:40 2006 +0000
@@ -139,7 +139,6 @@ int hvm_copy_to_guest_virt(unsigned long
 int hvm_copy_to_guest_virt(unsigned long vaddr, void *buf, int size);
 int hvm_copy_from_guest_virt(void *buf, unsigned long vaddr, int size);
 
-void hvm_setup_platform(struct domain* d);
 void hvm_print_line(struct vcpu *v, const char c);
 void hlt_timer_fn(void *data);
 
diff -r e3abede54214 -r 2368e779f89f xen/include/asm-x86/hvm/vlapic.h
--- a/xen/include/asm-x86/hvm/vlapic.h  Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/asm-x86/hvm/vlapic.h  Sun Nov 05 20:17:40 2006 +0000
@@ -90,6 +90,4 @@ struct vlapic *apic_round_robin(struct d
 
 s_time_t get_apictime_scheduled(struct vcpu *v);
 
-int hvm_apic_support(struct domain *d);
-
 #endif /* __ASM_X86_HVM_VLAPIC_H__ */
diff -r e3abede54214 -r 2368e779f89f xen/include/asm-x86/hvm/vpic.h
--- a/xen/include/asm-x86/hvm/vpic.h    Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/asm-x86/hvm/vpic.h    Sun Nov 05 20:17:40 2006 +0000
@@ -71,7 +71,7 @@ void pic_init(struct hvm_virpic *s,
               void (*irq_request)(void *, int),
               void *irq_request_opaque);
 void pic_update_irq(struct hvm_virpic *s); /* Caller must hold s->lock */
-void register_pic_io_hook (void);
+void register_pic_io_hook(struct domain *d);
 int cpu_get_pic_interrupt(struct vcpu *v, int *type);
 int is_periodic_irq(struct vcpu *v, int irq, int type);
 int is_irq_enabled(struct vcpu *v, int irq);
diff -r e3abede54214 -r 2368e779f89f xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h   Sat Nov 04 20:13:22 2006 +0000
+++ b/xen/include/public/hvm/params.h   Sun Nov 05 20:17:40 2006 +0000
@@ -5,7 +5,6 @@
 #define HVM_PARAM_CALLBACK_IRQ 0
 #define HVM_PARAM_STORE_PFN    1
 #define HVM_PARAM_STORE_EVTCHN 2
-#define HVM_PARAM_APIC_ENABLED 3
 #define HVM_PARAM_PAE_ENABLED  4
 #define HVM_PARAM_IOREQ_PFN    5
 #define HVM_PARAM_BUFIOREQ_PFN 6

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.