Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: endpoint: Describe reserved subregions within BARs

Some endpoint controllers expose platform-owned, fixed register windows
within a BAR that EPF drivers must not reprogram (e.g. a BAR marked
BAR_RESERVED). Even in that case, EPF drivers may need to reference a
well-defined subset of that BAR, e.g. to reuse an integrated DMA
controller MMIO window as a doorbell target.

Introduce struct pci_epc_bar_rsvd_region and extend struct
pci_epc_bar_desc so EPC drivers can advertise such fixed subregions in a
controller-agnostic way.

No functional change for existing users.

Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Tested-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Tested-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260312130229.2282001-15-cassel@kernel.org

authored by

Koichiro Den and committed by
Manivannan Sadhasivam
f51644eb 27ce1d8e

+28
+28
include/linux/pci-epc.h
··· 201 201 }; 202 202 203 203 /** 204 + * enum pci_epc_bar_rsvd_region_type - type of a fixed subregion behind a BAR 205 + * @PCI_EPC_BAR_RSVD_DMA_CTRL_MMIO: Integrated DMA controller MMIO window 206 + * 207 + * BARs marked BAR_RESERVED are owned by the SoC/EPC hardware and must not be 208 + * reprogrammed by EPF drivers. Some of them still expose fixed subregions that 209 + * EPFs may want to reference (e.g. embedded doorbell fallback). 210 + */ 211 + enum pci_epc_bar_rsvd_region_type { 212 + PCI_EPC_BAR_RSVD_DMA_CTRL_MMIO = 0, 213 + }; 214 + 215 + /** 216 + * struct pci_epc_bar_rsvd_region - fixed subregion behind a BAR 217 + * @type: reserved region type 218 + * @offset: offset within the BAR aperture 219 + * @size: size of the reserved region 220 + */ 221 + struct pci_epc_bar_rsvd_region { 222 + enum pci_epc_bar_rsvd_region_type type; 223 + resource_size_t offset; 224 + resource_size_t size; 225 + }; 226 + 227 + /** 204 228 * struct pci_epc_bar_desc - hardware description for a BAR 205 229 * @type: the type of the BAR 206 230 * @fixed_size: the fixed size, only applicable if type is BAR_FIXED_MASK. 207 231 * @only_64bit: if true, an EPF driver is not allowed to choose if this BAR 208 232 * should be configured as 32-bit or 64-bit, the EPF driver must 209 233 * configure this BAR as 64-bit. 234 + * @nr_rsvd_regions: number of fixed subregions described for BAR_RESERVED 235 + * @rsvd_regions: fixed subregions behind BAR_RESERVED 210 236 */ 211 237 struct pci_epc_bar_desc { 212 238 enum pci_epc_bar_type type; 213 239 u64 fixed_size; 214 240 bool only_64bit; 241 + u8 nr_rsvd_regions; 242 + const struct pci_epc_bar_rsvd_region *rsvd_regions; 215 243 }; 216 244 217 245 /**