ia64/xen-unstable
changeset 15323:171ec463e7ce
[IA64] Use virtualized psr in vcpu context instead of real psr.
Signed-off-by: Tristan Gingold <tgingold@free.fr>
Signed-off-by: Tristan Gingold <tgingold@free.fr>
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Tue Jun 12 15:16:03 2007 -0600 (2007-06-12) |
parents | 601509daabfc |
children | c4256be388cc |
files | tools/libxc/ia64/xc_ia64_hvm_build.c tools/libxc/ia64/xc_ia64_linux_restore.c tools/libxc/xc_dom_ia64.c xen/arch/ia64/vmx/vlsapic.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/vcpu.c |
line diff
1.1 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c Tue Jun 12 15:07:05 2007 -0600 1.2 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Tue Jun 12 15:16:03 2007 -0600 1.3 @@ -1,3 +1,4 @@ 1.4 +#include <asm/kregs.h> 1.5 #include "xg_private.h" 1.6 #include "xenguest.h" 1.7 #include "xc_private.h" 1.8 @@ -1083,6 +1084,11 @@ xc_hvm_build(int xc_handle, uint32_t dom 1.9 free(image); 1.10 1.11 ctxt->regs.ip = 0x80000000ffffffb0UL; 1.12 + ctxt->regs.ar.fpsr = xc_ia64_fpsr_default(); 1.13 + ctxt->regs.cr.isr = 1UL << 63; 1.14 + ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_BN; 1.15 + ctxt->regs.cr.dcr = 0; 1.16 + ctxt->regs.cr.pta = 15 << 2; 1.17 1.18 memset(&launch_domctl, 0, sizeof(launch_domctl)); 1.19
2.1 --- a/tools/libxc/ia64/xc_ia64_linux_restore.c Tue Jun 12 15:07:05 2007 -0600 2.2 +++ b/tools/libxc/ia64/xc_ia64_linux_restore.c Tue Jun 12 15:16:03 2007 -0600 2.3 @@ -227,17 +227,7 @@ xc_domain_restore(int xc_handle, int io_ 2.4 2.5 fprintf(stderr, "ip=%016lx, b0=%016lx\n", ctxt.regs.ip, ctxt.regs.b[0]); 2.6 2.7 - /* First to initialize. */ 2.8 - domctl.cmd = XEN_DOMCTL_setvcpucontext; 2.9 - domctl.domain = (domid_t)dom; 2.10 - domctl.u.vcpucontext.vcpu = 0; 2.11 - set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt); 2.12 - if (xc_domctl(xc_handle, &domctl) != 0) { 2.13 - ERROR("Couldn't set vcpu context"); 2.14 - goto out; 2.15 - } 2.16 - 2.17 - /* Second to set registers... */ 2.18 + /* Initialize and set registers. */ 2.19 ctxt.flags = VGCF_EXTRA_REGS; 2.20 domctl.cmd = XEN_DOMCTL_setvcpucontext; 2.21 domctl.domain = (domid_t)dom;
3.1 --- a/tools/libxc/xc_dom_ia64.c Tue Jun 12 15:07:05 2007 -0600 3.2 +++ b/tools/libxc/xc_dom_ia64.c Tue Jun 12 15:16:03 2007 -0600 3.3 @@ -13,6 +13,7 @@ 3.4 #include <string.h> 3.5 #include <inttypes.h> 3.6 #include <assert.h> 3.7 +#include <asm/kregs.h> 3.8 3.9 #include <xen/xen.h> 3.10 #include <xen/foreign/ia64.h> 3.11 @@ -106,9 +107,10 @@ static int vcpu_ia64(struct xc_dom_image 3.12 memset(ctxt, 0, sizeof(*ctxt)); 3.13 3.14 ctxt->flags = 0; 3.15 - ctxt->regs.psr = 0; /* all necessary bits filled by hypervisor */ 3.16 + /* PSR is set according to SAL 3.2.4: AC, IC and BN are set. */ 3.17 + ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_IC | IA64_PSR_BN; 3.18 ctxt->regs.ip = dom->parms.virt_entry; 3.19 - ctxt->regs.cfm = (uint64_t) 1 << 63; 3.20 + ctxt->regs.cfm = 1UL << 63; 3.21 #ifdef __ia64__ /* FIXME */ 3.22 ctxt->regs.ar.fpsr = xc_ia64_fpsr_default(); 3.23 #endif
4.1 --- a/xen/arch/ia64/vmx/vlsapic.c Tue Jun 12 15:07:05 2007 -0600 4.2 +++ b/xen/arch/ia64/vmx/vlsapic.c Tue Jun 12 15:16:03 2007 -0600 4.3 @@ -696,11 +696,8 @@ static void vlsapic_write_ipi(VCPU *vcpu 4.4 test_bit(_VPF_down, &targ->pause_flags)) { 4.5 4.6 struct pt_regs *targ_regs = vcpu_regs(targ); 4.7 - struct vcpu_guest_context c; 4.8 4.9 - memset (&c, 0, sizeof(c)); 4.10 - 4.11 - if (arch_set_info_guest(targ, &c) != 0) { 4.12 + if (arch_set_info_guest(targ, NULL) != 0) { 4.13 printk("arch_boot_vcpu: failure\n"); 4.14 return; 4.15 }
5.1 --- a/xen/arch/ia64/xen/domain.c Tue Jun 12 15:07:05 2007 -0600 5.2 +++ b/xen/arch/ia64/xen/domain.c Tue Jun 12 15:16:03 2007 -0600 5.3 @@ -622,12 +622,10 @@ void arch_get_info_guest(struct vcpu *v, 5.4 c.nat->regs.r[10] = uregs->r10; 5.5 c.nat->regs.r[11] = uregs->r11; 5.6 5.7 - if (is_hvm) { 5.8 - c.nat->regs.psr = vmx_vcpu_get_psr (v); 5.9 - } else { 5.10 - /* FIXME: get the vpsr. */ 5.11 - c.nat->regs.psr = uregs->cr_ipsr; 5.12 - } 5.13 + if (is_hvm) 5.14 + c.nat->regs.psr = vmx_vcpu_get_psr(v); 5.15 + else 5.16 + c.nat->regs.psr = vcpu_get_psr(v); 5.17 5.18 c.nat->regs.ip = uregs->cr_iip; 5.19 c.nat->regs.cfm = uregs->cr_ifs; 5.20 @@ -717,6 +715,26 @@ int arch_set_info_guest(struct vcpu *v, 5.21 struct domain *d = v->domain; 5.22 int rc; 5.23 5.24 + /* Finish vcpu initialization. */ 5.25 + if (!v->is_initialised) { 5.26 + if (d->arch.is_vti) 5.27 + rc = vmx_final_setup_guest(v); 5.28 + else 5.29 + rc = vcpu_late_initialise(v); 5.30 + if (rc != 0) 5.31 + return rc; 5.32 + 5.33 + vcpu_init_regs(v); 5.34 + 5.35 + v->is_initialised = 1; 5.36 + /* Auto-online VCPU0 when it is initialised. */ 5.37 + if (v->vcpu_id == 0) 5.38 + clear_bit(_VPF_down, &v->pause_flags); 5.39 + } 5.40 + 5.41 + if (c.nat == NULL) 5.42 + return 0; 5.43 + 5.44 uregs->b6 = c.nat->regs.b[6]; 5.45 uregs->b7 = c.nat->regs.b[7]; 5.46 5.47 @@ -727,8 +745,11 @@ int arch_set_info_guest(struct vcpu *v, 5.48 uregs->r9 = c.nat->regs.r[9]; 5.49 uregs->r10 = c.nat->regs.r[10]; 5.50 uregs->r11 = c.nat->regs.r[11]; 5.51 - 5.52 - uregs->cr_ipsr = c.nat->regs.psr; 5.53 + 5.54 + if (!d->arch.is_vti) 5.55 + vcpu_set_psr(v, c.nat->regs.psr); 5.56 + else 5.57 + vmx_vcpu_set_psr(v, c.nat->regs.psr); 5.58 uregs->cr_iip = c.nat->regs.ip; 5.59 uregs->cr_ifs = c.nat->regs.cfm; 5.60 5.61 @@ -813,32 +834,6 @@ int arch_set_info_guest(struct vcpu *v, 5.62 v->arch.iva = c.nat->regs.cr.iva; 5.63 } 5.64 5.65 - if (v->is_initialised) 5.66 - return 0; 5.67 - 5.68 - if (d->arch.is_vti) { 5.69 - rc = vmx_final_setup_guest(v); 5.70 - if (rc != 0) 5.71 - return rc; 5.72 - } else { 5.73 - rc = vcpu_late_initialise(v); 5.74 - if (rc != 0) 5.75 - return rc; 5.76 - VCPU(v, interrupt_mask_addr) = 5.77 - (unsigned char *) d->arch.shared_info_va + 5.78 - INT_ENABLE_OFFSET(v); 5.79 - } 5.80 - 5.81 - /* This overrides some registers. */ 5.82 - vcpu_init_regs(v); 5.83 - 5.84 - if (!v->is_initialised) { 5.85 - v->is_initialised = 1; 5.86 - /* Auto-online VCPU0 when it is initialised. */ 5.87 - if (v->vcpu_id == 0) 5.88 - clear_bit(_VPF_down, &v->pause_flags); 5.89 - } 5.90 - 5.91 return 0; 5.92 } 5.93
6.1 --- a/xen/arch/ia64/xen/hypercall.c Tue Jun 12 15:07:05 2007 -0600 6.2 +++ b/xen/arch/ia64/xen/hypercall.c Tue Jun 12 15:16:03 2007 -0600 6.3 @@ -86,11 +86,7 @@ fw_hypercall_ipi (struct pt_regs *regs) 6.4 6.5 /* First start: initialize vpcu. */ 6.6 if (!targ->is_initialised) { 6.7 - struct vcpu_guest_context c; 6.8 - 6.9 - memset (&c, 0, sizeof (c)); 6.10 - 6.11 - if (arch_set_info_guest (targ, &c) != 0) { 6.12 + if (arch_set_info_guest (targ, NULL) != 0) { 6.13 printk ("arch_boot_vcpu: failure\n"); 6.14 return; 6.15 }
7.1 --- a/xen/arch/ia64/xen/vcpu.c Tue Jun 12 15:07:05 2007 -0600 7.2 +++ b/xen/arch/ia64/xen/vcpu.c Tue Jun 12 15:16:03 2007 -0600 7.3 @@ -182,8 +182,6 @@ void vcpu_init_regs(struct vcpu *v) 7.4 INT_ENABLE_OFFSET(v); 7.5 VCPU(v, itv) = (1 << 16); /* timer vector masked */ 7.6 7.7 - /* SAL specification 3.2.4 */ 7.8 - VCPU(v, vpsr) = IA64_PSR_AC | IA64_PSR_IC | IA64_PSR_BN; 7.9 v->vcpu_info->evtchn_upcall_pending = 0; 7.10 v->vcpu_info->evtchn_upcall_mask = -1; 7.11 }