hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/arch/powerpc/include/asm/pci-bridge.h
....@@ -1,15 +1,13 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 #ifndef _ASM_POWERPC_PCI_BRIDGE_H
23 #define _ASM_POWERPC_PCI_BRIDGE_H
34 #ifdef __KERNEL__
45 /*
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * as published by the Free Software Foundation; either version
8
- * 2 of the License, or (at your option) any later version.
96 */
107 #include <linux/pci.h>
118 #include <linux/list.h>
129 #include <linux/ioport.h>
10
+#include <linux/numa.h>
1311
1412 struct device_node;
1513
....@@ -19,6 +17,8 @@
1917 struct pci_controller_ops {
2018 void (*dma_dev_setup)(struct pci_dev *pdev);
2119 void (*dma_bus_setup)(struct pci_bus *bus);
20
+ bool (*iommu_bypass_supported)(struct pci_dev *pdev,
21
+ u64 mask);
2222
2323 int (*probe_mode)(struct pci_bus *bus);
2424
....@@ -43,9 +43,6 @@
4343 void (*teardown_msi_irqs)(struct pci_dev *pdev);
4444 #endif
4545
46
- int (*dma_set_mask)(struct pci_dev *pdev, u64 dma_mask);
47
- u64 (*dma_get_required_mask)(struct pci_dev *pdev);
48
-
4946 void (*shutdown)(struct pci_controller *hose);
5047 };
5148
....@@ -69,7 +66,7 @@
6966
7067 void __iomem *io_base_virt;
7168 #ifdef CONFIG_PPC64
72
- void *io_base_alloc;
69
+ void __iomem *io_base_alloc;
7370 #endif
7471 resource_size_t io_base_phys;
7572 resource_size_t pci_io_size;
....@@ -129,6 +126,7 @@
129126 #endif /* CONFIG_PPC64 */
130127
131128 void *private_data;
129
+ struct npu *npu;
132130 };
133131
134132 /* These are used for config access before all the PCI probing
....@@ -185,6 +183,7 @@
185183 struct pci_dn {
186184 int flags;
187185 #define PCI_DN_FLAG_IOV_VF 0x01
186
+#define PCI_DN_FLAG_DEAD 0x02 /* Device has been hot-removed */
188187
189188 int busno; /* pci bus number */
190189 int devfn; /* pci device and function number */
....@@ -203,7 +202,6 @@
203202 #define IODA_INVALID_PE 0xFFFFFFFF
204203 unsigned int pe_number;
205204 #ifdef CONFIG_PCI_IOV
206
- int vf_index; /* VF index in the PF */
207205 u16 vfs_expanded; /* number of VFs IOV BAR expanded */
208206 u16 num_vfs; /* number of VFs enabled*/
209207 unsigned int *pe_num_map; /* PE# for the first VF PE or array */
....@@ -224,11 +222,14 @@
224222 extern struct pci_dn *pci_get_pdn_by_devfn(struct pci_bus *bus,
225223 int devfn);
226224 extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev);
227
-extern struct pci_dn *add_dev_pci_data(struct pci_dev *pdev);
228
-extern void remove_dev_pci_data(struct pci_dev *pdev);
229225 extern struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,
230226 struct device_node *dn);
231227 extern void pci_remove_device_node_info(struct device_node *dn);
228
+
229
+#ifdef CONFIG_PCI_IOV
230
+struct pci_dn *add_sriov_vf_pdns(struct pci_dev *pdev);
231
+void remove_sriov_vf_pdns(struct pci_dev *pdev);
232
+#endif
232233
233234 static inline int pci_device_from_OF_node(struct device_node *np,
234235 u8 *bus, u8 *devfn)
....@@ -264,7 +265,7 @@
264265 #ifdef CONFIG_NUMA
265266 #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
266267 #else
267
-#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
268
+#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE)
268269 #endif
269270
270271 #endif /* CONFIG_PPC64 */
....@@ -273,6 +274,8 @@
273274 extern struct pci_controller *pci_find_hose_for_OF_device(
274275 struct device_node* node);
275276
277
+extern struct pci_controller *pci_find_controller_for_domain(int domain_nr);
278
+
276279 /* Fill up host controller resources from the OF node */
277280 extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
278281 struct device_node *dev, int primary);