Add CPU map XML files for the LoongArch architecture, describing
the Loongson vendor, supported features, and the la464/la664 CPU
models.

The following files are added:
- loongarch_vendors.xml: Loongson vendor (0x14)
- loongarch_features.xml: lbt, lasx, lsx, ptw, pmu, msgint,
  kvm-pv-ipi, kvm-steal-time
- loongarch_la464.xml: Loongson 3A5000 (la464) model
- loongarch_la664.xml: Loongson 3A6000 (la664) model

index.xml and meson.build are updated to include the new files.

Signed-off-by: Xianglai Li <[email protected]>
---
Cc: Bibo Mao <[email protected]>

 src/cpu_map/index.xml              | 13 +++++++++++++
 src/cpu_map/loongarch_features.xml | 26 ++++++++++++++++++++++++++
 src/cpu_map/loongarch_la464.xml    | 10 ++++++++++
 src/cpu_map/loongarch_la664.xml    | 11 +++++++++++
 src/cpu_map/loongarch_vendors.xml  |  3 +++
 src/cpu_map/meson.build            |  4 ++++
 6 files changed, 67 insertions(+)
 create mode 100644 src/cpu_map/loongarch_features.xml
 create mode 100644 src/cpu_map/loongarch_la464.xml
 create mode 100644 src/cpu_map/loongarch_la664.xml
 create mode 100644 src/cpu_map/loongarch_vendors.xml

diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 50b5cc7ed9..e4de295203 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -259,4 +259,17 @@
       <include filename='arm_Ampere-1a.xml'/>
     </group>
   </arch>
+
+  <arch name='loongarch'>
+    <include filename='loongarch_vendors.xml'/>
+    <include filename='loongarch_features.xml'/>
+
+    <group name='3A5000 model'>
+      <include filename='loongarch_la464.xml'/>
+    </group>
+
+    <group name='3A6000 model'>
+      <include filename='loongarch_la664.xml'/>
+    </group>
+  </arch>
 </cpus>
diff --git a/src/cpu_map/loongarch_features.xml 
b/src/cpu_map/loongarch_features.xml
new file mode 100644
index 0000000000..b86721d27d
--- /dev/null
+++ b/src/cpu_map/loongarch_features.xml
@@ -0,0 +1,26 @@
+<cpus>
+  <feature name='lbt'>
+    <cpucfg index='0xf0000000' value='0x00000008'/>
+  </feature>
+  <feature name='lasx'>
+    <cpucfg index='0x00000002' value='0x00000080'/>
+  </feature>
+  <feature name='lsx'>
+    <cpucfg index='0x00000002' value='0x00000040'/>
+  </feature>
+  <feature name='ptw'>
+    <cpucfg index='0x00000002' value='0x01000000'/>
+  </feature>
+  <feature name='pmu'>
+    <cpucfg index='0x00000006' value='0x00000001'/>
+  </feature>
+  <feature name='msgint'>
+    <cpucfg index='0x00000001' value='0x04000000'/>
+  </feature>
+  <feature name='kvm-pv-ipi'>
+    <cpucfg index='0xf0000000' value='0x00000001'/>
+  </feature>
+  <feature name='kvm-steal-time'>
+    <cpucfg index='0xf0000000' value='0x00000002'/>
+  </feature>
+</cpus>
diff --git a/src/cpu_map/loongarch_la464.xml b/src/cpu_map/loongarch_la464.xml
new file mode 100644
index 0000000000..df75222d78
--- /dev/null
+++ b/src/cpu_map/loongarch_la464.xml
@@ -0,0 +1,10 @@
+<cpus>
+  <model name='la464'>
+    <vendor name='Loongson'/>
+    <feature name='series'>
+      <cpucfg index='0' value='0xc000'/>
+    </feature>
+    <feature name='lasx'/>
+    <feature name='lsx'/>
+  </model>
+</cpus>
diff --git a/src/cpu_map/loongarch_la664.xml b/src/cpu_map/loongarch_la664.xml
new file mode 100644
index 0000000000..7cf8c8fb06
--- /dev/null
+++ b/src/cpu_map/loongarch_la664.xml
@@ -0,0 +1,11 @@
+<cpus>
+  <model name='la664'>
+    <vendor name='Loongson'/>
+    <feature name='series'>
+      <cpucfg index='0' value='0xd000'/>
+    </feature>
+    <feature name='ptw'/>
+    <feature name='lasx'/>
+    <feature name='lsx'/>
+  </model>
+</cpus>
diff --git a/src/cpu_map/loongarch_vendors.xml 
b/src/cpu_map/loongarch_vendors.xml
new file mode 100644
index 0000000000..d40d2d7e51
--- /dev/null
+++ b/src/cpu_map/loongarch_vendors.xml
@@ -0,0 +1,3 @@
+<cpus>
+  <vendor name='Loongson' value='0x14'/>
+</cpus>
diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build
index fd5d2596ec..3a707c1ff1 100644
--- a/src/cpu_map/meson.build
+++ b/src/cpu_map/meson.build
@@ -17,6 +17,10 @@ cpumap_data = [
   'arm_ThunderX299xx.xml',
   'arm_vendors.xml',
   'index.xml',
+  'loongarch_features.xml',
+  'loongarch_la464.xml',
+  'loongarch_la664.xml',
+  'loongarch_vendors.xml',
   'ppc64_POWER10.xml',
   'ppc64_POWER11.xml',
   'ppc64_POWER6.xml',
-- 
2.39.1

Reply via email to