public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
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>,
	"Yongji Xie" <elohimes@gmail.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	x86@kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 5/8] x86/PCI: Preserve IORESOURCE_STARTALIGN alignment
Date: Thu, 8 Aug 2024 15:10:48 -0500	[thread overview]
Message-ID: <20240808201048.GA157414@bhelgaas> (raw)
In-Reply-To: <20240807151723.613742-6-stewart.hildebrand@amd.com>

On Wed, Aug 07, 2024 at 11:17:14AM -0400, Stewart Hildebrand wrote:
> There is a corner case in pcibios_allocate_dev_resources() where the
> IORESOURCE_STARTALIGN alignment of memory BAR resources gets
> overwritten. This does not affect bridge resources. The corner case is
> not yet possible to trigger on x86, but it will be possible once the
> default resource alignment changes, and memory BAR resources will start
> to use IORESOURCE_STARTALIGN. 

I see from [8/8] that "Changing pcibios_default_alignment() results in
the second method of alignment with IORESOURCE_STARTALIGN", but that
connection is not at all obvious, and there's no patch in this series
that sets IORESOURCE_STARTALIGN, so it's kind of hard to connect all
the dots here.

The only caller of pcibios_default_alignment() is
pci_specified_resource_alignment(), and that doesn't mention
IORESOURCE_STARTALIGN either.

Neither does pcibios_allocate_dev_resources().

I feel like we've had this conversation before; apologies if so.  But
we need to figure out to make this more explicit and less magic.

> Account for IORESOURCE_STARTALIGN in
> preparation for changing the default resource alignment.
> 
> Skip the pcibios_save_fw_addr() call since the resource doesn't contain
> a valid address when alignment has been requested. The impact of this is
> that we won't be able to restore the firmware allocated BAR, which does
> not meet alignment requirements anyway.
> 
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> ---
> v2->v3:
> * no change
> 
> v1->v2:
> * capitalize subject text
> * clarify commit message
> * skip pcibios_save_fw_addr() call
> ---
>  arch/x86/pci/i386.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
> index 3abd55902dbc..13d7f7ac3bde 100644
> --- a/arch/x86/pci/i386.c
> +++ b/arch/x86/pci/i386.c
> @@ -256,7 +256,7 @@ static void alloc_resource(struct pci_dev *dev, int idx, int pass)
>  		if (r->flags & IORESOURCE_PCI_FIXED) {
>  			dev_info(&dev->dev, "BAR %d %pR is immovable\n",
>  				 idx, r);
> -		} else {
> +		} else if (!(r->flags & IORESOURCE_STARTALIGN)) {
>  			/* We'll assign a new address later */
>  			pcibios_save_fw_addr(dev, idx, r->start);
>  			r->end -= r->start;
> -- 
> 2.46.0
> 

  reply	other threads:[~2024-08-08 20:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 15:17 [PATCH v3 0/8] PCI: Align small BARs Stewart Hildebrand
2024-08-07 15:17 ` [PATCH v3 1/8] x86/PCI: Improve code readability Stewart Hildebrand
2024-08-08  8:55   ` Ilpo Järvinen
2024-08-07 15:17 ` [PATCH v3 2/8] PCI: Don't unnecessarily disable memory decoding Stewart Hildebrand
2024-08-07 15:17 ` [PATCH v3 3/8] PCI: Restore resource alignment Stewart Hildebrand
2024-08-08 19:28   ` Bjorn Helgaas
2024-08-08 20:28     ` Stewart Hildebrand
2024-08-08 21:54       ` Bjorn Helgaas
2024-08-14 18:12         ` Stewart Hildebrand
2024-08-07 15:17 ` [PATCH v3 4/8] PCI: Restore memory decoding after reallocation Stewart Hildebrand
2024-08-08 19:37   ` Bjorn Helgaas
2024-08-14 18:31     ` Stewart Hildebrand
2024-08-07 15:17 ` [PATCH v3 5/8] x86/PCI: Preserve IORESOURCE_STARTALIGN alignment Stewart Hildebrand
2024-08-08 20:10   ` Bjorn Helgaas [this message]
2024-08-07 15:17 ` [PATCH v3 6/8] powerpc/pci: " Stewart Hildebrand
2024-08-07 15:17 ` [PATCH v3 7/8] PCI: Don't reassign resources that are already aligned Stewart Hildebrand
2024-08-07 15:17 ` [PATCH v3 8/8] PCI: Align small BARs Stewart Hildebrand
2024-08-08 21:53   ` Bjorn Helgaas
2024-08-14 13:55     ` Stewart Hildebrand
2024-08-14 22:05       ` Bjorn Helgaas
2024-08-07 15:42 ` [PATCH v3 0/8] " Arnd Bergmann

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=20240808201048.GA157414@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=elohimes@gmail.com \
    --cc=hpa@zytor.com \
    --cc=ilpo.jarvinen@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox