WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] [PATCH] fix INIT injection

Applied, thanks.

On Wed, Sep 17, 2008 at 05:36:57PM +0900, Kouya Shimura wrote:
Content-Description: message body text
> Isaku Yamahata writes:
> > > +        /* Switch to physical mode when injecting PAL_INIT */
> > > +        if (MODE_IND(new_psr) == 0 &&
> > > +            vcpu_regs(vcpu)->cr_iip == PAL_INIT_ENTRY) {
> > > +            vcpu->arch.arch_vmx.mmu_mode = VMX_MMU_PHY_DT;
> > > +            switch_to_physical_rid(vcpu);
> > > +            break;
> > > +        }
> > >          /* Sanity check */
> > >          panic_domain(vcpu_regs(vcpu),
> > >                       "Unexpected virtual <--> physical mode transition, "
> > 
> > I think this hunk corresponds to what you meant by 'Unexpected virtual'.
> > Why not set mm_switch_table[][0] to SW_2P_DT? any reason?
> 
> Well, INIT is a exceptional case. Guest OS by itself never do such
> state transitions and it should be checked, I think.
> 
> But I've found a bug in the previous patch.
> INIT injecttion doesn't work on psr.it=0,dt=1,rt=1 because
> mm_switch_table[][0] is SW_NOP.
> 
> New one attached.
> 
> Thanks,
> Kouya
> 
> Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
> Signed-off-by: Kazuhiro Suzuki <kaz@xxxxxxxxxxxxxx>
> 

> diff -r 4a381ddc764a xen/arch/ia64/vmx/vlsapic.c
> --- a/xen/arch/ia64/vmx/vlsapic.c     Tue Sep 16 21:25:30 2008 +0900
> +++ b/xen/arch/ia64/vmx/vlsapic.c     Wed Sep 17 17:00:45 2008 +0900
> @@ -43,6 +43,7 @@
>  #include <asm/vmx_platform.h>
>  #include <asm/viosapic.h>
>  #include <asm/vlsapic.h>
> +#include <asm/vmx_phy_mode.h>
>  #include <asm/linux/jiffies.h>
>  #include <xen/domain.h>
>  #include <asm/hvm/support.h>
> @@ -614,9 +615,8 @@ struct vcpu *lid_to_vcpu(struct domain *
>   * To inject INIT to guest, we must set the PAL_INIT entry 
>   * and set psr to switch to physical mode
>   */
> -#define PAL_INIT_ENTRY 0x80000000ffffffa0
>  #define PSR_SET_BITS (IA64_PSR_DT | IA64_PSR_IT | IA64_PSR_RT | \
> -                      IA64_PSR_IC | IA64_PSR_RI)
> +                      IA64_PSR_IC | IA64_PSR_RI | IA64_PSR_I | IA64_PSR_CPL)
>  
>  static void vmx_inject_guest_pal_init(VCPU *vcpu)
>  {
> diff -r 4a381ddc764a xen/arch/ia64/vmx/vmx_phy_mode.c
> --- a/xen/arch/ia64/vmx/vmx_phy_mode.c        Tue Sep 16 21:25:30 2008 +0900
> +++ b/xen/arch/ia64/vmx/vmx_phy_mode.c        Wed Sep 17 17:00:45 2008 +0900
> @@ -255,7 +255,11 @@ switch_mm_mode(VCPU *vcpu, IA64_PSR old_
>  switch_mm_mode(VCPU *vcpu, IA64_PSR old_psr, IA64_PSR new_psr)
>  {
>      int act;
> -    act = mm_switch_action(old_psr, new_psr);
> +    /* Switch to physical mode when injecting PAL_INIT */
> +    if (MODE_IND(new_psr) == 0 && vcpu_regs(vcpu)->cr_iip == PAL_INIT_ENTRY)
> +        act = SW_2P_DT;
> +    else
> +        act = mm_switch_action(old_psr, new_psr);
>      perfc_incra(vmx_switch_mm_mode, act);
>      switch (act) {
>      case SW_2P_DT:
> diff -r 4a381ddc764a xen/include/asm-ia64/vmx_phy_mode.h
> --- a/xen/include/asm-ia64/vmx_phy_mode.h     Tue Sep 16 21:25:30 2008 +0900
> +++ b/xen/include/asm-ia64/vmx_phy_mode.h     Wed Sep 17 17:00:45 2008 +0900
> @@ -96,4 +96,6 @@ extern void physical_tlb_miss(VCPU *vcpu
>  #define VMX_MMU_PHY_D      1    /* Half physical: it=1,dt=0  */
>  #define VMX_MMU_PHY_DT     3    /* Full physical mode: it=0,dt=0  */
>  
> +#define PAL_INIT_ENTRY 0x80000000ffffffa0
> +
>  #endif /* _PHY_MODE_H_ */

> _______________________________________________
> Xen-ia64-devel mailing list
> Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-ia64-devel

-- 
yamahata

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