Re: Possible PCI subsystem bug in 2.4

From: Rogier Wolff (R.E.Wolff@BitWizard.nl)
Date: Fri May 04 2001 - 06:34:11 EST


Linus Torvalds wrote:
>
> On Thu, 3 May 2001, Alan Cox wrote:
> >
> > Obvious one is to go to the next power of two clear.
>
> The question is mainly _which_ power of two.
>
> I don't think we can round up infinitely, as that might just end up
> causing us to not have any PCI space at all. Or we could end up deciding
> that real PCI space is memory, and then getting a clash when a real device
> tries to register its bios-allocated area that clashes with our extreme
> rounding.
>
> I suspect it would be safe to round up to the next megabyte, possibly up
> to 64MB or so. But much more would make me nervous.
>
> Any suggestions?

The amount of RAM in a machine almost always has just one or two "1"
bits.

8, 16, 20, 24, 32, 36, 40, 48, 64, 80 Mb were the numbers that you'd
see in the early Pentium times, right?

So rounding up would mean: Add one until the number of 1-bits in the
address is less than 3. People with 3 or more differently sized DIMMS
in their machine will experience a slightly ineffcient round-up.

Speed this up with: Find-lowest-1-bit, add that.

Example you quoted:
                                                nr of 1 bits.
BIOS-proclaimed end-of-ram: 0x13fff0000 15
lowest 1-bit: 0x000010000 1
add: 0x140000000 2

long round_highmem (long val)
{
        while (hweight32 (val) > 2)
                val += 1 << ffs (val);
        return val;
}

                Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots. 
* There are also old, bald pilots. 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 07 2001 - 21:00:19 EST