From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Stewart Hildebrand <stewart.hildebrand@amd.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-pci@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 4/6] x86: PCI: preserve IORESOURCE_STARTALIGN alignment
Date: Wed, 10 Jul 2024 17:05:43 +0300 (EEST) [thread overview]
Message-ID: <22e339c1-0ada-0824-cd34-d5779328b522@linux.intel.com> (raw)
In-Reply-To: <20240709133610.1089420-5-stewart.hildebrand@amd.com>
On Tue, 9 Jul 2024, 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.
>
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> ---
> 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;
> + }
> }
> }
> }
>
As a general comment to that loop in pcibios_allocate_dev_resources()
function, it would be nice to reverse some of the logic in the if
conditions and use continue to limit the runaway indentation level.
--
i.
next prev parent reply other threads:[~2024-07-10 14:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 13:35 [PATCH 0/6] PCI: align small (<4k) BARs Stewart Hildebrand
2024-07-09 13:35 ` [PATCH 1/6] PCI: don't clear already cleared bit Stewart Hildebrand
2024-07-09 13:35 ` [PATCH 2/6] PCI: restore resource alignment Stewart Hildebrand
2024-07-09 13:36 ` [PATCH 3/6] PCI: restore memory decoding after reallocation Stewart Hildebrand
2024-07-09 16:16 ` Bjorn Helgaas
2024-07-10 20:31 ` Stewart Hildebrand
2024-07-09 13:36 ` [RFC PATCH 4/6] x86: PCI: preserve IORESOURCE_STARTALIGN alignment Stewart Hildebrand
2024-07-09 16:19 ` Bjorn Helgaas
2024-07-10 16:16 ` Stewart Hildebrand
2024-07-10 21:24 ` Bjorn Helgaas
2024-07-10 22:49 ` Stewart Hildebrand
2024-07-11 18:40 ` Bjorn Helgaas
2024-07-11 18:58 ` Stewart Hildebrand
2024-07-11 20:35 ` Bjorn Helgaas
2024-07-15 17:26 ` Stewart Hildebrand
2024-07-10 14:05 ` Ilpo Järvinen [this message]
2024-07-15 17:30 ` Stewart Hildebrand
2024-07-09 13:36 ` [PATCH 5/6] PCI: don't reassign resources that are already aligned Stewart Hildebrand
2024-07-09 13:36 ` [PATCH 6/6] PCI: align small (<4k) BARs Stewart Hildebrand
2024-07-09 16:21 ` Bjorn Helgaas
2024-07-10 16:35 ` Stewart Hildebrand
2024-07-10 13:56 ` Ilpo Järvinen
2024-07-10 16:28 ` Stewart Hildebrand
2024-07-10 23:26 ` [PATCH 0/6] " Stewart Hildebrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22e339c1-0ada-0824-cd34-d5779328b522@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=stewart.hildebrand@amd.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.