- 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
Showing the changes to include/linux (2 of 17 files). Show all
Unified · Split
| @@ -53,7 +53,8 @@ struct pci_epc_ops { · 52 unmodified lines | ||
| 53 | 53 | phys_addr_t addr); |
| 54 | 54 | int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts); |
| 55 | 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 | 58 | int (*get_msix)(struct pci_epc *epc, u8 func_no); |
| 58 | 59 | int (*raise_irq)(struct pci_epc *epc, u8 func_no, |
| 59 | 60 | enum pci_epc_irq_type type, u16 interrupt_num); |
| @@ -71,6 +72,7 @@ struct pci_epc_ops { · 11 unmodified lines | ||
| 71 | 72 | * @bitmap: bitmap to manage the PCI address space |
| 72 | 73 | * @pages: number of bits representing the address region |
| 73 | 74 | * @page_size: size of each page |
| 75 | + * @lock: mutex to protect bitmap | |
| 74 | 76 | */ |
| 75 | 77 | struct pci_epc_mem { |
| 76 | 78 | phys_addr_t phys_base; |
| @@ -78,6 +80,8 @@ struct pci_epc_mem { · 1 unmodified line | ||
| 78 | 80 | unsigned long *bitmap; |
| 79 | 81 | size_t page_size; |
| 80 | 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 | 92 | * @mem: address space of the endpoint controller |
| 89 | 93 | * @max_functions: max number of functions that can be configured in this EPC |
| 90 | 94 | * @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) | |
| 92 | 98 | */ |
| 93 | 99 | struct pci_epc { |
| 94 | 100 | struct device dev; |
| @@ -97,8 +103,10 @@ struct pci_epc { · 2 unmodified lines | ||
| 97 | 103 | struct pci_epc_mem *mem; |
| 98 | 104 | u8 max_functions; |
| 99 | 105 | 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; | |
| 102 | 110 | }; |
| 103 | 111 | |
| 104 | 112 | /** |
| @@ -113,6 +121,7 @@ struct pci_epc { · 8 unmodified lines | ||
| 113 | 121 | */ |
| 114 | 122 | struct pci_epc_features { |
| 115 | 123 | unsigned int linkup_notifier : 1; |
| 124 | + unsigned int core_init_notifier : 1; | |
| 116 | 125 | unsigned int msi_capable : 1; |
| 117 | 126 | unsigned int msix_capable : 1; |
| 118 | 127 | u8 reserved_bar; |
| @@ -141,6 +150,12 @@ static inline void *epc_get_drvdata(struct pci_epc *epc) · 22 unmodified lines | ||
| 141 | 150 | return dev_get_drvdata(&epc->dev); |
| 142 | 151 | } |
| 143 | 152 | |
| 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 | + | |
| 144 | 159 | struct pci_epc * |
| 145 | 160 | __devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, |
| 146 | 161 | struct module *owner); |
| @@ -151,6 +166,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); · 4 unmodified lines | ||
| 151 | 166 | void pci_epc_destroy(struct pci_epc *epc); |
| 152 | 167 | int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf); |
| 153 | 168 | void pci_epc_linkup(struct pci_epc *epc); |
| 169 | +void pci_epc_init_notify(struct pci_epc *epc); | |
| 154 | 170 | void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf); |
| 155 | 171 | int pci_epc_write_header(struct pci_epc *epc, u8 func_no, |
| 156 | 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 | 181 | phys_addr_t phys_addr); |
| 166 | 182 | int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts); |
| 167 | 183 | 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); | |
| 169 | 186 | int pci_epc_get_msix(struct pci_epc *epc, u8 func_no); |
| 170 | 187 | int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, |
| 171 | 188 | enum pci_epc_irq_type type, u16 interrupt_num); |
| @@ -15,6 +15,11 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | struct pci_epf; |
| 17 | 17 | |
| 18 | +enum pci_notify_event { | |
| 19 | + CORE_INIT, | |
| 20 | + LINK_UP, | |
| 21 | +}; | |
| 22 | + | |
| 18 | 23 | enum pci_barno { |
| 19 | 24 | BAR_0, |
| 20 | 25 | BAR_1, |
| @@ -55,13 +60,10 @@ struct pci_epf_header { · 34 unmodified lines | ||
| 55 | 60 | * @bind: ops to perform when a EPC device has been bound to EPF device |
| 56 | 61 | * @unbind: ops to perform when a binding has been lost between a EPC device |
| 57 | 62 | * and EPF device |
| 58 | − * @linkup: ops to perform when the EPC device has established a connection with | |
| 59 | − * a host system | |
| 60 | 63 | */ |
| 61 | 64 | struct pci_epf_ops { |
| 62 | 65 | int (*bind)(struct pci_epf *epf); |
| 63 | 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 | 95 | * struct pci_epf_bar - represents the BAR of EPF device |
| 94 | 96 | * @phys_addr: physical address that should be mapped to the BAR |
| 97 | + * @addr: virtual address corresponding to the @phys_addr | |
| 95 | 98 | * @size: the size of the address space present in BAR |
| 96 | 99 | */ |
| 97 | 100 | struct pci_epf_bar { |
| 98 | 101 | dma_addr_t phys_addr; |
| 102 | + void *addr; | |
| 99 | 103 | size_t size; |
| 100 | 104 | enum pci_barno barno; |
| 101 | 105 | int flags; |
| @@ -112,6 +116,8 @@ struct pci_epf_bar { · 10 unmodified lines | ||
| 112 | 116 | * @epc: the EPC device to which this EPF device is bound |
| 113 | 117 | * @driver: the EPF driver to which this EPF device is bound |
| 114 | 118 | * @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 | */ |
| 116 | 122 | struct pci_epf { |
| 117 | 123 | struct device dev; |
| @@ -125,6 +131,22 @@ struct pci_epf { · 7 unmodified lines | ||
| 125 | 131 | struct pci_epc *epc; |
| 126 | 132 | struct pci_epf_driver *driver; |
| 127 | 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 | + */ | |
| 146 | +struct pci_epf_msix_tbl { | |
| 147 | + u64 msg_addr; | |
| 148 | + u32 msg_data; | |
| 149 | + u32 vector_ctrl; | |
| 128 | 150 | }; |
| 129 | 151 | |
| 130 | 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 | ||
| 154 | 176 | void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar); |
| 155 | 177 | int pci_epf_bind(struct pci_epf *epf); |
| 156 | 178 | void pci_epf_unbind(struct pci_epf *epf); |
| 157 | −void pci_epf_linkup(struct pci_epf *epf); | |
| 158 | 179 | #endif /* __LINUX_PCI_EPF_H */ |