drivers/pci/controller/pcie-xilinx-dma-pl.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/pcie-xilinx-dma-pl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/pcie-xilinx-dma-pl.c- Extension
.c- Size
- 22603 bytes
- Lines
- 848
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/interrupt.hlinux/irq.hlinux/irqchip/irq-msi-lib.hlinux/irqdomain.hlinux/kernel.hlinux/module.hlinux/msi.hlinux/of_address.hlinux/of_pci.h../pci.hpcie-xilinx-common.h
Detected Declarations
struct xilinx_pl_dma_variantstruct xilinx_msistruct pl_dma_pcieenum xilinx_pl_dma_versionfunction pcie_readfunction pcie_writefunction xilinx_pl_dma_pcie_link_upfunction xilinx_pl_dma_pcie_clear_err_interruptsfunction xilinx_pl_dma_pcie_valid_devicefunction xilinx_pl_dma_pcie_enable_msifunction xilinx_mask_intx_irqfunction xilinx_unmask_intx_irqfunction xilinx_pl_dma_pcie_intx_mapfunction xilinx_pl_dma_pcie_msi_handler_highfunction xilinx_pl_dma_pcie_msi_handler_lowfunction xilinx_pl_dma_pcie_event_flowfunction xilinx_pl_dma_pcie_intr_handlerfunction xilinx_compose_msi_msgfunction xilinx_irq_domain_allocfunction xilinx_irq_domain_freefunction xilinx_pl_dma_pcie_free_irq_domainsfunction xilinx_pl_dma_pcie_init_msi_irq_domainfunction xilinx_pl_dma_pcie_intx_flowfunction xilinx_pl_dma_pcie_mask_event_irqfunction xilinx_pl_dma_pcie_unmask_event_irqfunction xilinx_pl_dma_pcie_event_mapfunction xilinx_pl_dma_pcie_init_irq_domainfunction xilinx_pl_dma_pcie_setup_irqfunction xilinx_pl_dma_pcie_init_portfunction xilinx_request_msi_irqfunction xilinx_pl_dma_pcie_parse_dtfunction xilinx_pl_dma_pcie_probe
Annotated Snippet
struct xilinx_pl_dma_variant {
enum xilinx_pl_dma_version version;
};
struct xilinx_msi {
unsigned long *bitmap;
struct irq_domain *dev_domain;
struct mutex lock; /* Protect bitmap variable */
int irq_msi0;
int irq_msi1;
};
/**
* struct pl_dma_pcie - PCIe port information
* @dev: Device pointer
* @reg_base: IO Mapped Register Base
* @cfg_base: IO Mapped Configuration Base
* @irq: Interrupt number
* @cfg: Holds mappings of config space window
* @phys_reg_base: Physical address of reg base
* @intx_domain: Legacy IRQ domain pointer
* @pldma_domain: PL DMA IRQ domain pointer
* @resources: Bus Resources
* @msi: MSI information
* @intx_irq: INTx error interrupt number
* @lock: Lock protecting shared register access
* @variant: PL DMA PCIe version check pointer
*/
struct pl_dma_pcie {
struct device *dev;
void __iomem *reg_base;
void __iomem *cfg_base;
int irq;
struct pci_config_window *cfg;
phys_addr_t phys_reg_base;
struct irq_domain *intx_domain;
struct irq_domain *pldma_domain;
struct list_head resources;
struct xilinx_msi msi;
int intx_irq;
raw_spinlock_t lock;
const struct xilinx_pl_dma_variant *variant;
};
static inline u32 pcie_read(struct pl_dma_pcie *port, u32 reg)
{
if (port->variant->version == QDMA)
return readl(port->reg_base + reg + QDMA_BRIDGE_BASE_OFF);
return readl(port->reg_base + reg);
}
static inline void pcie_write(struct pl_dma_pcie *port, u32 val, u32 reg)
{
if (port->variant->version == QDMA)
writel(val, port->reg_base + reg + QDMA_BRIDGE_BASE_OFF);
else
writel(val, port->reg_base + reg);
}
static inline bool xilinx_pl_dma_pcie_link_up(struct pl_dma_pcie *port)
{
return (pcie_read(port, XILINX_PCIE_DMA_REG_PSCR) &
XILINX_PCIE_DMA_REG_PSCR_LNKUP) ? true : false;
}
static void xilinx_pl_dma_pcie_clear_err_interrupts(struct pl_dma_pcie *port)
{
unsigned long val = pcie_read(port, XILINX_PCIE_DMA_REG_RPEFR);
if (val & XILINX_PCIE_DMA_RPEFR_ERR_VALID) {
dev_dbg(port->dev, "Requester ID %lu\n",
val & XILINX_PCIE_DMA_RPEFR_REQ_ID);
pcie_write(port, XILINX_PCIE_DMA_RPEFR_ALL_MASK,
XILINX_PCIE_DMA_REG_RPEFR);
}
}
static bool xilinx_pl_dma_pcie_valid_device(struct pci_bus *bus,
unsigned int devfn)
{
struct pl_dma_pcie *port = bus->sysdata;
if (!pci_is_root_bus(bus)) {
/*
* Checking whether the link is up is the last line of
* defense, and this check is inherently racy by definition.
* Sending a PIO request to a downstream device when the link is
* down causes an unrecoverable error, and a reset of the entire
* PCIe controller will be needed. We can reduce the likelihood
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqchip/irq-msi-lib.h`, `linux/irqdomain.h`, `linux/kernel.h`, `linux/module.h`, `linux/msi.h`.
- Detected declarations: `struct xilinx_pl_dma_variant`, `struct xilinx_msi`, `struct pl_dma_pcie`, `enum xilinx_pl_dma_version`, `function pcie_read`, `function pcie_write`, `function xilinx_pl_dma_pcie_link_up`, `function xilinx_pl_dma_pcie_clear_err_interrupts`, `function xilinx_pl_dma_pcie_valid_device`, `function xilinx_pl_dma_pcie_enable_msi`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.