]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
LoongArch: Don't panic if no valid cache info for PCI
authorHuacai Chen <chenhuacai@loongson.cn>
Thu, 20 Nov 2025 06:42:05 +0000 (14:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:43:25 +0000 (11:43 +0100)
commit a6b533adfc05ba15360631e019d3e18275080275 upstream.

If there is no valid cache info detected (may happen in virtual machine)
for pci_dfl_cache_line_size, kernel shouldn't panic. Because in the PCI
core it will be evaluated to (L1_CACHE_BYTES >> 2).

Cc: <stable@vger.kernel.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/loongarch/pci/pci.c

index 2726639150bc7ab66402381a09fe3d1d7b4af8c3..927dd31f82b93e22fea35a53f6bd1b196b3b2c7d 100644 (file)
@@ -51,11 +51,11 @@ static int __init pcibios_init(void)
         */
        lsize = cpu_last_level_cache_line_size();
 
-       BUG_ON(!lsize);
+       if (lsize) {
+               pci_dfl_cache_line_size = lsize >> 2;
 
-       pci_dfl_cache_line_size = lsize >> 2;
-
-       pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
+               pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
+       }
 
        return 0;
 }