History

Merge branch 'remotes/lorenzo/pci/endpoint'

- Use notification chain instead of EPF linkup ops for EPC events (Kishon Vijay Abraham I) - Protect concurrent allocation in endpoint outbound address region (Kishon Vijay Abraham I) - Protect concurrent access to pci_epf_ops (Kishon Vijay Abraham I) - Assign function number for each PF in endpoint core (Kishon Vijay Abraham I) - Refactor endpoint mode core initialization (Vidya Sagar) - Add API to notify when core initialization completes (Vidya Sagar) - Add test framework support to defer core initialization (Vidya Sagar) - Update Tegra SoC ABI header to support uninitialization of UPHY PLL when in endpoint mode without reference clock (Vidya Sagar) - Add DT and driver support for Tegra194 PCIe endpoint nodes (Vidya Sagar) - Add endpoint test support for DMA data transfer (Kishon Vijay Abraham I) - Print throughput information in endpoint test (Kishon Vijay Abraham I) - Use streaming DMA APIs for endpoint test buffer allocation (Kishon Vijay Abraham I) - Add endpoint test command line option for DMA (Kishon Vijay Abraham I) - When stopping a controller via configfs, clear endpoint "start" entry to prevent WARN_ON (Kunihiko Hayashi) - Update endpoint ->set_msix() to pay attention to MSI-X BAR Indicator and offset when finding MSI-X tables (Kishon Vijay Abraham I) - MSI-X tables are in local memory, not in the PCI address space. Update pcie-designware-ep to account for this (Kishon Vijay Abraham I) - Allow AM654 PCIe Endpoint to raise MSI-X interrupts (Kishon Vijay Abraham I) - Avoid using module parameter to determine irqtype for endpoint test (Kishon Vijay Abraham I) - Add ioctl to clear IRQ for endpoint test (Kishon Vijay Abraham I) - Add endpoint test 'e' option to clear IRQ (Kishon Vijay Abraham I) - Bump limit on number of endpoint test devices from 10 to 10,000 (Kishon Vijay Abraham I) - Use full pci-endpoint-test name in request_irq() for easier profiling (Kishon Vijay Abraham I) - Reduce log level of -EPROBE_DEFER error messages to debug (Thierry Reding) * remotes/lorenzo/pci/endpoint: misc: pci_endpoint_test: remove duplicate macro PCI_ENDPOINT_TEST_STATUS PCI: tegra: Print -EPROBE_DEFER error message at debug level misc: pci_endpoint_test: Use full pci-endpoint-test name in request_irq() misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices tools: PCI: Add 'e' to clear IRQ misc: pci_endpoint_test: Add ioctl to clear IRQ misc: pci_endpoint_test: Avoid using module parameter to determine irqtype PCI: keystone: Allow AM654 PCIe Endpoint to raise MSI-X interrupt PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get correct MSI-X table address PCI: endpoint: Fix ->set_msix() to take BIR and offset as arguments misc: pci_endpoint_test: Add support to get DMA option from userspace tools: PCI: Add 'd' command line option to support DMA misc: pci_endpoint_test: Use streaming DMA APIs for buffer allocation PCI: endpoint: functions/pci-epf-test: Print throughput information PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data PCI: endpoint: Fix clearing start entry in configfs PCI: tegra: Add support for PCIe endpoint mode in Tegra194 dt-bindings: PCI: tegra: Add DT support for PCIe EP nodes in Tegra194 soc/tegra: bpmp: Update ABI header PCI: pci-epf-test: Add support to defer core initialization PCI: dwc: Add API to notify core initialization completion PCI: endpoint: Add notification for core init completion PCI: dwc: Refactor core initialization code for EP mode PCI: endpoint: Add core init notifying feature PCI: endpoint: Assign function number for each PF in EPC core PCI: endpoint: Protect concurrent access to pci_epf_ops with mutex PCI: endpoint: Fix for concurrent memory allocation in OB address region PCI: endpoint: Replace spinlock with mutex PCI: endpoint: Use notification chain mechanism to notify EPC events to EPF

Bjorn Helgaas committed 6 years ago

Commit b16f2ab2 parents cc36a45 e48ba3e17 files · +1655 −308Browse files

Showing the changes to include/linux (2 of 17 files). Show all

Unified · Split

2 files
  1. include/linux/pci-epc.h +22 −5
  2. include/linux/pci-epf.h +25 −4
