On Fri, Apr 27, 2018 at 12:14 PM, Richard Henderson <
richard.hender...@linaro.org> wrote:
> On 04/25/2018 01:45 PM, Michael Clark wrote:
> > +uint32_t old, new;
> > +do {
> > +old = atomic_read(&plic->pending[word]);
> > +new = (old & ~(1 << (irq & 31))) | (-!!pending & (1
On 04/25/2018 01:45 PM, Michael Clark wrote:
> +uint32_t old, new;
> +do {
> +old = atomic_read(&plic->pending[word]);
> +new = (old & ~(1 << (irq & 31))) | (-!!pending & (1 << (irq & 31)));
> +} while (atomic_cmpxchg(&plic->pending[word], old, new) != old);
I prefer
The PLIC previously used a mutex to protect against concurrent
access to the claimed and pending bitfields. Instead of using
a mutex, we update the bitfields using atomic_cmpxchg.
Rename sifive_plic_num_irqs_pending to sifive_plic_irqs_pending
and add an early out if any interrupts are pending as