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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 09, 2024 at 09:36:01AM -0400, Stewart Hildebrand wrote:
> Currently, it's not possible to use the IORESOURCE_STARTALIGN flag on
> x86 due to the alignment being overwritten in
> pcibios_allocate_dev_resources(). Make one small change in arch/x86 to
> make it work on x86.

Is this a regression?  I didn't look up when IORESOURCE_STARTALIGN was
added, but likely it was for some situation on x86, so presumably it
worked at one time.  If something broke it in the meantime, it would
be nice to identify the commit that broke it.

Nit: follow the subject line conventions for this and the other
patches.  Learn them with "git log --oneline".  For this patch,
"x86/PCI: <Capitalized text>" is appropriate.

> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> ---
> RFC: We don't have enough info in this function to re-calculate the
>      alignment value in case of IORESOURCE_STARTALIGN. Luckily our
>      alignment value seems to be intact, so just don't touch it...
>      Alternatively, we could call pci_reassigndev_resource_alignment()
>      after the loop. Would that be preferable?
> ---
>  arch/x86/pci/i386.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> 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;
> +						}
>  					}
>  				}
>  			}
> -- 
> 2.45.2
> 




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux