qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] hw/intc: sifive_plic: change interrupt priority regis


From: Jim Shu
Subject: Re: [PATCH v2 2/2] hw/intc: sifive_plic: change interrupt priority register to WARL field
Date: Mon, 3 Oct 2022 12:13:26 +0800

Hi Clément,

> > > @@ -180,7 +180,15 @@ static void sifive_plic_write(void *opaque, hwaddr 
> > > addr, uint64_t value,
> > >      if (addr_between(addr, plic->priority_base, plic->num_sources << 2)) 
> > > {
> > >          uint32_t irq = ((addr - plic->priority_base) >> 2) + 1;
> > >
> > > -        if (value <= plic->num_priorities) {
> > > +        if ((plic->num_priorities + 1) & (plic->num_priorities)) {
> >
> > That's the opposite. If n is a power of 2, n & (n-1) == 0 (eg 8 & 7 ==
> >  0, 9 & 8 == 8).
> > Note that n must be positive too. But I'm not sure it matters here.
> > I'll let you decide.
> >

num_priorities is a uint32_t variable so that n is always positive.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]