Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp192809iob; Mon, 2 May 2022 16:49:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDKTzu918ubRNo3Qs5rTSmhL4x5kJjL/VNVQ3qLMPj8oaQktrnAlUzdkVKySwXoCxLf0Km X-Received: by 2002:a17:90b:4a06:b0:1d2:a600:3020 with SMTP id kk6-20020a17090b4a0600b001d2a6003020mr1751367pjb.87.1651535353926; Mon, 02 May 2022 16:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651535353; cv=none; d=google.com; s=arc-20160816; b=dpXB1L+C9HOz7HZZC88M0nHvAJ28Ht8mXoMM76ySIgV3EQlYqN7IqSGlIsULTnd/vE vAWouZhmlnYDptozctqxMJeVxQP2DcA8yk6KHYGfiMvwKijbO0+fETKUdVWlYk510qZO vgBrgccjbf2LzxCj2PJ/If8yv22+gRL67yy58uze7CWKWIbJaJP6oscYqnwd79WrgLNd HurA270ADywm6hQhDv9J9G/hvcwOl0So7H2k1BY7gPzljHPjiY2vdim8EAJQ23iIq7pe nC3HPvniiPBlWSVFMsSCgZkX4g5Ref/4GNoM0nZ+Pi+urkuVagj3AfvuGKW/eDDVavA7 3Oew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=aOUmnl7BKu1huo7JhRvlC6s5ifyyE6pCVv3geLjblJE=; b=zpxf1G1NO5UuKftWSUP78b8fiRvSPHzqqZjyHDdMksLVuQ094UXnKTd1IZZIktcGrq y5hwR/FNVVLS9w1f3hrBMZ6ARyfugUL1+kap3al6ObsudnyVj/eFtMJQ4ZwkjwQb3Rc/ hjl0OAIZXI/Obpog69cqX9U4bGoswP6awWQeifalFNjbq7Be4dz3wIPZ2sOpWaS2cKSD xc/IObMbfidr4VGI9+P8vujpziubU4mWTBElPmVyzQTB4SYnlheq1PUS5GLQ0YJwKRvc u1K34vIguZ0wIXpLhLQ8XXJbrWEvH7YhA34Kwe9BDT2e37nhA3aDaTPjXa0+ps54PRMr jE/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iw71wdeV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n8-20020a170902e54800b001562b0bf47bsi1248187plf.58.2022.05.02.16.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:49:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iw71wdeV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 609DB338BE; Mon, 2 May 2022 16:49:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233025AbiEAI7B (ORCPT + 99 others); Sun, 1 May 2022 04:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233784AbiEAI65 (ORCPT ); Sun, 1 May 2022 04:58:57 -0400 Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63F646571; Sun, 1 May 2022 01:55:25 -0700 (PDT) Received: by mail-vk1-xa2c.google.com with SMTP id o132so5464832vko.11; Sun, 01 May 2022 01:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aOUmnl7BKu1huo7JhRvlC6s5ifyyE6pCVv3geLjblJE=; b=iw71wdeVgX/zqOqatNvV37VC5uK48TPq+zz/4eoVern9BMCrd+yw1BVQJhENpcrAY2 Y6X1JzJ860vYmWLV+Rc8ED2iFlSJhWX9pTmRJxoOThy1cnnNUrgstPJD0mXXCTrs3Ltq cIaSTPwONr6lyKL86B1BEP9qA0kA4yKjo8NPmkt04+sH9QNPE2kPUxb8QBmaPW2uE81h NHZtiPwQ2ezrLyi+dEY35WkeF49mauv4N/xlLrBVBKmvpScjODdA+zY++S3ht6RDVrv3 IJUiMixnC3tvHkaQ1TqrMmZsmOkxSfkW5UkWKr3lKS8zCFq5ZZr1Dn72zwiy2dhQbEoC c+8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aOUmnl7BKu1huo7JhRvlC6s5ifyyE6pCVv3geLjblJE=; b=IymEvJ8VLvWky//dDlGZuWB+u6EvE7IuswCPjMrfKUf8cSZGjW2p4NlEKAfd5PN0nX tXQg9PB+ZYIVY4KiY9KGNJLzfaemZapI1K3e0QBL780+cTdIGkRqzKv7IUjNPciMKJlf V59zctSsJBo4X5sHQUbqFgQDYzMAKoDZMB3H33HJRkc3MxQb80FKsws6/yunYqKClH0A +Vf6osoVWSLRPWxfbkpWM2bVjorFw0pENFDkINcWp1OYwzDvHJsgP470koUVCcWEUwl3 u4KCeQ4qolZxvJ6iNY5Ebhd0snYR6bGTRt+7rZfXczOWHczD0xzSeo+POMvlwQbKZNC1 /4xQ== X-Gm-Message-State: AOAM530tqbJ0HNdH4i0PKYGrHWmeOzu/Vkl6uctextqUqHdGI1NE6FWT M0Ipy2i+nSiovTU9z+4i2Pi6a9xyj8vPD1jVKiU= X-Received: by 2002:a1f:e606:0:b0:34d:76c1:722c with SMTP id d6-20020a1fe606000000b0034d76c1722cmr1806372vkh.17.1651395323323; Sun, 01 May 2022 01:55:23 -0700 (PDT) MIME-Version: 1.0 References: <20220430090518.3127980-1-chenhuacai@loongson.cn> <20220430090518.3127980-2-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Sun, 1 May 2022 16:55:12 +0800 Message-ID: Subject: Re: [PATCH V9 01/24] Documentation: LoongArch: Add basic documentations To: Bagas Sanjaya Cc: Huacai Chen , Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds , linux-arch , "open list:DOCUMENTATION" , LKML , Xuefeng Li , Yanteng Si , Guo Ren , Xuerui Wang , Jiaxun Yang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Bagas, On Sun, May 1, 2022 at 3:49 PM Bagas Sanjaya wrote: > > On Sat, Apr 30, 2022 at 05:04:55PM +0800, Huacai Chen wrote: > > +Instruction names (Mnemonics) > > +----------------------------- > > + > > +We only list the instruction names here, for details please read the references. > > + > > +Arithmetic Operation Instructions:: > > + > > + ADD.W SUB.W ADDI.W ADD.D SUB.D ADDI.D > > + SLT SLTU SLTI SLTUI > > + AND OR NOR XOR ANDN ORN ANDI ORI XORI > > + MUL.W MULH.W MULH.WU DIV.W DIV.WU MOD.W MOD.WU > > + MUL.D MULH.D MULH.DU DIV.D DIV.DU MOD.D MOD.DU > > + PCADDI PCADDU12I PCADDU18I > > + LU12I.W LU32I.D LU52I.D ADDU16I.D > > + > > +Bit-shift Instructions:: > > + > > + SLL.W SRL.W SRA.W ROTR.W SLLI.W SRLI.W SRAI.W ROTRI.W > > + SLL.D SRL.D SRA.D ROTR.D SLLI.D SRLI.D SRAI.D ROTRI.D > > + > > +Bit-manipulation Instructions:: > > + > > + EXT.W.B EXT.W.H CLO.W CLO.D SLZ.W CLZ.D CTO.W CTO.D CTZ.W CTZ.D > > + BYTEPICK.W BYTEPICK.D BSTRINS.W BSTRINS.D BSTRPICK.W BSTRPICK.D > > + REVB.2H REVB.4H REVB.2W REVB.D REVH.2W REVH.D BITREV.4B BITREV.8B BITREV.W BITREV.D > > + MASKEQZ MASKNEZ > > + > > +Branch Instructions:: > > + > > + BEQ BNE BLT BGE BLTU BGEU BEQZ BNEZ B BL JIRL > > + > > +Load/Store Instructions:: > > + > > + LD.B LD.BU LD.H LD.HU LD.W LD.WU LD.D ST.B ST.H ST.W ST.D > > + LDX.B LDX.BU LDX.H LDX.HU LDX.W LDX.WU LDX.D STX.B STX.H STX.W STX.D > > + LDPTR.W LDPTR.D STPTR.W STPTR.D > > + PRELD PRELDX > > + > > +Atomic Operation Instructions:: > > + > > + LL.W SC.W LL.D SC.D > > + AMSWAP.W AMSWAP.D AMADD.W AMADD.D AMAND.W AMAND.D AMOR.W AMOR.D AMXOR.W AMXOR.D > > + AMMAX.W AMMAX.D AMMIN.W AMMIN.D > > + > > +Barrier Instructions:: > > + > > + IBAR DBAR > > + > > +Special Instructions:: > > + > > + SYSCALL BREAK CPUCFG NOP IDLE ERTN DBCL RDTIMEL.W RDTIMEH.W RDTIME.D ASRTLE.D ASRTGT.D > > + > > +Privileged Instructions:: > > + > > + CSRRD CSRWR CSRXCHG > > + IOCSRRD.B IOCSRRD.H IOCSRRD.W IOCSRRD.D IOCSRWR.B IOCSRWR.H IOCSRWR.W IOCSRWR.D > > + CACOP TLBP(TLBSRCH) TLBRD TLBWR TLBFILL TLBCLR TLBFLUSH INVTLB LDDIR LDPTE > > + > > Since these above are list of instruction categories, it's better to use > enumerated lists. Also, make use of ReST labels to link to References > sections, like this: OK, thanks, let me try. Huacai > > -- >8 -- > > diff --git a/Documentation/loongarch/introduction.rst b/Documentation/loongarch/introduction.rst > index 420c0d2ebcfbe7..2d83283ecf28b9 100644 > --- a/Documentation/loongarch/introduction.rst > +++ b/Documentation/loongarch/introduction.rst > @@ -194,60 +194,61 @@ can see I21L/I21H and I26L/I26H here. > Instruction names (Mnemonics) > ----------------------------- > > -We only list the instruction names here, for details please read the references. > +We only list the instruction names here, for details please read the > +:ref:`references `. > > -Arithmetic Operation Instructions:: > +1. Arithmetic Operation Instructions:: > > - ADD.W SUB.W ADDI.W ADD.D SUB.D ADDI.D > - SLT SLTU SLTI SLTUI > - AND OR NOR XOR ANDN ORN ANDI ORI XORI > - MUL.W MULH.W MULH.WU DIV.W DIV.WU MOD.W MOD.WU > - MUL.D MULH.D MULH.DU DIV.D DIV.DU MOD.D MOD.DU > - PCADDI PCADDU12I PCADDU18I > - LU12I.W LU32I.D LU52I.D ADDU16I.D > + ADD.W SUB.W ADDI.W ADD.D SUB.D ADDI.D > + SLT SLTU SLTI SLTUI > + AND OR NOR XOR ANDN ORN ANDI ORI XORI > + MUL.W MULH.W MULH.WU DIV.W DIV.WU MOD.W MOD.WU > + MUL.D MULH.D MULH.DU DIV.D DIV.DU MOD.D MOD.DU > + PCADDI PCADDU12I PCADDU18I > + LU12I.W LU32I.D LU52I.D ADDU16I.D > > -Bit-shift Instructions:: > +2. Bit-shift Instructions:: > > - SLL.W SRL.W SRA.W ROTR.W SLLI.W SRLI.W SRAI.W ROTRI.W > - SLL.D SRL.D SRA.D ROTR.D SLLI.D SRLI.D SRAI.D ROTRI.D > + SLL.W SRL.W SRA.W ROTR.W SLLI.W SRLI.W SRAI.W ROTRI.W > + SLL.D SRL.D SRA.D ROTR.D SLLI.D SRLI.D SRAI.D ROTRI.D > > -Bit-manipulation Instructions:: > +3. Bit-manipulation Instructions:: > > - EXT.W.B EXT.W.H CLO.W CLO.D SLZ.W CLZ.D CTO.W CTO.D CTZ.W CTZ.D > - BYTEPICK.W BYTEPICK.D BSTRINS.W BSTRINS.D BSTRPICK.W BSTRPICK.D > - REVB.2H REVB.4H REVB.2W REVB.D REVH.2W REVH.D BITREV.4B BITREV.8B BITREV.W BITREV.D > - MASKEQZ MASKNEZ > + EXT.W.B EXT.W.H CLO.W CLO.D SLZ.W CLZ.D CTO.W CTO.D CTZ.W CTZ.D > + BYTEPICK.W BYTEPICK.D BSTRINS.W BSTRINS.D BSTRPICK.W BSTRPICK.D > + REVB.2H REVB.4H REVB.2W REVB.D REVH.2W REVH.D BITREV.4B BITREV.8B BITREV.W BITREV.D > + MASKEQZ MASKNEZ > > -Branch Instructions:: > +4. Branch Instructions:: > > - BEQ BNE BLT BGE BLTU BGEU BEQZ BNEZ B BL JIRL > + BEQ BNE BLT BGE BLTU BGEU BEQZ BNEZ B BL JIRL > > -Load/Store Instructions:: > +5. Load/Store Instructions:: > > - LD.B LD.BU LD.H LD.HU LD.W LD.WU LD.D ST.B ST.H ST.W ST.D > - LDX.B LDX.BU LDX.H LDX.HU LDX.W LDX.WU LDX.D STX.B STX.H STX.W STX.D > - LDPTR.W LDPTR.D STPTR.W STPTR.D > - PRELD PRELDX > + LD.B LD.BU LD.H LD.HU LD.W LD.WU LD.D ST.B ST.H ST.W ST.D > + LDX.B LDX.BU LDX.H LDX.HU LDX.W LDX.WU LDX.D STX.B STX.H STX.W STX.D > + LDPTR.W LDPTR.D STPTR.W STPTR.D > + PRELD PRELDX > > -Atomic Operation Instructions:: > +6. Atomic Operation Instructions:: > > - LL.W SC.W LL.D SC.D > - AMSWAP.W AMSWAP.D AMADD.W AMADD.D AMAND.W AMAND.D AMOR.W AMOR.D AMXOR.W AMXOR.D > - AMMAX.W AMMAX.D AMMIN.W AMMIN.D > + LL.W SC.W LL.D SC.D > + AMSWAP.W AMSWAP.D AMADD.W AMADD.D AMAND.W AMAND.D AMOR.W AMOR.D AMXOR.W AMXOR.D > + AMMAX.W AMMAX.D AMMIN.W AMMIN.D > > -Barrier Instructions:: > +7. Barrier Instructions:: > > - IBAR DBAR > + IBAR DBAR > > -Special Instructions:: > +8. Special Instructions:: > > - SYSCALL BREAK CPUCFG NOP IDLE ERTN DBCL RDTIMEL.W RDTIMEH.W RDTIME.D ASRTLE.D ASRTGT.D > + SYSCALL BREAK CPUCFG NOP IDLE ERTN DBCL RDTIMEL.W RDTIMEH.W RDTIME.D ASRTLE.D ASRTGT.D > > -Privileged Instructions:: > +9. Privileged Instructions:: > > - CSRRD CSRWR CSRXCHG > - IOCSRRD.B IOCSRRD.H IOCSRRD.W IOCSRRD.D IOCSRWR.B IOCSRWR.H IOCSRWR.W IOCSRWR.D > - CACOP TLBP(TLBSRCH) TLBRD TLBWR TLBFILL TLBCLR TLBFLUSH INVTLB LDDIR LDPTE > + CSRRD CSRWR CSRXCHG > + IOCSRRD.B IOCSRRD.H IOCSRRD.W IOCSRRD.D IOCSRWR.B IOCSRWR.H IOCSRWR.W IOCSRWR.D > + CACOP TLBP(TLBSRCH) TLBRD TLBWR TLBFILL TLBCLR TLBFLUSH INVTLB LDDIR LDPTE > > Virtual Memory > ============== > @@ -315,6 +316,8 @@ MIPS, while New Loongson is based on LoongArch. Take Loongson-3 as an example: > Loongson-3A1000/3B1500/3A2000/3A3000/3A4000 are MIPS-compatible, while Loongson- > 3A5000 (and future revisions) are all based on LoongArch. > > +.. _loongarch-references: > + > References > ========== > > > > + > > + +---------------------------------------------+ > > + |:: | > > + | | > > + | +-----+ +---------+ +-------+ | > > + | | IPI | --> | CPUINTC | <-- | Timer | | > > + | +-----+ +---------+ +-------+ | > > + | ^ | > > + | | | > > + | +---------+ +-------+ | > > + | | LIOINTC | <-- | UARTs | | > > + | +---------+ +-------+ | > > + | ^ | > > + | | | > > + | +-----------+ | > > + | | HTVECINTC | | > > + | +-----------+ | > > + | ^ ^ | > > + | | | | > > + | +---------+ +---------+ | > > + | | PCH-PIC | | PCH-MSI | | > > + | +---------+ +---------+ | > > + | ^ ^ ^ | > > + | | | | | > > + | +---------+ +---------+ +---------+ | > > + | | PCH-LPC | | Devices | | Devices | | > > + | +---------+ +---------+ +---------+ | > > + | ^ | > > + | | | > > + | +---------+ | > > + | | Devices | | > > + | +---------+ | > > + | | > > + | | > > + +---------------------------------------------+ > > + > ... > > + > > + +--------------------------------------------------------+ > > + |:: | > > + | | > > + | +-----+ +---------+ +-------+ | > > + | | IPI | --> | CPUINTC | <-- | Timer | | > > + | +-----+ +---------+ +-------+ | > > + | ^ ^ | > > + | | | | > > + | +---------+ +---------+ +-------+ | > > + | | EIOINTC | | LIOINTC | <-- | UARTs | | > > + | +---------+ +---------+ +-------+ | > > + | ^ ^ | > > + | | | | > > + | +---------+ +---------+ | > > + | | PCH-PIC | | PCH-MSI | | > > + | +---------+ +---------+ | > > + | ^ ^ ^ | > > + | | | | | > > + | +---------+ +---------+ +---------+ | > > + | | PCH-LPC | | Devices | | Devices | | > > + | +---------+ +---------+ +---------+ | > > + | ^ | > > + | | | > > + | +---------+ | > > + | | Devices | | > > + | +---------+ | > > + | | > > + | | > > + +--------------------------------------------------------+ > > + > > I think just literal blocks is enough for the diagrams above. > > -- > An old man doll... just what I always wanted! - Clara