forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/arch/x86/pci/mmconfig-shared.c
....@@ -29,6 +29,7 @@
2929 static bool pci_mmcfg_running_state;
3030 static bool pci_mmcfg_arch_init_failed;
3131 static DEFINE_MUTEX(pci_mmcfg_lock);
32
+#define pci_mmcfg_lock_held() lock_is_held(&(pci_mmcfg_lock).dep_map)
3233
3334 LIST_HEAD(pci_mmcfg_list);
3435
....@@ -54,7 +55,7 @@
5455 struct pci_mmcfg_region *cfg;
5556
5657 /* keep list sorted by segment and starting bus number */
57
- list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list) {
58
+ list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list, pci_mmcfg_lock_held()) {
5859 if (cfg->segment > new->segment ||
5960 (cfg->segment == new->segment &&
6061 cfg->start_bus >= new->start_bus)) {
....@@ -118,7 +119,7 @@
118119 {
119120 struct pci_mmcfg_region *cfg;
120121
121
- list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list)
122
+ list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list, pci_mmcfg_lock_held())
122123 if (cfg->segment == segment &&
123124 cfg->start_bus <= bus && bus <= cfg->end_bus)
124125 return cfg;