LoongArch: Refactor cache probe and flush methods
[platform/kernel/linux-starfive.git] / arch / loongarch / include / asm / cpu-info.h
index b6c4f96..cd73a6f 100644 (file)
 
 #include <asm/loongarch.h>
 
+/* cache_desc->flags */
+enum {
+       CACHE_PRESENT   = (1 << 0),
+       CACHE_PRIVATE   = (1 << 1),     /* core private cache */
+       CACHE_INCLUSIVE = (1 << 2),     /* include the inner level caches */
+};
+
 /*
  * Descriptor for a cache
  */
 struct cache_desc {
-       unsigned int waysize;   /* Bytes per way */
+       unsigned char type;
+       unsigned char level;
        unsigned short sets;    /* Number of lines per set */
        unsigned char ways;     /* Number of ways */
        unsigned char linesz;   /* Size of line in bytes */
-       unsigned char waybit;   /* Bits to select in a cache set */
        unsigned char flags;    /* Flags describing cache properties */
 };
 
+#define CACHE_LEVEL_MAX                3
+#define CACHE_LEAVES_MAX       6
+
 struct cpuinfo_loongarch {
        u64                     asid_cache;
        unsigned long           asid_mask;
@@ -40,11 +50,8 @@ struct cpuinfo_loongarch {
        int                     tlbsizemtlb;
        int                     tlbsizestlbsets;
        int                     tlbsizestlbways;
-       struct cache_desc       icache; /* Primary I-cache */
-       struct cache_desc       dcache; /* Primary D or combined I/D cache */
-       struct cache_desc       vcache; /* Victim cache, between pcache and scache */
-       struct cache_desc       scache; /* Secondary cache */
-       struct cache_desc       tcache; /* Tertiary/split secondary cache */
+       int                     cache_leaves_present; /* number of cache_leaves[] elements */
+       struct cache_desc       cache_leaves[CACHE_LEAVES_MAX];
        int                     core;   /* physical core number in package */
        int                     package;/* physical package number */
        int                     vabits; /* Virtual Address size in bits */