linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] PCI: Align small (<4k) BARs
@ 2024-07-16 19:32 Stewart Hildebrand
  2024-07-16 19:32 ` [PATCH v2 1/8] x86/PCI: Move some logic to new function Stewart Hildebrand
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Stewart Hildebrand @ 2024-07-16 19:32 UTC (permalink / raw)
  To: Bjorn Helgaas, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Thomas Zimmermann, Arnd Bergmann,
	Sam Ravnborg, Yongji Xie, Ilpo Järvinen
  Cc: Stewart Hildebrand, x86, linux-pci, linux-kernel, linuxppc-dev

This series sets the default minimum resource alignment to 4k for memory
BARs. In preparation, it makes an optimization and addresses some corner
cases observed when reallocating BARs. I consider the prepapatory
patches to be prerequisites to changing the default BAR alignment.

I considered introducing checks for the specific scenarios described,
but chose not to pursue this. A check such as "if (xen_domain())" may be
pretty simple, but that doesn't account for other hypervisors. If other
hypervisors are to be considered, or if we try to dynamically reallocate
BARs for devices being marked for passthrough, such a check may quickly
grow unwieldy. Further, checking for the MSI-X tables residing in a
small (<4k) BAR is unlikely to be a one-liner. Making 4k alignment the
default seems more robust. Lastly, when using IORESOURCE_STARTALIGN, all
resources in the system need to be aligned.

I considered alternatively adding new functionality to the
pci=resource_alignment= option, but that approach was already attempted
and decided against [1].

[1] https://lore.kernel.org/linux-pci/1473757234-5284-4-git-send-email-xyjxie@linux.vnet.ibm.com/

v1->v2:
* rename ("PCI: don't clear already cleared bit") to
  ("PCI: Don't unnecessarily disable memory decoding")
* new patch: ("x86/PCI: Move some logic to new function")
* new patch: ("powerpc/pci: Preserve IORESOURCE_STARTALIGN alignment")

Stewart Hildebrand (8):
  x86/PCI: Move some logic to new function
  PCI: Don't unnecessarily disable memory decoding
  PCI: Restore resource alignment
  PCI: Restore memory decoding after reallocation
  x86/PCI: Preserve IORESOURCE_STARTALIGN alignment
  powerpc/pci: Preserve IORESOURCE_STARTALIGN alignment
  PCI: Don't reassign resources that are already aligned
  PCI: Align small (<4k) BARs

 arch/powerpc/kernel/pci-common.c |  6 +++--
 arch/x86/pci/i386.c              | 38 +++++++++++++++------------
 drivers/pci/pci.c                | 43 +++++++++++++++++++++++--------
 drivers/pci/setup-bus.c          | 44 ++++++++++++++++++++++++++++++++
 include/linux/pci.h              |  2 ++
 5 files changed, 103 insertions(+), 30 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-07-18 14:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 19:32 [PATCH v2 0/8] PCI: Align small (<4k) BARs Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 1/8] x86/PCI: Move some logic to new function Stewart Hildebrand
2024-07-17 19:28   ` Philipp Stanner
2024-07-18 14:54     ` Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 2/8] PCI: Don't unnecessarily disable memory decoding Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 3/8] PCI: Restore resource alignment Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 4/8] PCI: Restore memory decoding after reallocation Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 5/8] x86/PCI: Preserve IORESOURCE_STARTALIGN alignment Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 6/8] powerpc/pci: " Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 7/8] PCI: Don't reassign resources that are already aligned Stewart Hildebrand
2024-07-16 19:32 ` [PATCH v2 8/8] PCI: Align small (<4k) BARs Stewart Hildebrand
2024-07-17 13:15 ` [PATCH v2 0/8] " David Laight
2024-07-17 13:21   ` David Laight
2024-07-17 18:30   ` Stewart Hildebrand
2024-07-18 10:01     ` David Laight
2024-07-18 13:48       ` Stewart Hildebrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).