Re: [PATCH v8 4/6] x86/PCI: Enable a 64bit BAR on AMD Family 15h (Models 30h-3fh) Processors v4

From: Andy Shevchenko
Date: Tue Jul 11 2017 - 13:50:33 EST


On Tue, Jul 11, 2017 at 3:07 PM, kbuild test robot <lkp@xxxxxxxxx> wrote:

> make ARCH=i386

Yeah, either this code shouldn't have been built on 32-bit arch at
all, or be portable.

> arch/x86/pci/fixup.c: In function 'pci_amd_enable_64bit_bar':
>>> arch/x86/pci/fixup.c:674:15: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> res->start = 0x100000000ull;
> ^~~~~~~~~~~~~~
> arch/x86/pci/fixup.c:675:13: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> res->end = 0xfd00000000ull - 1;
> ^~~~~~~~~~~~~~~
>>> arch/x86/pci/fixup.c:686:22: warning: right shift count >= width of type [-Wshift-count-overflow]

I suppose explicit casting will help.

> high = ((res->start >> 40) & AMD_141b_MMIO_HIGH_MMIOBASE_MASK) |
> ^~
> arch/x86/pci/fixup.c:687:21: warning: right shift count >= width of type [-Wshift-count-overflow]
> ((((res->end + 1) >> 40) << AMD_141b_MMIO_HIGH_MMIOLIMIT_SHIFT)
> ^~

These can be done via upper_32_bits() + shift.

--
With Best Regards,
Andy Shevchenko