[PATCH] GICv3: Fixing 32 bit compatibility

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Sep 9 02:19:12 PDT 2014


On Tue, Sep 09, 2014 at 11:12:01AM +0200, Robert Richter wrote:
> On 09.09.14 10:00:42, Uwe Kleine-König wrote:
> > On Mon, Sep 08, 2014 at 04:11:19PM +0200, Robert Richter wrote:
> 
> > > @@ -479,7 +479,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
> > >     smp_wmb();
> > >  
> > >     for_each_cpu_mask(cpu, *mask) {
> > > -           u64 cluster_id = cpu_logical_map(cpu) & ~0xffUL;
> > > +           u64 cluster_id = cpu_logical_map(cpu) & ~0xffULL;
> > This doesn't change anything, does it?
> 
> It does, not in 64 bit but in 32 bit there unsigned long is 32
> bit. So, bit masks are broken if you compile a 32 bit kernel.
Can you make an example where the result actually changes?

> > I wonder if it would be cleaner to use (u64)0xff here.
> 
> No, that's ULL for. This is commonly used in x86 too.
I don't care much here, but I'd say ULL is to force an unsigned long
long. If you want to make it obvious that you want a 64bit value, a cast
to u64 makes this more clear.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the linux-arm-kernel mailing list