|
40 | 40 |
|
41 | 41 | /* SOFTIRQ_DEV_ASSIGN list for all CPUs */
|
42 | 42 | static struct list_head softirq_dev_entry_list;
|
| 43 | +/* passthrough device link */ |
| 44 | +static struct list_head ptdev_list; |
43 | 45 |
|
44 | 46 | /*
|
45 | 47 | * entry could both be in ptdev_list and softirq_dev_entry_list.
|
@@ -98,10 +100,10 @@ _get_remapping_entry(struct vm *vm, uint32_t id)
|
98 | 100 | struct ptdev_remapping_info *entry;
|
99 | 101 | struct list_head *pos;
|
100 | 102 |
|
101 |
| - list_for_each(pos, &vm->ptdev_list) { |
| 103 | + list_for_each(pos, &ptdev_list) { |
102 | 104 | entry = list_entry(pos, struct ptdev_remapping_info,
|
103 | 105 | entry_node);
|
104 |
| - if (entry_id(entry) == id) |
| 106 | + if (entry_id(entry) == id && entry->vm == vm) |
105 | 107 | return entry;
|
106 | 108 | }
|
107 | 109 |
|
@@ -213,7 +215,7 @@ alloc_entry(struct vm *vm, enum ptdev_intr_type type)
|
213 | 215 | entry->type = type;
|
214 | 216 | entry->vm = vm;
|
215 | 217 | atomic_clear_int(&entry->active, ACTIVE_FLAG);
|
216 |
| - list_add(&entry->entry_node, &vm->ptdev_list); |
| 218 | + list_add(&entry->entry_node, &ptdev_list); |
217 | 219 |
|
218 | 220 | return entry;
|
219 | 221 | }
|
@@ -245,10 +247,11 @@ release_all_entry(struct vm *vm)
|
245 | 247 | struct ptdev_remapping_info *entry;
|
246 | 248 | struct list_head *pos, *tmp;
|
247 | 249 |
|
248 |
| - list_for_each_safe(pos, tmp, &vm->ptdev_list) { |
| 250 | + list_for_each_safe(pos, tmp, &ptdev_list) { |
249 | 251 | entry = list_entry(pos, struct ptdev_remapping_info,
|
250 | 252 | entry_node);
|
251 |
| - release_entry(entry); |
| 253 | + if (entry->vm == vm) |
| 254 | + release_entry(entry); |
252 | 255 | }
|
253 | 256 | }
|
254 | 257 |
|
@@ -295,13 +298,14 @@ static void check_deactive_pic_intx(struct vm *vm, uint8_t phys_pin)
|
295 | 298 | return;
|
296 | 299 |
|
297 | 300 | spinlock_obtain(&vm->ptdev_lock);
|
298 |
| - list_for_each(pos, &vm->ptdev_list) { |
| 301 | + list_for_each(pos, &ptdev_list) { |
299 | 302 | entry = list_entry(pos, struct ptdev_remapping_info,
|
300 | 303 | entry_node);
|
301 | 304 | if (entry->type == PTDEV_INTR_INTX &&
|
302 | 305 | entry->intx.vpin_src == PTDEV_VPIN_PIC &&
|
303 | 306 | entry->intx.phys_pin == phys_pin &&
|
304 |
| - entry_is_active(entry)) { |
| 307 | + entry_is_active(entry) && |
| 308 | + entry->vm == vm) { |
305 | 309 | GSI_MASK_IRQ(pin_to_irq(phys_pin));
|
306 | 310 | ptdev_deactivate_entry(entry);
|
307 | 311 | dev_dbg(ACRN_DBG_IRQ,
|
@@ -855,13 +859,13 @@ void ptdev_init(void)
|
855 | 859 | if (get_cpu_id() > 0)
|
856 | 860 | return;
|
857 | 861 |
|
| 862 | + INIT_LIST_HEAD(&ptdev_list); |
858 | 863 | INIT_LIST_HEAD(&softirq_dev_entry_list);
|
859 | 864 | spinlock_init(&softirq_dev_lock);
|
860 | 865 | }
|
861 | 866 |
|
862 | 867 | void ptdev_vm_init(struct vm *vm)
|
863 | 868 | {
|
864 |
| - INIT_LIST_HEAD(&vm->ptdev_list); |
865 | 869 | spinlock_init(&vm->ptdev_lock);
|
866 | 870 | }
|
867 | 871 |
|
@@ -987,7 +991,7 @@ int get_ptdev_info(char *str, int str_max)
|
987 | 991 | list_for_each(vm_pos, &vm_list) {
|
988 | 992 | vm = list_entry(vm_pos, struct vm, list);
|
989 | 993 | spinlock_obtain(&vm->ptdev_lock);
|
990 |
| - list_for_each(pos, &vm->ptdev_list) { |
| 994 | + list_for_each(pos, &ptdev_list) { |
991 | 995 | entry = list_entry(pos, struct ptdev_remapping_info,
|
992 | 996 | entry_node);
|
993 | 997 | if (entry_is_active(entry)) {
|
|
0 commit comments