From 55c7dc34b8ff1a75bb011ca783b6cd3c7f1a5643 Mon Sep 17 00:00:00 2001
From: zhaotianrui <zhaotianrui@loongson.cn>
Date: Wed, 11 Jan 2023 11:41:55 -0500
Subject: [PATCH 2/4] Add loongarch cpu model and vendor info

Define loongarch cpu model type and vendor id in
cpu_map/loongarch.xml

Signed-off-by: zhaotianrui <zhaotianrui@loongson.cn>
---
 src/cpu_map/Makefile.inc.am       | 2 ++
 src/cpu_map/index.xml             | 5 +++++
 src/cpu_map/loongarch_3a5000.xml  | 6 ++++++
 src/cpu_map/loongarch_vendors.xml | 3 +++
 4 files changed, 16 insertions(+)
 create mode 100644 src/cpu_map/loongarch_3a5000.xml
 create mode 100644 src/cpu_map/loongarch_vendors.xml

diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index 8eb818706a..3c674dea40 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -68,6 +68,8 @@ cpumap_DATA = \
 	cpu_map/x86_Skylake-Server-noTSX-IBRS.xml \
 	cpu_map/x86_Westmere.xml \
 	cpu_map/x86_Westmere-IBRS.xml \
+	cpu_map/loongarch_vendors.xml \
+	cpu_map/loongarch_3a5000.xml \
 	cpu_map/arm_vendors.xml \
 	cpu_map/arm_cortex-a53.xml \
 	cpu_map/arm_cortex-a57.xml \
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 3ccc76b9ed..1c05dd814d 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -101,4 +101,9 @@
     <include filename='arm_FT-2000plus.xml'/>
     <include filename='arm_Tengyun-S2500.xml'/>
   </arch>
+
+  <arch name='loongarch64'>
+    <include filename="loongarch_vendors.xml"/>
+    <include filename="loongarch_3a5000.xml"/>
+  </arch>
 </cpus>
diff --git a/src/cpu_map/loongarch_3a5000.xml b/src/cpu_map/loongarch_3a5000.xml
new file mode 100644
index 0000000000..f6fe3386f7
--- /dev/null
+++ b/src/cpu_map/loongarch_3a5000.xml
@@ -0,0 +1,6 @@
+<cpus>
+  <model name='Loongson-3A5000'>
+    <vendor name='Loongson'/>
+      <prid value='0x14c010' mask='0xfffff0'/>
+  </model>
+</cpus>
diff --git a/src/cpu_map/loongarch_vendors.xml b/src/cpu_map/loongarch_vendors.xml
new file mode 100644
index 0000000000..c744654617
--- /dev/null
+++ b/src/cpu_map/loongarch_vendors.xml
@@ -0,0 +1,3 @@
+<cpus>
+  <vendor name='Loongson'/>
+</cpus>
-- 
2.25.1

