Skip to contentSkip to conversation

target-mips: Implement Loongson 3A processor.

PATCH Superseded [email protected] 2 participants 2 messages Nov 22, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-mips: Implement Loongson 3A processor.

From: Heiher <[email protected]>

---
 target-mips/mips-defs.h      |   2 +
 target-mips/translate.c      | 449 ++++++++++++++++++++++++++++++++++++++++++-
 target-mips/translate_init.c |  24 +++
 3 files changed, 469 insertions(+), 6 deletions(-)
target-mips/mips-defs.h +2 -0
index 047554e..30e3197 100644
@@ -50,6 +50,7 @@
 /* Chip specific instructions. */
 #define		INSN_LOONGSON2E  0x20000000
 #define		INSN_LOONGSON2F  0x40000000
+#define		INSN_LOONGSON3A  0x10000000
 #define		INSN_VR54XX	0x80000000
 
 /* MIPS CPU defines. */
@@ -70,6 +71,7 @@
 /* MIPS Technologies "Release 2" */
 #define		CPU_MIPS32R2	(CPU_MIPS32 | ISA_MIPS32R2)
 #define		CPU_MIPS64R2	(CPU_MIPS64 | CPU_MIPS32R2 | ISA_MIPS64R2)
+#define		CPU_LOONGSON3A  (CPU_MIPS64R2 | INSN_LOONGSON3A)
 
 /* MIPS Technologies "Release 3" */
 #define CPU_MIPS32R3 (CPU_MIPS32R2 | ISA_MIPS32R3)
target-mips/translate.c +443 -6

483 lines not on this page · raw message

target-mips/translate_init.c +24 -0
index 39ed5c4..ad3d4f6 100644
@@ -750,6 +750,30 @@ static const mips_def_t mips_defs[] =
         .mmu_type = MMU_TYPE_R4000,
     },
     {
+        .name = "Loongson-3A",
+        .CP0_PRid = 0x6308,
+        /* 64KB I-cache and d-cache. 4 way with 32 bit cache line size.  */
+        .CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) | (0x2 << CP0C0_AT) |
+                       (MMU_TYPE_R4000 << CP0C0_MT),
+        .CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (63 << CP0C1_MMU) |
+                       (2 << CP0C1_IS) | (4 << CP0C1_IL) | (3 << CP0C1_IA) |
+                       (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA) |
+                       (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP),
+        .CP0_Config2 = MIPS_CONFIG2 | (5 << CP0C2_SS) | ( 5 << CP0C2_SL) |
+                       (3 << CP0C2_SA),
+        .CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_LPA),
+        .SYNCI_Step = 16,
+        .CCRes = 2,
+        .CP0_Status_rw_bitmask = 0xF5D0FFFF,
+        .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV) | (0x1 << FCR0_F64),
+        .CP1_fcr31 = 0,
+        .CP1_fcr31_rw_bitmask = 0xFF83FFFF,
+        .SEGBITS = 40,
+        .PABITS = 40,
+        .insn_flags = CPU_LOONGSON3A,
+        .mmu_type = MMU_TYPE_R4000,
+    },
+    {
         /* A generic CPU providing MIPS64 ASE DSP 2 features.
            FIXME: Eventually this should be replaced by a real CPU model. */
         .name = "mips64dspr2",
Signature · 1 line
2.10.2
#1 lore raw
Your series seems to have some coding style problems. See output below for more information:

Hi,

Your series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PATCH] target-mips: Implement Loongson 3A processor.
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
16e778e target-mips: Implement Loongson 3A processor.

=== OUTPUT BEGIN ===
Checking PATCH 1/1: target-mips: Implement Loongson 3A processor....
ERROR: code indent should never use tabs
#17: FILE: target-mips/mips-defs.h:53:
+#define^I^IINSN_LOONGSON3A 0x10000000$

ERROR: code indent should never use tabs
#25: FILE: target-mips/mips-defs.h:74:
+#define^I^ICPU_LOONGSON3A (CPU_MIPS64R2 | INSN_LOONGSON3A)$

ERROR: braces {} are necessary for all arms of this statement #49: FILE: target-mips/translate.c:2453:
+ if (left)
[...]

ERROR: braces {} are necessary for all arms of this statement #65: FILE: target-mips/translate.c:2469:
+ if (left)
[...]
+ else
[...]

ERROR: braces {} are necessary for all arms of this statement #88: FILE: target-mips/translate.c:2492:
+ if (left)
[...]

ERROR: switch and case should be at the same indent #128: FILE: target-mips/translate.c:2532:
+ switch (ctx->opcode & 0xc03f) {
+ case 4: /* gslwlc1 */
[...]
+ case 5: /* gslwrc1 */
[...]
+ case 6: /* gsldlc1 */
[...]
+ case 7: /* gsldrc1 */
[...]
+ default:

ERROR: space prohibited before that '++' (ctx:WxO) #146: FILE: target-mips/translate.c:2550:

+                    gen_excp_cop2 ++;
                                   ^

ERROR: switch and case should be at the same indent #149: FILE: target-mips/translate.c:2553:
+ switch (ctx->opcode & 0x8020) {
[...]
+ case 0x20: /* gslq */
[...]
+ case 0x8020: /* gslqc1 */
[...]
+ default:

ERROR: space prohibited before that '++' (ctx:WxO) #176: FILE: target-mips/translate.c:2580:

+                    gen_excp_cop2 ++;
                                   ^

ERROR: switch and case should be at the same indent #181: FILE: target-mips/translate.c:2585:
+ switch (ctx->opcode & 0x7) {
+ case 0x0: /* gslbx */
[...]
+ case 0x1: /* gslhx */
[...]
+ case 0x2: /* gslwx */
[...]
+ case 0x3: /* gsldx */
[...]
+ case 0x6: /* gslwxc1 */
[...]
+ case 0x7: /* gsldxc1 */
[...]
+ default:

ERROR: switch and case should be at the same indent #249: FILE: target-mips/translate.c:2653:
+ switch (ctx->opcode & 0xc03f) {
+ case 4: /* gsswlc1 */
[...]
+ case 5: /* gsswrc1 */
[...]
+ case 6: /* gssdlc1 */

ERROR: space prohibited before that '++' (ctx:WxO) #309: FILE: target-mips/translate.c:2713:

+                    gen_excp_cop2 ++;
                                   ^

ERROR: switch and case should be at the same indent #312: FILE: target-mips/translate.c:2716:
+ switch (ctx->opcode & 0x8020) {
[...]
+ case 0x20: /* gssq */
[...]
+ case 0x8020: /* gssqc1 */
[...]
+ default:

ERROR: space prohibited before that '++' (ctx:WxO) #341: FILE: target-mips/translate.c:2745:

+                    gen_excp_cop2 ++;
                                   ^

ERROR: switch and case should be at the same indent #346: FILE: target-mips/translate.c:2750:
+ switch (ctx->opcode & 0x7) {
+ case 0x0: /* gssbx */
[...]
+ case 0x1: /* gsshx */
[...]
+ case 0x2: /* gsswx */
[...]
+ case 0x3: /* gssdx */
[...]
+ case 0x6: /* gsswxc1 */
[...]
+ case 0x7: /* gssdxc1 */
[...]
+ default:

ERROR: space prohibited after that open parenthesis '(' #538: FILE: target-mips/translate_init.c:784:
+ .CP0_Config2 = MIPS_CONFIG2 | (5 << CP0C2_SS) | ( 5 << CP0C2_SL) |

total: 16 errors, 0 warnings, 527 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]