summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2025-04-24 11:34:04 +0300
committerBjorn Helgaas <bhelgaas@google.com>2025-05-29 00:15:40 +0300
commit793908d60b8745c386b9f4e29eb702f74ceb0886 (patch)
tree88aa24dfd322766c023c5299a302d23e357515a9 /include/linux
parent0af2f6be1b4281385b618cb86ad946eded089ac8 (diff)
downloadlinux-793908d60b8745c386b9f4e29eb702f74ceb0886.tar.xz
PCI: endpoint: Retain fixed-size BAR size as well as aligned size
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: 2a9a801620ef ("PCI: endpoint: Add support to specify alignment for buffers allocated to BARs") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> [mani: commit message fixup] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> [bhelgaas: more specific subject, commit log, wrap comment to match file] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Niklas Cassel <cassel@kernel.org> Link: https://patch.msgid.link/20250424-pci-ep-size-alignment-v5-1-2d4ec2af23f5@baylibre.com
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pci-epf.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 879d19cebd4f..749cee0bcf2c 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -114,6 +114,8 @@ struct pci_epf_driver {
* @phys_addr: physical address that should be mapped to the BAR
* @addr: virtual address corresponding to the @phys_addr
* @size: the size of the address space present in BAR
+ * @aligned_size: the size actually allocated to accommodate the iATU alignment
+ * requirement
* @barno: BAR number
* @flags: flags that are set for the BAR
*/
@@ -121,6 +123,7 @@ struct pci_epf_bar {
dma_addr_t phys_addr;
void *addr;
size_t size;
+ size_t aligned_size;
enum pci_barno barno;
int flags;
};