diff options
author | kaf24@localhost.localdomain <kaf24@localhost.localdomain> | 2006-11-05 20:17:40 +0000 |
---|---|---|
committer | kaf24@localhost.localdomain <kaf24@localhost.localdomain> | 2006-11-05 20:17:40 +0000 |
commit | 6bc01e4efd50e1986a9391f75980d45691f42b74 (patch) | |
tree | f7199b965f56400c4eb493d5944bf8a147ce4d9f | |
parent | 5aa732c2041ec9d06b7de4a167ad6925cc1a2a97 (diff) | |
download | xen-6bc01e4efd50e1986a9391f75980d45691f42b74.tar.gz xen-6bc01e4efd50e1986a9391f75980d45691f42b74.tar.bz2 xen-6bc01e4efd50e1986a9391f75980d45691f42b74.zip |
[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@xensource.com>
33 files changed, 98 insertions, 160 deletions
diff --git a/tools/examples/xmexample.hvm b/tools/examples/xmexample.hvm index 20b58af44b..5f10a76fb6 100644 --- a/tools/examples/xmexample.hvm +++ b/tools/examples/xmexample.hvm @@ -48,9 +48,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 #cpus = "0" # all vcpus run on CPU0 diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index a4adff8a89..49a870bb0d 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -165,8 +165,6 @@ init_hypercalls(void) 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 --git a/tools/libxc/ia64/xc_ia64_hvm_build.c b/tools/libxc/ia64/xc_ia64_hvm_build.c index 0caaf343b3..ad5c6fdabd 100644 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c @@ -618,7 +618,7 @@ error_out: 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 --git a/tools/libxc/xc_hvm_build.c b/tools/libxc/xc_hvm_build.c index 300d7ae428..8995c60925 100644 --- a/tools/libxc/xc_hvm_build.c +++ b/tools/libxc/xc_hvm_build.c @@ -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_handle, 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_handle, 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 --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h index 75e0c47be5..d6343fbf5c 100644 --- a/tools/libxc/xenguest.h +++ b/tools/libxc/xenguest.h @@ -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 --git a/tools/libxc/xg_private.c b/tools/libxc/xg_private.c index 3c50552290..49fcb624e8 100644 --- a/tools/libxc/xg_private.c +++ b/tools/libxc/xg_private.c @@ -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 --git a/tools/python/README.XendConfig b/tools/python/README.XendConfig index 2e677f887a..d860aac9c7 100644 --- a/tools/python/README.XendConfig +++ b/tools/python/README.XendConfig @@ -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 --git a/tools/python/README.sxpcfg b/tools/python/README.sxpcfg index 9beffd6ba0..9f7b787789 100644 --- a/tools/python/README.sxpcfg +++ b/tools/python/README.sxpcfg @@ -56,7 +56,6 @@ image - vncconsole - pae - acpi - - apic (parseDeviceModel) - boot - fda diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index d267164d8b..51831838f7 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -377,19 +377,18 @@ static PyObject *pyxc_hvm_build(XcObject *self, 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 --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index c70c94fc00..f140c158c7 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -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 --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index eadd79891a..1bb5171eef 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -181,10 +181,6 @@ 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, use="# of Virtual CPUS in domain.") @@ -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 --git a/tools/xm-test/lib/XmTestLib/arch.py b/tools/xm-test/lib/XmTestLib/arch.py index 5625a53546..331ede5414 100644 --- a/tools/xm-test/lib/XmTestLib/arch.py +++ b/tools/xm-test/lib/XmTestLib/arch.py @@ -71,7 +71,6 @@ ia_ParavirtDefaults = {"memory" : 64, 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 --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 6a2bc549b7..da2e29f772 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -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 --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index f423f41c6c..e785d31882 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -57,14 +57,6 @@ integer_param("hvm_debug", opt_hvm_debug_level); 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,35 +115,67 @@ void hvm_release_assist_channel(struct vcpu *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; - struct vcpu *v = current; - - if ( !is_hvm_domain(d) || (v->vcpu_id != 0) ) - return; + struct hvm_domain *platform = &d->arch.hvm_domain; + int rc; - platform = &d->arch.hvm_domain; - pic_init(&platform->vpic, pic_irq_request, &platform->interrupt_request); - register_pic_io_hook(); + if ( !is_hvm_domain(d) ) + return 0; - if ( hvm_apic_support(d) ) + if ( !hvm_enabled ) { - spin_lock_init(&d->arch.hvm_domain.round_robin_lock); - hvm_vioapic_init(d); + 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; + 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); pit_init(v, cpu_khz); 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 --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/hvm/i8254.c index 96a80cf670..516c114907 100644 --- a/xen/arch/x86/hvm/i8254.c +++ b/xen/arch/x86/hvm/i8254.c @@ -374,9 +374,9 @@ void pit_init(struct vcpu *v, unsigned long cpu_khz) 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 --git a/xen/arch/x86/hvm/i8259.c b/xen/arch/x86/hvm/i8259.c index 5da40cf7f9..d22eaa8ca9 100644 --- a/xen/arch/x86/hvm/i8259.c +++ b/xen/arch/x86/hvm/i8259.c @@ -548,12 +548,12 @@ static int intercept_elcr_io(ioreq_t *p) return 1; } -void register_pic_io_hook (void) +void register_pic_io_hook(struct domain *d) { - 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); + 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 --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c index 8a6dc963df..839d29787a 100644 --- a/xen/arch/x86/hvm/intercept.c +++ b/xen/arch/x86/hvm/intercept.c @@ -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 type) return 0; } -int register_io_handler(unsigned long addr, unsigned long size, - intercept_action_t action, int type) +int register_io_handler( + struct domain *d, 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); + 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 --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c index f857de8f87..b435fbdf9f 100644 --- a/xen/arch/x86/hvm/pmtimer.c +++ b/xen/arch/x86/hvm/pmtimer.c @@ -52,7 +52,7 @@ void pmtimer_init(struct vcpu *v, int base) /* 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 --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c index 5aff1b72d0..77b703b040 100644 --- a/xen/arch/x86/hvm/rtc.c +++ b/xen/arch/x86/hvm/rtc.c @@ -381,7 +381,7 @@ void rtc_init(struct vcpu *v, int base, int irq) 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 --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index fc2827bb11..ef354abb7e 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1046,8 +1046,7 @@ static void svm_vmexit_do_cpuid(struct vmcb_struct *vmcb, unsigned long input, 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 --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c index 356130bd11..6c3dc7c7c1 100644 --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -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 --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c index d7b2321e62..0ed6463045 100644 --- a/xen/arch/x86/hvm/vioapic.c +++ b/xen/arch/x86/hvm/vioapic.c @@ -530,9 +530,6 @@ void hvm_vioapic_do_irqs(struct domain *d, uint16_t irqs) { 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 domain *d, uint16_t irqs) { 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 domain *d, int irq, int level) { 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) @@ -569,9 +562,6 @@ 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 --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 24c3af8c0b..64820c767c 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -155,17 +155,11 @@ int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig) 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 --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 6a49cec3fc..65be8a3494 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -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 --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 343eb3d3c5..e91bb58d6a 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -905,17 +905,11 @@ static void vmx_do_cpuid(struct cpu_user_regs *regs) 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 --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index fd0745773e..d3b4d0287e 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -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 --git a/xen/include/asm-ia64/vmx_platform.h b/xen/include/asm-ia64/vmx_platform.h index 07d05a68c6..17f4df7302 100644 --- a/xen/include/asm-ia64/vmx_platform.h +++ b/xen/include/asm-ia64/vmx_platform.h @@ -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 --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 5c7369550c..851b37830e 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -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 --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index a49cf34ad3..b784d059fe 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -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 @@ static inline int hvm_portio_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 --git a/xen/include/asm-x86/hvm/support.h b/xen/include/asm-x86/hvm/support.h index 4373949a26..f63b0156e9 100644 --- a/xen/include/asm-x86/hvm/support.h +++ b/xen/include/asm-x86/hvm/support.h @@ -139,7 +139,6 @@ int hvm_copy_from_guest_phys(void *buf, paddr_t paddr, int size); 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 --git a/xen/include/asm-x86/hvm/vlapic.h b/xen/include/asm-x86/hvm/vlapic.h index 883e3cac28..3827c11766 100644 --- a/xen/include/asm-x86/hvm/vlapic.h +++ b/xen/include/asm-x86/hvm/vlapic.h @@ -90,6 +90,4 @@ struct vlapic *apic_round_robin(struct domain *d, s_time_t get_apictime_scheduled(struct vcpu *v); -int hvm_apic_support(struct domain *d); - #endif /* __ASM_X86_HVM_VLAPIC_H__ */ diff --git a/xen/include/asm-x86/hvm/vpic.h b/xen/include/asm-x86/hvm/vpic.h index 67f229f04a..643eb5bd1a 100644 --- a/xen/include/asm-x86/hvm/vpic.h +++ b/xen/include/asm-x86/hvm/vpic.h @@ -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 --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index 82aaebc4a9..f4f424a0e5 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -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 |