[PATCH v7 01/23] PCI: endpoint: Add EP core layer to enable EP controller and EP functions

Bjorn Helgaas helgaas at kernel.org
Tue Dec 13 15:44:42 PST 2022


On Mon, Apr 10, 2017 at 07:25:10PM +0530, Kishon Vijay Abraham I wrote:
> Introduce a new EP core layer in order to support endpoint functions in
> linux kernel. This comprises the EPC library (Endpoint Controller Library)
> and EPF library (Endpoint Function Library). EPC library implements
> functions specific to an endpoint controller and EPF library implements
> functions specific to an endpoint function.

> +void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar)
> +{
> +	void *space;
> +	struct device *dev = &epf->dev;
> +	dma_addr_t phys_addr;
> +
> +	if (size < 128)
> +		size = 128;
> +	size = roundup_pow_of_two(size);
> +
> +	space = dma_alloc_coherent(dev, size, &phys_addr, GFP_KERNEL);
> +	if (!space) {
> +		dev_err(dev, "failed to allocate mem space\n");
> +		return NULL;
> +	}
> +
> +	epf->bar[bar].phys_addr = phys_addr;

> + * struct pci_epf_bar - represents the BAR of EPF device
> + * @phys_addr: physical address that should be mapped to the BAR
> + * @size: the size of the address space present in BAR
> + */
> +struct pci_epf_bar {
> +	dma_addr_t	phys_addr;

If this "phys_addr" is an address that can appear on the PCI bus, is
"phys_addr" a misnomer?  Many drivers use dma, dmabuf, bus_addr, etc.

Bjorn



More information about the linux-arm-kernel mailing list