include/linux/pci-epc.h+22−5
@@ -53,7 +53,8 @@ struct pci_epc_ops { · 52 unmodified lines
53 phys_addr_t addr);53 phys_addr_t addr);
54 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);54 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);
55 int (*get_msi)(struct pci_epc *epc, u8 func_no);55 int (*get_msi)(struct pci_epc *epc, u8 func_no);
56 int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts);56 int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts,
57 enum pci_barno, u32 offset);
57 int (*get_msix)(struct pci_epc *epc, u8 func_no);58 int (*get_msix)(struct pci_epc *epc, u8 func_no);
58 int (*raise_irq)(struct pci_epc *epc, u8 func_no,59 int (*raise_irq)(struct pci_epc *epc, u8 func_no,
59 enum pci_epc_irq_type type, u16 interrupt_num);60 enum pci_epc_irq_type type, u16 interrupt_num);
@@ -71,6 +72,7 @@ struct pci_epc_ops { · 11 unmodified lines
71 * @bitmap: bitmap to manage the PCI address space72 * @bitmap: bitmap to manage the PCI address space
72 * @pages: number of bits representing the address region73 * @pages: number of bits representing the address region
73 * @page_size: size of each page74 * @page_size: size of each page
75 * @lock: mutex to protect bitmap
74 */76 */
75struct pci_epc_mem {77struct pci_epc_mem {
76 phys_addr_t phys_base;78 phys_addr_t phys_base;
@@ -78,6 +80,8 @@ struct pci_epc_mem { · 1 unmodified line
78 unsigned long *bitmap;80 unsigned long *bitmap;
79 size_t page_size;81 size_t page_size;
80 int pages;82 int pages;
83 /* mutex to protect against concurrent access for memory allocation*/
84 struct mutex lock;
81};85};
82 86
83/**87/**
@@ -88,7 +92,9 @@ struct pci_epc_mem { · 4 unmodified lines
88 * @mem: address space of the endpoint controller92 * @mem: address space of the endpoint controller
89 * @max_functions: max number of functions that can be configured in this EPC93 * @max_functions: max number of functions that can be configured in this EPC
90 * @group: configfs group representing the PCI EPC device94 * @group: configfs group representing the PCI EPC device
91 * @lock: spinlock to protect pci_epc ops95 * @lock: mutex to protect pci_epc ops
96 * @function_num_map: bitmap to manage physical function number
97 * @notifier: used to notify EPF of any EPC events (like linkup)
92 */98 */
93struct pci_epc {99struct pci_epc {
94 struct device dev;100 struct device dev;
@@ -97,8 +103,10 @@ struct pci_epc { · 2 unmodified lines
97 struct pci_epc_mem *mem;103 struct pci_epc_mem *mem;
98 u8 max_functions;104 u8 max_functions;
99 struct config_group *group;105 struct config_group *group;
100 /* spinlock to protect against concurrent access of EP controller */106 /* mutex to protect against concurrent access of EP controller */
101 spinlock_t lock;107 struct mutex lock;
108 unsigned long function_num_map;
109 struct atomic_notifier_head notifier;
102};110};
103 111
104/**112/**
@@ -113,6 +121,7 @@ struct pci_epc { · 8 unmodified lines
113 */121 */
114struct pci_epc_features {122struct pci_epc_features {
115 unsigned int linkup_notifier : 1;123 unsigned int linkup_notifier : 1;
124 unsigned int core_init_notifier : 1;
116 unsigned int msi_capable : 1;125 unsigned int msi_capable : 1;
117 unsigned int msix_capable : 1;126 unsigned int msix_capable : 1;
118 u8 reserved_bar;127 u8 reserved_bar;
@@ -141,6 +150,12 @@ static inline void *epc_get_drvdata(struct pci_epc *epc) · 22 unmodified lines
141 return dev_get_drvdata(&epc->dev);150 return dev_get_drvdata(&epc->dev);
142}151}
143 152
153static inline int
154pci_epc_register_notifier(struct pci_epc *epc, struct notifier_block *nb)
155{
156 return atomic_notifier_chain_register(&epc->notifier, nb);
157}
158
144struct pci_epc *159struct pci_epc *
145__devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,160__devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
146 struct module *owner);161 struct module *owner);
@@ -151,6 +166,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); · 4 unmodified lines
151void pci_epc_destroy(struct pci_epc *epc);166void pci_epc_destroy(struct pci_epc *epc);
152int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);167int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);
153void pci_epc_linkup(struct pci_epc *epc);168void pci_epc_linkup(struct pci_epc *epc);
169void pci_epc_init_notify(struct pci_epc *epc);
154void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);170void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);
155int pci_epc_write_header(struct pci_epc *epc, u8 func_no,171int pci_epc_write_header(struct pci_epc *epc, u8 func_no,
156 struct pci_epf_header *hdr);172 struct pci_epf_header *hdr);
@@ -165,7 +181,8 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no, · 8 unmodified lines
165 phys_addr_t phys_addr);181 phys_addr_t phys_addr);
166int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);182int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);
167int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);183int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);
168int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts);184int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts,
185 enum pci_barno, u32 offset);
169int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);186int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);
170int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,187int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,
171 enum pci_epc_irq_type type, u16 interrupt_num);188 enum pci_epc_irq_type type, u16 interrupt_num);
include/linux/pci-epf.h+25−4
@@ -15,6 +15,11 @@ · 14 unmodified lines
15 15
16struct pci_epf;16struct pci_epf;
17 17
18enum pci_notify_event {
19 CORE_INIT,
20 LINK_UP,
21};
22
18enum pci_barno {23enum pci_barno {
19 BAR_0,24 BAR_0,
20 BAR_1,25 BAR_1,
@@ -55,13 +60,10 @@ struct pci_epf_header { · 34 unmodified lines
55 * @bind: ops to perform when a EPC device has been bound to EPF device60 * @bind: ops to perform when a EPC device has been bound to EPF device
56 * @unbind: ops to perform when a binding has been lost between a EPC device61 * @unbind: ops to perform when a binding has been lost between a EPC device
57 * and EPF device62 * and EPF device
58 * @linkup: ops to perform when the EPC device has established a connection with
59 * a host system
60 */63 */
61struct pci_epf_ops {64struct pci_epf_ops {
62 int (*bind)(struct pci_epf *epf);65 int (*bind)(struct pci_epf *epf);
63 void (*unbind)(struct pci_epf *epf);66 void (*unbind)(struct pci_epf *epf);
64 void (*linkup)(struct pci_epf *epf);
65};67};
66 68
67/**69/**
@@ -92,10 +94,12 @@ struct pci_epf_driver { · 24 unmodified lines
92/**94/**
93 * struct pci_epf_bar - represents the BAR of EPF device95 * struct pci_epf_bar - represents the BAR of EPF device
94 * @phys_addr: physical address that should be mapped to the BAR96 * @phys_addr: physical address that should be mapped to the BAR
97 * @addr: virtual address corresponding to the @phys_addr
95 * @size: the size of the address space present in BAR98 * @size: the size of the address space present in BAR
96 */99 */
97struct pci_epf_bar {100struct pci_epf_bar {
98 dma_addr_t phys_addr;101 dma_addr_t phys_addr;
102 void *addr;
99 size_t size;103 size_t size;
100 enum pci_barno barno;104 enum pci_barno barno;
101 int flags;105 int flags;
@@ -112,6 +116,8 @@ struct pci_epf_bar { · 10 unmodified lines
112 * @epc: the EPC device to which this EPF device is bound116 * @epc: the EPC device to which this EPF device is bound
113 * @driver: the EPF driver to which this EPF device is bound117 * @driver: the EPF driver to which this EPF device is bound
114 * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc118 * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc
119 * @nb: notifier block to notify EPF of any EPC events (like linkup)
120 * @lock: mutex to protect pci_epf_ops
115 */121 */
116struct pci_epf {122struct pci_epf {
117 struct device dev;123 struct device dev;
@@ -125,6 +131,22 @@ struct pci_epf { · 7 unmodified lines
125 struct pci_epc *epc;131 struct pci_epc *epc;
126 struct pci_epf_driver *driver;132 struct pci_epf_driver *driver;
127 struct list_head list;133 struct list_head list;
134 struct notifier_block nb;
135 /* mutex to protect against concurrent access of pci_epf_ops */
136 struct mutex lock;
137};
138
139/**
140 * struct pci_epf_msix_tbl - represents the MSIX table entry structure
141 * @msg_addr: Writes to this address will trigger MSIX interrupt in host
142 * @msg_data: Data that should be written to @msg_addr to trigger MSIX interrupt
143 * @vector_ctrl: Identifies if the function is prohibited from sending a message
144 * using this MSIX table entry
145 */
146struct pci_epf_msix_tbl {
147 u64 msg_addr;
148 u32 msg_data;
149 u32 vector_ctrl;
128};150};
129 151
130#define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)152#define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)
@@ -154,5 +176,4 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, · 23 unmodified lines
154void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);176void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
155int pci_epf_bind(struct pci_epf *epf);177int pci_epf_bind(struct pci_epf *epf);
156void pci_epf_unbind(struct pci_epf *epf);178void pci_epf_unbind(struct pci_epf *epf);
157void pci_epf_linkup(struct pci_epf *epf);
158#endif /* __LINUX_PCI_EPF_H */179#endif /* __LINUX_PCI_EPF_H */