PCI: endpoint: pci-epf-vntb: Simplify ctrl/SPAD space allocation
authorJerome Brunet <jbrunet@baylibre.com>
Thu, 24 Apr 2025 08:34:05 +0000 (10:34 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 28 May 2025 21:47:37 +0000 (16:47 -0500)
commite5327a655636e2ffb93d65f44777d9481aab3715
tree05cc08873c3af1437d76ac1c282184ae30d9695f
parent793908d60b8745c386b9f4e29eb702f74ceb0886
PCI: endpoint: pci-epf-vntb: Simplify ctrl/SPAD space allocation

When allocating the shared ctrl/SPAD space, epf_ntb_config_spad_bar_alloc()
should not try to handle the size quirks for underlying BAR, whether it is
fixed size or alignment. This is already handled by pci_epf_alloc_space().

Also, when handling the alignment, this allocates more space than
necessary. For example, with a SPAD size of 1024B and a ctrl size of 308B,
the space necessary is 1332B. If the alignment is 1MB,
epf_ntb_config_spad_bar_alloc() tries to allocate 2MB where 1MB would have
been more than enough.

Drop the handling of the BAR size quirks and let pci_epf_alloc_space()
handle that. Just make sure the 32bits SPAD register are aligned on 32bits.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250424-pci-ep-size-alignment-v5-2-2d4ec2af23f5@baylibre.com
drivers/pci/endpoint/functions/pci-epf-vntb.c