From patchwork Mon Jul 18 13:09:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weiwei Li X-Patchwork-Id: 12921253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D13EECCA47F for ; Mon, 18 Jul 2022 13:11:48 +0000 (UTC) Received: from localhost ([::1]:42466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDQXL-00054n-PQ for qemu-devel@archiver.kernel.org; Mon, 18 Jul 2022 09:11:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDQVr-0002HZ-OO; Mon, 18 Jul 2022 09:10:15 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:43136 helo=cstnet.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDQVo-0002zd-4d; Mon, 18 Jul 2022 09:10:15 -0400 Received: from localhost.localdomain (unknown [180.156.173.38]) by APP-01 (Coremail) with SMTP id qwCowABnbweqW9Vi5+hPEQ--.55056S2; Mon, 18 Jul 2022 21:10:04 +0800 (CST) From: Weiwei Li To: palmer@dabbelt.com, alistair.francis@wdc.com, bin.meng@windriver.com, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: wangjunqiang@iscas.ac.cn, lazyparser@gmail.com, Weiwei Li Subject: [PATCH V3 0/6] Improve the U/S/H extension related check Date: Mon, 18 Jul 2022 21:09:49 +0800 Message-Id: <20220718130955.11899-1-liweiwei@iscas.ac.cn> X-Mailer: git-send-email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-IP: [180.156.173.38] X-CM-SenderInfo: 5olzvxxzhlqxpvfd2hldfou0/ Received-SPF: pass client-ip=159.226.251.21; envelope-from=liweiwei@iscas.ac.cn; helo=cstnet.cn X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patchset tries to improve the U/S/H related check: * add check for the supported privilege modes conbinations: only supporting M, S mode is not a suggested combination * add check for "H extension depends on I extension" * add check for "H extension implicitly requires S mode" * add check for csrs only existed when U mode is supported * fix and simplify the checks in hmode/hmode32 Any suggestions are welcome. v3: * Fix the issues suggested by Andrew Jones in commit messages v2: * update patch 3 to make the newlines start at the same position as above line * update patch 5 to add check for "H extension implicitly requires S mode" Weiwei Li (6): target/riscv: Add check for supported privilege mode combinations target/riscv: H extension depends on I extension target/riscv: Fix checkpatch warning may triggered in csr_ops table target/riscv: Add check for csrs existed with U extension target/riscv: Fix checks in hmode/hmode32 target/riscv: Simplify the check in hmode to resue the check in riscv_csrrw_check target/riscv/cpu.c | 17 ++ target/riscv/csr.c | 490 ++++++++++++++++++++++++--------------------- 2 files changed, 278 insertions(+), 229 deletions(-)