hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/s390/include/asm/pci.h
....@@ -2,12 +2,10 @@
22 #ifndef __ASM_S390_PCI_H
33 #define __ASM_S390_PCI_H
44
5
-/* must be set before including pci_clp.h */
6
-#define PCI_BAR_COUNT 6
7
-
85 #include <linux/pci.h>
96 #include <linux/mutex.h>
107 #include <linux/iommu.h>
8
+#include <linux/pci_hotplug.h>
119 #include <asm-generic/pci.h>
1210 #include <asm/pci_clp.h>
1311 #include <asm/pci_debug.h>
....@@ -24,7 +22,16 @@
2422 int pci_proc_domain(struct pci_bus *);
2523
2624 #define ZPCI_BUS_NR 0 /* default bus number */
27
-#define ZPCI_DEVFN 0 /* default device number */
25
+
26
+#define ZPCI_NR_DMA_SPACES 1
27
+#define ZPCI_NR_DEVICES CONFIG_PCI_NR_FUNCTIONS
28
+#define ZPCI_DOMAIN_BITMAP_SIZE (1 << 16)
29
+
30
+#ifdef PCI
31
+#if (ZPCI_NR_DEVICES > ZPCI_DOMAIN_BITMAP_SIZE)
32
+# error ZPCI_NR_DEVICES can not be bigger than ZPCI_DOMAIN_BITMAP_SIZE
33
+#endif
34
+#endif /* PCI */
2835
2936 /* PCI Function Controls */
3037 #define ZPCI_FC_FN_ENABLED 0x80
....@@ -83,6 +90,8 @@
8390
8491 struct zpci_bar_struct {
8592 struct resource *res; /* bus resource */
93
+ void __iomem *mio_wb;
94
+ void __iomem *mio_wt;
8695 u32 val; /* bar start & 3 flag bits */
8796 u16 map_idx; /* index into bar mapping array */
8897 u8 size; /* order 2 exponent */
....@@ -90,10 +99,27 @@
9099
91100 struct s390_domain;
92101
102
+#define ZPCI_FUNCTIONS_PER_BUS 256
103
+struct zpci_bus {
104
+ struct kref kref;
105
+ struct pci_bus *bus;
106
+ struct zpci_dev *function[ZPCI_FUNCTIONS_PER_BUS];
107
+ struct list_head resources;
108
+ struct list_head bus_next;
109
+ struct resource bus_resource;
110
+ int pchid;
111
+ int domain_nr;
112
+ bool multifunction;
113
+ enum pci_bus_speed max_bus_speed;
114
+};
115
+
93116 /* Private data per function */
94117 struct zpci_dev {
95
- struct pci_bus *bus;
118
+ struct zpci_bus *zbus;
96119 struct list_head entry; /* list of all zpci_devices, needed for hotplug, etc. */
120
+ struct list_head bus_next;
121
+ struct kref kref;
122
+ struct hotplug_slot hotplug_slot;
97123
98124 enum zpci_state state;
99125 u32 fid; /* function ID, used by sclp */
....@@ -102,7 +128,13 @@
102128 u16 pchid; /* physical channel ID */
103129 u8 pfgid; /* function group ID */
104130 u8 pft; /* pci function type */
105
- u16 domain;
131
+ u8 port;
132
+ u8 rid_available : 1;
133
+ u8 has_hp_slot : 1;
134
+ u8 is_physfn : 1;
135
+ u8 util_str_avail : 1;
136
+ u8 reserved : 4;
137
+ unsigned int devfn; /* DEVFN part of the RID*/
106138
107139 struct mutex lock;
108140 u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */
....@@ -112,6 +144,8 @@
112144 /* IRQ stuff */
113145 u64 msi_addr; /* MSI address */
114146 unsigned int max_msi; /* maximum number of MSI's */
147
+ unsigned int msi_first_bit;
148
+ unsigned int msi_nr_irqs;
115149 struct airq_iv *aibv; /* adapter interrupt bit vector */
116150 unsigned long aisb; /* number of the summary bit */
117151
....@@ -130,7 +164,8 @@
130164 struct iommu_device iommu_dev; /* IOMMU core handle */
131165
132166 char res_name[16];
133
- struct zpci_bar_struct bars[PCI_BAR_COUNT];
167
+ bool mio_capable;
168
+ struct zpci_bar_struct bars[PCI_STD_NUM_BARS];
134169
135170 u64 start_dma; /* Start of available DMA addresses */
136171 u64 end_dma; /* End of available DMA addresses */
....@@ -145,10 +180,10 @@
145180 atomic64_t mapped_pages;
146181 atomic64_t unmapped_pages;
147182
183
+ u8 version;
148184 enum pci_bus_speed max_bus_speed;
149185
150186 struct dentry *debugfs_dev;
151
- struct dentry *debugfs_perf;
152187
153188 struct s390_domain *s390_domain; /* s390 IOMMU domain data */
154189 };
....@@ -159,42 +194,52 @@
159194 }
160195
161196 extern const struct attribute_group *zpci_attr_groups[];
197
+extern unsigned int s390_pci_force_floating __initdata;
198
+extern unsigned int s390_pci_no_rid;
162199
163200 /* -----------------------------------------------------------------------------
164201 Prototypes
165202 ----------------------------------------------------------------------------- */
166203 /* Base stuff */
167
-int zpci_create_device(struct zpci_dev *);
168
-void zpci_remove_device(struct zpci_dev *zdev);
204
+int zpci_create_device(u32 fid, u32 fh, enum zpci_state state);
205
+void zpci_remove_device(struct zpci_dev *zdev, bool set_error);
169206 int zpci_enable_device(struct zpci_dev *);
170207 int zpci_disable_device(struct zpci_dev *);
208
+void zpci_device_reserved(struct zpci_dev *zdev);
209
+bool zpci_is_device_configured(struct zpci_dev *zdev);
210
+
171211 int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);
172212 int zpci_unregister_ioat(struct zpci_dev *, u8);
173213 void zpci_remove_reserved_devices(void);
174214
175215 /* CLP */
216
+int clp_setup_writeback_mio(void);
176217 int clp_scan_pci_devices(void);
177
-int clp_rescan_pci_devices(void);
178
-int clp_rescan_pci_devices_simple(void);
179
-int clp_add_pci_device(u32, u32, int);
218
+int clp_query_pci_fn(struct zpci_dev *zdev);
180219 int clp_enable_fh(struct zpci_dev *, u8);
181220 int clp_disable_fh(struct zpci_dev *);
182221 int clp_get_state(u32 fid, enum zpci_state *state);
222
+
223
+/* UID */
224
+void update_uid_checking(bool new);
183225
184226 /* IOMMU Interface */
185227 int zpci_init_iommu(struct zpci_dev *zdev);
186228 void zpci_destroy_iommu(struct zpci_dev *zdev);
187229
188230 #ifdef CONFIG_PCI
231
+static inline bool zpci_use_mio(struct zpci_dev *zdev)
232
+{
233
+ return static_branch_likely(&have_mio) && zdev->mio_capable;
234
+}
235
+
189236 /* Error handling and recovery */
190237 void zpci_event_error(void *);
191238 void zpci_event_availability(void *);
192
-void zpci_rescan(void);
193239 bool zpci_is_enabled(void);
194240 #else /* CONFIG_PCI */
195241 static inline void zpci_event_error(void *e) {}
196242 static inline void zpci_event_availability(void *e) {}
197
-static inline void zpci_rescan(void) {}
198243 #endif /* CONFIG_PCI */
199244
200245 #ifdef CONFIG_HOTPLUG_PCI_S390
....@@ -211,7 +256,14 @@
211256 /* Helpers */
212257 static inline struct zpci_dev *to_zpci(struct pci_dev *pdev)
213258 {
214
- return pdev->sysdata;
259
+ struct zpci_bus *zbus = pdev->sysdata;
260
+
261
+ return zbus->function[pdev->devfn];
262
+}
263
+
264
+static inline struct zpci_dev *to_zpci_dev(struct device *dev)
265
+{
266
+ return to_zpci(to_pci_dev(dev));
215267 }
216268
217269 struct zpci_dev *get_zdev_by_fid(u32);
....@@ -219,6 +271,9 @@
219271 /* DMA */
220272 int zpci_dma_init(void);
221273 void zpci_dma_exit(void);
274
+
275
+int __init zpci_irq_init(void);
276
+void __init zpci_irq_exit(void);
222277
223278 /* FMB */
224279 int zpci_fmb_enable_device(struct zpci_dev *);
....@@ -229,7 +284,6 @@
229284 void zpci_debug_exit(void);
230285 void zpci_debug_init_device(struct zpci_dev *, const char *);
231286 void zpci_debug_exit_device(struct zpci_dev *);
232
-void zpci_debug_info(struct zpci_dev *, struct seq_file *);
233287
234288 /* Error reporting */
235289 int zpci_report_error(struct pci_dev *, struct zpci_report_error_header *);