On Fri, 2018-06-29 at 17:34 +1000, Russell Currey wrote: <snip>
> + /* > + * The TCE isn't being used, so let's try and > allocate it. > + * Bits 0 and 1 are read/write, and we use bit 2 as > a "lock" > + * bit. This is to prevent any race where the value > is set in > + * the TCE table but the invalidate/mb() hasn't > finished yet. > + */ > + entry = cpu_to_be64((addr - offset) | 7); > + ret = cmpxchg(&pe->tces[i], tce, entry); > + if (ret != tce) { > + /* conflict, start looking again just in > case */ > + i--; > + continue; > + } > + pnv_pci_phb3_tce_invalidate(pe, 0, 0, addr - offset, > 1); This is wrong and won't work outside of PHB3, will make a generic handler > + mb(); > + /* clear the lock bit now that we know it's active > */ > + ret = cmpxchg(&pe->tces[i], entry, cpu_to_be64((addr > - offset) | 3)); > + if (ret != entry) { > + /* conflict, start looking again just in > case */ > + i--; > + continue; > + } > + > + return (i << phb->ioda.max_tce_order) | offset; > + } > + /* If we get here, the table must be full, so error out. */ > + return -1ULL; > +} > +
qtpass.desktop
Description: application/desktop