Commit 7eb48d73 authored by Jerome Brunet's avatar Jerome Brunet Committed by Greg Kroah-Hartman
Browse files

UPSTREAM: PCI: endpoint: Retain fixed-size BAR size as well as aligned size



[ Upstream commit 793908d6 ]

When allocating space for an endpoint function on a BAR with a fixed size,
the size saved in 'struct pci_epf_bar.size' should be the fixed size as
expected by pci_epc_set_bar().

However, if pci_epf_alloc_space() increased the allocation size to
accommodate iATU alignment requirements, it previously saved the larger
aligned size in .size, which broke pci_epc_set_bar().

To solve this, keep the fixed BAR size in .size and save the aligned size
in a new .aligned_size for use when deallocating it.

Fixes: 2a9a8016 ("PCI: endpoint: Add support to specify alignment for buffers allocated to BARs")
Change-Id: I03a683211138a36107ac3aa0c9a2c5c5f3437db6
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
[mani: commit message fixup]
Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
[bhelgaas: more specific subject, commit log, wrap comment to match file]
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20250424-pci-ep-size-alignment-v5-1-2d4ec2af23f5@baylibre.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit 0a3e2ec5)
Bug: 437846539
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent d1b84a3c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment