[Cbe-oss-dev] OProfile performance counter interrupt support

Arnd Bergmann arnd.bergmann at de.ibm.com
Wed Oct 11 23:32:21 EST 2006


On Tuesday 10 October 2006 19:15, Carl Love wrote:
> Ben and Arnd:
> 
> I have been studying the code and Ben's reply (see below).  The
> functions cbe_clear_pm_interrupts(), cbe_enable_pm_interrupts(),
> cbe_disable_pm_interrupts() have been modified.  These functions are in
> arch/powerpc/platforms/cell.  I am guessing the changes were by Arnd, I
> do not really know. I don't believe Kevin has touched these.  The code 
> for the functions are below.  What I see is that the calls to read/write
> the pm_status in cbe_clear_pm_interrupts(), cbe_enable_pm_interrupts()
> changed.  I also see that the function iic_setup_iic_is() no longer
> exists.  I don't see any of the interrupt mapping in these routines that
> Ben was talking about.  I am not really sure what Ben is talking about
> in his message.  This is a whole new area for me.  I really have no idea
> how all this works.  Sorry for being so clueless here.  It seems like I
> need to call some function that sets up the interrupts as described by
> Ben.  I am guessing the function replaces the iic_setup_iic_is()
> function.  For now, I will remove the iic_setup_iic_is() function and
> try playing with OProfile using the modified cbe functions to see what
> happens.  I will keep looking at the code to try and figure out if there
> are additional things that need work.  If you can look at the code below
> and tell me if all the needed changes are there I would appreciate it.  

First of all, there is no point discussing this in private, using the
mailing list will usually get you quicker answers and also helps the
people that have run into the same problem with other code.

What Ben was trying to explain to you is that the functions you have
quoted have now been replaced with the simpler generic interrupt interface
that everyone else uses. You no longer need to worry about enabling
or acknowledging the interrupt yourself, just register your own
handler function to get called when the interrupt happens.

	Arnd <><

> /*
>  * Enabling/disabling interrupts for the entire performance monitoring
> unit.
>  */
> 
> u32 cbe_clear_pm_interrupts(u32 cpu)
> {
>         struct cbe_iic_regs __iomem *iic_regs = cbe_get_cpu_iic_regs
> (cpu);
>         u32 mask;
> 
>         /* First read pm_status to clear the interrupt -- order is
> important! *\/
>         mask = cbe_read_pm(cpu, pm_status);
> 
>         /* Write 1 to PMI bit to clear the interrupt. */
>         out_be64(&iic_regs->iic_is, CBE_IIC_IS_PMI);
> 
>         return mask;
> }
> EXPORT_SYMBOL_GPL(cbe_clear_pm_interrupts);
> 
> void cbe_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask)
> {
>         struct cbe_iic_regs __iomem *iic_regs = cbe_get_cpu_iic_regs
> (cpu);
>         struct cbe_iic_ir iic_ir;
>         u32 node = cpu >> 1;
> 
>         /* Set which node and thread will handle the next interrupt */
>         iic_ir.val = 0;
>         iic_ir.dst_node_id = node;
>         iic_ir.dst_unit_id = (thread == 0) ? CBE_IIC_IR_PT0 :
> CBE_IIC_IR_PT1;
>         out_be64(&iic_regs->iic_ir.val, iic_ir.val);
> 
>         /* Enable pm interrupts */
>         if (mask)
>                 cbe_write_pm(cpu, pm_status, mask);
> }
> EXPORT_SYMBOL_GPL(cbe_enable_pm_interrupts);
> 
> void cbe_disable_pm_interrupts(u32 cpu)
> {
>         cbe_write_pm(cpu, pm_status, 0);
>         cbe_clear_pm_interrupts(cpu);
> }
> EXPORT_SYMBOL_GPL(cbe_disable_pm_interrupts);
> 
> u32 cbe_query_pm_interrupts(u32 cpu)
> {
>         return cbe_read_pm(cpu, pm_status);
> }
> EXPORT_SYMBOL_GPL(cbe_query_pm_interrupts);
> 
> 
> On Mon, 2006-10-09 at 11:35 +1000, Benjamin Herrenschmidt wrote:
> > On Thu, 2006-10-05 at 11:33 -0700, Carl Love wrote:
> > > Ben:
> > > 
> > > We talked about the changes to the interrupt handling code for OProile
> > > back at the end of August.  I understand that you were making changes to
> > > the performance monitor interrupt control calls.  On SDK 1.1 (2.6.16
> > > kernel) I use the following:
> > > 
> > >   cbe_disable_pm_interrupts(cpu);
> > >   cbe_clear_pm_interrupts(cpu);
> > >   cbe_enable_pm_interrupts(cpu, handler_thread, 0);
> > > 
> > > What is the syntax for the 2.6.18 kernel?  
> > > 
> > > I have been busy trying to debug RTAS calls for the last two months.  It
> > > looks like we finally have the RTAS calls working.  I am starting to
> > > port the op_model_cell.c file from 2.6.16 to 2.6.18.  
> > 
> > You basically just map and request irqs.
> > 
> > Since the current device-tree doesn't contain a proper interrupt mapping
> > for those, you need to do the mapping by hand, a bit like the SPEs. The
> > way to do that is to do:
> > 
> > 	unsigned int irq;
> > 
> > 	irq = irq_create_mapping(NULL,
> > 		IIC_IRQ_IOEX_PMI | (node << IIC_IRQ_NODE_SHIFT));
> > 
> > Where "node" is the node number (one per BE). The constants here are
> > defined in arch/powerpc/platforms/cell/interrupt.h. You can then test if
> > the mapping succeeded with:
> > 
> > 	if (irq != NO_IRQ)
> > 
> > And you can request/enable that irq:
> > 
> > 	request_irq(irq, ....);
> > 
> > Ben.
> > 
> > 
> 
> 
> 
> 



More information about the cbe-oss-dev mailing list