Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 stressapptest (1.0.6-2.lnd.1) unstable; urgency=medium
 .
   * add loongarch64 support
Author: Nan xiongchao <nanxiongchao@loongson.cn>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2021-08-12

--- stressapptest-1.0.6.orig/configure.ac
+++ stressapptest-1.0.6/configure.ac
@@ -41,8 +41,16 @@ case x"$target_cpu" in
     AC_DEFINE([STRESSAPPTEST_CPU_ARMV7A],[],
               [Defined if the target CPU is armv7a])
     ;;
+  "xloongarch64")
+    AC_DEFINE([STRESSAPPTEST_CPU_LOONGARCH64],[],
+              [Defined if the target CPU is loongarch64])
+    ;;
+  "xmips64el")
+    AC_DEFINE([STRESSAPPTEST_CPU_MIPS64EL],[],
+              [Defined if the target CPU is mips64el])
+    ;;
   *)
-    AC_MSG_ERROR([$target_cpu is not supported! Try x86_64, i686, powerpc, or armv7a])
+    AC_MSG_ERROR([$target_cpu is not supported! Try x86_64, i686, powerpc, or armv7a, loongarch64, mips64el])
     ;;
 esac
 
--- stressapptest-1.0.6.orig/src/os.h
+++ stressapptest-1.0.6/src/os.h
@@ -172,6 +172,14 @@ class OsLayer {
     datacast_t data;
     __asm __volatile("rdtsc" : "=a" (data.l32.l), "=d"(data.l32.h));
     tsc = data.l64;
+#elif defined(STRESSAPPTEST_CPU_LOONGARCH64)
+    datacast_t data;
+    uint64 ci;
+    __asm __volatile("rdtime.d %0, %1" : "=r"(data.l64), "=r"(ci));
+    tsc = data.l64;
+#elif defined(STRESSAPPTEST_CPU_MIPS64EL)
+  #warning "Unsupported CPU type MIPS64EL: your build may not function correctly"
+    tsc = 0;
 #elif defined(STRESSAPPTEST_CPU_ARMV7A)
   #warning "Unsupported CPU type ARMV7A: your build may not function correctly"
     tsc = 0;
--- stressapptest-1.0.6.orig/src/worker.cc
+++ stressapptest-1.0.6/src/worker.cc
@@ -93,6 +93,12 @@ namespace {
         : "=b" (cpu)
 # endif
         : "a" (1) : "cx", "dx");
+#elif defined(STRESSAPPTEST_CPU_LOONGARCH64)
+  #warning "Unsupported CPU type loongarch64: unable to determine core ID."
+    cpu = 0;
+#elif defined(STRESSAPPTEST_CPU_MIPS64EL)
+  #warning "Unsupported CPU type mips64el: unable to determine core ID."
+    cpu = 0;
 #elif defined(STRESSAPPTEST_CPU_ARMV7A)
   #warning "Unsupported CPU type ARMV7A: unable to determine core ID."
     cpu = 0;
