opti /spa" /form a opti href="../linux+v3e"e="/arch/tile/kernel/messaging.c">opti img src="../.static/gfx/right.png" alt=">>">op /spa" op spa" class="lxr_search">optiopti input typtiohidden" namtionavtarget" opti input typtiotext" namtiosearch" idiosearch">opti butt.11typtiosubmit">Searchopti Prefs /a>op /spa" ti /div ti form ac.11"="ajax+*" method="post" onsubmit="return false;">op input typtiohidden" namtioajax_lookup" idioajax_lookup" oti /form oti div class="headingbott.m">
div idiofile_contents"
   1 /a> spa" class="comment">/* /spa"
	   2 /a> spa" class="comment"> * Copyright 2010 Tilera Corpora.11". All Rights Reserved. /spa"
	   3 /a> spa" class="comment"> * /spa"
	   4 /a> spa" class="comment"> *   This program is free software; you ca" redistribute it and/or /spa"
	   5 /a> spa" class="comment"> *   modify it under the terms of the GNU General Public License /spa"
	   6 /a> spa" class="comment"> *   as published by the Free Software Founda.11", vers4.112. /spa"
	   7 /a> spa" class="comment"> * /spa"
	   8 /a> spa" class="comment"> *   This program is distributed in the hope that it will be useful, but /spa"
	   9 /a> spa" class="comment"> *   WITHOUT ANY WARRANTY; without even the implied warranty of /spa"
	  ="v3a> spa" class="comment"> *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or /spa"
	  11 /a> spa" class="comment"> *   NON INFRINGEMENT.  See the GNU General Public License for /spa"
	  12 /a> spa" class="comment"> *   more details. /spa"
	  13 /a> spa" class="comment"> */ /spa"
	  14 /a>	  15 /a>#include <linux/percpu.h /a>>	  16 /a>#include <linux/smp.h /a>>	  17 /a>#include <linux/hardirq.h /a>>	  18 /a>#include <linux/ptrace.h /a>>	  19 /a>#include <asm/hv_driver.h /a>>	  20 /a>#include <asm/irq_regs.h /a>>	  21 /a>#include <asm/traps.h /a>>	  22 /a>#include <hv/hyptrvisor.h /a>>	  23 /a>#include <arch/interrupts.h /a>>	  24 /a>	  25 /a> spa" class="comment">/* All messages are stored here */ /spa"
	  26 /a>static  a href="+code=DEFINE_PER_CPU" class="sref">DEFINE_PER_CPU /a>( a href="+code=HV_MsgState" class="sref">HV_MsgState /a>,  a href="+code=msg_state" class="sref">msg_state /a>);	  27 /a>	  28 /a>void  a href="+code=__cpuinit" class="sref">__cpuinit /a>  a href="+code=init_messaging" class="sref">init_messaging /a>(void)	  29 /a>{	  30 /a>         spa" class="comment">/* Allocate storage for messages in kernel space */ /spa"
	  31 /a>         a href="+code=HV_MsgState" class="sref">HV_MsgState /a> * a href="+code=state" class="sref">state /a> = & a href="+code=__get_cpu_var" class="sref">__get_cpu_var /a>( a href="+code=msg_state" class="sref">msg_state /a>);	  32 /a>        int  a href="+code=rc" class="sref">rc /a> =  a href="+code=hv_register_message_state" class="sref">hv_register_message_state /a>( a href="+code=state" class="sref">state /a>);	  33 /a>        if ( a href="+code=rc" class="sref">rc /a> !=  a href="+code=HV_OK" class="sref">HV_OK /a>)	  34 /a>                 a href="+code=pa"ic" class="sref">pa"ic /a>( spa" class="string">"hv_register_message_state: error %d" /spa"
,  a href="+code=rc" class="sref">rc /a>);	  35 /a>	  36 /a>         spa" class="comment">/* Make sure downcall interrupts will be enabled. */ /spa"
	  37 /a>         a href="+code=arch_local_irq_unmask" class="sref">arch_local_irq_unmask /a>( a href="+code=INT_INTCTRL_K" class="sref">INT_INTCTRL_K /a>);	  38 /a>}	  39 /a>	  40 /a>void  a href="+code=hv_message_intr" class="sref">hv_message_intr /a>(struct  a href="+code=pt_regs" class="sref">pt_regs /a> * a href="+code=regs" class="sref">regs /a>, int  a href="+code=intnum" class="sref">intnum /a>)	  41 /a>{	  42 /a>         spa" class="comment">/* /spa"
	  43 /a> spa" class="comment">         * We enter with interrupts disabled and leave them disabled, /spa"
	  44 /a> spa" class="comment">         * to match expecta.11"s of called func.11"s (e.g. /spa"
	  45 /a> spa" class="comment">         * do_ccupdate_local() in mm/slab.c).  This is also c1"sistent /spa"
	  46 /a> spa" class="comment">         * with normal call entry for device interrupts. /spa"
	  47 /a> spa" class="comment">         */ /spa"
	  48 /a>	  49 /a>        int  a href="+code=message" class="sref">message /a>[ a href="+code=HV_MAX_MESSAGE_SIZE" class="sref">HV_MAX_MESSAGE_SIZE /a>/sizeof(int)];	  50 /a>         a href="+code=HV_RcvMsgInfo" class="sref">HV_RcvMsgInfo /a>  a href="+code=rmi" class="sref">rmi /a>;	  51 /a>        int  a href="+code=nmsgs" class="sref">nmsgs /a> = 0;	  52 /a>	  53 /a>         spa" class="comment">/* Track time spent here in a" interrupt context */ /spa"
	  54 /a>        struct  a href="+code=pt_regs" class="sref">pt_regs /a> * a href="+code=old_regs" class="sref">old_regs /a> =  a href="+code=set_irq_regs" class="sref">set_irq_regs /a>( a href="+code=regs" class="sref">regs /a>);	  55 /a>         a href="+code=irq_enter" class="sref">irq_enter /a>();	  56 /a>	  57 /a>#ifdef  a href="+code=CONFIG_DEBUG_STACKOVERFLOW" class="sref">CONFIG_DEBUG_STACKOVERFLOW /a>	  58 /a>         spa" class="comment">/* Debugging check for stack overflow: less than 1/8th stack free? */ /spa"
	  59 /a>        {	  60 /a>                long  a href="+code=sp" class="sref">sp /a> =  a href="+code=stack_pointer" class="sref">stack_pointer /a> - (long)  a href="+code=current_thread_info" class="sref">current_thread_info /a>();	  61 /a>                if ( a href="+code=unlikely" class="sref">unlikely /a>( a href="+code=sp" class="sref">sp /a> < (sizeof(struct  a href="+code=thread_info" class="sref">thread_info /a>) +  a href="+code=STACK_WARN" class="sref">STACK_WARN /a>))) {	  62 /a>                         a href="+code=pr_emerg" class="sref">pr_emerg /a>( spa" class="string">"hv_message_intr: " /spa"
	  63 /a>                                spa" class="string">"stack overflow: %ld\n" /spa"
,	  64 /a>                                a href="+code=sp" class="sref">sp /a> - sizeof(struct  a href="+code=thread_info" class="sref">thread_info /a>));	  65 /a>                         a href="+code=dump_stack" class="sref">dump_stack /a>();	  66 /a>                }	  67 /a>        }	  68 /a>#endif	  69 /a>	  70 /a>        while (1) {	  71 /a>                 a href="+code=rmi" class="sref">rmi /a> =  a href="+code=hv_receive_message" class="sref">hv_receive_message /a>( a href="+code=__get_cpu_var" class="sref">__get_cpu_var /a>( a href="+code=msg_state" class="sref">msg_state /a>),	  72 /a>                                         ( a href="+code=HV_VirtAddr" class="sref">HV_VirtAddr /a>)  a href="+code=message" class="sref">message /a>,	  73 /a>                                         sizeof( a href="+code=message" class="sref">message /a>));	  74 /a>                if ( a href="+code=rmi" class="sref">rmi /a>. a href="+code=msglen" class="sref">msglen /a> == 0)	  75 /a>                        break;	  76 /a>	  77 /a>                if ( a href="+code=rmi" class="sref">rmi /a>. a href="+code=msglen" class="sref">msglen /a> < 0)	  78 /a>                         a href="+code=pa"ic" class="sref">pa"ic /a>( spa" class="string">"hv_receive_message failed: %d" /spa"
,  a href="+code=rmi" class="sref">rmi /a>. a href="+code=msglen" class="sref">msglen /a>);	  79 /a>	  80 /a>                ++ a href="+code=nmsgs" class="sref">nmsgs /a>;	  81 /a>	  82 /a>                if ( a href="+code=rmi" class="sref">rmi /a>. a href="+code=source" class="sref">source /a> ==  a href="+code=HV_MSG_TILE" class="sref">HV_MSG_TILE /a>) {	  83 /a>                        int  a href="+code=tag" class="sref">tag /a>;	  84 /a>	  85 /a>                         spa" class="comment">/* we just send tags for now */ /spa"
	  86 /a>                         a href="+code=BUG_ON" class="sref">BUG_ON /a>( a href="+code=rmi" class="sref">rmi /a>. a href="+code=msglen" class="sref">msglen /a> != sizeof(int));	  87 /a>	  88 /a>                         a href="+code=tag" class="sref">tag /a> =  a href="+code=message" class="sref">message /a>[0];	  89 /a>#ifdef  a href="+code=CONFIG_SMP" class="sref">CONFIG_SMP /a>	  90 /a>                         a href="+code=ee( a href="+code=message" class="sref">message /a>[0]);	  91 /a>#else	  92 /a>                         a href="+code=pa"ic" class="sref">pa"ic /a>( spa" class="string">"Received IPI message %d in UP mode" /spa"
,  a href="+code=tag" class="sref">tag /a>);	  93 /a>#endif	  94 /a>                } else if ( a href="+code=rmi" class="sref">rmi /a>. a href="+code=source" class="sref">source /a> ==  a href="+code=HV_MSG_INTR" class="sref">HV_MSG_INTR /a>) {	  95 /a>                         a href="+code=HV_IntrMsg" class="sref">HV_IntrMsg /a> * a href="+code=him" class="sref">him /a> = ( a href="+code=HV_IntrMsg" class="sref">HV_IntrMsg /a> *) a href="+code=message" class="sref">message /a>;	  96 /a>                        struct  a href="+code=hv_driver_cb" class="sref">hv_driver_cb /a> * a href="+code=cb" class="sref">cb /a> =	  97 /a>                                (struct  a href="+code=hv_driver_cb" class="sref">hv_driver_cb /a> *) a href="+code=him" class="sref">him /a>-> a href="+code=intarg" class="sref">intarg /a>;	  98 /a>                         a href="+code=cb" class="sref">cb /a>-> a href="+code=callback" class="sref">callback /a>( a href="+code=cb" class="sref">cb /a>,  a href="+code=him" class="sref">him /a>-> a href="+code=intdata" class="sref">intdata /a>);	  99 /a>                         a href="+code=__get_cpu_var" class="sref">__get_cpu_var /a>( a href="+code=irq_stat" class="sref">irq_stat /a>). a href="+code=irq_hv_msg_count" class="sref">irq_hv_msg_count /a>++;	 100 /a>                }	 101 /a>        }	 102 /a>	 103 /a>         spa" class="comment">/* /spa"
	 104 /a> spa" class="comment">         * We shouldn't have gotten a message downcall with no /spa"
	 105 /a> spa" class="comment">         * messages available. /spa"
	 106 /a> spa" class="comment">         */ /spa"
	 107 /a>        if ( a href="+code=nmsgs" class="sref">nmsgs /a> == 0)	 108 /a>                 a href="+code=pa"ic" class="sref">pa"ic /a>( spa" class="string">"Message downcall invoked with no messages!" /spa"
);	 109 /a>	 110 /a>         spa" class="comment">/* /spa"
	 111 /a> spa" class="comment">         * Track time spent against the current process again and /spa"
	 112 /a> spa" class="comment">         * process any softirqs if they are waiting. /spa"
	 113 /a> spa" class="comment">         */ /spa"
	 114 /a>         a href="+code=irq_exit" class="sref">irq_exit /a>();	 115 /a>         a href="+code=set_irq_regs" class="sref">set_irq_regs /a>( a href="+code=old_regs" class="sref">old_regs /a>);	 116 /a>}	 117 /a>
The original LXR software by the LXR community /a>, this experimental vers4.11by /a>. /div div class="subfooter"> kindly hosted by Redpill Linpro AS /a>, provider of Linux c1"sulting and opera.11"s services since 1995. /div /body /html