hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/pci.h
....@@ -7,11 +7,10 @@
77 #include <linux/slab.h>
88 #include <linux/string.h>
99 #include <linux/scatterlist.h>
10
+#include <linux/numa.h>
1011 #include <asm/io.h>
11
-#include <asm/pat.h>
12
+#include <asm/memtype.h>
1213 #include <asm/x86_init.h>
13
-
14
-#ifdef __KERNEL__
1514
1615 struct pci_sysdata {
1716 int domain; /* PCI domain */
....@@ -26,7 +25,7 @@
2625 void *fwnode; /* IRQ domain for MSI assignment */
2726 #endif
2827 #if IS_ENABLED(CONFIG_VMD)
29
- bool vmd_domain; /* True if in Intel VMD domain */
28
+ struct pci_dev *vmd_dev; /* VMD Device if in Intel VMD domain */
3029 #endif
3130 };
3231
....@@ -34,14 +33,17 @@
3433 extern int noioapicquirk;
3534 extern int noioapicreroute;
3635
36
+static inline struct pci_sysdata *to_pci_sysdata(const struct pci_bus *bus)
37
+{
38
+ return bus->sysdata;
39
+}
40
+
3741 #ifdef CONFIG_PCI
3842
3943 #ifdef CONFIG_PCI_DOMAINS
4044 static inline int pci_domain_nr(struct pci_bus *bus)
4145 {
42
- struct pci_sysdata *sd = bus->sysdata;
43
-
44
- return sd->domain;
46
+ return to_pci_sysdata(bus)->domain;
4547 }
4648
4749 static inline int pci_proc_domain(struct pci_bus *bus)
....@@ -53,24 +55,20 @@
5355 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
5456 static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
5557 {
56
- struct pci_sysdata *sd = bus->sysdata;
57
-
58
- return sd->fwnode;
58
+ return to_pci_sysdata(bus)->fwnode;
5959 }
6060
6161 #define pci_root_bus_fwnode _pci_root_bus_fwnode
6262 #endif
6363
64
+#if IS_ENABLED(CONFIG_VMD)
6465 static inline bool is_vmd(struct pci_bus *bus)
6566 {
66
-#if IS_ENABLED(CONFIG_VMD)
67
- struct pci_sysdata *sd = bus->sysdata;
68
-
69
- return sd->vmd_domain;
70
-#else
71
- return false;
72
-#endif
67
+ return to_pci_sysdata(bus)->vmd_dev != NULL;
7368 }
69
+#else
70
+#define is_vmd(bus) false
71
+#endif /* CONFIG_VMD */
7472
7573 /* Can be used to override the logic in pci_scan_bus for skipping
7674 already-configured bus numbers - to be used for buggy BIOSes
....@@ -107,22 +105,6 @@
107105
108106 extern void pci_iommu_alloc(void);
109107
110
-#ifdef CONFIG_PCI_MSI
111
-/* implemented in arch/x86/kernel/apic/io_apic. */
112
-struct msi_desc;
113
-int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
114
-void native_teardown_msi_irq(unsigned int irq);
115
-void native_restore_msi_irqs(struct pci_dev *dev);
116
-#else
117
-#define native_setup_msi_irqs NULL
118
-#define native_teardown_msi_irq NULL
119
-#endif
120
-#endif /* __KERNEL__ */
121
-
122
-#ifdef CONFIG_X86_64
123
-#include <asm/pci_64.h>
124
-#endif
125
-
126108 /* generic pci stuff */
127109 #include <asm-generic/pci.h>
128110
....@@ -130,9 +112,7 @@
130112 /* Returns the node based on pci bus */
131113 static inline int __pcibus_to_node(const struct pci_bus *bus)
132114 {
133
- const struct pci_sysdata *sd = bus->sysdata;
134
-
135
- return sd->node;
115
+ return to_pci_sysdata(bus)->node;
136116 }
137117
138118 static inline const struct cpumask *
....@@ -141,7 +121,7 @@
141121 int node;
142122
143123 node = __pcibus_to_node(bus);
144
- return (node == -1) ? cpu_online_mask :
124
+ return (node == NUMA_NO_NODE) ? cpu_online_mask :
145125 cpumask_of_node(node);
146126 }
147127 #endif