ia64/xen-unstable

changeset 16106:f5bc04410880

[IA64] vmx_setup_platform() may fail. make it return error value.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Fri Oct 12 14:14:13 2007 -0600 (2007-10-12)
parents 0badb22cde79
children be791f4f6040
files xen/arch/ia64/vmx/vmx_init.c xen/arch/ia64/xen/dom0_ops.c xen/include/asm-ia64/vmx.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmx_init.c	Fri Oct 12 14:11:57 2007 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vmx_init.c	Fri Oct 12 14:14:13 2007 -0600
     1.3 @@ -394,24 +394,34 @@ static void vmx_build_io_physmap_table(s
     1.4  
     1.5  }
     1.6  
     1.7 -void vmx_setup_platform(struct domain *d)
     1.8 +int vmx_setup_platform(struct domain *d)
     1.9  {
    1.10 +	unsigned long mpa;
    1.11  	ASSERT(d != dom0); /* only for non-privileged vti domain */
    1.12  
    1.13  	vmx_build_io_physmap_table(d);
    1.14  
    1.15 -	d->arch.vmx_platform.shared_page_va =
    1.16 -		(unsigned long)__va(__gpa_to_mpa(d, IO_PAGE_START));
    1.17 +	mpa = __gpa_to_mpa(d, IO_PAGE_START);
    1.18 +	if (mpa == 0)
    1.19 +		return -EINVAL;
    1.20 +	d->arch.vmx_platform.shared_page_va = (unsigned long)__va(mpa);
    1.21  	/* For buffered IO requests. */
    1.22  	spin_lock_init(&d->arch.hvm_domain.buffered_io_lock);
    1.23 -	d->arch.hvm_domain.buffered_io_va =
    1.24 -		(unsigned long)__va(__gpa_to_mpa(d, BUFFER_IO_PAGE_START));
    1.25 -	d->arch.hvm_domain.buffered_pio_va =
    1.26 -		(unsigned long)__va(__gpa_to_mpa(d, BUFFER_PIO_PAGE_START));
    1.27 +
    1.28 +	mpa = __gpa_to_mpa(d, BUFFER_IO_PAGE_START);
    1.29 +	if (mpa == 0)
    1.30 +		return -EINVAL;
    1.31 +	d->arch.hvm_domain.buffered_io_va = (unsigned long)__va(mpa);
    1.32 +	mpa = __gpa_to_mpa(d, BUFFER_PIO_PAGE_START);
    1.33 +	if (mpa == 0)
    1.34 +		return -EINVAL;
    1.35 +	d->arch.hvm_domain.buffered_pio_va = (unsigned long)__va(mpa);
    1.36  	/* TEMP */
    1.37  	d->arch.vmx_platform.pib_base = 0xfee00000UL;
    1.38  
    1.39  	d->arch.sal_data = xmalloc(struct xen_sal_data);
    1.40 +	if (d->arch.sal_data == NULL)
    1.41 +		return -ENOMEM;
    1.42  
    1.43  	/* Only open one port for I/O and interrupt emulation */
    1.44  	memset(&d->shared_info->evtchn_mask[0], 0xff,
    1.45 @@ -421,6 +431,8 @@ void vmx_setup_platform(struct domain *d
    1.46  	viosapic_init(d);
    1.47  
    1.48  	vacpi_init(d);
    1.49 +
    1.50 +	return 0;
    1.51  }
    1.52  
    1.53  void vmx_do_launch(struct vcpu *v)
     2.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Fri Oct 12 14:11:57 2007 -0600
     2.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Fri Oct 12 14:14:13 2007 -0600
     2.3 @@ -104,8 +104,8 @@ long arch_do_domctl(xen_domctl_t *op, XE
     2.4                      ret = -EINVAL;
     2.5                  } else {
     2.6                      d->arch.is_vti = 1;
     2.7 -                    vmx_setup_platform(d);
     2.8                      xen_ia64_set_convmem_end(d, ds->maxmem);
     2.9 +                    ret = vmx_setup_platform(d);
    2.10                  }
    2.11              }
    2.12              else {
     3.1 --- a/xen/include/asm-ia64/vmx.h	Fri Oct 12 14:11:57 2007 -0600
     3.2 +++ b/xen/include/asm-ia64/vmx.h	Fri Oct 12 14:14:13 2007 -0600
     3.3 @@ -33,7 +33,7 @@ extern void vmx_init_env(void);
     3.4  extern int vmx_final_setup_guest(struct vcpu *v);
     3.5  extern void vmx_save_state(struct vcpu *v);
     3.6  extern void vmx_load_state(struct vcpu *v);
     3.7 -extern void vmx_setup_platform(struct domain *d);
     3.8 +extern int vmx_setup_platform(struct domain *d);
     3.9  extern void vmx_do_launch(struct vcpu *v);
    3.10  extern void vmx_io_assist(struct vcpu *v);
    3.11  extern int ia64_hypercall (struct pt_regs *regs);