Re: [RFC PATCH 4/6] x86: PCI: preserve IORESOURCE_STARTALIGN alignment

From: Stewart Hildebrand
Date: Mon Jul 15 2024 - 13:26:34 EST


On 7/10/24 17:24, Bjorn Helgaas wrote:
> On Wed, Jul 10, 2024 at 12:16:24PM -0400, Stewart Hildebrand wrote:
>> On 7/9/24 12:19, Bjorn Helgaas wrote:
>>> On Tue, Jul 09, 2024 at 09:36:01AM -0400, Stewart Hildebrand wrote:
>>>> diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
>>>> index f2f4a5d50b27..ff6e61389ec7 100644
>>>> --- a/arch/x86/pci/i386.c
>>>> +++ b/arch/x86/pci/i386.c
>>>> @@ -283,8 +283,11 @@ static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
>>>> /* We'll assign a new address later */
>>>> pcibios_save_fw_addr(dev,
>>>> idx, r->start);
>>>> - r->end -= r->start;
>>>> - r->start = 0;
>>>> + if (!(r->flags &
>>>> + IORESOURCE_STARTALIGN)) {
>>>> + r->end -= r->start;
>>>> + r->start = 0;
>>>> + }
>
> I wondered why this only touched x86 and whether other arches need a
> similar change. This is used in two paths:
>
> 1) pcibios_resource_survey_bus(), which is only implemented by x86
>
> 2) pcibios_resource_survey(), which is implemented by x86 and
> powerpc. The powerpc pcibios_allocate_resources() is similar to the
> x86 pcibios_allocate_dev_resources(), but powerpc doesn't have the
> r->end and r->start updates you're making conditional.

Actually it does. It's in a separate function, alloc_resource(). I'll
make the change over there too.

> So it looks like x86 is indeed the only place that needs this change.
> None of this stuff is arch-specific, so it's a shame that we don't
> have generic code for it all. Sigh, oh well.
>
>>>> }
>>>> }
>>>> }
>>>> --
>>>> 2.45.2
>>>>
>>