[SLOF] [PATCH slof] pci-properties: Enforce all MMIO BARs to be 64K page aligned

Michael Roth mdroth at linux.vnet.ibm.com
Wed Mar 1 12:02:59 AEDT 2017


Quoting Segher Boessenkool (2017-02-27 04:05:37)
> On Mon, Feb 27, 2017 at 12:21:45PM +0530, Nikunj A Dadhania wrote:
> > Seems fine, assign-var-min-align can be optimized (untested)
> > 
> > : assign-var-min-align ( size var min-align -- al-mem )
> >    dup 3 pick < IF                 \ ( size var min-align min-align size)
> >        drop 1 pick                 \ ( size var sz-al)
> >    THEN
> >    swap                            \ ( size align var )              
> >    dup @                           \ ( size align var cur-mem)
> >    rot                             \ ( size var cur-mem align )
> >    #aligned                        \ ( size var al-mem )        align the mem to the size
> >    dup 2swap -rot +                \ ( al-mem var new-mem )     add size to aligned mem
> >    swap !                          \ ( al-mem )                 set variable to new mem
> > ;
> 
> With less stack juggling, totally untested as well of course:
> 
> : assign-var-min-align ( size var min-align -- al-mem )
>   swap >r over umax r@ @ swap #aligned tuck + r> ! ;

Thanks, much nicer than what I managed to come up with. I ended up
re-working it based on your approach.

> 
> (Why have var in the middle of the params btw?  It is more natural to
> have it at the end).

It was mostly because it was an "extended" version of assign-var,
so in my head it made sense to add the parameter to the end of the
list. Not sure if that reasoning applies well to Forth.

> 
> 
> Segher
> 



More information about the SLOF mailing list