From patchwork Tue Oct 19 15:24:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515964 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp810308imp; Tue, 19 Oct 2021 09:11:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj/2sulNpQmaSaxPjw5y4wVdCLCMHCSiLVyJCteQgFSriWnEAaCzn90feXI9Dcl+Cka7PE X-Received: by 2002:a37:91c1:: with SMTP id t184mr719175qkd.129.1634659872427; Tue, 19 Oct 2021 09:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634659872; cv=none; d=google.com; s=arc-20160816; b=pxkp05YC4B5f+0dnAzLdobcYhbR0xQg1ZximsMj7CjUvHTI76uPNFbULyoVDKIKrSB rJi/4buKBEy+VLLlcY7kV4YzC7YaQ+PL2Pf6fIQ4R4Xy+6Sdme8tSRgpaaDl1MAJX/rn mVSYiF82MoA6XGbzG7iTOGnXy5gqsuJsS/HiV04i0m5iR3SqYQEBFwp/2aIQarVz1ldh VNzlgUJrsUO76nNa7L3aoXoSXYXmEBckrgSZwpWV9AYy+I0M4IQ5hOjr7jH/csYM0a7s XlPcnU8QmeDuoVF1FY8GlDfTlN4VYwjFlt+i3/dh2p4pwFWGSu155I5PApmqK075GULa 4rQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=YRdhBqAZVe2CoKMEXUJmw7YJyaxSB5A7JVaWtsnB0O4=; b=S5GOGURTU+0COgGvgDfsff5ZBTSu4h+InwDggWdmfncQHqUsQLGOwpfsvEhyjle3nF IvuU6K52r2gTXowX849dEviX2mTwvIBRQeQT3gyoyDpmyAMtDWWXyHtzEH2YSTWJtqqI vMZhxf33kpPfxXmrisrcX7LwtMhrqQdAyjqe/jI9gsQVv+yRq4tIqWRcDPvgHK0YSXWH 2UHup4H5aum/Y/+sDvCUl8XlHR/mvMjeSBPZqEU6mF315ES9E6dTbpXlBKAn/yV4KMCW VrtHuT3zh0FnMGFTT+o9q+IvF/o0RP6/H6U4NRyYlw1NqE2PHuMBHPegr3ZJIqjDppfI r6BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=g9yhLzFQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n4si15528749vsh.363.2021.10.19.09.11.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Oct 2021 09:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=g9yhLzFQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrhm-0002tj-QU for patch@linaro.org; Tue, 19 Oct 2021 12:11:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqyp-0004kd-NU for qemu-devel@nongnu.org; Tue, 19 Oct 2021 11:24:44 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:40628) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcqyn-0007SY-TY for qemu-devel@nongnu.org; Tue, 19 Oct 2021 11:24:43 -0400 Received: by mail-pf1-x430.google.com with SMTP id o133so218259pfg.7 for ; Tue, 19 Oct 2021 08:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YRdhBqAZVe2CoKMEXUJmw7YJyaxSB5A7JVaWtsnB0O4=; b=g9yhLzFQ80njbIvuoAstyyypG8TFRaE+yv1ZS31+k8lutueKpsa9YviQKwcJOv7hcM BxwXWuClSBAuqjHC5bO1nrL/N47HbvZN6JN1ZKsJ9Kz7uxbfaZQ2yLA2rkH/fz2bJC25 v6PIQe7beX2S6nWwrVMo7dylwdhsEoL89yR5qXs16B/w+x8zWkzuIOnegPBwSSJ9Wqok qyqpC+8hJ3GuBMnty5LbS22xAMfc/BdiUEa/yPZl4SGGx6HxqtopgEGuubjE+ResfCOj ikygYaq8DE9Z3+mLnOTF7A1sadk5cviamvA2u8EzmhCldmz/J92mtsSvTtDER/T/M5xP dzcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YRdhBqAZVe2CoKMEXUJmw7YJyaxSB5A7JVaWtsnB0O4=; b=0HfC76CdeU/0kFmCcQzCCeyMn0ioLcj1VOx7fMjdV65r8x//Jcwqcdpes/nELOIaT4 +iTm3w5+JVgc6HUOA9Ig7QZPrFx7noYAoK4LYP3oUuwYFsarKxNb5WSmqw3479LvAe3N 9dkFkYLyAFK2Lom0Sy7XUX5vzOWQz9pRI8VZnmOjyYK/noXTrrmjjt5+J2iztQ6roYdQ pKfwJxeGnE2Ht0l7K/BxkB3Q/KmmvtoHwDA6f7UBEl2sEXllYf90+E+H2uhMDEwSoH1S WXuOcNjDqZ8eWIfy17XOU9nW8jFE9gJaQt4ZQpirWm9PDHB5dyWScx96/IKXo7pWXbVF 3VDA== X-Gm-Message-State: AOAM5321/O9DO6qix1h+eaoNlqym40my+dwD0dkma0dxmaZ38UVo95fQ N1rRqCuQnZ+zwIOCnLVOp/HI+0ADC78drg== X-Received: by 2002:a65:62cb:: with SMTP id m11mr29262025pgv.425.1634657079672; Tue, 19 Oct 2021 08:24:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id i2sm3293814pjt.19.2021.10.19.08.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 08:24:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 00/16] target/riscv: Rationalize XLEN and operand length Date: Tue, 19 Oct 2021 08:24:22 -0700 Message-Id: <20211019152438.269077-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com, qemu-riscv@nongnu.org, zhiwei_liu@c-sky.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is a partial patch set attempting to set things in the right direction for both the UXL and RV128 patch sets. r~ Changes for v5: * Fix cpu_dump, which asserted for -accel qtest. Instead of filtering CSRs explicitly in cpu_dump, let the riscv_csr_operations predicate do the job. This means we won't dump S-mode registers when RVS is not enabled, much like we currently filter on RVH. Changes for v4: * Use riscv_csrrw_debug for cpu_dump. This fixes the issue that Alistair pointed out wrt the MSTATUS.SD bit not being correct in the dump; note that gdbstub already uses riscv_csrrw_debug, and so did not have a problem. * Align the registers in cpu_dump. Changes for v3: * Fix CONFIG_ typo. * Fix ctzw typo. * Mark get_xlen unused (clang werror) * Compute MSTATUS_SD on demand. Changes for v2: * Set mxl/sxl/uxl at reset. * Set sxl/uxl in write_mstatus. Richard Henderson (16): target/riscv: Move cpu_get_tb_cpu_state out of line target/riscv: Create RISCVMXL enumeration target/riscv: Split misa.mxl and misa.ext target/riscv: Replace riscv_cpu_is_32bit with riscv_cpu_mxl target/riscv: Add MXL/SXL/UXL to TB_FLAGS target/riscv: Use REQUIRE_64BIT in amo_check64 target/riscv: Properly check SEW in amo_op target/riscv: Replace is_32bit with get_xl/get_xlen target/riscv: Replace DisasContext.w with DisasContext.ol target/riscv: Use gen_arith_per_ol for RVM target/riscv: Adjust trans_rev8_32 for riscv64 target/riscv: Use gen_unary_per_ol for RVB target/riscv: Use gen_shift*_per_ol for RVB, RVI target/riscv: Align gprs and fprs in cpu_dump target/riscv: Use riscv_csrrw_debug for cpu_dump target/riscv: Compute mstatus.sd on demand target/riscv/cpu.h | 73 +++------ target/riscv/cpu_bits.h | 8 +- hw/riscv/boot.c | 2 +- linux-user/elfload.c | 2 +- linux-user/riscv/cpu_loop.c | 2 +- semihosting/arm-compat-semi.c | 2 +- target/riscv/cpu.c | 203 ++++++++++++++---------- target/riscv/cpu_helper.c | 92 ++++++++++- target/riscv/csr.c | 104 +++++++----- target/riscv/gdbstub.c | 10 +- target/riscv/machine.c | 10 +- target/riscv/monitor.c | 4 +- target/riscv/translate.c | 174 +++++++++++++++----- target/riscv/insn_trans/trans_rvb.c.inc | 140 ++++++++-------- target/riscv/insn_trans/trans_rvi.c.inc | 44 ++--- target/riscv/insn_trans/trans_rvm.c.inc | 36 ++++- target/riscv/insn_trans/trans_rvv.c.inc | 29 ++-- 17 files changed, 581 insertions(+), 354 deletions(-) -- 2.25.1