Re: [PATCH] bsps/powerpc: Introduction of interrupt locks
On 19/4/2024 6:12 pm, Christian MAUDERER wrote: > it is tested on an MVME2500 which uses the powerpc/qoriq_e500 in an SMP > configuration. Great and thanks. I should have access next week to MVME2700 hardware and can test it there. I doubt there will be an issue looking at the change but this group of BSPs has had issues in the past, eg interrupts on some boards did not work for over 10 years after a change, ie RTEMS 4.10 until 5. I am OK to push the change and if I find anything I will raise it. Thanks Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] bsps/powerpc: Introduction of interrupt locks
Hello Chris, it is tested on an MVME2500 which uses the powerpc/qoriq_e500 in an SMP configuration. Best regards Christian On 2024-04-18 04:04, Chris Johns wrote: Hi Vincenzo, Welcome to RTEMS. What hardware in the shared VME PowerPC family of BSPS has this change been tested on? Thanks Chris On 17/4/2024 5:34 pm, Vincenzo Calabretta wrote: Interrupt locks are introduced in shared vme device drivers to enable compilation in an SMP configuration of the qoriq BSP. --- bsps/powerpc/shared/vme/vmeTsi148.c | 44 ++- bsps/powerpc/shared/vme/vmeUniverse.c | 40 +--- 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/bsps/powerpc/shared/vme/vmeTsi148.c b/bsps/powerpc/shared/vme/vmeTsi148.c index aaabb1b28d..a6f0ac87ab 100644 --- a/bsps/powerpc/shared/vme/vmeTsi148.c +++ b/bsps/powerpc/shared/vme/vmeTsi148.c @@ -545,16 +545,17 @@ vmeTsi148Reset(void) vmeTsi148ResetXX(THEBASE); } +RTEMS_INTERRUPT_LOCK_DEFINE( static, vmeTsi148_lock, "vmeTsi148_lock" ) void vmeTsi148ResetBusXX(BERegister *base) { -unsigned long flags; uint32_t v; +rtems_interrupt_lock_context lock_context; - rtems_interrupt_disable(flags); + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); v = TSI_RD(base, TSI_VCTRL_REG); TSI_WR(base, TSI_VCTRL_REG, v | TSI_VCTRL_SRESET); - rtems_interrupt_enable(flags); + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); } void @@ -1410,7 +1411,8 @@ int vmeTsi148IntRoute(unsigned int level, unsigned int pin) { int i; -unsigned long mask, shift, mapreg, flags, wire; +unsigned long mask, shift, mapreg, wire; +rtems_interrupt_lock_context lock_context; if ( pin >= TSI_NUM_WIRES || ! tsi_wire[pin] || !vmeTsi148IrqMgrInstalled ) return -1; @@ -1442,8 +1444,7 @@ unsigned long mask, shift, mapreg, flags, wire; /* wires are offset by 1 so we can initialize the wire table to all zeros */ wire = (tsi_wire[pin]-1) << shift; -rtems_interrupt_disable(flags); - + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); for ( i = 0; i -rtems_interrupt_enable(flags); + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); return 0; } @@ -1461,9 +1462,9 @@ VmeTsi148ISR vmeTsi148ISRGet(unsigned long vector, void **parg) { VmeTsi148ISRrval = 0; -unsigned longflags; volatile IRQEntry *p; int v = uni2tsivec(vector); +rtems_interrupt_lock_context lock_context; if ( v < 0 ) @@ -1471,13 +1472,13 @@ int v = uni2tsivec(vector); p = irqHdlTbl + v; - rtems_interrupt_disable(flags); + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); if ( *p ) { if ( parg ) *parg = (*p)->usrData; rval = (*p)->isr; } - rtems_interrupt_enable(flags); + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); return rval; } @@ -1794,8 +1795,8 @@ vmeTsi148InstallISR(unsigned long vector, VmeTsi148ISR hdl, void *arg) { IRQEntry ip; int v; -unsigned longflags; volatile IRQEntry *p; +rtems_interrupt_lock_context lock_context; if ( !vmeTsi148IrqMgrInstalled || (v = uni2tsivec(vector)) < 0 ) return -1; @@ -1808,14 +1809,14 @@ volatile IRQEntry *p; ip->isr=hdl; ip->usrData=arg; - rtems_interrupt_disable(flags); + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); if (*p) { - rtems_interrupt_enable(flags); + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); free(ip); return -1; } *p = ip; - rtems_interrupt_enable(flags); + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); return 0; } @@ -1824,22 +1825,22 @@ vmeTsi148RemoveISR(unsigned long vector, VmeTsi148ISR hdl, void *arg) { int v; IRQEntry ip; -unsigned long flags; volatile IRQEntry *p; +rtems_interrupt_lock_context lock_context; if ( !vmeTsi148IrqMgrInstalled || (v = uni2tsivec(vector)) < 0 ) return -1; p = irqHdlTbl + v; - rtems_interrupt_disable(flags); + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); ip = *p; if ( !ip || ip->isr!=hdl || ip->usrData!=arg ) { - rtems_interrupt_enable(flags); + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); return -1; }
Re: [PATCH] bsps/powerpc: Introduction of interrupt locks
Hi Vincenzo, Welcome to RTEMS. What hardware in the shared VME PowerPC family of BSPS has this change been tested on? Thanks Chris On 17/4/2024 5:34 pm, Vincenzo Calabretta wrote: > Interrupt locks are introduced in shared vme device drivers to enable > compilation in an SMP configuration of the qoriq BSP. > --- > bsps/powerpc/shared/vme/vmeTsi148.c | 44 ++- > bsps/powerpc/shared/vme/vmeUniverse.c | 40 +--- > 2 files changed, 45 insertions(+), 39 deletions(-) > > diff --git a/bsps/powerpc/shared/vme/vmeTsi148.c > b/bsps/powerpc/shared/vme/vmeTsi148.c > index aaabb1b28d..a6f0ac87ab 100644 > --- a/bsps/powerpc/shared/vme/vmeTsi148.c > +++ b/bsps/powerpc/shared/vme/vmeTsi148.c > @@ -545,16 +545,17 @@ vmeTsi148Reset(void) > vmeTsi148ResetXX(THEBASE); > } > > +RTEMS_INTERRUPT_LOCK_DEFINE( static, vmeTsi148_lock, "vmeTsi148_lock" ) > void > vmeTsi148ResetBusXX(BERegister *base) > { > -unsigned long flags; > uint32_t v; > +rtems_interrupt_lock_context lock_context; > > - rtems_interrupt_disable(flags); > + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); > v = TSI_RD(base, TSI_VCTRL_REG); > TSI_WR(base, TSI_VCTRL_REG, v | TSI_VCTRL_SRESET); > - rtems_interrupt_enable(flags); > + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); > } > > void > @@ -1410,7 +1411,8 @@ int > vmeTsi148IntRoute(unsigned int level, unsigned int pin) > { > int i; > -unsigned longmask, shift, mapreg, flags, wire; > +unsigned longmask, shift, mapreg, wire; > +rtems_interrupt_lock_context lock_context; > > if ( pin >= TSI_NUM_WIRES || ! tsi_wire[pin] || > !vmeTsi148IrqMgrInstalled ) > return -1; > @@ -1442,8 +1444,7 @@ unsigned long mask, shift, mapreg, flags, wire; > /* wires are offset by 1 so we can initialize the wire table to all > zeros */ > wire = (tsi_wire[pin]-1) << shift; > > -rtems_interrupt_disable(flags); > - > + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); > for ( i = 0; i wire_mask[i] &= ~mask; > } > @@ -1453,7 +1454,7 @@ rtems_interrupt_disable(flags); > mask |= wire; > TSI_WR( THEBASE, mapreg, mask ); > > -rtems_interrupt_enable(flags); > + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); > return 0; > } > > @@ -1461,9 +1462,9 @@ VmeTsi148ISR > vmeTsi148ISRGet(unsigned long vector, void **parg) > { > VmeTsi148ISR rval = 0; > -unsigned long flags; > volatile IRQEntry *p; > int v = uni2tsivec(vector); > +rtems_interrupt_lock_context lock_context; > > > if ( v < 0 ) > @@ -1471,13 +1472,13 @@ int v = uni2tsivec(vector); > > p = irqHdlTbl + v; > > - rtems_interrupt_disable(flags); > + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); > if ( *p ) { > if ( parg ) > *parg = (*p)->usrData; > rval = (*p)->isr; > } > - rtems_interrupt_enable(flags); > + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); > > return rval; > } > @@ -1794,8 +1795,8 @@ vmeTsi148InstallISR(unsigned long vector, VmeTsi148ISR > hdl, void *arg) > { > IRQEntry ip; > intv; > -unsigned long flags; > volatile IRQEntry *p; > +rtems_interrupt_lock_context lock_context; > > if ( !vmeTsi148IrqMgrInstalled || (v = uni2tsivec(vector)) < 0 ) > return -1; > @@ -1808,14 +1809,14 @@ volatile IRQEntry *p; > ip->isr=hdl; > ip->usrData=arg; > > - rtems_interrupt_disable(flags); > + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); > if (*p) { > - rtems_interrupt_enable(flags); > + rtems_interrupt_lock_release( &vmeTsi148_lock, > &lock_context ); > free(ip); > return -1; > } > *p = ip; > - rtems_interrupt_enable(flags); > + rtems_interrupt_lock_release( &vmeTsi148_lock, &lock_context ); > return 0; > } > > @@ -1824,22 +1825,22 @@ vmeTsi148RemoveISR(unsigned long vector, VmeTsi148ISR > hdl, void *arg) > { > int v; > IRQEntry ip; > -unsigned long flags; > volatile IRQEntry *p; > +rtems_interrupt_lock_context lock_context; > > if ( !vmeTsi148IrqMgrInstalled || (v = uni2tsivec(vector)) < 0 ) > return -1; > > p = irqHdlTbl + v; > > - rtems_interrupt_disable(flags); > + rtems_interrupt_lock_acquire( &vmeTsi148_lock, &lock_context ); > ip = *p; > if ( !ip || ip->isr!=hdl || ip->usrData!=arg ) { > -