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
5353 phys_addr_t addr);
5454 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);
5555 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);
5758 int (*get_msix)(struct pci_epc *epc, u8 func_no);
5859 int (*raise_irq)(struct pci_epc *epc, u8 func_no,
5960 enum pci_epc_irq_type type, u16 interrupt_num);
@@ -71,6 +72,7 @@ struct pci_epc_ops { · 11 unmodified lines
7172 * @bitmap: bitmap to manage the PCI address space
7273 * @pages: number of bits representing the address region
7374 * @page_size: size of each page
75+ * @lock: mutex to protect bitmap
7476 */
7577 struct pci_epc_mem {
7678 phys_addr_t phys_base;
@@ -78,6 +80,8 @@ struct pci_epc_mem { · 1 unmodified line
7880 unsigned long *bitmap;
7981 size_t page_size;
8082 int pages;
83+ /* mutex to protect against concurrent access for memory allocation*/
84+ struct mutex lock;
8185 };
8286
8387 /**
@@ -88,7 +92,9 @@ struct pci_epc_mem { · 4 unmodified lines
8892 * @mem: address space of the endpoint controller
8993 * @max_functions: max number of functions that can be configured in this EPC
9094 * @group: configfs group representing the PCI EPC device
91− * @lock: spinlock to protect pci_epc ops
95+ * @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)
9298 */
9399 struct pci_epc {
94100 struct device dev;
@@ -97,8 +103,10 @@ struct pci_epc { · 2 unmodified lines
97103 struct pci_epc_mem *mem;
98104 u8 max_functions;
99105 struct config_group *group;
100− /* spinlock to protect against concurrent access of EP controller */
101− spinlock_t lock;
106+ /* mutex to protect against concurrent access of EP controller */
107+ struct mutex lock;
108+ unsigned long function_num_map;
109+ struct atomic_notifier_head notifier;
102110 };
103111
104112 /**
@@ -113,6 +121,7 @@ struct pci_epc { · 8 unmodified lines
113121 */
114122 struct pci_epc_features {
115123 unsigned int linkup_notifier : 1;
124+ unsigned int core_init_notifier : 1;
116125 unsigned int msi_capable : 1;
117126 unsigned int msix_capable : 1;
118127 u8 reserved_bar;
@@ -141,6 +150,12 @@ static inline void *epc_get_drvdata(struct pci_epc *epc) · 22 unmodified lines
141150 return dev_get_drvdata(&epc->dev);
142151 }
143152
153+static inline int
154+pci_epc_register_notifier(struct pci_epc *epc, struct notifier_block *nb)
155+{
156+ return atomic_notifier_chain_register(&epc->notifier, nb);
157+}
158+
144159 struct pci_epc *
145160 __devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
146161 struct module *owner);
@@ -151,6 +166,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); · 4 unmodified lines
151166 void pci_epc_destroy(struct pci_epc *epc);
152167 int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);
153168 void pci_epc_linkup(struct pci_epc *epc);
169+void pci_epc_init_notify(struct pci_epc *epc);
154170 void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);
155171 int pci_epc_write_header(struct pci_epc *epc, u8 func_no,
156172 struct pci_epf_header *hdr);
@@ -165,7 +181,8 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no, · 8 unmodified lines
165181 phys_addr_t phys_addr);
166182 int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);
167183 int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);
168−int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts);
184+int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts,
185+ enum pci_barno, u32 offset);
169186 int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);
170187 int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,
171188 enum pci_epc_irq_type type, u16 interrupt_num);
include/linux/pci-epf.h+25−4
@@ -15,6 +15,11 @@ · 14 unmodified lines
1515
1616 struct pci_epf;
1717
18+enum pci_notify_event {
19+ CORE_INIT,
20+ LINK_UP,
21+};
22+
1823 enum pci_barno {
1924 BAR_0,
2025 BAR_1,
@@ -55,13 +60,10 @@ struct pci_epf_header { · 34 unmodified lines
5560 * @bind: ops to perform when a EPC device has been bound to EPF device
5661 * @unbind: ops to perform when a binding has been lost between a EPC device
5762 * and EPF device
58− * @linkup: ops to perform when the EPC device has established a connection with
59− * a host system
6063 */
6164 struct pci_epf_ops {
6265 int (*bind)(struct pci_epf *epf);
6366 void (*unbind)(struct pci_epf *epf);
64− void (*linkup)(struct pci_epf *epf);
6567 };
6668
6769 /**
@@ -92,10 +94,12 @@ struct pci_epf_driver { · 24 unmodified lines
9294 /**
9395 * struct pci_epf_bar - represents the BAR of EPF device
9496 * @phys_addr: physical address that should be mapped to the BAR
97+ * @addr: virtual address corresponding to the @phys_addr
9598 * @size: the size of the address space present in BAR
9699 */
97100 struct pci_epf_bar {
98101 dma_addr_t phys_addr;
102+ void *addr;
99103 size_t size;
100104 enum pci_barno barno;
101105 int flags;
@@ -112,6 +116,8 @@ struct pci_epf_bar { · 10 unmodified lines
112116 * @epc: the EPC device to which this EPF device is bound
113117 * @driver: the EPF driver to which this EPF device is bound
114118 * @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
115121 */
116122 struct pci_epf {
117123 struct device dev;
@@ -125,6 +131,22 @@ struct pci_epf { · 7 unmodified lines
125131 struct pci_epc *epc;
126132 struct pci_epf_driver *driver;
127133 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+ */
146+struct pci_epf_msix_tbl {
147+ u64 msg_addr;
148+ u32 msg_data;
149+ u32 vector_ctrl;
128150 };
129151
130152 #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
154176 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
155177 int pci_epf_bind(struct pci_epf *epf);
156178 void pci_epf_unbind(struct pci_epf *epf);
157−void pci_epf_linkup(struct pci_epf *epf);
158179 #endif /* __LINUX_PCI_EPF_H */