From akpm@osdl.org Mon May 29 15:50:49 2006 Message-Id: <200605292250.k4TMoSCr020768@shell0.pdx.osdl.net> From: Mel Gorman Subject: PCI: 64-bit-resources-arch-powerpc-changes update To: mel@csn.ul.ie, greg@kroah.com, segher@kernel.crashing.org, vgoyal@in.ibm.com, mm-commits@vger.kernel.org Date: Mon, 29 May 2006 15:54:48 -0700 The 64-bit resource change ended up causing us to do a 64-bit divide and ppc32 won't link (missing __udivdi3). The following patch has been successfully boot tested on the same machine with 64 bit resource_size_t. Because the mask is assumed to be a power-of-two - 1, I added a comment and a BUG_ON() to be sure. Signed-off-by: Mel Gorman Cc: Segher Boessenkool Cc: Vivek Goyal Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/pci_32.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- gregkh-2.6.orig/arch/powerpc/kernel/pci_32.c +++ gregkh-2.6/arch/powerpc/kernel/pci_32.c @@ -1114,8 +1114,16 @@ check_for_io_childs(struct pci_bus *bus, int i; int rc = 0; -#define push_end(res, size) do { unsigned long __sz = (size) ; \ - res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \ + /* + * Assuming mask is a power of two - 1, push_end + * moves res->end to the end of the next + * mask-aligned boundary. + * e.g. res->end of 0x1fff moves to 0x2fff + */ +#define push_end(res, mask) do { \ + BUG_ON(((mask+1) & mask) != 0); \ + res->end = -(-res->end & ~(unsigned long)mask); \ + res->end += mask; \ } while (0) list_for_each_entry(dev, &bus->devices, bus_list) {