Commit f7186cb9 authored by Marc Zyngier's avatar Marc Zyngier Committed by zhangyuyang
Browse files

irqchip/gic-v4: Make sure a VPE is locked when VMAPP is issued

mainline inclusion
from mainline-v6.11-rc1
commit a84a07fa3100d7ad46a3d6882af25a3df9c9e7e3
category: other
bugzilla: https://gitee.com/openeuler/kernel/issues/IAVK49

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a84a07fa3100d7ad46a3d6882af25a3df9c9e7e3



--------------------------------------------------------------------------

In order to make sure that vpe->col_idx is correctly sampled when a VMAPP
command is issued, the vpe_lock must be held for the VPE. This is now
possible since the introduction of the per-VM vmapp_lock, which can be
taken before vpe_lock in the correct locking order.

Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarNianyao Tang <tangnianyao@huawei.com>
Link: https://lore.kernel.org/r/20240705093155.871070-4-maz@kernel.org


Signed-off-by: default avatarcaijian <caijian11@h-partners.com>
parent b3bb92fb
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2138,7 +2138,9 @@ static void its_map_vm(struct its_node *its, struct its_vm *vm)
		for (i = 0; i < vm->nr_vpes; i++) {
			struct its_vpe *vpe = vm->vpes[i];

			scoped_guard(raw_spinlock, &vpe->vpe_lock)
				its_send_vmapp(its, vpe, true);

			its_send_vinvall(its, vpe);
		}
	}
@@ -2155,10 +2157,12 @@ static void its_unmap_vm(struct its_node *its, struct its_vm *vm)
	if (!--vm->vlpi_count[its->list_nr]) {
		int i;

		for (i = 0; i < vm->nr_vpes; i++)
		for (i = 0; i < vm->nr_vpes; i++) {
			guard(raw_spinlock)(&vm->vpes[i]->vpe_lock);
			its_send_vmapp(its, vm->vpes[i], false);
		}
	}
}

static int its_vlpi_map(struct irq_data *d, struct its_cmd_info *info)
{