[Skiboot] [PATCH 3/5] libflash/mbox-flash: Update to V2 of the protocol

Cyril Bur cyril.bur at au1.ibm.com
Sat May 13 00:04:44 AEST 2017


On Tue, 2017-05-02 at 09:27 +0200, Benjamin Herrenschmidt wrote:
> On Mon, 2017-04-24 at 19:14 +1000, Cyril Bur wrote:
> > +       while(len) {
> > +               uint32_t chunk;
> > +               uint32_t dat;
> > +
> > +               /* XXX: make this read until it's aligned */
> > +               if (len > 3 && !(off & 3)) {
> > +                       rc = lpc_read(OPAL_LPC_FW, off, &dat, 4);
> > +                       if (!rc)
> > +                               *(uint32_t *)buf = dat;
> > +                       chunk = 4;
> > +               } else {
> > +                       rc = lpc_read(OPAL_LPC_FW, off, &dat, 1);
> > +                       if (!rc)
> > +                               *(uint8_t *)buf = dat;
> > +                       chunk = 1;
> > +               }
> > +               if (rc) {
> 
> You'll acquire/release a lock for every 4 bytes.. In HostBoot, I've
> updated the underlying lpc_read to take arbitrary quantities instead
> (though only on memory mapped LPC, ie, P9)..
> 

Yes, actually this is something that did a bit fall by the wayside - I
meant to have a crack at this as well but unfortunately my infinite
time ran out.

> To do that, I'd rework opb_mmio_write() and opb_mmio_read() along
> the lines of:
> 
> 	sync();
> 	while (size > 3 && !(offset & 3))
> 		__in/out_be32
> 	while (size > 1 && !(offset & 1))
> 		__in/out_be16
> 	while
> (size)
> 		__in/out_8
> 
> That will provide correct semantics for all cases and limits the
> amount of locks and sync's in bulk transfers which should speed
> things up a bit.
> 

This would absolutely be of huge benefit for this work.

> Cheers,
> Ben.
> 
> 



More information about the Skiboot mailing list