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] pv_ops: move binary patching to later after CPU ini

To: "Dong, Eddie" <eddie.dong@xxxxxxxxx>
Subject: Re: [Xen-ia64-devel] pv_ops: move binary patching to later after CPU initialization
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Thu, 27 Mar 2008 19:50:50 +0900
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 27 Mar 2008 03:51:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <10EA09EFD8728347A513008B6B0DA77A02F76F3F@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <10EA09EFD8728347A513008B6B0DA77A02F76F3F@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
I guess you just followed x86 way, but delaying until check_bug()
is too late for IA64 case because of at least ia64_get_cpuid().
At this moment I'm not sure how late binary patching can
be delayed, though.
Presumably it is necessary to revise boot protocol.

Renaming xen_paravirt_patch() to xen_patch() seems reasonable,
so I applied only the renaming part.


thanks,

On Wed, Mar 26, 2008 at 05:12:40PM +0800, Dong, Eddie wrote:
> 
>  arch/ia64/kernel/paravirt.c       |    8 +++++++-
>  arch/ia64/kernel/paravirt_core.c  |   17 ++---------------
>  arch/ia64/kernel/paravirt_entry.c |    3 ++-
>  arch/ia64/kernel/setup.c          |    3 +++
>  arch/ia64/xen/paravirt_xen.c      |    8 +-------
>  arch/ia64/xen/xen_pv_ops.c        |    4 ++++
>  arch/ia64/xen/xensetup.S          |   10 ----------
>  include/asm-ia64/paravirt.h       |    1 +
>  8 files changed, 20 insertions(+), 34 deletions(-)
> 
> So far it is still NULL for both native & xen.
> 
> Thanks, eddie
> 
> 
>     Defer binary patching from beginning to later after initialization
>     is done.
>     
>     Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@xxxxxxxxx>
> 
> diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c
> index 37bad82..b7340dd 100644
> --- a/arch/ia64/kernel/paravirt.c
> +++ b/arch/ia64/kernel/paravirt.c
> @@ -39,12 +39,18 @@ struct pv_info pv_info = {
>       .name = "bare hardware"
>  };
>  
> +static void native_patch(void)
> +{
> +}
> +
>  
> /***********************************************************************
> ****
>   * pv_init_ops
>   * initialization hooks.
>   */
>  
> -struct pv_init_ops pv_init_ops;
> +struct pv_init_ops pv_init_ops = {
> +     .patch = native_patch,
> +};
>  
>  
> /***********************************************************************
> ****
>   * pv_cpu_ops
> diff --git a/arch/ia64/kernel/paravirt_core.c
> b/arch/ia64/kernel/paravirt_core.c
> index 6b7c70f..003ce1f 100644
> --- a/arch/ia64/kernel/paravirt_core.c
> +++ b/arch/ia64/kernel/paravirt_core.c
> @@ -21,20 +21,7 @@
>   */
>  
>  #include <asm/paravirt_core.h>
> -
> -/*
> - * flush_icache_range() can't be used here.
> - * we are here before cpu_init() which initializes
> - * ia64_i_cache_stride_shift. flush_icache_range() uses it.
> - */
> -void __init_or_module
> -paravirt_flush_i_cache_range(const void *instr, unsigned long size)
> -{
> -     unsigned long i;
> -
> -     for (i = 0; i < size; i += sizeof(bundle_t))
> -             asm volatile ("fc.i %0":: "r"(instr + i): "memory");
> -}
> +#include <asm/pgtable.h>
>  
>  bundle_t* __init_or_module
>  paravirt_get_bundle(unsigned long tag)
> @@ -162,7 +149,7 @@ paravirt_write_inst(unsigned long tag, cmp_inst_t
> inst)
>       default:
>               BUG();
>       }
> -     paravirt_flush_i_cache_range(bundle, sizeof(*bundle));
> +     flush_icache_range((unsigned long)bundle, (unsigned
> long)(bundle+1));
>  }
>  
>  /* for debug */
> diff --git a/arch/ia64/kernel/paravirt_entry.c
> b/arch/ia64/kernel/paravirt_entry.c
> index 708287a..857d2a1 100644
> --- a/arch/ia64/kernel/paravirt_entry.c
> +++ b/arch/ia64/kernel/paravirt_entry.c
> @@ -20,6 +20,7 @@
>  
>  #include <asm/paravirt_core.h>
>  #include <asm/paravirt_entry.h>
> +#include <asm/pgtable.h>
>  
>  /* br.cond.sptk.many <target25>      B1 */
>  typedef union inst_b1 {
> @@ -56,7 +57,7 @@ __paravirt_entry_apply(unsigned long tag, const void
> *target)
>       inst.l = inst_b1.l;
>  
>       paravirt_write_inst(tag, inst);
> -     paravirt_flush_i_cache_range(bundle, sizeof(*bundle));
> +     flush_icache_range((unsigned long)bundle, (unsigned
> long)(bundle+1));
>  }
>  
>  static void __init
> diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
> index 24561d3..6634ba7 100644
> --- a/arch/ia64/kernel/setup.c
> +++ b/arch/ia64/kernel/setup.c
> @@ -987,6 +987,9 @@ cpu_init (void)
>  void __init
>  check_bugs (void)
>  {
> +#ifdef CONFIG_PARAVIRT_GUEST
> +        pv_init_ops.patch();
> +#endif
>       ia64_patch_mckinley_e9((unsigned long)
> __start___mckinley_e9_bundles,
>                              (unsigned long)
> __end___mckinley_e9_bundles);
>  }
> diff --git a/arch/ia64/xen/paravirt_xen.c b/arch/ia64/xen/paravirt_xen.c
> index aa12cb5..969478e 100644
> --- a/arch/ia64/xen/paravirt_xen.c
> +++ b/arch/ia64/xen/paravirt_xen.c
> @@ -28,7 +28,7 @@ const static struct paravirt_entry xen_entries[]
> __initdata = {
>  };
>  
>  void __init
> -xen_entry_patch(void)
> +xen_patch(void)
>  {
>       extern const struct paravirt_entry_patch
> __start_paravirt_entry[];
>       extern const struct paravirt_entry_patch
> __stop_paravirt_entry[];
> @@ -39,12 +39,6 @@ xen_entry_patch(void)
>  
> sizeof(xen_entries)/sizeof(xen_entries[0]));
>  }
>  
> -void __init
> -xen_paravirt_patch(void)
> -{
> -     xen_entry_patch();
> -}
> -
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
> index 3601b79..a2da7b2 100644
> --- a/arch/ia64/xen/xen_pv_ops.c
> +++ b/arch/ia64/xen/xen_pv_ops.c
> @@ -38,6 +38,9 @@
>  #include "irq_xen.h"
>  #include "time.h"
>  
> +/* TODO: move xen_patch to this file */
> +extern void xen_patch(void);
> +
>  
> /***********************************************************************
> ****
>   * general info
>   */
> @@ -157,6 +160,7 @@ xen_post_smp_prepare_boot_cpu(void)
>  
>  static const struct pv_init_ops xen_init_ops __initdata = {
>       .banner = xen_banner,
> +     .patch = xen_patch,
>  
>       .reserve_memory = xen_reserve_memory,
>  
> diff --git a/arch/ia64/xen/xensetup.S b/arch/ia64/xen/xensetup.S
> index cb3432b..0df93d8 100644
> --- a/arch/ia64/xen/xensetup.S
> +++ b/arch/ia64/xen/xensetup.S
> @@ -45,16 +45,6 @@ GLOBAL_ENTRY(early_xen_setup)
>       ;;
>  #endif
>  
> -#ifdef CONFIG_PARAVIRT
> -     /* patch privops */
> -(isBP)       mov r4=rp
> -     ;;
> -(isBP)       br.call.sptk.many rp=xen_paravirt_patch
> -     ;;
> -(isBP)       mov rp=r4
> -     ;;
> -#endif
> -
>       br.ret.sptk.many rp
>       ;;
>  END(early_xen_setup)
> diff --git a/include/asm-ia64/paravirt.h b/include/asm-ia64/paravirt.h
> index 285f7ff..949ffd7 100644
> --- a/include/asm-ia64/paravirt.h
> +++ b/include/asm-ia64/paravirt.h
> @@ -59,6 +59,7 @@ struct rsvd_region;
>  
>  struct pv_init_ops {
>       void (*banner)(void);
> +     void (*patch)(void);
>  
>       int (*reserve_memory)(struct rsvd_region *region);
>  


> _______________________________________________
> 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

<Prev in Thread] Current Thread [Next in Thread>