[PATCH 0/2] Add machanism to limit msi allocation for Loongson

From: Huacai Chen
Date: Sat May 27 2023 - 01:55:43 EST

Loongson machines can have as many as 256 logical cpus, but the maximum
of msi vectors in one irqchip is also 256 (practically that is less than
256, because pch-pic consumes some of them). Even on a 64-core machine,
256 irqs can be easily exhausted if there are several NICs (NICs usually
allocate msi irqs depending on the number of online cpus). So we want to
limit the msi allocation.

Patch-1 adjusts the return value semanteme of msi_domain_prepare_irqs(),
allowing us to modify the input "nvec" by overriding the msi_domain_ops

Patch-2 adds a machanism to limit msi allocation:
1, Modify input "nvec" by overriding the msi_domain_ops::msi_prepare();
2, The default limit is 256, which is compatible with the old behavior;
3, Add a cmdline parameter "loongson_msi_limit=xxx" to control the limit.

Huacai Chen and Juxin Gao(2):
PCI: Omit pci_disable_device() in .shutdown().
PCI: loongson: Improve the MRRS quirk for LS7A.

Signed-off-by: Juxin Gao <gaojuxin@xxxxxxxxxxx>
Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>