summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/pci
diff options
context:
space:
mode:
authorHuacai Chen <chenhuacai@loongson.cn>2022-10-12 16:36:14 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2022-10-12 16:36:14 +0800
commitb61a40afca164a9bd066f749beff3bf209c5e209 (patch)
tree414693038d707d37b34edfee4f4ece650275996a /arch/loongarch/pci
parenta2a84e36331af3b000ad12b552c5485b8282b366 (diff)
downloadlinux-b61a40afca164a9bd066f749beff3bf209c5e209.tar.bz2
LoongArch: Refactor cache probe and flush methods
Current cache probe and flush methods have some drawbacks: 1, Assume there are 3 cache levels and only 3 levels; 2, Assume L1 = I + D, L2 = V, L3 = S, V is exclusive, S is inclusive. However, the fact is I + D, I + D + V, I + D + S and I + D + V + S are all valid. So, refactor the cache probe and flush methods to adapt more types of cache hierarchy. Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/pci')
-rw-r--r--arch/loongarch/pci/pci.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/loongarch/pci/pci.c b/arch/loongarch/pci/pci.c
index e9b7c34d9b6d..2726639150bc 100644
--- a/arch/loongarch/pci/pci.c
+++ b/arch/loongarch/pci/pci.c
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/vgaarb.h>
+#include <asm/cacheflush.h>
#include <asm/loongson.h>
#define PCI_DEVICE_ID_LOONGSON_HOST 0x7a00
@@ -45,12 +46,10 @@ static int __init pcibios_init(void)
unsigned int lsize;
/*
- * Set PCI cacheline size to that of the highest level in the
+ * Set PCI cacheline size to that of the last level in the
* cache hierarchy.
*/
- lsize = cpu_dcache_line_size();
- lsize = cpu_vcache_line_size() ? : lsize;
- lsize = cpu_scache_line_size() ? : lsize;
+ lsize = cpu_last_level_cache_line_size();
BUG_ON(!lsize);