From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677832929; cv=none; d=zohomail.com; s=zohoarc; b=De1e0yiwF+iLJpJ6QuST32e/uuMAOpzG47FtN+9Is0jtMow51bnOGoyPiNPxZjmeODtf8cZH/Odqjpn0Fc3tEJvBBUGvMZ2xZeI1JFF8iuIvRwaKuHlJavWa2CV/pO8PzFv01QwV9ZRp8M2ocgpDzcGEkRNTXEit0QO7vNiCQeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677832929; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b78UWC9uO9LxVpWkpN/xs0h4gShaH6sg+/KTvj59t3E=; b=FoJXTfmj18ADqdjRQNs2YBejIsaVPKqsOVlmsX71/S7PnYzwPluqQOGtJ2B9CBzSKqM7cCBMc2Fm0QXzweeO3ay3GIRrnZmSs0O/FQU1dR2FNpI1c2iiHW/j6j4Fl2lW9s5S5RdcldHXvjkfwg+RKA0yryZKY9+hqWquiFbL0ho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677832929327379.3570329313243; Fri, 3 Mar 2023 00:42:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0yp-0006f9-Vh; Fri, 03 Mar 2023 03:41:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yj-0006bE-Ag for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:26 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yh-0007le-Gu for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:25 -0500 Received: by mail-pl1-x62a.google.com with SMTP id v11so1964276plz.8 for ; Fri, 03 Mar 2023 00:41:22 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id bm17-20020a056a00321100b00580fb018e4bsm1003792pfb.211.2023.03.03.00.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832881; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=b78UWC9uO9LxVpWkpN/xs0h4gShaH6sg+/KTvj59t3E=; b=EZ8I5II2oJMEU+btNsknYwfXouwIb/GFdSnde5b2ccW6zheXNAT+0U+nMrAx5sF+j6 h6tb31w8BSno946APJIv9L3ii1KqSG3rXBf0F7rx3kLG0NMoforggNUJg4UkimfjSmcF eQiMbWBnaCDvezmcom6MIpGJcyEVMmUQKYcVJKtY1HkxOO2FuhuCiYF7HmjPXfiQic2i ErLTv1VI7t7UM3f9JTQkSv1vp5B0ixLrcNv/1Ska183h9JoCDaDm30VCcwJd9LdPUGOm g9x03dYakQM6uxz0INoIZfEV+O726e9Rkh5qeQS5/RXvmNsV5OPpRbUmQWMylhi6YGt4 Pqdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832881; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b78UWC9uO9LxVpWkpN/xs0h4gShaH6sg+/KTvj59t3E=; b=apxIG+FdSCl4nMuONeXlJ1xKDPmYcUW1aKxJGYW3QjHfusvEm1KO0T1v3zElsGYF4s nJZC3inkJ09JUu30Lv/7FVe+Y+qPlBsq3soS4IODL1eT14PaNhXfhtDpRzIxia3k5gh6 aMEA+ZWECG0aeWD9ai4lyRW/WbHiv4kuZ54dr5/SoqwwURNQLoOToHUeM1iukAU6vGHX D/Hgrf9gXgDxYfWnViPdYiq7zXoAc2i94P5YHSttdzJzP5v1hMah7HchZDG34tnkmqM5 +hneppQcHoC2+xZBG86lYCxIv0mKZHpLsNg4V/4BNEy6SH5Oy4ukdEJ3P88SRumWnrXA NrZA== X-Gm-Message-State: AO0yUKUsLiQJV74V7hz2Kl0eBeStq/afdYR5/a36vtieaKaLAtSJe7uT JX/Fjda9eIjWoEhlAk7hjQnRKg== X-Google-Smtp-Source: AK7set88rnUYDfO7QNOQbML6Hk46FIloQo6dJo2Op0D1fh1njCt80+JvG/87c3T7hXcklT/PJsliSw== X-Received: by 2002:a05:6a20:bf25:b0:cc:8a62:d0d5 with SMTP id gc37-20020a056a20bf2500b000cc8a62d0d5mr1262791pzb.55.1677832881511; Fri, 03 Mar 2023 00:41:21 -0800 (PST) Subject: [PULL 01/59] target/riscv: introduce riscv_cpu_cfg() Date: Fri, 3 Mar 2023 00:36:42 -0800 Message-Id: <20230303083740.12817-2-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Bin Meng , LIU Zhiwei , Weiwei Li , Richard Henderson , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677832930609100006 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We're going to do changes that requires accessing the RISCVCPUConfig struct from the RISCVCPU, having access only to a CPURISCVState 'env' pointer. Add a helper to make the code easier to read. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Bin Meng Reviewed-by: LIU Zhiwei Reviewed-by: Weiwei Li Reviewed-by: Richard Henderson Message-ID: <20230222185205.355361-2-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 31537fc05f..7ee22cbfa1 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -654,6 +654,11 @@ static inline RISCVMXL riscv_cpu_mxl(CPURISCVState *en= v) #endif #define riscv_cpu_mxl_bits(env) (1UL << (4 + riscv_cpu_mxl(env))) =20 +static inline const RISCVCPUConfig *riscv_cpu_cfg(CPURISCVState *env) +{ + return &env_archcpu(env)->cfg; +} + #if defined(TARGET_RISCV32) #define cpu_recompute_xl(env) ((void)(env), MXL_RV32) #else --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833420; cv=none; d=zohomail.com; s=zohoarc; b=HFDewAKhsTJY7CFGJatIPk/GO5rxH9kRLvtHfApBNcA0/MlPViq77eubjUVoetGjrGueN04/U7HfiWmvwPW/ruZinZC9Bj7hB495kjpkN4BlHNi2Z1y4GAR6rYqwpoP3ViXM/u3Q9ExkxBcstxBedToTBPquVM9yNqWrRiqiMCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833420; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JSXQ1gv8F6gBWFEiNu0PyJfk2U181G5/O9/ILiiVGXY=; b=OpkorUMUby5LEEu0wdIT8SVMjubOWMoMnfHUnu/8j2coOZpOT/Ye4aiXbHijRA357bbpCDhOC3VAC4N1aZp+oOs8IU2KJlUUP4fmYODzbgJpcDc0Q4d2VjL/zm1Nrt1Ga7OyrChMEfgh078zdaN6bHQJ+qMaVnnnLL9T7UUGcAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833420781553.0447145501088; Fri, 3 Mar 2023 00:50:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0yv-0007F2-NG; Fri, 03 Mar 2023 03:41:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yk-0006es-Sh for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:26 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yi-0007lv-8z for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:26 -0500 Received: by mail-pl1-x62a.google.com with SMTP id a2so1994407plm.4 for ; Fri, 03 Mar 2023 00:41:23 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kq14-20020a170903284e00b0019cf747253csm974701plb.87.2023.03.03.00.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832883; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=JSXQ1gv8F6gBWFEiNu0PyJfk2U181G5/O9/ILiiVGXY=; b=EHgivzUCJHpMIL1y3nJBd/u3gFrhIlr7Rvu4b/1bteOrBNQZl06WiZJaECFZF1gKJ8 BJr6UZd56OV+vznQ6lVp6crcH554X6ToFvcoKBrV+KV0h/B9JacfSV5ZwCilvBMMcTJM mqrhFRLY5UZtwB7T/a1EnDWQyx48NdnjQoHhK1tgfhvUwgeK1AQGjHne1UhzjN+r0bTm liL05Qn7GQAV9VTwLXVzjtFNFetzFREPTO1KqxkrHjQ2YfxwVTtv8KiKbzY8mstmKEoM P4pf2fmL8v0XaIzfe9zuu19iwogc0AQFm9LgHIgDYoaJAnO9U75cA3lU5K+Cz8xPVNNu H5Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832883; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JSXQ1gv8F6gBWFEiNu0PyJfk2U181G5/O9/ILiiVGXY=; b=RU9w31oQOs/bdDoKsosALaPVYx46v/i+kJXInLCJ14cxZ+cCeEOPaj49DH6t78g60J jcqgKqUBZnLg/nAmcuXlI8MJPt9w+fPsdmWgVWDlTewMW0bDoEvz+6DndDubWjraVw9L L0O7a4lg2T+Lms3ljfdLqtGj5zHlgoShWykGgrBshNo56Il9kSs/4A9bOWYJIyAG+Uh1 3es0WiNlXKsUGgOWFbGRsJXtopoosrJnc6IO6hPBhoGr7NbakepK4OmGDIWAFfLL1l20 pWD4elqxnuPMKloKCmmmSgRNkVawnU9f69pUreIK22j9vvyYogtgVCTr2RY8tRHVITkO q0DQ== X-Gm-Message-State: AO0yUKWKBxH39LbcVZ50KC6MgKtBmzpSbahT83L4qc63WFWlzg346TAG +pa7/camcSFbY9zSHt8IiPB7nA== X-Google-Smtp-Source: AK7set+tyRsSDYvzg9KmsebpvTOdoyIZEXWpWREFcI/gAiuO+4wOu2fNV1p5qUxZJ7VLNcDacaTQHA== X-Received: by 2002:a17:902:e842:b0:19a:b4a9:9ddb with SMTP id t2-20020a170902e84200b0019ab4a99ddbmr1481757plg.49.1677832882946; Fri, 03 Mar 2023 00:41:22 -0800 (PST) Subject: [PULL 02/59] target/riscv: do not mask unsupported QEMU extensions in write_misa() Date: Fri, 3 Mar 2023 00:36:43 -0800 Message-Id: <20230303083740.12817-3-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833422689100006 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The masking done using env->misa_ext_mask already filters any extension that QEMU doesn't support. If the hart supports the extension then QEMU supports it as well. If the masking done by env->misa_ext_mask is somehow letting unsupported QEMU extensions pass by, misa_ext_mask itself needs to be fixed instead. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Message-ID: <20230222185205.355361-3-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 1b0a0c1693..e149b453da 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1356,9 +1356,6 @@ static RISCVException write_misa(CPURISCVState *env, = int csrno, /* Mask extensions that are not supported by this hart */ val &=3D env->misa_ext_mask; =20 - /* Mask extensions that are not supported by QEMU */ - val &=3D (RVI | RVE | RVM | RVA | RVF | RVD | RVC | RVS | RVU | RVV); - /* 'D' depends on 'F', so clear 'D' if 'F' is not present */ if ((val & RVD) && !(val & RVF)) { val &=3D ~RVD; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833466; cv=none; d=zohomail.com; s=zohoarc; b=E8bzAar6lmsT7PAJFhzqyvPOhVNNg3IYZM3h2JgpK8ZOZkp53pBre5Oo6f9gAm35+EFKyEekBBpswMT+Sn7T2E2FPu2xy/wPF0NYq/6OgU1HbEO8qT5r25VgunU5mtiBBl426v4nPW3Uk/EP8yRoQImCLuHxXi+LvnKDL/ggSQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833466; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4Hfiux9wjBHefjdAiFtqfeuuXfGolGwUIxeXcDisz5o=; b=PEWJuSugwIwkwQKar4t+JBW8jfO3zzumhI+vdKFeA1xgVM7tcTy4wZGbzJnvELGD1KWKQ8s2yA6EgFc+nWleJsK8COjguyH5fayrIo1NOkbF1HD5a83rC+FanRroYrGjP5wMo/TDU/LEEReaqPKd5+SepPooPPAs0iozuKrdMcY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833466413756.8117288084147; Fri, 3 Mar 2023 00:51:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0yx-0007Hs-HG; Fri, 03 Mar 2023 03:41:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yl-0006fy-S6 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:30 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yj-0007m8-P2 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:27 -0500 Received: by mail-pj1-x102e.google.com with SMTP id kb15so1813200pjb.1 for ; Fri, 03 Mar 2023 00:41:25 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id x15-20020a170902ec8f00b0019aa5e0aadesm976117plg.110.2023.03.03.00.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832884; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=4Hfiux9wjBHefjdAiFtqfeuuXfGolGwUIxeXcDisz5o=; b=C9CXga+yG17lo4qFtwa+yfafom+JPrJaE/5kr4LAbjz41AmhvuUeNBSe0ZfO2pn9RX qXVbVa0j2x31lgBVcQD5Dz1jq6ckCepmLP6rss0etNQHQCLtd7tazbSNkIPqLunO5Jot rF7DvrY/umjU7u2L7DyBtluW0l9JXRSW10cstRgyhrWC3rddFSY7g9xNus9M/iK8oQ7R FaTbSM/ZIeAH3k3El+GQU08w2qUiVaWlOkVk3V+GMzCAYVkwTmk38+bL4SIqydKQtCdB p/CZHp8leUYzu/ixzhpIiajiKk1pfzxG/xUNeJ+9sQeFrAdOYcoPtwqxp2NXYsIOAo5l g96w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832884; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Hfiux9wjBHefjdAiFtqfeuuXfGolGwUIxeXcDisz5o=; b=V1w50GVX2bi05FfwYJAzKHmO9YTrgmbA2BvA7ZTBNyr7wlOblc6WarAL/xXpS9JrvI 2+Pur1pTpOp8Na5Oh7KdDbhKfHswBFvBzWSgJFEjBY6uPlb1+ulZCBSXMka1IygT21uz D82PXBRp2jiYaMOghY4QSFeWHPRhblY9JyIOYzYlyjKocCzeIwbp3/+VbdNgSFQ7TNa7 wTqnRGZjnI3odFDKkanE9w2+LCmngwk7H424maQaAAoMGwsSA3b+WhZpvOpt9gQFp04R VPtkAuP5zgeGyfiYr8hZqS+EH619TUae0Ph4P3mSJLXhb6dNSXLgHkAl4Ek0ipwWx8rQ W+Mw== X-Gm-Message-State: AO0yUKXijH1NoCU4fkUOBRrvsjDiNgGJv52V8QHA03/Q5eZODhINYihT ZlJQOwhCh7Rm6sri8cjRAUzB6g== X-Google-Smtp-Source: AK7set8fBQjPXKzFPTdtKuiinrCLHzEPQARCg3SvizpIacPD8FkvN00vTk+KBtb1ojPWavwxP/9xQg== X-Received: by 2002:a17:90a:190f:b0:233:ccd2:40a4 with SMTP id 15-20020a17090a190f00b00233ccd240a4mr905500pjg.23.1677832884243; Fri, 03 Mar 2023 00:41:24 -0800 (PST) Subject: [PULL 03/59] target/riscv: allow MISA writes as experimental Date: Fri, 3 Mar 2023 00:36:44 -0800 Message-Id: <20230303083740.12817-4-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Andrew Jones , Bin Meng , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833467009100006 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza At this moment, and apparently since ever, we have no way of enabling RISCV_FEATURE_MISA. This means that all the code from write_misa(), all the nuts and bolts that handles how to properly write this CSR, has always been a no-op as well because write_misa() will always exit earlier. This seems to be benign in the majority of cases. Booting an Ubuntu 'virt' guest and logging all the calls to 'write_misa' shows that no writes to MISA CSR was attempted. Writing MISA, i.e. enabling/disabling RISC-V extensions after the machine is powered on, seems to be a niche use. After discussions in the mailing list, most notably in [1], we reached the consensus that this code is not suited to be exposed to users because it's not well tested, but at the same time removing it is a bit extreme because we would like to fix it, and it's easier to do so with the code available to use instead of fetching it from git log. The approach taken here is to get rid of RISCV_FEATURE_MISA altogether and use a new experimental flag called x-misa-w. The default value is false, meaning that we're keeping the existing behavior of doing nothing if a write_misa() is attempted. As with any existing experimental flag, x-misa-w is also a temporary flag that we need to remove once we fix write_misa(). [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg05092.html Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Andrew Jones Reviewed-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-4-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 6 ++++++ target/riscv/cpu.h | 2 +- target/riscv/csr.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 93b52b826c..1d637b1acd 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1210,6 +1210,12 @@ static Property riscv_cpu_properties[] =3D { =20 DEFINE_PROP_BOOL("rvv_ta_all_1s", RISCVCPU, cfg.rvv_ta_all_1s, false), DEFINE_PROP_BOOL("rvv_ma_all_1s", RISCVCPU, cfg.rvv_ma_all_1s, false), + + /* + * write_misa() is marked as experimental for now so mark + * it with -x and default to 'false'. + */ + DEFINE_PROP_BOOL("x-misa-w", RISCVCPU, cfg.misa_w, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 7ee22cbfa1..ca828424c1 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -89,7 +89,6 @@ enum { RISCV_FEATURE_MMU, RISCV_FEATURE_PMP, RISCV_FEATURE_EPMP, - RISCV_FEATURE_MISA, RISCV_FEATURE_DEBUG }; =20 @@ -498,6 +497,7 @@ struct RISCVCPUConfig { bool pmp; bool epmp; bool debug; + bool misa_w; =20 bool short_isa_string; }; diff --git a/target/riscv/csr.c b/target/riscv/csr.c index e149b453da..3cb8d2ffad 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1329,7 +1329,7 @@ static RISCVException read_misa(CPURISCVState *env, i= nt csrno, static RISCVException write_misa(CPURISCVState *env, int csrno, target_ulong val) { - if (!riscv_feature(env, RISCV_FEATURE_MISA)) { + if (!riscv_cpu_cfg(env)->misa_w) { /* drop write to misa */ return RISCV_EXCP_NONE; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833199; cv=none; d=zohomail.com; s=zohoarc; b=i+XGiCq3tFuKVV8XFUX1txE5iGk4ik7W1xZlDjXlTcwucKOPHzjuP1S8WyFgi/qg7ZVEYh2aTLi5VUMnQormRYm+dgZILEdJ7s/2mAO437iFzsEMSdQwyfLHA9y0bRNYqQaMTrj3hdqon6aubZUvGChDAgLBy2Ye+8rWtWUoSs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833199; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P2qA3TlwLDKov+3r2kqVjzEEhRt6+MxAW7wsR31Qwbc=; b=fFpNh0cabeg0XSwTuVZG7guS0Gj+m9h1oF5Nr8JTgiLDtM/ys+uj5g15gGfE4I8nGoJbrVnADtUcFWyinFVySobP5IZpvJUafCqZYg9RU15NAt++bUx7fhLdDLmIZnMsu6jFwKlslXjhCMa1kL9faC+GzS1FXrH0LQJde35z7Vg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833199730991.2959192061071; Fri, 3 Mar 2023 00:46:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0yv-0007EY-21; Fri, 03 Mar 2023 03:41:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yn-0006lV-HG for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:31 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yl-0007mg-F4 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:28 -0500 Received: by mail-pj1-x1031.google.com with SMTP id kb15so1813245pjb.1 for ; Fri, 03 Mar 2023 00:41:27 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id k11-20020a17090a590b00b0023747b0445fsm2890039pji.14.2023.03.03.00.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832886; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=P2qA3TlwLDKov+3r2kqVjzEEhRt6+MxAW7wsR31Qwbc=; b=a+j6TuXiHOZhLEYSt664Qcyzf6h9ifO7ov6U/clWotK+jO/aJZ8mawNDYTY5l0uPcZ C7pYseDq9DhB+GxWMGmVpS2yqr3OfVGhAqTWIHE+CsW1fSNaRtnHGsEZYGq7oY56/P4D icaT9CA7u4AHnZKgFst/XKXx7qt148BdpGQuIER1pQmFU7WLeTN8UBbXG+g4za+pXHws k2eBpwMuBp064nBqQNKMFOAkwfffO0VXWJTbxXi5/xlzIpOAd9pyIBrsimpllSA1rTjw 7GeDlOt1EjMTBbrOfrN0PgXMKuaXxSFE7pqkYTtagT8M0qSnj9dWxh1O+ZBobT3qxpRz MK1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832886; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P2qA3TlwLDKov+3r2kqVjzEEhRt6+MxAW7wsR31Qwbc=; b=Q7X1CjvVf555lxzrabogZ30/dXK31zlShPnJjUMKZ7h3p6WDB+D9285EKvyOrG6zEP +0QW7Bcr4BUqO6Afj9Kmw0rTHsGFcuwEi3JrGuoDx2C3OymG8ssg3+R/Z/QxRvha7HZx eT0RJFs7nE9L6G8CIrHwnT0MPWMGSsSmBbw02sXXQMZ7jQpeegJOuSOnVTYUcwvsjYtW suVQBIkJ+IfLczWC0Qhtp6oGTq3RGdKvRVQViyQ+2ZGs1PSeKuupxvXuwXXGMhfWUr+u JGTiPNdZHi6ZbzJ1oJXOrL9hExs1uzv1bL3TD2f6YwpPH3ywv9TZkiPqWWC3D5etNShw TwOw== X-Gm-Message-State: AO0yUKVpFGGLWcni28R48U3mJ6n4EqNOq6FR0aC+vhlCDTSqwz1bDzsH fsqEnRh47nZjY+g8DepJDuV9/w== X-Google-Smtp-Source: AK7set/l2Q6I6Az94nVReDP48CYWAF+3V5pR+pHbWE4SFGep+jNbK2kitHBtoj0aPTlgAvx8nxG9KA== X-Received: by 2002:a17:90b:350f:b0:235:31e9:e793 with SMTP id ls15-20020a17090b350f00b0023531e9e793mr5239254pjb.13.1677832885675; Fri, 03 Mar 2023 00:41:25 -0800 (PST) Subject: [PULL 04/59] target/riscv: remove RISCV_FEATURE_DEBUG Date: Fri, 3 Mar 2023 00:36:45 -0800 Message-Id: <20230303083740.12817-5-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833201604100003 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza RISCV_FEATURE_DEBUG will always follow the value defined by cpu->cfg.debug flag. Read the flag instead. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-5-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 6 +----- target/riscv/cpu.h | 1 - target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/machine.c | 3 +-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 1d637b1acd..13e55ec5bd 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -637,7 +637,7 @@ static void riscv_cpu_reset_hold(Object *obj) set_default_nan_mode(1, &env->fp_status); =20 #ifndef CONFIG_USER_ONLY - if (riscv_feature(env, RISCV_FEATURE_DEBUG)) { + if (cpu->cfg.debug) { riscv_trigger_init(env); } =20 @@ -935,10 +935,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error = **errp) } } =20 - if (cpu->cfg.debug) { - riscv_set_feature(env, RISCV_FEATURE_DEBUG); - } - =20 #ifndef CONFIG_USER_ONLY if (cpu->cfg.ext_sstc) { diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index ca828424c1..dc62554e14 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -89,7 +89,6 @@ enum { RISCV_FEATURE_MMU, RISCV_FEATURE_PMP, RISCV_FEATURE_EPMP, - RISCV_FEATURE_DEBUG }; =20 /* Privileged specification version */ diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 3a9472a2ff..7ae832e829 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -105,7 +105,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ul= ong *pc, flags =3D FIELD_DP32(flags, TB_FLAGS, MSTATUS_HS_VS, get_field(env->mstatus_hs, MSTATUS_VS)); } - if (riscv_feature(env, RISCV_FEATURE_DEBUG) && !icount_enabled()) { + if (cpu->cfg.debug && !icount_enabled()) { flags =3D FIELD_DP32(flags, TB_FLAGS, ITRIGGER, env->itrigger_enab= led); } #endif diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 3cb8d2ffad..e220c4a5fd 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -437,7 +437,7 @@ static RISCVException epmp(CPURISCVState *env, int csrn= o) =20 static RISCVException debug(CPURISCVState *env, int csrno) { - if (riscv_feature(env, RISCV_FEATURE_DEBUG)) { + if (riscv_cpu_cfg(env)->debug) { return RISCV_EXCP_NONE; } =20 diff --git a/target/riscv/machine.c b/target/riscv/machine.c index c6ce318cce..4634968898 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -226,9 +226,8 @@ static const VMStateDescription vmstate_kvmtimer =3D { static bool debug_needed(void *opaque) { RISCVCPU *cpu =3D opaque; - CPURISCVState *env =3D &cpu->env; =20 - return riscv_feature(env, RISCV_FEATURE_DEBUG); + return cpu->cfg.debug; } =20 static int debug_post_load(void *opaque, int version_id) --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677832929; cv=none; d=zohomail.com; s=zohoarc; b=K6HmVbr2P+6LfM34A+xLd3Ror/KLhksO/EUaATPcLSc+iIVDcRPveOA1WDYkh5UAbNYDyKNyaMNsbMOL2qCfGpXOtpRsKUgN3BFbDEH+nUUGsWu3Srt24vptg0k1gG+SV5Km0UEy9XvqWoa3jyPRtg8m4mYbmRKGBoPm2k4+5ik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677832929; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zUP3OSA2SEm6Zwc923BsVzEs0eo9CAKakWrt+naZB44=; b=REU8qjsysU4WyXda07sU0V+6Hs6PaPUudBAziGVrZn1CpULBG2cUavI8vsSvqcdGAxPDVdkhM8cWmNE0Y1pKv8e+eD99VUdARhvJmoVKN1bvU54Rdo6+oGmlI3dYfwyP1Dg15jmfCB9d/+WkFvm9SdYO3ahLzMTzF8vBqNZNgQU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783292921665.50609502370958; Fri, 3 Mar 2023 00:42:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z2-0007k5-L4; Fri, 03 Mar 2023 03:41:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yo-0006pg-95 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:31 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0ym-0007n9-8T for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:29 -0500 Received: by mail-pj1-x1035.google.com with SMTP id l1so1810617pjt.2 for ; Fri, 03 Mar 2023 00:41:27 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id 1-20020a630301000000b004fb11a7f2d4sm977214pgd.57.2023.03.03.00.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832887; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=zUP3OSA2SEm6Zwc923BsVzEs0eo9CAKakWrt+naZB44=; b=lzEbdHZF+nYepfAlf+CrysjOAeD2QDubMHkQnvju9SkFdNi2NrOqCFdQxn1e7gYqS7 eVYRngnHKg/XRZjNuMq6+OCGN5aK176+aaxTl1O8RO3H6Ec01rBQlox4c0bAWIZaTAd2 CqUp61XGi0jGiThHBDVIVS1spI7cLKKG2imkdQ3vKANTvjOvMWZmBtiIaM4AHQQEfcIK oYC3v8jOCigEbb/rR49HwWY9FanP83xPUqXSybL8nIvprhURCnWLTZVyyG+AJdhRdpXV Y29uuS0WCpp14Y6o4z4KlKyXI72UIm1WhAW1csjsjxcEW2wQjocWrjP6R2seppnJ3Lc2 vmyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832887; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zUP3OSA2SEm6Zwc923BsVzEs0eo9CAKakWrt+naZB44=; b=ukQZ1EPR2jXYkPFeWpH4J89OFv83xEv/Y2kDgJErL1Vpkc0Ux6JsJ5ufu43hBuQZjR rWRF9VUBJQV8/uaZjRdaNCEM+W0YodbaXdhmEbm4VGLC7r9rY2YMBcrO/l5IRi31RKKB ntqhGsVAv9HuZ/ZWoBFbyykxksWHK/l4oGB5mGz6LhXgL1/dCFy5WY+gNzNSPq8BpADm Z3WwxBgkdenhE5DbQMI7ynNw84XPG+PD5ay5hulF1YtzQ8lWFB9ohN182JgtsCtHjKMI FiCdc27+MpXsGbLPxg9G2AdtPMEWD/gkxB1y3c7sobTH49nht5igCr2gfX3feah2RDI4 vPCg== X-Gm-Message-State: AO0yUKVIRPm0Zrm/+RmmXDk0rRZXu1wXObiGGNtuBnZz+3m495WqkGj3 IF6IpjOhEGoaDescWNAQ7oligw== X-Google-Smtp-Source: AK7set8u5WTnGJ5WcPWAQ3lgFoE0CmLNWonzfRBgIVlz3cr8XHgdQ4J7hk9psxa+eWhjsk0EhVsebA== X-Received: by 2002:a17:90b:1e05:b0:237:7149:b333 with SMTP id pg5-20020a17090b1e0500b002377149b333mr791616pjb.43.1677832886938; Fri, 03 Mar 2023 00:41:26 -0800 (PST) Subject: [PULL 05/59] target/riscv/cpu.c: error out if EPMP is enabled without PMP Date: Fri, 3 Mar 2023 00:36:46 -0800 Message-Id: <20230303083740.12817-6-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677832930598100005 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza Instead of silently ignoring the EPMP setting if there is no PMP available, error out informing the user that EPMP depends on PMP support: $ ./qemu-system-riscv64 -cpu rv64,pmp=3Dfalse,x-epmp=3Dtrue qemu-system-riscv64: Invalid configuration: EPMP requires PMP support This will force users to pick saner options in the QEMU command line. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-6-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 13e55ec5bd..aec7830c44 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -925,13 +925,18 @@ static void riscv_cpu_realize(DeviceState *dev, Error= **errp) =20 if (cpu->cfg.pmp) { riscv_set_feature(env, RISCV_FEATURE_PMP); + } + + if (cpu->cfg.epmp) { + riscv_set_feature(env, RISCV_FEATURE_EPMP); =20 /* * Enhanced PMP should only be available * on harts with PMP support */ - if (cpu->cfg.epmp) { - riscv_set_feature(env, RISCV_FEATURE_EPMP); + if (!cpu->cfg.pmp) { + error_setg(errp, "Invalid configuration: EPMP requires PMP sup= port"); + return; } } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833207; cv=none; d=zohomail.com; s=zohoarc; b=T9pEzwdMi+5Gob9be8V7QTtx2wJ+W7uiMX1kUD2iR9bF1fe+ZNPU5VK7VOJMzzLtsU958p/R+uYeRsnzBJeZmVa1iIUYPltud7UFBjqUFy3NEKsMbKevSDkslYBLppIg/rL+vGH2brjZ5M0eQkQLAmRaOombnbUX3/DRSWxJEiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833207; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=r1PJv2cc+BR+zPrPoG5NvS1vpNzJ8EEawxdCZRC2CNQ=; b=ON3m7stp6yzf3luHkNyF+w3ifgG1LI5iXI23rGCwAo5TfXukT1/4IKxLtWgEOjBkJoEHsO0ajntOfs353xcFUpiuFjk7qYoBKNEvwcyoqJ6q+e98zzrStqJAzVGfmw/qrsDAyDDNjg+Vjqti4TLvfkocZwZub9UODxLksFpDxPk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833207942646.3717986473317; Fri, 3 Mar 2023 00:46:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z1-0007dU-8C; Fri, 03 Mar 2023 03:41:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yq-0006ut-5T for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:33 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yn-0007lm-9z for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:31 -0500 Received: by mail-pl1-x62c.google.com with SMTP id n6so1985665plf.5 for ; Fri, 03 Mar 2023 00:41:28 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id e1-20020a17090ada0100b002353082958csm2889489pjv.10.2023.03.03.00.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832888; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=r1PJv2cc+BR+zPrPoG5NvS1vpNzJ8EEawxdCZRC2CNQ=; b=VR5E6yi2M2GeZof41BYWKNPXunmL56yx1pa72bA7Xzme5y7Qpy+2COqdMkW9Lho3U6 yJY9VL/sVZOLYXJta3Yee1zQQtwk5xfKaGBQ2viiMMg+H+OSP2rKAOv3un+CgIb59vOV E1sOjYE9ppFp1J8pmzzHo0u/moqkVS7rB4ad36XkxFwEjh8jh9e+wx2C2SinZ2qkgnv9 J7HtoSbPqrD5bnTjmWhSaKvrnYAuSAZP8QqF0lfiBDLIWpCrUXgufm56FY1CCKY/BVsl IChpvDksOjG24LY/5f1AUR9wTga83KP5GyWEvq/WH1lSR3Uh9Rp8zc+yOGdRbMxqdVZK 5ZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832888; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r1PJv2cc+BR+zPrPoG5NvS1vpNzJ8EEawxdCZRC2CNQ=; b=Ypp21049vpZXNvHqTgbFCUA8L5CznErbMXcgeaXFGD52Z68EOhm81gqz4tvPyak8Dj sjpSl2kricjMSk/sSXQ4bq5SvNN2++AWrfhwv9QpqBGbPtRlvVgQsHKj5i9JmJV6Zlby +DndLCltwjyj6x7HoH/JMKw8p2RlUWgXZkDkVkBruqgLZcRGa8GqmC1BJLDVCcWlyJCi XKxcQSxaGNhw1r9DN3C8nOyPZSaqqxdkQXSMPFwZRy5n6TVkS8pr/sBLZhQRpzehsW1v x9AqDHFQuj/UcujvTQ4AH8J/xr/3T1FLbLPJ7SgrDdzEPfAORhhasF3MqJXLeSSHe58+ FLTw== X-Gm-Message-State: AO0yUKUQqulVCXP+Oq37+6RaHmWUzVcIi5ctsRvBsgmnOlsGcGs4sDS6 I23VnYMbWIYM7iDhyPU6v4GZYw== X-Google-Smtp-Source: AK7set8/KwJ+KHLuj3ynlD09Ot/wBLS4d+q2VYvCiuV8fLUK/mkVMEEkZR1+Cv243AY1/3EIGfwWpw== X-Received: by 2002:a17:90b:17c2:b0:236:6dc3:3e66 with SMTP id me2-20020a17090b17c200b002366dc33e66mr967512pjb.5.1677832888162; Fri, 03 Mar 2023 00:41:28 -0800 (PST) Subject: [PULL 06/59] target/riscv: remove RISCV_FEATURE_EPMP Date: Fri, 3 Mar 2023 00:36:47 -0800 Message-Id: <20230303083740.12817-7-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833209593100003 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza RISCV_FEATURE_EPMP is always set to the same value as the cpu->cfg.epmp flag. Use the flag directly. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-7-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 10 +++------- target/riscv/cpu.h | 1 - target/riscv/csr.c | 2 +- target/riscv/pmp.c | 4 ++-- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index aec7830c44..807a466f34 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -927,17 +927,13 @@ static void riscv_cpu_realize(DeviceState *dev, Error= **errp) riscv_set_feature(env, RISCV_FEATURE_PMP); } =20 - if (cpu->cfg.epmp) { - riscv_set_feature(env, RISCV_FEATURE_EPMP); - + if (cpu->cfg.epmp && !cpu->cfg.pmp) { /* * Enhanced PMP should only be available * on harts with PMP support */ - if (!cpu->cfg.pmp) { - error_setg(errp, "Invalid configuration: EPMP requires PMP sup= port"); - return; - } + error_setg(errp, "Invalid configuration: EPMP requires PMP support= "); + return; } =20 =20 diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index dc62554e14..471e587729 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -88,7 +88,6 @@ enum { RISCV_FEATURE_MMU, RISCV_FEATURE_PMP, - RISCV_FEATURE_EPMP, }; =20 /* Privileged specification version */ diff --git a/target/riscv/csr.c b/target/riscv/csr.c index e220c4a5fd..951327022d 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -428,7 +428,7 @@ static RISCVException pmp(CPURISCVState *env, int csrno) =20 static RISCVException epmp(CPURISCVState *env, int csrno) { - if (env->priv =3D=3D PRV_M && riscv_feature(env, RISCV_FEATURE_EPMP)) { + if (env->priv =3D=3D PRV_M && riscv_cpu_cfg(env)->epmp) { return RISCV_EXCP_NONE; } =20 diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 4bc4113531..aa4d1996e9 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -88,7 +88,7 @@ static void pmp_write_cfg(CPURISCVState *env, uint32_t pm= p_index, uint8_t val) if (pmp_index < MAX_RISCV_PMPS) { bool locked =3D true; =20 - if (riscv_feature(env, RISCV_FEATURE_EPMP)) { + if (riscv_cpu_cfg(env)->epmp) { /* mseccfg.RLB is set */ if (MSECCFG_RLB_ISSET(env)) { locked =3D false; @@ -239,7 +239,7 @@ static bool pmp_hart_has_privs_default(CPURISCVState *e= nv, target_ulong addr, { bool ret; =20 - if (riscv_feature(env, RISCV_FEATURE_EPMP)) { + if (riscv_cpu_cfg(env)->epmp) { if (MSECCFG_MMWP_ISSET(env)) { /* * The Machine Mode Whitelist Policy (mseccfg.MMWP) is set --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833167; cv=none; d=zohomail.com; s=zohoarc; b=ZZV2N/QTnha9i6Rn4pvDr/CF71KCedpbMPwj1t99SKOPsmBWYvBAqhJGiVPasUEAJUPkQNr2Bv7zz5kMswO/wwcT19IVNF1XXKcUJs4BDyJ1R+ZSwzEL6a+xskCDROtvmfAQDTELL6QZ8J8iitmzC/LFB9kHchi2KyD0lDPBvOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833167; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kI3o3dnokKQZK1aoWMiZTonuuu8q8EoVLV5n3ZX1MVE=; b=DxgV8WDn7ZY3Z4p3kCBgx1T8wOkaMPDZCVx3bNF/ql12T5lwV8TpQKOXuGwAPFVH/lcYkojfvoPjM3uyvApiMcUVsPGfL+/uEINfx8YR/hmKJGbX7INdgKmbKk/VkNi8/1fTbfvdiEu82ZR7/n5baHNSUPMjqSxXr3+vNiMP7Pg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833167460506.9792756278039; Fri, 3 Mar 2023 00:46:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z4-0007oc-DE; Fri, 03 Mar 2023 03:41:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yr-00073x-RB for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:33 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yp-0007o9-TC for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:33 -0500 Received: by mail-pj1-x1030.google.com with SMTP id m8-20020a17090a4d8800b002377bced051so5488613pjh.0 for ; Fri, 03 Mar 2023 00:41:30 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kk15-20020a170903070f00b0019c912c19d3sm978375plb.62.2023.03.03.00.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832889; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=kI3o3dnokKQZK1aoWMiZTonuuu8q8EoVLV5n3ZX1MVE=; b=R3FEXYRUiLpJEQxmGnNjd0iWuFuoyOWihcbFLQK9KR/H0qFRWPQmw0ywS8rAGFughz aDn/RUK5A3UhkcyjC2W/e3EnJiYAqFnqfNws0KuKGmmyLQRnkufzq7YHou2k9uOhVy39 CbD/9j0Tm9g9LedE197TiUmg39m41k9IPX3UkAh+gr7Ux9rXFOcbmksPElWUaQUTqrS+ ndT3/XGW1X4ct2PYuPWYWq4yqLx7cO3htiJDjAxInDf2Xoz44BxOhw7kqVraOgkZ59JY 2hZPoB/4ROqVis8IMtmYrGEQhUjV2Hur9XbYppItaaxqS341oKJ0T1kD2mGf2toQWtkU 6hmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832889; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kI3o3dnokKQZK1aoWMiZTonuuu8q8EoVLV5n3ZX1MVE=; b=s17KsfChmzKGnoz3QI4NF+fHK6DJtPntPmxWZf2urui2eDCQZUfEDS1gtc7lKaYAkI bIE5ArtwrOF4bKTQ6Fn7ebg6q6snZ2rpmJeQdsLaiEmJ4JEJF3CQnufLGt4Qy6T+u5HS b3lG69hXMTBswhnTfsYws9mzG8Nf5PzzfneMhceQCimvIXcSeQCTc31vvBgXPcEsTL5v 3ZQ2RQWLUkwrWHbJVH5wWm2e3nzhGH4eDJ/5qEauBx6+aAHFAqK2ZZxwZO/TtYBjOPaU cPFiYPE0FC62SfV45mxJsurfI+4JJpWf98DS6YFboeDFytC6ty175AV6we5p8JxiAQj1 90Yw== X-Gm-Message-State: AO0yUKUWRY0RzmtUATkmP0AtsTgAMugFx+n0e6rlqayc8Z4DwLOwbt1Q PkDtEesJEHcpHh8DSJmh4wqQWQ== X-Google-Smtp-Source: AK7set88+5auA6DtfnHLDjYM79vfq0Y/eUFFFbErpip96qlSI2KgPtaJHj57tRmTQ8PKmk+tQD/tMg== X-Received: by 2002:a17:902:d543:b0:19b:22c2:26a1 with SMTP id z3-20020a170902d54300b0019b22c226a1mr1348968plf.9.1677832889637; Fri, 03 Mar 2023 00:41:29 -0800 (PST) Subject: [PULL 07/59] target/riscv: remove RISCV_FEATURE_PMP Date: Fri, 3 Mar 2023 00:36:48 -0800 Message-Id: <20230303083740.12817-8-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833169441100003 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza RISCV_FEATURE_PMP is being set via riscv_set_feature() by mirroring the cpu->cfg.pmp flag. Use the flag instead. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-8-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 4 ---- target/riscv/cpu.h | 1 - target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/machine.c | 3 +-- target/riscv/op_helper.c | 2 +- target/riscv/pmp.c | 2 +- 7 files changed, 5 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 807a466f34..d321ad28d2 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -923,10 +923,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error = **errp) riscv_set_feature(env, RISCV_FEATURE_MMU); } =20 - if (cpu->cfg.pmp) { - riscv_set_feature(env, RISCV_FEATURE_PMP); - } - if (cpu->cfg.epmp && !cpu->cfg.pmp) { /* * Enhanced PMP should only be available diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 471e587729..d3f9f29f4c 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -87,7 +87,6 @@ so a cpu features bitfield is required, likewise for optional PMP suppo= rt */ enum { RISCV_FEATURE_MMU, - RISCV_FEATURE_PMP, }; =20 /* Privileged specification version */ diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 7ae832e829..57d20c605b 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -706,7 +706,7 @@ static int get_physical_address_pmp(CPURISCVState *env,= int *prot, pmp_priv_t pmp_priv; int pmp_index =3D -1; =20 - if (!riscv_feature(env, RISCV_FEATURE_PMP)) { + if (!riscv_cpu_cfg(env)->pmp) { *prot =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; return TRANSLATE_SUCCESS; } diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 951327022d..cf33494945 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -419,7 +419,7 @@ static int aia_hmode32(CPURISCVState *env, int csrno) =20 static RISCVException pmp(CPURISCVState *env, int csrno) { - if (riscv_feature(env, RISCV_FEATURE_PMP)) { + if (riscv_cpu_cfg(env)->pmp) { return RISCV_EXCP_NONE; } =20 diff --git a/target/riscv/machine.c b/target/riscv/machine.c index 4634968898..67e9e56853 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -27,9 +27,8 @@ static bool pmp_needed(void *opaque) { RISCVCPU *cpu =3D opaque; - CPURISCVState *env =3D &cpu->env; =20 - return riscv_feature(env, RISCV_FEATURE_PMP); + return cpu->cfg.pmp; } =20 static int pmp_post_load(void *opaque, int version_id) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index 48f918b71b..9c0b91c88f 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -195,7 +195,7 @@ target_ulong helper_mret(CPURISCVState *env) uint64_t mstatus =3D env->mstatus; target_ulong prev_priv =3D get_field(mstatus, MSTATUS_MPP); =20 - if (riscv_feature(env, RISCV_FEATURE_PMP) && + if (riscv_cpu_cfg(env)->pmp && !pmp_get_num_rules(env) && (prev_priv !=3D PRV_M)) { riscv_raise_exception(env, RISCV_EXCP_INST_ACCESS_FAULT, GETPC()); } diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index aa4d1996e9..205bfbe090 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -265,7 +265,7 @@ static bool pmp_hart_has_privs_default(CPURISCVState *e= nv, target_ulong addr, } } =20 - if ((!riscv_feature(env, RISCV_FEATURE_PMP)) || (mode =3D=3D PRV_M)) { + if (!riscv_cpu_cfg(env)->pmp || (mode =3D=3D PRV_M)) { /* * Privileged spec v1.10 states if HW doesn't implement any PMP en= try * or no PMP entry matches an M-Mode access, the access succeeds. --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833061; cv=none; d=zohomail.com; s=zohoarc; b=eouD1Tb8CJuuNNnYoUDaVZFaVsgVBtd43KUVr4GeN6RQQNmZNOWrVNpPtuW9Vueyv7+QKH93lEd2A+pd/2XuTO9vO6t0cV70RVNAX8bI+m3/VdwNNH/rKjo4yFpx70ZEuB8Nbckt4rnG4hXBv3dH56rJgnuKQo6zp01pRAF2AzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833061; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ihpb4HVM2K+uGSZ8ovXkDuhXMAKAlLyH9A3iHU/y+Eg=; b=Wdrf2Ew2Y++SsxnWbakfv1aC+qAvj/mJSHWb9qYiPnCDxgP3al1i7qJeT+lxSU2otCaitAOZNBN1wU0HEnyShPQ3fqpUVWKUqtQgp06dHVRvLExfmWhjm8cSYT5WVx+DulJVWqiO7uTWK7WKrpax98In9+ZZNQz57uUCcCwRL/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833061130593.1825772986331; Fri, 3 Mar 2023 00:44:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z5-0007p9-Ih; Fri, 03 Mar 2023 03:41:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yt-000795-DM for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:35 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yq-0007oi-Mt for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:34 -0500 Received: by mail-pg1-x52f.google.com with SMTP id p6so1060352pga.0 for ; Fri, 03 Mar 2023 00:41:32 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id e21-20020aa78255000000b005a8dcd32851sm1085526pfn.11.2023.03.03.00.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832891; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=ihpb4HVM2K+uGSZ8ovXkDuhXMAKAlLyH9A3iHU/y+Eg=; b=O+udFM3sKy7NeGyBZFyq2/7yQKT5QP/XF6DJcoM9ukpCQmNK3L/FmC57GGhg7+GuzU 0+Am+M/0FzidyNo1dv3kqwBZtGG/iL6D4Al8o++in6G2Hu/I9fRM/eJfupXiDJ0ZVGPP +CWtYOdQb/Tc28wifW9zqVJc65IZwKq/yTYzvUWyHEF1wiCKq92iApicEgyabPi2Mbka ayHrFzEskxDR3tfvsv23nxpY9gmGBQOko16oLUUeIxFt8p4eBxAMs5TR67233SRvPJiH t5cj1Oon1iT+NdUYWbTioX+crNyIXXxTr+moQmOixGzcBiqWFbEVDQipJkdF2Oij5/Sx OPkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832891; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ihpb4HVM2K+uGSZ8ovXkDuhXMAKAlLyH9A3iHU/y+Eg=; b=RNHtxVx+q/4IrSAx90qvT5sCTAdXsRrt5j+ANwxYFHK+cAYPvzhqojCyhnygQr0dgG rsRO0Q9yON0z69POELUTtNvdqs/AK2UlJ6fzj4WtF0IGfJzKuIyl+W7KPc0Il1fErDjx WB3IhOMfl7sYJgleUbwgIrKatz9d05WSyKfM+gb2/dOqgMiyHCDbrduBvhogNfBd2+Kh sxkkreOhGRXitSz/iWpT0Q2aFyXiTl1bf1+1+tO+SV7JZsvpJHnDzpxesyQCJNwl8xTf /jZ4PeTjNdEiQAtTziRyVnJVNEWEPXV8l4dglnO+jAByApQO3ZgvBLSQGP+npSd7XgmG kLnQ== X-Gm-Message-State: AO0yUKWUIVD5JkoY0aU4IZdvz44xMZonMu+RctFFtD9b3kRab2yzLclf IFoy5HeIk+BUJLRKaZh/OONtmw== X-Google-Smtp-Source: AK7set8iKpkV6PKnNxPs7PI+5oNnRxdOTiTQbXtqdMqKI3O4cw7GwOnkqoQPObdy6RDo/tkqFZm81w== X-Received: by 2002:a62:6487:0:b0:594:26a7:cbd2 with SMTP id y129-20020a626487000000b0059426a7cbd2mr890934pfb.8.1677832891150; Fri, 03 Mar 2023 00:41:31 -0800 (PST) Subject: [PULL 08/59] hw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus() Date: Fri, 3 Mar 2023 00:36:49 -0800 Message-Id: <20230303083740.12817-9-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=palmer@rivosinc.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833062992100003 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza Read cpu_ptr->cfg.mmu directly. As a bonus, use cpu_ptr in riscv_isa_string(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-9-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- hw/riscv/virt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 86c4adc0c9..49f2c157f7 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -232,20 +232,21 @@ static void create_fdt_socket_cpus(RISCVVirtState *s,= int socket, bool is_32_bit =3D riscv_is_32bit(&s->soc[0]); =20 for (cpu =3D s->soc[socket].num_harts - 1; cpu >=3D 0; cpu--) { + RISCVCPU *cpu_ptr =3D &s->soc[socket].harts[cpu]; + cpu_phandle =3D (*phandle)++; =20 cpu_name =3D g_strdup_printf("/cpus/cpu@%d", s->soc[socket].hartid_base + cpu); qemu_fdt_add_subnode(ms->fdt, cpu_name); - if (riscv_feature(&s->soc[socket].harts[cpu].env, - RISCV_FEATURE_MMU)) { + if (cpu_ptr->cfg.mmu) { qemu_fdt_setprop_string(ms->fdt, cpu_name, "mmu-type", (is_32_bit) ? "riscv,sv32" : "riscv,sv= 48"); } else { qemu_fdt_setprop_string(ms->fdt, cpu_name, "mmu-type", "riscv,none"); } - name =3D riscv_isa_string(&s->soc[socket].harts[cpu]); + name =3D riscv_isa_string(cpu_ptr); qemu_fdt_setprop_string(ms->fdt, cpu_name, "riscv,isa", name); g_free(name); qemu_fdt_setprop_string(ms->fdt, cpu_name, "compatible", "riscv"); --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833459; cv=none; d=zohomail.com; s=zohoarc; b=b2vXMfntxqGu3JOF1o9zEukoAVLUcuZ7YLW5yIgubKqbNznkgZOIHlukZHPsnMSN7SnjsB+4odC/ymML0xQhn7pTe4DpadZ2mDk+eHwQfHsjwcZW9r1+RvgQ5hX/BUNoEhTkD7pDZY2GtWwya1aqLmQFDpyV0n6XpmARbRwE7NE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833459; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NTo+MxKNtXSvYV70HFKf6XyJ/lMPPvtHSjNjRwVe5TA=; b=iSuDqS+4zmIb7SwGuxB61ndsYmmF7SfirPNleTUPvl7GM6Xa1McZd91kZZLXZ+3XivFqjolNn0wNZOJVEgdkfpXwEnjZ85NHPAM5scNATr1zwT1oP0J4CWxZ77OKZWx/yTJDk5uDvG4OeE8gSPXOYJmKDS0n+PSW5OV+CGaqxnw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833459309346.7604604228459; Fri, 3 Mar 2023 00:50:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z0-0007XA-2Y; Fri, 03 Mar 2023 03:41:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yt-00079u-It for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:35 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yr-0007pD-P0 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:35 -0500 Received: by mail-pj1-x102c.google.com with SMTP id qa18-20020a17090b4fd200b0023750b675f5so5421814pjb.3 for ; Fri, 03 Mar 2023 00:41:33 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id j14-20020a17090a2a8e00b0023739b104f8sm979750pjd.50.2023.03.03.00.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832892; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=NTo+MxKNtXSvYV70HFKf6XyJ/lMPPvtHSjNjRwVe5TA=; b=gTuSn5exNJLNsCgd7B9e9tBVZEzWtd5rdBz+7EQkVPq9Alc/yr4G13Eyitk/9pa+bk ZeSt3exMUo5iyS+EXHtjmFGfQ4FNKDKCoCuscPgbdKzT9//mQ/tKr0OAVGEAVfV6/sAr ZBLQHcJquTi0GI2ybDW58RUDtd/wQciXXKqE/iMFiuARmMhjN3o+Q0p3J5qH2TiaFX5D uBpYLGvNGmb5WuEjQwvxnPzfujvQAKto+LD+TuBYn07gif6yfe1a2qPnBMUNPWPA6FLf DT8JU8BM+3bjOKzM7BFFXyrg+8m/trJlC0C5vFP9pm3FyGn+SbfjLtxxKxLOgIEcWXLa 4TfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832892; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NTo+MxKNtXSvYV70HFKf6XyJ/lMPPvtHSjNjRwVe5TA=; b=ad/iu4MsMBuKaP1r1+n/y7bRohjusJgmoYNoqJh6gpsesg5uFknW7QSKyfco2v0kqi 8REMAtHwWx16/p4AGj+wduTEtGllmSn4wRVE9VL2QuqtcI7ISv/Z08akDHP40S8dXiOD dfEostgysAoLvYLvmj+0mxPZ6QFVC94EqQhdJssSOegi7NNt7Sm5yl/wwow0g5Joatqq ItD9h3uDuF3aXdEljenbQRsqTOU+VJBenYnXDZlHuXl8QrMnhBRiLIFMiGd1+e1kjyS4 kTZFhug6g6DD2aKwrnCXBJUhSt++GfGDtJEQrSS/eLx6XBe0vGvTXGCqtzMDiwMynUrC CRrQ== X-Gm-Message-State: AO0yUKWL+hjVr3k1BSkk0tE+rqWwEpq1JIekhru8cf2GGU41euAwdcD2 xhUZ5SxzTW0cGyD4h6ldSZXWIQ== X-Google-Smtp-Source: AK7set/jso63hHfWWZFqxhIVWdYsQzWi5xSNQQJiW1pBRy6eaWMo/3QpzsxQyMEa2zSR8KshkbCpDw== X-Received: by 2002:a17:90b:3907:b0:233:f447:1271 with SMTP id ob7-20020a17090b390700b00233f4471271mr758292pjb.43.1677832892481; Fri, 03 Mar 2023 00:41:32 -0800 (PST) Subject: [PULL 09/59] target/riscv: remove RISCV_FEATURE_MMU Date: Fri, 3 Mar 2023 00:36:50 -0800 Message-Id: <20230303083740.12817-10-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833460934100006 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza RISCV_FEATURE_MMU is set whether cpu->cfg.mmu is set, so let's just use the flag directly instead. With this change the enum is also removed. It is worth noticing that this enum, and all the RISCV_FEATURES_* that were contained in it, predates the existence of the cpu->cfg object. Today, using cpu->cfg is an easier way to retrieve all the features and extensions enabled in the hart. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-10-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 4 ---- target/riscv/cpu.h | 7 ------- target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 4 ++-- target/riscv/monitor.c | 2 +- target/riscv/pmp.c | 2 +- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index d321ad28d2..11da920915 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -919,10 +919,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error = **errp) } } =20 - if (cpu->cfg.mmu) { - riscv_set_feature(env, RISCV_FEATURE_MMU); - } - if (cpu->cfg.epmp && !cpu->cfg.pmp) { /* * Enhanced PMP should only be available diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index d3f9f29f4c..ac33362525 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -81,13 +81,6 @@ #define RVH RV('H') #define RVJ RV('J') =20 -/* S extension denotes that Supervisor mode exists, however it is possible - to have a core that support S mode but does not have an MMU and there - is currently no bit in misa to indicate whether an MMU exists or not - so a cpu features bitfield is required, likewise for optional PMP suppo= rt */ -enum { - RISCV_FEATURE_MMU, -}; =20 /* Privileged specification version */ enum { diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 57d20c605b..2b731a8c7f 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -796,7 +796,7 @@ static int get_physical_address(CPURISCVState *env, hwa= ddr *physical, mode =3D PRV_U; } =20 - if (mode =3D=3D PRV_M || !riscv_feature(env, RISCV_FEATURE_MMU)) { + if (mode =3D=3D PRV_M || !riscv_cpu_cfg(env)->mmu) { *physical =3D addr; *prot =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; return TRANSLATE_SUCCESS; diff --git a/target/riscv/csr.c b/target/riscv/csr.c index cf33494945..75a540bfcb 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -2621,7 +2621,7 @@ static RISCVException rmw_siph(CPURISCVState *env, in= t csrno, static RISCVException read_satp(CPURISCVState *env, int csrno, target_ulong *val) { - if (!riscv_feature(env, RISCV_FEATURE_MMU)) { + if (!riscv_cpu_cfg(env)->mmu) { *val =3D 0; return RISCV_EXCP_NONE; } @@ -2640,7 +2640,7 @@ static RISCVException write_satp(CPURISCVState *env, = int csrno, { target_ulong vm, mask; =20 - if (!riscv_feature(env, RISCV_FEATURE_MMU)) { + if (!riscv_cpu_cfg(env)->mmu) { return RISCV_EXCP_NONE; } =20 diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 236f93b9f5..f36ddfa967 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -218,7 +218,7 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict) return; } =20 - if (!riscv_feature(env, RISCV_FEATURE_MMU)) { + if (!riscv_cpu_cfg(env)->mmu) { monitor_printf(mon, "S-mode MMU unavailable\n"); return; } diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 205bfbe090..a08cd95658 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -315,7 +315,7 @@ int pmp_hart_has_privs(CPURISCVState *env, target_ulong= addr, } =20 if (size =3D=3D 0) { - if (riscv_feature(env, RISCV_FEATURE_MMU)) { + if (riscv_cpu_cfg(env)->mmu) { /* * If size is unknown (0), assume that all bytes * from addr to the end of the page will be accessed. --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833006; cv=none; d=zohomail.com; s=zohoarc; b=lh0xsvXXxoSfRSgqRrvuteaPbtXO7OvRiWNlo/vSgqlH3/Tgk1Qm0Br5XgHhCAxxQFPHeJmyP+Q+V1x2JG6zXA6ta5lU5hDoL4L9VfKUuT7qnsrItsBZPZ/dCS13vaBatOIryQaaivKOztLAi5/nyHb3XvfxJQtOweaYBmz+Msk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833006; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MPDpcPiU9jbrwrbZWIjRMlGIFv8ed8SP93XpsmceXZA=; b=nKnxikM1XO9B/fG5c96af2WqM8Ts2kzw5kqrMaNgjXgXjrXat/4QOOZPFSEJz/K0o5GbZEcYuEU/ON0rGrzRlfwQ0LWW55I6HgHDrmt/zfdq0ULlpK7Y1/nCMsUSfgJV/TZKwU9/nWR2xItmf3BW2k60LvrTAYilRpq0CjMYMyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833006426785.3106168493623; Fri, 3 Mar 2023 00:43:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0yz-0007UN-IW; Fri, 03 Mar 2023 03:41:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yv-0007Ed-22 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:37 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yt-0007pb-5c for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:36 -0500 Received: by mail-pj1-x102d.google.com with SMTP id oj5so1779380pjb.5 for ; Fri, 03 Mar 2023 00:41:34 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id a8-20020a170902900800b0019ac9c9ce16sm969415plp.138.2023.03.03.00.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832893; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=MPDpcPiU9jbrwrbZWIjRMlGIFv8ed8SP93XpsmceXZA=; b=s266GqFHlgVqcvGFqqfRCTV032FbqtCZXjtmhmgtgLj4fyg88ZTXB5hvMQ7R1k5HHA r/H5CZFfaJ3rDQeuC6erAtPAv7HESioyXLD0KshpIvGU07qwyMl+UGBlWTc68rqWft1r VCOIumd3FcGBrVNdogXUPCjXVOF6ROopvSiMT3ag6aUBCNwz/ZI9FrRLOkUYH5oNSqr4 2O6vbaWkMzfH8DIQYVdLa4GZZUl5wVdeyEDXixh3FaasmfgGnzlkI+BaSn+fpqb7+NtD CFyZfBB/lc8Gd1oKfw+0R4iuR3MigyxEukNNm61gAijGfbD8Heh29BIrKB3INfMlQL9v Ukmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832893; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MPDpcPiU9jbrwrbZWIjRMlGIFv8ed8SP93XpsmceXZA=; b=JkZJjhDYWo1Y+I9xhgQ/SaTIC/Jfilc0JyV47clAfpHovAOKzquA+5kiDA6xtAnpKM zxLiclRNCrfATpuxEBJNkj26CgS+2mwhVhiqzvAkmg4j65I84CxaX9kqf4g6+M5Swlau 6vbVrymZxkoSyrrd4JK1kBMF8BC+zilEg1ddzwNM5xotcmEK7t+dwAv0jVfcKwxkHtMu vc1YPQHl+5hIPgTY4AWQPqHWxdlOH1ROJI8/IX+yzs9cKMGkRrY0gYYz0SOez3J1C4/8 6jLa2xLVikkT7qgBj/t8tkvFtOjl80B57ItYe7ymRZatJFUIV/FSC90te5cDJhTon5wm xwuA== X-Gm-Message-State: AO0yUKXCW9IMpXit0+ftuOgdYHJCUfHk+ZyOaxW1lZvzYzEw4HKMHUpJ FSthQfWEKEACHOsNXtedeTPXVw== X-Google-Smtp-Source: AK7set+ADLXl2c5zfOXCz3b7RU06VCuXsXjdH+HZiRJpIPrQJFs2iJ31rdwRsMDfeuyONECIN1Rlxg== X-Received: by 2002:a17:902:db0b:b0:19e:524a:657 with SMTP id m11-20020a170902db0b00b0019e524a0657mr1400547plx.56.1677832893650; Fri, 03 Mar 2023 00:41:33 -0800 (PST) Subject: [PULL 10/59] target/riscv/cpu: remove CPUArchState::features and friends Date: Fri, 3 Mar 2023 00:36:51 -0800 Message-Id: <20230303083740.12817-11-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Bin Meng , Andrew Jones , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833006851100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The attribute is no longer used since we can retrieve all the enabled features in the hart by using cpu->cfg instead. Remove env->feature, riscv_feature() and riscv_set_feature(). We also need to bump vmstate_riscv_cpu version_id and minimal_version_id since 'features' is no longer being migrated. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Message-ID: <20230222185205.355361-11-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.h | 12 ------------ target/riscv/machine.c | 5 ++--- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index ac33362525..b9f69a134b 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -175,8 +175,6 @@ struct CPUArchState { /* 128-bit helpers upper part return value */ target_ulong retxh; =20 - uint32_t features; - #ifdef CONFIG_USER_ONLY uint32_t elf_flags; #endif @@ -525,16 +523,6 @@ static inline int riscv_has_ext(CPURISCVState *env, ta= rget_ulong ext) return (env->misa_ext & ext) !=3D 0; } =20 -static inline bool riscv_feature(CPURISCVState *env, int feature) -{ - return env->features & (1ULL << feature); -} - -static inline void riscv_set_feature(CPURISCVState *env, int feature) -{ - env->features |=3D (1ULL << feature); -} - #include "cpu_user.h" =20 extern const char * const riscv_int_regnames[]; diff --git a/target/riscv/machine.c b/target/riscv/machine.c index 67e9e56853..9c455931d8 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -331,8 +331,8 @@ static const VMStateDescription vmstate_pmu_ctr_state = =3D { =20 const VMStateDescription vmstate_riscv_cpu =3D { .name =3D "cpu", - .version_id =3D 6, - .minimum_version_id =3D 6, + .version_id =3D 7, + .minimum_version_id =3D 7, .post_load =3D riscv_cpu_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32), @@ -351,7 +351,6 @@ const VMStateDescription vmstate_riscv_cpu =3D { VMSTATE_UINT32(env.misa_ext, RISCVCPU), VMSTATE_UINT32(env.misa_mxl_max, RISCVCPU), VMSTATE_UINT32(env.misa_ext_mask, RISCVCPU), - VMSTATE_UINT32(env.features, RISCVCPU), VMSTATE_UINTTL(env.priv, RISCVCPU), VMSTATE_UINTTL(env.virt, RISCVCPU), VMSTATE_UINT64(env.resetvec, RISCVCPU), --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833254; cv=none; d=zohomail.com; s=zohoarc; b=npgUrWdIyUXj8MTplQ1bo0xIsvPc20J6Iy25SN2whsy2AokF24tWkyTg3XLK4hGE2ik+v0b8SyHKvxQdJmabjeIsBlAMHKGUgBTAd91suVPBkFwi5ggxJqb8fypyBv2IcKfVa8zvoEf/t9QqaVWAsLXpAI7Z1lcDdra7FM+adJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833254; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1tBlsx7SnOxqiVplnbiuLiMigZbJDtgl1hLXrOTps5Q=; b=MjFLT2spnsLoou0I+lS9vPCmX3/H6sJEhPnf9/2blrgI87sECnZP9c9N5jTOHUa4syuECsh7MMuz/+rufmNCA16UH2JxsCbkWrUpe+06rrDfM2s11+D/Rn7XlwBaQn2BdbwyPPj+GS5XK34iHsJU0sTycFSSwGz6O5wrXTSnIUE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833254654808.7885660995616; Fri, 3 Mar 2023 00:47:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z3-0007mX-3M; Fri, 03 Mar 2023 03:41:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yw-0007H5-Bx for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:38 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yu-0007qA-D5 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:38 -0500 Received: by mail-pl1-x62e.google.com with SMTP id u5so1972930plq.7 for ; Fri, 03 Mar 2023 00:41:36 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id x8-20020a1709027c0800b0019a7c890c5asm949271pll.263.2023.03.03.00.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832895; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=1tBlsx7SnOxqiVplnbiuLiMigZbJDtgl1hLXrOTps5Q=; b=5GMOYEMJrPHNsg5BTtQj4VIyp1NPdGKTViUjTz/2NikgBMsWzZPMhdkHXj+sTQMmwQ /GSzc6PFJsIxkIgMO48mXiTlptHKK66tS3lbLjS/t2otwnqGua70dBSl/Wqkkrwcmpva yaIBY03iRbkNIlrLsHAnyQEXFaB6ECFCOjuIG0n9LYZlQqsgc2/+4eXmUWZUh3axeD2z y32HUmbmw0mSOc7bTQ7vMPoEs80Fbt4lHtDwZFH78VSBGmN5RV8TmOn4ZXFzyN9iPgib D9YqtjEKHEaPey8BcjacRTh2qXV1w+BNQ0upHv6Ms9b5oD/PXfz/qI/JcRzFnjkLye7N 8cFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832895; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1tBlsx7SnOxqiVplnbiuLiMigZbJDtgl1hLXrOTps5Q=; b=qfUF1zDxBd5TkMi6efT6Ni5vbi+6RMe7fXjENyVv9sAv3y83WVEr/r0YkWe54lUZgT tQ0QhnHZVa7tc4AyP+kheMhRg7fupXdZF35LgZWcpdxEkGnbPLaQ8qygacEbu3keupDg vf5lVZjo1yE8n3b/VZsnmJxIB3PIcsEEERIdgD52j+nlK7W6W35i+hvRBY3ssYkY9nK+ h9OQ42e6HM3fI/Wcxt4ingplpylhyPX8JfmdrDXV9zkYK7mt8wIKYtTwi4p2EHfg9cD1 M6IqyxQXD8d5ZoHN0QCm1upFfXhUER4xG19p/CpPkEndcm75r2qgOovWXThg4xZrgeYT FmGA== X-Gm-Message-State: AO0yUKW5PBP5tuNmFPlrCz3zfcgw9nneiO9U6FQw1yO+Ur30yQOfvlKJ e+TV+Dt8vTInGecCJYBuxBBzPw== X-Google-Smtp-Source: AK7set+N9FUx5fvIb8Yj3bZZIRRD6af1TWZIWHSJQFNv3UdsBtwJw70LGTrpCSHGSC3aA7T1MA2A+A== X-Received: by 2002:a17:903:2344:b0:19e:6e29:2a8c with SMTP id c4-20020a170903234400b0019e6e292a8cmr1529054plh.5.1677832894945; Fri, 03 Mar 2023 00:41:34 -0800 (PST) Subject: [PULL 11/59] target/riscv: Fix the relationship between Zfhmin and Zfh Date: Fri, 3 Mar 2023 00:36:52 -0800 Message-Id: <20230303083740.12817-12-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833255819100009 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Zfhmin is part of Zfh, so Zfhmin will be enabled when Zfh is enabled. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-2-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 93b52b826c..a717f5d995 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -729,7 +729,11 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU= *cpu, Error **errp) return; } =20 - if ((cpu->cfg.ext_zfh || cpu->cfg.ext_zfhmin) && !cpu->cfg.ext_f) { + if (cpu->cfg.ext_zfh) { + cpu->cfg.ext_zfhmin =3D true; + } + + if (cpu->cfg.ext_zfhmin && !cpu->cfg.ext_f) { error_setg(errp, "Zfh/Zfhmin extensions require F extension"); return; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833302; cv=none; d=zohomail.com; s=zohoarc; b=c4jli9YpSMXNMAx5XYawspG2t+OGcXHXKsYTx/whFkAl0Q6jPDuvrxskwLmEcKQEMLuLSE+bCRzp184lma45DqEgXy/eyKO9XdW8PH6MAehMjV4DAijc3Wsev2+SCEuR2po9AYe+KvrpG+TGjbrFP0+WoEl3AOqgpOb2OmtR0jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833302; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1NW+NIexrpPmdGr0YETGUz1SO+EPDDsXBDOKSAL+94I=; b=gpyiizSeGW0JQp2zIVZpSpXJZaCmh0jzN6lKfWhq6SSf5auPDMBe1thGw6qesovN33nbKWeiCMOsFzs9r+W9FPiwwr6rocYSFxU4It0k3WoyPljOP3FVAJw9BNGrIaorGHiJDDcAS2JR6HDHJX5++aFuEVZFk/9XfHIYhPxCVzI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833302565837.9847830445937; Fri, 3 Mar 2023 00:48:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z8-0007ze-Jv; Fri, 03 Mar 2023 03:41:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yx-0007L0-OA for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:39 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yv-0007qp-Ap for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:39 -0500 Received: by mail-pj1-x102d.google.com with SMTP id h11-20020a17090a2ecb00b00237c740335cso1565674pjs.3 for ; Fri, 03 Mar 2023 00:41:36 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id nl2-20020a17090b384200b002311dbb2bc5sm2853499pjb.45.2023.03.03.00.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832896; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=1NW+NIexrpPmdGr0YETGUz1SO+EPDDsXBDOKSAL+94I=; b=7whNdQVEyKS45V+NcQrgr3c/mC2WV7+Tp9VBZL92YOqkvvq+b0Ar1/UHC1rBaXwvny GPM+XDEqRYpqBzNdP9/g1xjH4TXg1j7Q/B1bQ0rIPDhGbxRSCJpczhzI/8ijxr2//Trm MI89iAlOSHz3FylA5mw3JQtN35H/UP6WHVPAVQk5ZNpJdnYenspFErexSASQjFt7jhbx YEM0BWJFsMmbfXmBOIR/cLQjE1bXj6p8DD4o4fvgP5m6iAr1iBPV7QD2QaFbMbXgMZDG 44gZxIkdLcyyPSoy6/SYDushRoXaeAfGoGl4CcpmU+iw9W78Jc/YiXOjbe8uEqzv8JYM jofw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832896; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1NW+NIexrpPmdGr0YETGUz1SO+EPDDsXBDOKSAL+94I=; b=UqerxyhhB0D6vS73X7iAGEsA9AH0+a2EvBNjaNXMg56ltCiR3KSTs3pB1VjWcFPOwQ u3RLGzQveKAws4iho48oljfzu+4O+kiYedr5LGlhqf6Nov3sLau4lqguKTSVCyYFjlvh F7xgaD3M2t9dyiC0jOLB/J6uWjPlLGIz8OkU5mpE4fazX+PVI1kRk3HA5Nn0tY6XiJf6 F/9mQ8E/Xzq4bAtzamMC1mCskAnNcEn74U5un2CwbfvuasQhazK103ty3vj4TzwNe3BD 2UbATCiJcDDPja24vl9dtVV3wjxusu47wGYyoWe5FeojtpLelyRH9U62XN9Zv6qQGVxJ TQIg== X-Gm-Message-State: AO0yUKVSBvCROWRuMvwWuDXB0uz7Q128pS0TVMk9jKWbpmiBTYXktKP0 vNDlWaZop49KtET4RRyWocB1OQ== X-Google-Smtp-Source: AK7set9Jb7TQ/PJn/mIBx3TkF6CuY6HXF9O74HvUxpLpeioUndaD5ZuRNc8Xl4I9mulPBumrRxh6LQ== X-Received: by 2002:a17:90b:38c3:b0:236:704d:ab8c with SMTP id nn3-20020a17090b38c300b00236704dab8cmr900526pjb.26.1677832896142; Fri, 03 Mar 2023 00:41:36 -0800 (PST) Subject: [PULL 12/59] target/riscv: Fix the relationship between Zhinxmin and Zhinx Date: Fri, 3 Mar 2023 00:36:53 -0800 Message-Id: <20230303083740.12817-13-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833304141100009 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Just like zfh and zfhmin, Zhinxmin is part of Zhinx so Zhinxmin will be enabled when Zhinx is enabled. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-3-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a717f5d995..dcd85f7f27 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -754,8 +754,11 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU= *cpu, Error **errp) } =20 /* Set the ISA extensions, checks should have happened above */ - if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinx || - cpu->cfg.ext_zhinxmin) { + if (cpu->cfg.ext_zhinx) { + cpu->cfg.ext_zhinxmin =3D true; + } + + if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) { cpu->cfg.ext_zfinx =3D true; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833185; cv=none; d=zohomail.com; s=zohoarc; b=l9u5BNM867yg7i6k1e+wz+RA7dLoEFh5nHkSnvM6XMC3r37uF2suBsutMQi+2oIbFbhRmQxf6nNj6hZPUqxpJc+0OKmJVuYD6yh/osKWkVMuK2wh43GqRiaf95sliYo3dWjqXduj8ETdymMb7+RF54WGWZBvEj/WGjUjkFKB9YI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833185; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lqVjjOTZ9eMdzabLZOWmFSlP1B+iw01WmCSIdt7lwp0=; b=PM0Rbyhbr5+EEjaVxHo/l0xShs5zeQZH/i8kLmBX80V8vBeNTkft1yv7t10fQn7ZKvfIKPX6UCohJCdxoYJublsxkxrJnyfbKAx9p2L3tXbiBZlpmon4SasBJp2SgJUa1sLGzOM7yuvG3WxpnrzlytDvDSMtbcSmnCbARhYROZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783318510745.25209012876337; Fri, 3 Mar 2023 00:46:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z2-0007kE-KQ; Fri, 03 Mar 2023 03:41:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yy-0007PD-KO for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:41 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yw-0007ra-S6 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:40 -0500 Received: by mail-pf1-x429.google.com with SMTP id ce7so1070802pfb.9 for ; Fri, 03 Mar 2023 00:41:38 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id t8-20020aa79388000000b0058bb79beefcsm1025500pfe.123.2023.03.03.00.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832897; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=lqVjjOTZ9eMdzabLZOWmFSlP1B+iw01WmCSIdt7lwp0=; b=M/CgJXP9rICo1SFnWYHofEHswm58IRdJ/AXEmzWgkhzd8IaP9EXrt1zcQN9kuQ1q4/ R6oGgrB/LZN29aB4+oeRXUfDvscnShXcjDeZyxApxOhOR6UHL7pyCjSqklLwu7Sa2M7x Xh9chqPfRRg4vGQrAzm4S4UOkhYQ84s4odJsQ0MmVIWqMmLILfbdKNQSdVD8YVPhebqd ksco7viY5dyf5goJFC6eHZcH44AIgjswelmlbF7QmCI66nVDAjoakCC4jxb/J6L4WQ5B 9gsbfkj/I37AHEsxN5KTxV7y4TGs1qaqKXAxdf1uWHkhKv3j5DXbB5WzFyPdTNFAYQFu YPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832897; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lqVjjOTZ9eMdzabLZOWmFSlP1B+iw01WmCSIdt7lwp0=; b=Ve682nJPOLFs0FnQ1VM2V6QX7tuOqZTCPuICSKc5FRPK1Dmfli46+IaRiQcmrlIq4v L36WGuXYVCdso3CAk+1irDUJV5Yig0wUXDjMFfqzJYC6YWAtWiPhAV6267Z/0mM3HlAF cHickvy8QEDAu77R2RUE+Sc1Bp4tMZTPTbeZ/qdUPBsH9BxZxvi2irlbG8Ih1XhgfmLa gFsOQqcaUOJ9QRWKZkyorQ1m78lOxLjqfkgZlr8cYaOFM5DTB+E2dwYM9kmQTkZgh8N3 0i+FCB75DU/84L01DacAd2oMEcRON0NltgJrVWSXaq5MT60c2Tz2KDO08rrvUfYuVZhQ VZIQ== X-Gm-Message-State: AO0yUKWdbyEgHyAo1kcRsWvd1AO7HD+wwtKFRtxQXb8l8YqThDMJDcQ/ 0SjYi7FeE+jmO9BF8RkSDXJHKQ== X-Google-Smtp-Source: AK7set/Fva0h7CxUkJquuQuyfRebkusQdeH50L/8rYor5kmF+HPBFIgJJmoYco/4bAOnb3b3gnmPPA== X-Received: by 2002:a62:7b45:0:b0:5a9:b4eb:d262 with SMTP id w66-20020a627b45000000b005a9b4ebd262mr1598578pfc.1.1677832897354; Fri, 03 Mar 2023 00:41:37 -0800 (PST) Subject: [PULL 13/59] target/riscv: Simplify the check for Zfhmin and Zhinxmin Date: Fri, 3 Mar 2023 00:36:54 -0800 Message-Id: <20230303083740.12817-14-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=palmer@rivosinc.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833185524100009 Content-Type: text/plain; charset="utf-8" From: Weiwei Li We needn't check Zfh and Zhinx in these instructions. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-4-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_rvzfh.c.inc | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvzfh.c.inc b/target/riscv/insn_= trans/trans_rvzfh.c.inc index 2ad5716312..85fc1aa822 100644 --- a/target/riscv/insn_trans/trans_rvzfh.c.inc +++ b/target/riscv/insn_trans/trans_rvzfh.c.inc @@ -28,15 +28,14 @@ } \ } while (0) =20 -#define REQUIRE_ZFH_OR_ZFHMIN(ctx) do { \ - if (!(ctx->cfg_ptr->ext_zfh || ctx->cfg_ptr->ext_zfhmin)) { \ +#define REQUIRE_ZFHMIN(ctx) do { \ + if (!ctx->cfg_ptr->ext_zfhmin) { \ return false; \ } \ } while (0) =20 -#define REQUIRE_ZFH_OR_ZFHMIN_OR_ZHINX_OR_ZHINXMIN(ctx) do { \ - if (!(ctx->cfg_ptr->ext_zfh || ctx->cfg_ptr->ext_zfhmin || \ - ctx->cfg_ptr->ext_zhinx || ctx->cfg_ptr->ext_zhinxmin)) { \ +#define REQUIRE_ZFHMIN_OR_ZHINXMIN(ctx) do { \ + if (!(ctx->cfg_ptr->ext_zfhmin || ctx->cfg_ptr->ext_zhinxmin)) { \ return false; \ } \ } while (0) @@ -47,7 +46,7 @@ static bool trans_flh(DisasContext *ctx, arg_flh *a) TCGv t0; =20 REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN(ctx); + REQUIRE_ZFHMIN(ctx); =20 decode_save_opc(ctx); t0 =3D get_gpr(ctx, a->rs1, EXT_NONE); @@ -70,7 +69,7 @@ static bool trans_fsh(DisasContext *ctx, arg_fsh *a) TCGv t0; =20 REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN(ctx); + REQUIRE_ZFHMIN(ctx); =20 decode_save_opc(ctx); t0 =3D get_gpr(ctx, a->rs1, EXT_NONE); @@ -401,7 +400,7 @@ static bool trans_fmax_h(DisasContext *ctx, arg_fmax_h = *a) static bool trans_fcvt_s_h(DisasContext *ctx, arg_fcvt_s_h *a) { REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN_OR_ZHINX_OR_ZHINXMIN(ctx); + REQUIRE_ZFHMIN_OR_ZHINXMIN(ctx); =20 TCGv_i64 dest =3D dest_fpr(ctx, a->rd); TCGv_i64 src1 =3D get_fpr_hs(ctx, a->rs1); @@ -418,7 +417,7 @@ static bool trans_fcvt_s_h(DisasContext *ctx, arg_fcvt_= s_h *a) static bool trans_fcvt_d_h(DisasContext *ctx, arg_fcvt_d_h *a) { REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN_OR_ZHINX_OR_ZHINXMIN(ctx); + REQUIRE_ZFHMIN_OR_ZHINXMIN(ctx); REQUIRE_ZDINX_OR_D(ctx); =20 TCGv_i64 dest =3D dest_fpr(ctx, a->rd); @@ -436,7 +435,7 @@ static bool trans_fcvt_d_h(DisasContext *ctx, arg_fcvt_= d_h *a) static bool trans_fcvt_h_s(DisasContext *ctx, arg_fcvt_h_s *a) { REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN_OR_ZHINX_OR_ZHINXMIN(ctx); + REQUIRE_ZFHMIN_OR_ZHINXMIN(ctx); =20 TCGv_i64 dest =3D dest_fpr(ctx, a->rd); TCGv_i64 src1 =3D get_fpr_hs(ctx, a->rs1); @@ -452,7 +451,7 @@ static bool trans_fcvt_h_s(DisasContext *ctx, arg_fcvt_= h_s *a) static bool trans_fcvt_h_d(DisasContext *ctx, arg_fcvt_h_d *a) { REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN_OR_ZHINX_OR_ZHINXMIN(ctx); + REQUIRE_ZFHMIN_OR_ZHINXMIN(ctx); REQUIRE_ZDINX_OR_D(ctx); =20 TCGv_i64 dest =3D dest_fpr(ctx, a->rd); @@ -585,7 +584,7 @@ static bool trans_fcvt_h_wu(DisasContext *ctx, arg_fcvt= _h_wu *a) static bool trans_fmv_x_h(DisasContext *ctx, arg_fmv_x_h *a) { REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN(ctx); + REQUIRE_ZFHMIN(ctx); =20 TCGv dest =3D dest_gpr(ctx, a->rd); =20 @@ -605,7 +604,7 @@ static bool trans_fmv_x_h(DisasContext *ctx, arg_fmv_x_= h *a) static bool trans_fmv_h_x(DisasContext *ctx, arg_fmv_h_x *a) { REQUIRE_FPU; - REQUIRE_ZFH_OR_ZFHMIN(ctx); + REQUIRE_ZFHMIN(ctx); =20 TCGv t0 =3D get_gpr(ctx, a->rs1, EXT_ZERO); =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677832946; cv=none; d=zohomail.com; s=zohoarc; b=J29h/gCNzZFdBlruI6Ev8mpTv/ac8ewC2L9NI6G6tOL3txFbmdiHfUsWmSqYF8qXALcBC12ZD8RM9SLClcg7TznmUEPwiuCXXQOeSdsNp+GtDTIAQU2MQGtldSEreFLawqTWNESi+ugjXgoyGecb2n/H8vczskTKPelccLQr1l8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677832946; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E2uTMnecgdqwtCVcnTwCqTOoQw2CLDtGHhwqfs8rN5Y=; b=IhzfBoaUs+jhTc/phdzuc30nsmVcBGSzue8DaPhqarSGr5O1UuvURzpBuc6UBNr7YzZElMY/EQuUns7cgHD/ahx+Aat9xkvIZEFqZ2BMLIP7B2IlTJq4t3G1fgP5Y39WJ4jm+ajPX9J8cbhDYYcc4BHkvL1uuhIPlR5A2+yppN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677832946179413.1094104120739; Fri, 3 Mar 2023 00:42:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z4-0007ox-Md; Fri, 03 Mar 2023 03:41:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0yz-0007Vu-Mj for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:41 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yx-0007s7-UP for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:41 -0500 Received: by mail-pj1-x1031.google.com with SMTP id 6-20020a17090a190600b00237c5b6ecd7so5413121pjg.4 for ; Fri, 03 Mar 2023 00:41:39 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id m8-20020aa79008000000b005dae7d1b61asm1021857pfo.154.2023.03.03.00.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832898; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=E2uTMnecgdqwtCVcnTwCqTOoQw2CLDtGHhwqfs8rN5Y=; b=nOByMZlfUE+3wYpRTD2WQ0zfJQvWJEtBmdP3X8qn+3yNeyCYl8MY54sjvwEUubiIeD CZIoDDcLRJ1KylGpULcO7EHnxuk9DAPw/G5uR+KSyL63lQUC7eW1HwHJie3+2RH2AQTl lqzanUuDe6obwgYedvNSQ9KuSz60J+VtwB0k3tkvR/8TNekvcKHfAE9H8pAh87cSATj/ v1V6p1FIpQmgyf8kbSN6QZs0r0w6ciMuvvsxp8Gls4kyPiR/z4w9mXZfP2Py1lQfSTlB J6Qs/HvXa//vQeJ99WR2QqNmXiCGvppIgUdPoyIlQkQPODWORn2pCPNDAzkN8mxGs7om eeOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832898; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E2uTMnecgdqwtCVcnTwCqTOoQw2CLDtGHhwqfs8rN5Y=; b=Se5+Tl1+GlhhL+vjxeYitq71Q8XA4unMPNNDL11nb+OIv1VWpqwxUbdyiKTEA9lm/O KIqwno0t0c3g/GXemT9QMUZFt3O/sJcQhaovNndFAIXoyUFrQ+/L7IMcAWu7WLtgeOto rdgmCj4GvC+GOQ7aQoSU+bsWtxILNldezLdSYMi/uPILqdhI3FEg1GmmyTRaykwsr/W0 6aW2QG8Plp2tk8CLEcz5RIKSlnjG9SaZoYOUjULYQSJIc+hrSAPm4DPed5uHgAxOOgYh svQwl209Rtry3akoCbHv723XXjsqDxQuxs2JtuPnYgj6NE1j8rpmi5S7Zzhpgzn9J1v3 B3yw== X-Gm-Message-State: AO0yUKXcDClX4QF03F7ejfKWU2BpjSRdXL2YFoq4KjPAB5PZi8tCDhLv Veqe3jxFmzxvh04d7EbDL1Q4+A== X-Google-Smtp-Source: AK7set/CnTo1KPFRpz3pbg8Tes8k0/Cs7AyRXYoU+gzf6Y9pqPZ3HvJqO3pmKPaB9xTPQNb/yeRDCA== X-Received: by 2002:a05:6a20:7785:b0:c7:13be:6de9 with SMTP id c5-20020a056a20778500b000c713be6de9mr1258284pzg.14.1677832898510; Fri, 03 Mar 2023 00:41:38 -0800 (PST) Subject: [PULL 14/59] target/riscv: Add cfg properties for Zv* extensions Date: Fri, 3 Mar 2023 00:36:55 -0800 Message-Id: <20230303083740.12817-15-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677832948217100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Add properties for Zve64d,Zvfh,Zvfhmin extensions. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-5-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 31537fc05f..7f5264e165 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -462,7 +462,10 @@ struct RISCVCPUConfig { bool ext_zhinxmin; bool ext_zve32f; bool ext_zve64f; + bool ext_zve64d; bool ext_zmmul; + bool ext_zvfh; + bool ext_zvfhmin; bool ext_smaia; bool ext_ssaia; bool ext_sscofpmf; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833178; cv=none; d=zohomail.com; s=zohoarc; b=NlGeW9rGJC851dvezOidmgTkdu4VYT4SuHZiJKRkXnbt7UBGIqa1HRdJPjK8DHTjyWqSf7ehZTAF8vTTKiIout03BglsPvl+aZq+xNaUd8sO2u7GD9ouccf1cxxsO6r7v5t+9hNr6fmrHhMatmMKUDd1rzuwDBOKCyilZnPewMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833178; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kcuWfVLv90nTH9ge75vXg3yLoUBwSn2SzMUf+lNtxFY=; b=OD4zZ297hs0kR54mNxg9qX3Wzxnt/pVVOe43QkiOyk8PQyfhnQrAZp05O/dyGQFkMFegJflXwjFYY3SmRAH0gKzYeJEt4Jjhu+wCg994c1MMr8sK+Np5jd4d5G6rLh6mSCO1oSpSuCNsEbbHjqIhpNwqp4o0rxpNBceCpjG5eGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833178223732.1116876171565; Fri, 3 Mar 2023 00:46:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z3-0007no-H5; Fri, 03 Mar 2023 03:41:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z0-0007Zl-DP for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:42 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0yy-0007sb-UO for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:42 -0500 Received: by mail-pl1-x631.google.com with SMTP id y11so2012615plg.1 for ; Fri, 03 Mar 2023 00:41:40 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id b9-20020aa78109000000b005d72e54a7e1sm1006384pfi.215.2023.03.03.00.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832899; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=kcuWfVLv90nTH9ge75vXg3yLoUBwSn2SzMUf+lNtxFY=; b=oc5hzZGi1tkywwpu9azT+KRWT6ia4ODRsGR63CUJ6UL21FNaWlXbUt1hxb04zhx2HW bkAgkmUbctOS8FbaO7neyd1LdHr/qQUeS7Ct9BW9vVTDjLE1e6VxNDVUGwk+yVEZiQ8n uyGiHq15q8EonkxD1HdBHjvYlKP+VSgX1BUz2YuJeYXHdzZsDpaKwpJ18XAP5xvbbAYD 96/wQ/4DZF9ByiqVEtAeKLjjPoT4C05SGW/SsHq2yJE6m3xQawcqFKcqp/dtH3sH7CqE A4/Pc9WuuPr0aGEQqBrrrNlBioC3io0DfYB/7uYz9JzmXtiPPQa6dwl2rWtM01i7iqQk PZCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832899; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kcuWfVLv90nTH9ge75vXg3yLoUBwSn2SzMUf+lNtxFY=; b=VuKs52mGRhyle+BcOeImlwItLMEBPzzbrRgPgLMYDFg6YWfyJzdCyZhGicjbJa8o0i f+rHPeAhaIRASIys2QoaIxan/nwApUywr+hEZw1aimiHPv6Xh5aQHBjO5Rwe9nieSqz7 O52iE/wI+/FxPh/QSRg+d+8Q5SVLui/Wrn82Qf3RfeRfDk6MSQMfv5i+L+86IPK1+kbH nOIlDEAEY+ipAKfB51GMa7IXvgTWxxPeVMWdWHf77K4bycLQxNsxPLUCDacP4Ca91MRF tvE5yM+zYxKKjUFYFjC6N08TMQYFColhNOdbuECfTnvqY1H8ssIC+g9csrdq2GwduJ0S X9Jg== X-Gm-Message-State: AO0yUKUQ0a/l0BFEHsHETXEArANUxpiFaKgly5AMskQnmDT9J06IpKXZ XPEsDS6OeAeRNMDHiUH5TOciZw== X-Google-Smtp-Source: AK7set9iOf1TU7OPnBW3Y7ncZCnB6jJm/7wp7vTksHtOW5/VHNN8H1bXk30DRhHdt2LY/yMGTKN1NA== X-Received: by 2002:a05:6a21:9998:b0:cc:d514:62ce with SMTP id ve24-20020a056a21999800b000ccd51462cemr1772246pzb.44.1677832899628; Fri, 03 Mar 2023 00:41:39 -0800 (PST) Subject: [PULL 15/59] target/riscv: Fix relationship between V, Zve*, F and D Date: Fri, 3 Mar 2023 00:36:56 -0800 Message-Id: <20230303083740.12817-16-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833179500100007 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Add dependence chain: * V =3D> Zve64d =3D> Zve64f =3D> Zve32f =3D> F * V =3D> Zve64d =3D> D Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-6-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index dcd85f7f27..49912c9174 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -743,12 +743,27 @@ static void riscv_cpu_validate_set_extensions(RISCVCP= U *cpu, Error **errp) return; } =20 - if (cpu->cfg.ext_v && !cpu->cfg.ext_d) { - error_setg(errp, "V extension requires D extension"); + /* The V vector extension depends on the Zve64d extension */ + if (cpu->cfg.ext_v) { + cpu->cfg.ext_zve64d =3D true; + } + + /* The Zve64d extension depends on the Zve64f extension */ + if (cpu->cfg.ext_zve64d) { + cpu->cfg.ext_zve64f =3D true; + } + + /* The Zve64f extension depends on the Zve32f extension */ + if (cpu->cfg.ext_zve64f) { + cpu->cfg.ext_zve32f =3D true; + } + + if (cpu->cfg.ext_zve64d && !cpu->cfg.ext_d) { + error_setg(errp, "Zve64d/V extensions require D extension"); return; } =20 - if ((cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) && !cpu->cfg.ext_f) { + if (cpu->cfg.ext_zve32f && !cpu->cfg.ext_f) { error_setg(errp, "Zve32f/Zve64f extensions require F extension"); return; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677832953; cv=none; d=zohomail.com; s=zohoarc; b=lJOOcvJ09hP9Vp+EPXPQvIjzq3MJRLLaOQ9A1GFcYqtfjGdiIzp/K0ubQUMsqGQij8j61i9yl4694yV0KhI+P6zl9Tpoapl9E1SOqpgP02+Is3GJOc1DM0hXSfxG1yehWONlIhb1WUuaiNswrPHmLYHXZ6B0e7jgl7ZTZjJLkRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677832953; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lW3Uf0KlHT8vG+lzu2lShmAurqfdQqKUZLaTQ/2d9nc=; b=PNjZ1sc8cYiLil+QzzPxoBqCFETyUi+IyBT6HjTQe9Tb3YDgd6VoiT9uOnZWdEm33masm+jw/C7QqkQ2QY+GBSSn3UgUdP2iBBaf0fePN9XoyX2W6rFgZDUVve7L5RCTbOR4DBmq/jVTdDwUwut/5KBZhQo9mwubzg9K2oCyx9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16778329533030.998877068970387; Fri, 3 Mar 2023 00:42:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z5-0007pp-T7; Fri, 03 Mar 2023 03:41:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z2-0007h7-3U for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:44 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z0-0007t6-Dw for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:43 -0500 Received: by mail-pj1-x1033.google.com with SMTP id y2so1790594pjg.3 for ; Fri, 03 Mar 2023 00:41:42 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id lx3-20020a17090b4b0300b00233bc4edb77sm2900050pjb.25.2023.03.03.00.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832901; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=lW3Uf0KlHT8vG+lzu2lShmAurqfdQqKUZLaTQ/2d9nc=; b=tKFzg2u9hnOFYeRVb5TEFWMcTV13Tzvhf5Q7SFQWrx/temYulKmUp2v1Cmy7UPCPyI uboCi/yGe0o9BAR531AiIy++IsVWCX2E6PRH01M6MDX4hm3/mrKqFuj2OjWrHpB9AyyS lRlbRax6nkPMHr4bjjoIVE43Gb0X4Htk3YCiHLSRTLxDbWhe/ZmokYy8jzFELkPsE5Wi 2+fl1rP0OJGR0NAWyqygp5h1/YMNUjDNgPNyF/M3IoDxUaAgSNhWpnN9T0PDRXnu/Hk2 NErpoyA/zS0sj2es0NTeMnG5rvOWF63U2gGqnPBf04pJtJoBESrUbVJxs0p+Ly6uaMtB ZaIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832901; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lW3Uf0KlHT8vG+lzu2lShmAurqfdQqKUZLaTQ/2d9nc=; b=G14Yaxwpj9svfklf23sxBg72p9vVlbxUhfjm1BomevSCFr02Vx2tT0nUPWJwyyrpDd TId+JFZoyHRJmpPzJFy+Pd9yyXa5Ng/FSkFZC2REV3KhjfUjoH8GxsbmYf9csKgNOfvA /jNBu20zglX3VCl104q/c2zaX+T7l3wEN6duydEWkooiOON4GxhA97RHF5m8lZMWzthN 9GqKJsFqr+ZzEDZhdTs+7i89xNyYHd6GdH9SC2rR8U2TZG5IwQES4ifLlMvxTi6H0aEU sPFOZ+m0g1S+ANFtPzBneuoGl6aiwtq3QpqJ6dNzaZ+83HE++phVycyg8/fPmDMADxiR k/iA== X-Gm-Message-State: AO0yUKXzBKdnTL5OMlReqfh0eSEuEe4+sUJ4P7AvnJXUqW9kORapED3n pCOmG6nXeeOvgI5VXZMzDmlP1Q== X-Google-Smtp-Source: AK7set+a3CrsgLLcn7wJGxEvJcTB0nN+aUK9fz+myqVSMo5x5yTrkmr+ez0jcx7d8A7ia++Fm3pHdw== X-Received: by 2002:a17:90b:4c43:b0:233:c40d:9a37 with SMTP id np3-20020a17090b4c4300b00233c40d9a37mr934004pjb.10.1677832900844; Fri, 03 Mar 2023 00:41:40 -0800 (PST) Subject: [PULL 16/59] target/riscv: Add property check for Zvfh{min} extensions Date: Fri, 3 Mar 2023 00:36:57 -0800 Message-Id: <20230303083740.12817-17-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677832954284100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Add check for Zvfh and Zvfhmin. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-7-liweiwei@iscas.ac.cn> [Palmer: commit text] Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 49912c9174..49ac368662 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -768,6 +768,20 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU= *cpu, Error **errp) return; } =20 + if (cpu->cfg.ext_zvfh) { + cpu->cfg.ext_zvfhmin =3D true; + } + + if (cpu->cfg.ext_zvfhmin && !cpu->cfg.ext_zve32f) { + error_setg(errp, "Zvfh/Zvfhmin extensions require Zve32f extension= "); + return; + } + + if (cpu->cfg.ext_zvfh && !cpu->cfg.ext_zfhmin) { + error_setg(errp, "Zvfh extensions requires Zfhmin extension"); + return; + } + /* Set the ISA extensions, checks should have happened above */ if (cpu->cfg.ext_zhinx) { cpu->cfg.ext_zhinxmin =3D true; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677832942; cv=none; d=zohomail.com; s=zohoarc; b=TuUM3j6Ypt38kQR62mqvN5Hih7ZOVuOA7ue7sK79NarizjLSvWvLUiCJee6Y6q2lGmZUhHTyOQb105Pt9dMIQmskk2yrmyBHJPD69gTVDdVWIwpF5XsoAFfZK42rFeIB1JufcrxQpC8U3bblWAqUulGqfYoe1e2CHuiigIDp/zI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677832942; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AS9hiZl0QHmELtD5efmoWyb9Kuen5W+Uc8UohPs5jS8=; b=FtkESUThdW2r/tB+cgLfvpgvhrNqWup8YpW9inMjs8vRiu9zpwyvxUTlfxRuqBBVmcqYFra7GS4bjhHR5TzzceVdThEdRYgO3ekRp3eOR9x+hcuHzsHk7ozSRqdI4JhI7ED7yb57gKJPPECiDTYGpwvKALd1j9ZuYbcJkRWXKd4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677832942986471.6015719759265; Fri, 3 Mar 2023 00:42:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z9-00080k-QZ; Fri, 03 Mar 2023 03:41:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z3-0007nm-CO for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:45 -0500 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z1-0007tj-DG for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:45 -0500 Received: by mail-pf1-x42c.google.com with SMTP id bd34so1091769pfb.3 for ; Fri, 03 Mar 2023 00:41:42 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id f6-20020aa782c6000000b005d6dff9bbecsm1036415pfn.62.2023.03.03.00.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832902; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=AS9hiZl0QHmELtD5efmoWyb9Kuen5W+Uc8UohPs5jS8=; b=GF0VGGHrbOAFtMFLpLS3sPoBSIth7DzMVNbrkFkq4UN6HdCg5vlnwzl0hPmk6nNaiI sEgLzKpKeYJ87/HGYkOznUtKvhiwK0hsHyZVHqjAzw4YJBJHJ7wTZdLrEpA0yqtFWcJm todytLF8Tg3aHdte8fgiKz5ToaWEn7E/hREHLIJWWaYJltrRiMmcamva+Nz0Hb1v9dyU no4R488lqLKuG7wCqj4T/u/kzCJhpVjCfHDh1N7x7+kXyrIdCxy6vc4oCz+OvvrcJGKg JcRKA6H7e2PnTDJqUo+OudhpdO3rwQSJE+/qTqrAmAACJLx6OMai7F+gWBd6uRlQ7mRO HwXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832902; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AS9hiZl0QHmELtD5efmoWyb9Kuen5W+Uc8UohPs5jS8=; b=CEGMk5e0IIr2COo0BdeNIhGCHXUTdRG0dicsSUA/ibDsXB1jXVVKxerRy7AH0U8w7+ Kf10SakArhOVh5FUbL+VNBD0iwzk210sZV8YF8cCOR8PXJyS2iviWy6WLUQgw8wQal9y azx/3mBgscMR28/wSZI/yjd+XDqBrSplThJwSdsyXU0TW6B7oil1Bz4TQJR9akecQm4N HFm1bqW6zfatQCySI7zZ0DEzAYIm7lcUYzGaBYCTYAFz/BHVB/FAAtXFDB3PIBa5s/ER Xcy1Tp8VRsJfi/KA0XUbrQFBpjTiptQWZhDM0bHkLTath2GGjj/VYFtcqvKLNh16FqlC CAAw== X-Gm-Message-State: AO0yUKW12on4LyY5q/QuhOQiEKtgMxrVQC+MbTDWc526O01HLJnmHbzD JdCR4NSUnqPuLHzOqNMzY18CWw== X-Google-Smtp-Source: AK7set+GF8ylGbOcPgnGkkHo3QO5dUA4Xnu6zzcp6QZaS9evXMYyK+MdJviZ5GVxj9/NswQFP7CDrQ== X-Received: by 2002:aa7:948e:0:b0:5a8:b911:a264 with SMTP id z14-20020aa7948e000000b005a8b911a264mr1281302pfk.28.1677832902043; Fri, 03 Mar 2023 00:41:42 -0800 (PST) Subject: [PULL 17/59] target/riscv: Indent fixes in cpu.c Date: Fri, 3 Mar 2023 00:36:58 -0800 Message-Id: <20230303083740.12817-18-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=palmer@rivosinc.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677832944444100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Fix indent problems in vector related check. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-8-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 49ac368662..9b8747ab15 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -798,7 +798,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU = *cpu, Error **errp) } if (cpu->cfg.ext_f) { error_setg(errp, - "Zfinx cannot be supported together with F extension"); + "Zfinx cannot be supported together with F extensio= n"); return; } } @@ -861,40 +861,40 @@ static void riscv_cpu_validate_set_extensions(RISCVCP= U *cpu, Error **errp) ext |=3D RVV; if (!is_power_of_2(cpu->cfg.vlen)) { error_setg(errp, - "Vector extension VLEN must be power of 2"); + "Vector extension VLEN must be power of 2"); return; } if (cpu->cfg.vlen > RV_VLEN_MAX || cpu->cfg.vlen < 128) { error_setg(errp, - "Vector extension implementation only supports VLEN " - "in the range [128, %d]", RV_VLEN_MAX); + "Vector extension implementation only supports VLEN= " + "in the range [128, %d]", RV_VLEN_MAX); return; } if (!is_power_of_2(cpu->cfg.elen)) { error_setg(errp, - "Vector extension ELEN must be power of 2"); + "Vector extension ELEN must be power of 2"); return; } - if (cpu->cfg.elen > 64 || cpu->cfg.elen < 8) { - error_setg(errp, - "Vector extension implementation only supports ELEN " - "in the range [8, 64]"); - return; - } - if (cpu->cfg.vext_spec) { - if (!g_strcmp0(cpu->cfg.vext_spec, "v1.0")) { - vext_version =3D VEXT_VERSION_1_00_0; - } else { + if (cpu->cfg.elen > 64 || cpu->cfg.elen < 8) { error_setg(errp, - "Unsupported vector spec version '%s'", - cpu->cfg.vext_spec); + "Vector extension implementation only supports ELEN= " + "in the range [8, 64]"); return; } - } else { - qemu_log("vector version is not specified, " - "use the default value v1.0\n"); - } - set_vext_version(env, vext_version); + if (cpu->cfg.vext_spec) { + if (!g_strcmp0(cpu->cfg.vext_spec, "v1.0")) { + vext_version =3D VEXT_VERSION_1_00_0; + } else { + error_setg(errp, + "Unsupported vector spec version '%s'", + cpu->cfg.vext_spec); + return; + } + } else { + qemu_log("vector version is not specified, " + "use the default value v1.0\n"); + } + set_vext_version(env, vext_version); } if (cpu->cfg.ext_j) { ext |=3D RVJ; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677832964; cv=none; d=zohomail.com; s=zohoarc; b=bLSyquZ3Af9WYWGn8au2j3pXIMNTBIc22lwQ80WBr56oA0oGN2516HqB8uHcVe6gzBwAWjT5Me26ko8aNdwlU9NyCMC0aoXSb68NYx7REiAHvvE6hnG8tXxTIDjYF5eZmK90OC2aI8s0J0d0qD3caOEM9pbjXyl2lRKlw9VVBJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677832964; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=udjSUvUDm4pjtAf1qYFNISrlvK5Da5pynRSkd3iyEqA=; b=kFoEeRhxY8/JPc9OnIj9+1J5enCHYjr+jKAduHWk3R0yXKYLVc7yZBgnKw/jxvj3w7PnoCiQsA10gc8bK0tpTxgVRLcXLszu8/JnfJnT0Ts/NEwicZQFwUb1Buvs0Tx6tBVDkzFRs0fPerH+SdGxELdm9dHkNj17Aeg/BlBFt+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677832964627892.9150066421452; Fri, 3 Mar 2023 00:42:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zB-00083h-Ql; Fri, 03 Mar 2023 03:41:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z4-0007ol-G1 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:46 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z2-0007uA-PE for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:46 -0500 Received: by mail-pl1-x62d.google.com with SMTP id a9so1945392plh.11 for ; Fri, 03 Mar 2023 00:41:44 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id p24-20020a63c158000000b004e8f7f23c4bsm966866pgi.76.2023.03.03.00.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832903; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=udjSUvUDm4pjtAf1qYFNISrlvK5Da5pynRSkd3iyEqA=; b=pB2DrIy99M/uZGUJRxhuuzPyTLGjKsGS/k2szid8CSjFlmakAHwvRhrqK92TLvumxu HPmaYIjgGe947mx5Ex6cr36bZ0gn1sabN6dHps8BCdWlC75Qjzg24eCVL6zK/g2EzMkz jqJbOvLhZaXkRpsDNe/oOk/brYfOtBTQNX3KwAtnBUEG8DBx0SxNZH87xW2QF0bNYS5t kFAuK15coLEiWdBmUBraumSKW7BgUihmn+0r250STXcvO5bQE39hOnWHvp2swyqShtkY 1FM/mMQEcQ5DgjX6+0ZTPupVnKKEssj+XHzjyZdRnNhzPJJe4ucKlSy+p5MHPrvPmZ0s sl2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832903; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=udjSUvUDm4pjtAf1qYFNISrlvK5Da5pynRSkd3iyEqA=; b=RP42+jjoUdnqc0aTB6Nszo7S8aXRcmh+cOt3O536dM2GVilOCpBockSNi5t5RdnyiM avme9CBDTdAIPSKz1I0l6EmOEF/M9xf7g8ZjgmnIIT55kj3zFZGBhzSzzecuY9ZTNA74 rD8LPKEzqdpbR4/uAVLrQPS7dxJo7iIoAobY0k/COzCMhwVnSmVNVPm6+/2VV1v+beBO ewh/Kbm2kAuHUtWVjyoBdkEX9u7otp0WTkp+7ikYVzvhNE5aRPcZPmvDaaMdALtqMu30 RTMigCNVHSxmEKBrrZXQNLqq/J8dOw6E28uA2RyPUy2Mn7Tk1yH4lnyqO2tyQrvobfYR Hz8g== X-Gm-Message-State: AO0yUKXigL0To1Cswj8sPBfySLEObs6X6HrX1dTEavCPNzzQmscvpujx DDRDXCexmeAXsY3ZgL/RAf0vog== X-Google-Smtp-Source: AK7set8dvZe968iOXMeDwPWMEBVvmAMX4eYUA4ow/1ILc5MVlBZMEd1xmxka8l/KiKunZYSXSr4UCw== X-Received: by 2002:a05:6a20:a00e:b0:cc:9643:1f8f with SMTP id p14-20020a056a20a00e00b000cc96431f8fmr1447953pzj.13.1677832903449; Fri, 03 Mar 2023 00:41:43 -0800 (PST) Subject: [PULL 18/59] target/riscv: Simplify check for Zve32f and Zve64f Date: Fri, 3 Mar 2023 00:36:59 -0800 Message-Id: <20230303083740.12817-19-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677832966698100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li V/Zve64f depend on Zve32f, so we can only check Zve32f in these cases. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-9-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 3 +-- target/riscv/insn_trans/trans_rvv.c.inc | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 3a9472a2ff..a24a9fdeb9 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -51,7 +51,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulon= g *pc, *pc =3D env->xl =3D=3D MXL_RV32 ? env->pc & UINT32_MAX : env->pc; *cs_base =3D 0; =20 - if (riscv_has_ext(env, RVV) || cpu->cfg.ext_zve32f || cpu->cfg.ext_zve= 64f) { + if (cpu->cfg.ext_zve32f) { /* * If env->vl equals to VLMAX, we can use generic vector operation * expanders (GVEC) to accerlate the vector operations. diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 1b0a0c1693..5b757c8b82 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -93,8 +93,7 @@ static RISCVException vs(CPURISCVState *env, int csrno) CPUState *cs =3D env_cpu(env); RISCVCPU *cpu =3D RISCV_CPU(cs); =20 - if (env->misa_ext & RVV || - cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) { + if (cpu->cfg.ext_zve32f) { #if !defined(CONFIG_USER_ONLY) if (!env->debugger && !riscv_cpu_vector_enabled(env)) { return RISCV_EXCP_ILLEGAL_INST; diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index bbb5c3a7b5..6f7ecf1a68 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -173,9 +173,7 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1,= TCGv s2) { TCGv s1, dst; =20 - if (!require_rvv(s) || - !(has_ext(s, RVV) || s->cfg_ptr->ext_zve32f || - s->cfg_ptr->ext_zve64f)) { + if (!require_rvv(s) || !s->cfg_ptr->ext_zve32f) { return false; } =20 @@ -210,9 +208,7 @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s= 1, TCGv s2) { TCGv dst; =20 - if (!require_rvv(s) || - !(has_ext(s, RVV) || s->cfg_ptr->ext_zve32f || - s->cfg_ptr->ext_zve64f)) { + if (!require_rvv(s) || !s->cfg_ptr->ext_zve32f) { return false; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833465; cv=none; d=zohomail.com; s=zohoarc; b=k3BjbwgNaZnKfokSyXMTeaPFaBdM3NNOZF+rs4I3SXKDTU925wvKEEfQ/wUYmQzfD0W5Lnht/PF0pzQuceYsDXaRk8/C+JqKUgB4sQ39YIDXahMXS9Cj9mXISGiMMD9mZfPWfyOvdqmUkNij9GixRyCIkY0PevVNH4C57MMjNe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833465; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BSMNIIiNbY/Z/kSdE82Qh/Y2QcKhNFcRwfism8ERmoA=; b=NvRAf5GS9tyVq4s2ml6U91ETs2M8XcTM9YePS7wVmnN4Rl3NWvkWN8CM4S/rnsRcGKOY7V4qJ1TIFZ5AY/ekRpYMLK3XMRGO6hInOw4soAh945HHuQyve0hRL9d9WlNPAgXLpcFhANfa9eTxvPyhg1DnUXuAgc9U+9stx5fOhAM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833465746580.9869536689596; Fri, 3 Mar 2023 00:51:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0z7-0007vb-IG; Fri, 03 Mar 2023 03:41:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z5-0007p8-5h for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:47 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z3-0007tE-Kx for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:46 -0500 Received: by mail-pl1-x636.google.com with SMTP id a9so1945427plh.11 for ; Fri, 03 Mar 2023 00:41:45 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id ki13-20020a170903068d00b00194d2f14ef0sm986967plb.23.2023.03.03.00.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832905; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=BSMNIIiNbY/Z/kSdE82Qh/Y2QcKhNFcRwfism8ERmoA=; b=l5nzdD6vzGINnZHAEecWZKTLbj6S3oc0cOn0/pH7ZduMliM1NZFRxqc1Ox4ice/saT l9QQcMyyTfkWOxiw/2dTJKB5rlH9cbLhtj0yELyZkuf55TVCbtwi+lwE26K8jpNEX9aq w+jqP60nQo0MO9VzwBOyc0hYncOghA/PrOCifb4T50SDTh29UkseBPvmz0hLWJRneAm1 BARExRwfxIlOv4vkz/GLeNI6oFRYCjKZnvqhfHdIIDFSZ5tbtD6oF2fUVKPt9zR2amAL oACbaYOgvBU9BS72QD+/zHf+CsHFY7TtBYb89lHTZYalvjlaDVo+PZOI6BJMjDWxdfl+ EDPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832905; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BSMNIIiNbY/Z/kSdE82Qh/Y2QcKhNFcRwfism8ERmoA=; b=FVum3ZPfXlDGLmc5WHMXgmT9JNhxpeOvDHHYncYVPD/16kD22LGtA7KIN/5Bdvsa4p 23aQm9P3oKCx2u7wrvx9Ykd8I6skRWozjyrrQ1NRsHJtTdB5+97yD51Vx0EQ8+JXOvfA NNgNPTpWMZw54ONMj1JXnmCpM4pPdJ0Xtn3us6pEAyl7761n3E73THKEgvhEl/G0hAUK PeiCnLunu60FdRbA8Ao9BhrEbRU0NDXVGm/cksyPWIRGcoAGG/V67QuYETJqxVaMxMwz rzoAEm0yBuqty01UvHnnT3RcFqGhS7o5fEs8dsg3sl1fLDA9cpx8Q6rOCWQzSw8N14Tf schg== X-Gm-Message-State: AO0yUKUTPsyo6RHHImnMFm7tm5k3BP6rl3n3QqroUiXErv/wyd7oCBge F+q/O/IrLn8DWhQ5FZo04cUPxw== X-Google-Smtp-Source: AK7set84TK5aA5cfW8upcqn3WtXG4rSm6qDZYTiTdf6Eu4XNX2d1sJ7CPa5n6fVbUlQoZx2mSaHPgQ== X-Received: by 2002:a17:902:d492:b0:19c:b7da:fbdf with SMTP id c18-20020a170902d49200b0019cb7dafbdfmr1530397plg.26.1677832904739; Fri, 03 Mar 2023 00:41:44 -0800 (PST) Subject: [PULL 19/59] target/riscv: Replace check for F/D to Zve32f/Zve64d in trans_rvv.c.inc Date: Fri, 3 Mar 2023 00:37:00 -0800 Message-Id: <20230303083740.12817-20-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833466968100005 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Check for Zve32f/Zve64d can overlap check for F/D. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-10-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_rvv.c.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 6f7ecf1a68..9b2711b94b 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -41,9 +41,9 @@ static bool require_rvf(DisasContext *s) switch (s->sew) { case MO_16: case MO_32: - return has_ext(s, RVF); + return s->cfg_ptr->ext_zve32f; case MO_64: - return has_ext(s, RVD); + return s->cfg_ptr->ext_zve64d; default: return false; } @@ -58,9 +58,9 @@ static bool require_scale_rvf(DisasContext *s) switch (s->sew) { case MO_8: case MO_16: - return has_ext(s, RVF); + return s->cfg_ptr->ext_zve32f; case MO_32: - return has_ext(s, RVD); + return s->cfg_ptr->ext_zve64d; default: return false; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833058; cv=none; d=zohomail.com; s=zohoarc; b=lkCFOtUVSEXKkiqG8+H7SM7amyQUJU9n1gb9JeufXebdaSQpjrKvYPAOYo/NORz9cRvcph3PR0IyFtAk0c2xA1FULBIynQ04OT7zbQKocY3iqo2qdm0o8QaWe9EaFzYtigNyHdbUn3Wj0R/v7E01umo4bxrFeaSF55Nnmu4TDuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833058; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KdFCJsN+s5zjRcT/dEPni1wa/6tfViaP6/n8KeEaxj8=; b=WhUfq0d1u3u7h6qC2RvBt1MYjBIftZZEnD2DM9DG1sXB4OKdmubK8Z6s2C711q+OcfpkeAva26kO/8CHqgafrYtD6OPhY/L8t6Gn/ZsZ2UYPhmacbayFBmrkRJYwnOSAmKlz17EH6K/nIxvv5xHPYufc1v2cSyX7RQnbpEizdg4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833058544779.7322714367648; Fri, 3 Mar 2023 00:44:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zC-00084E-O7; Fri, 03 Mar 2023 03:41:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z6-0007t7-Oe for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:48 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z4-0007qA-OQ for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:48 -0500 Received: by mail-pl1-x62e.google.com with SMTP id u5so1973302plq.7 for ; Fri, 03 Mar 2023 00:41:46 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id lc14-20020a170902fa8e00b0019aca830869sm967906plb.238.2023.03.03.00.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832906; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=KdFCJsN+s5zjRcT/dEPni1wa/6tfViaP6/n8KeEaxj8=; b=5C922TWYXQHorRO+YWNw8nwr3Rt5nZD8a1iJV1VetrbWr52kRsCnu5tlp59pTu+IG7 uw7fcHPPqOJMzHh2Vnbp2sHsDAXwdfxDDQXLBQcLGtjAkONIkpe/mFcpp2yg0UGlcK9s u6/0Twhv4P+TyVdlSKwYUpQx+vas7PvuDdVxvWSVKRadsMQHYYakCzFwLdQfm1ETjhyo k0v94BmpfSqFiUe3u0ndV/7CwFF68nsiipDwO5010vaXpkWMIj3NTJtqO6Ff2H6k+QGu XAkXngahzS7rAO7nB2E9BxeKxdQFJWn/N+06Rzs2lrqDIC9EOw/OH5LsZyZpz5d1+1zA Bn1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832906; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KdFCJsN+s5zjRcT/dEPni1wa/6tfViaP6/n8KeEaxj8=; b=s9UiauN4b6ctwhDnj+Uzqn72joGdD6uPebs/AzzSKPKgN8EsfOrF/9ZL929HCnv2tL MyR2CWwkPh/SCRgYw69t2Y/IXy00uIP2N1fX4luAwwHUfQQPSylqcpL5X0EDp0R09kbh AXb9GR6lMmTOK1DOKHOYvR+kyw/hbmqGrHANzJn0wlgdjXHC/2Bls9LIWLKhM47J6Nef QOjeHdEO22JVFuXALbnGG0Ehml2r0ejkTZ52mmcxxeUppdCg0Kmiy8x3mMPcOkUN6dg9 SXmpWWcR96hHE0xppNrsHKRr0Dc6gPESw8TwrnTSch3Y8WhNtXDI30NbcnI9OAiZU2Lk 79pQ== X-Gm-Message-State: AO0yUKV+AMLITSN7T3lWd7zrAObFDcZPBBZjMNG8WIS1xwpJD5EdEDlJ eUCa0aFsux8ITteOeNY4azs2KQ== X-Google-Smtp-Source: AK7set9X1qlfIfAJQdX0eYTur1VEDqACYgF3u74r8EfCGJ4xFW/PH0Sg7MPz/hoQRnjXVgNLO+uxOw== X-Received: by 2002:a17:902:e546:b0:19a:7a02:7954 with SMTP id n6-20020a170902e54600b0019a7a027954mr1548724plf.24.1677832905988; Fri, 03 Mar 2023 00:41:45 -0800 (PST) Subject: [PULL 20/59] target/riscv: Remove redundunt check for zve32f and zve64f Date: Fri, 3 Mar 2023 00:37:01 -0800 Message-Id: <20230303083740.12817-21-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833059050100005 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Require_zve32/64f have been overlapped by require_rvf/require_scale_rvf. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-11-liweiwei@iscas.ac.cn> [Palmer: commit text] Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_rvv.c.inc | 128 ++++-------------------- 1 file changed, 21 insertions(+), 107 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 9b2711b94b..9053759546 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -66,50 +66,6 @@ static bool require_scale_rvf(DisasContext *s) } } =20 -static bool require_zve32f(DisasContext *s) -{ - /* RVV + Zve32f =3D RVV. */ - if (has_ext(s, RVV)) { - return true; - } - - /* Zve32f doesn't support FP64. (Section 18.2) */ - return s->cfg_ptr->ext_zve32f ? s->sew <=3D MO_32 : true; -} - -static bool require_scale_zve32f(DisasContext *s) -{ - /* RVV + Zve32f =3D RVV. */ - if (has_ext(s, RVV)) { - return true; - } - - /* Zve32f doesn't support FP64. (Section 18.2) */ - return s->cfg_ptr->ext_zve64f ? s->sew <=3D MO_16 : true; -} - -static bool require_zve64f(DisasContext *s) -{ - /* RVV + Zve64f =3D RVV. */ - if (has_ext(s, RVV)) { - return true; - } - - /* Zve64f doesn't support FP64. (Section 18.2) */ - return s->cfg_ptr->ext_zve64f ? s->sew <=3D MO_32 : true; -} - -static bool require_scale_zve64f(DisasContext *s) -{ - /* RVV + Zve64f =3D RVV. */ - if (has_ext(s, RVV)) { - return true; - } - - /* Zve64f doesn't support FP64. (Section 18.2) */ - return s->cfg_ptr->ext_zve64f ? s->sew <=3D MO_16 : true; -} - /* Destination vector register group cannot overlap source mask register. = */ static bool require_vm(int vm, int vd) { @@ -2331,9 +2287,7 @@ static bool opfvv_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm) && - require_zve32f(s) && - require_zve64f(s); + vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm); } =20 /* OPFVV without GVEC IR */ @@ -2421,9 +2375,7 @@ static bool opfvf_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_ss(s, a->rd, a->rs2, a->vm) && - require_zve32f(s) && - require_zve64f(s); + vext_check_ss(s, a->rd, a->rs2, a->vm); } =20 /* OPFVF without GVEC IR */ @@ -2461,9 +2413,7 @@ static bool opfvv_widen_check(DisasContext *s, arg_rm= rr *a) require_scale_rvf(s) && (s->sew !=3D MO_8) && vext_check_isa_ill(s) && - vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm); } =20 /* OPFVV with WIDEN */ @@ -2506,9 +2456,7 @@ static bool opfvf_widen_check(DisasContext *s, arg_rm= rr *a) require_scale_rvf(s) && (s->sew !=3D MO_8) && vext_check_isa_ill(s) && - vext_check_ds(s, a->rd, a->rs2, a->vm) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + vext_check_ds(s, a->rd, a->rs2, a->vm); } =20 /* OPFVF with WIDEN */ @@ -2540,9 +2488,7 @@ static bool opfwv_widen_check(DisasContext *s, arg_rm= rr *a) require_scale_rvf(s) && (s->sew !=3D MO_8) && vext_check_isa_ill(s) && - vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm); } =20 /* WIDEN OPFVV with WIDEN */ @@ -2585,9 +2531,7 @@ static bool opfwf_widen_check(DisasContext *s, arg_rm= rr *a) require_scale_rvf(s) && (s->sew !=3D MO_8) && vext_check_isa_ill(s) && - vext_check_dd(s, a->rd, a->rs2, a->vm) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + vext_check_dd(s, a->rd, a->rs2, a->vm); } =20 /* WIDEN OPFVF with WIDEN */ @@ -2664,9 +2608,7 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) require_rvf(s) && vext_check_isa_ill(s) && /* OPFV instructions ignore vs1 check */ - vext_check_ss(s, a->rd, a->rs2, a->vm) && - require_zve32f(s) && - require_zve64f(s); + vext_check_ss(s, a->rd, a->rs2, a->vm); } =20 static bool do_opfv(DisasContext *s, arg_rmr *a, @@ -2731,9 +2673,7 @@ static bool opfvv_cmp_check(DisasContext *s, arg_rmrr= *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_mss(s, a->rd, a->rs1, a->rs2) && - require_zve32f(s) && - require_zve64f(s); + vext_check_mss(s, a->rd, a->rs1, a->rs2); } =20 GEN_OPFVV_TRANS(vmfeq_vv, opfvv_cmp_check) @@ -2746,9 +2686,7 @@ static bool opfvf_cmp_check(DisasContext *s, arg_rmrr= *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_ms(s, a->rd, a->rs2) && - require_zve32f(s) && - require_zve64f(s); + vext_check_ms(s, a->rd, a->rs2); } =20 GEN_OPFVF_TRANS(vmfeq_vf, opfvf_cmp_check) @@ -2769,9 +2707,7 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_= v_f *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - require_align(a->rd, s->lmul) && - require_zve32f(s) && - require_zve64f(s)) { + require_align(a->rd, s->lmul)) { gen_set_rm(s, RISCV_FRM_DYN); =20 TCGv_i64 t1; @@ -2856,18 +2792,14 @@ static bool opfv_widen_check(DisasContext *s, arg_r= mr *a) static bool opxfv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && - require_rvf(s) && - require_zve32f(s) && - require_zve64f(s); + require_rvf(s); } =20 static bool opffv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && require_scale_rvf(s) && - (s->sew !=3D MO_8) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + (s->sew !=3D MO_8); } =20 #define GEN_OPFV_WIDEN_TRANS(NAME, CHECK, HELPER, FRM) \ @@ -2918,9 +2850,7 @@ static bool opfxv_widen_check(DisasContext *s, arg_rm= r *a) require_scale_rvf(s) && vext_check_isa_ill(s) && /* OPFV widening instructions ignore vs1 check */ - vext_check_ds(s, a->rd, a->rs2, a->vm) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + vext_check_ds(s, a->rd, a->rs2, a->vm); } =20 #define GEN_OPFXV_WIDEN_TRANS(NAME) \ @@ -2975,18 +2905,14 @@ static bool opfxv_narrow_check(DisasContext *s, arg= _rmr *a) { return opfv_narrow_check(s, a) && require_rvf(s) && - (s->sew !=3D MO_64) && - require_zve32f(s) && - require_zve64f(s); + (s->sew !=3D MO_64); } =20 static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) { return opfv_narrow_check(s, a) && require_scale_rvf(s) && - (s->sew !=3D MO_8) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + (s->sew !=3D MO_8); } =20 #define GEN_OPFV_NARROW_TRANS(NAME, CHECK, HELPER, FRM) \ @@ -3035,9 +2961,7 @@ static bool opxfv_narrow_check(DisasContext *s, arg_r= mr *a) require_scale_rvf(s) && vext_check_isa_ill(s) && /* OPFV narrowing instructions ignore vs1 check */ - vext_check_sd(s, a->rd, a->rs2, a->vm) && - require_scale_zve32f(s) && - require_scale_zve64f(s); + vext_check_sd(s, a->rd, a->rs2, a->vm); } =20 #define GEN_OPXFV_NARROW_TRANS(NAME, HELPER, FRM) \ @@ -3111,9 +3035,7 @@ GEN_OPIVV_WIDEN_TRANS(vwredsumu_vs, reduction_widen_c= heck) static bool freduction_check(DisasContext *s, arg_rmrr *a) { return reduction_check(s, a) && - require_rvf(s) && - require_zve32f(s) && - require_zve64f(s); + require_rvf(s); } =20 GEN_OPFVV_TRANS(vfredusum_vs, freduction_check) @@ -3540,9 +3462,7 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_= f_s *a) { if (require_rvv(s) && require_rvf(s) && - vext_check_isa_ill(s) && - require_zve32f(s) && - require_zve64f(s)) { + vext_check_isa_ill(s)) { gen_set_rm(s, RISCV_FRM_DYN); =20 unsigned int ofs =3D (8 << s->sew); @@ -3568,9 +3488,7 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_= s_f *a) { if (require_rvv(s) && require_rvf(s) && - vext_check_isa_ill(s) && - require_zve32f(s) && - require_zve64f(s)) { + vext_check_isa_ill(s)) { gen_set_rm(s, RISCV_FRM_DYN); =20 /* The instructions ignore LMUL and vector register group. */ @@ -3621,17 +3539,13 @@ GEN_OPIVI_TRANS(vslidedown_vi, IMM_ZX, vslidedown_v= x, slidedown_check) static bool fslideup_check(DisasContext *s, arg_rmrr *a) { return slideup_check(s, a) && - require_rvf(s) && - require_zve32f(s) && - require_zve64f(s); + require_rvf(s); } =20 static bool fslidedown_check(DisasContext *s, arg_rmrr *a) { return slidedown_check(s, a) && - require_rvf(s) && - require_zve32f(s) && - require_zve64f(s); + require_rvf(s); } =20 GEN_OPFVF_TRANS(vfslide1up_vf, fslideup_check) --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833444; cv=none; d=zohomail.com; s=zohoarc; b=JOd2tTLKiZ1gZaN0miG9Adgo9wBcCNFh2A1EN8lz8vr0s2SjGZdoUOqRGxD0aHglKa/z0AvMVn8hQIk65MK/VAsq1FYpKpaFDyWp7ImYJ7zWkCnR9u9HcarfeV1r6HKwy82jZpSOBlqvaaTxqSDLYVIcO0Byp84LPUlRMl49ssI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833444; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1BeHJ2jhqa6PgNXmb8JHZiMAIH3RrdZhAiRe7UlrIlc=; b=DTNiyhdF/HDRKOU6ACB/rj/FNqObPtjskJrvc4+flfc2rAYWPMHRaERZl4AvlINr99vVIsd7DOHcnH5vf2UKIbs2nBgNVGuxmm/JXgTSoxZ7iqNHe0R76S//TbltJFw/5ertw00A971WGEpPfq6OmBnuiiCdsWcz55NXpteK284= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833444130388.8287257166088; Fri, 3 Mar 2023 00:50:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zE-000858-26; Fri, 03 Mar 2023 03:41:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z8-0007xu-4b for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:50 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z6-0007wS-H1 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:49 -0500 Received: by mail-pj1-x102c.google.com with SMTP id y15-20020a17090aa40f00b00237ad8ee3a0so1585409pjp.2 for ; Fri, 03 Mar 2023 00:41:48 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id c10-20020a170902aa4a00b0019e8915b1b5sm976094plr.105.2023.03.03.00.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832907; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=1BeHJ2jhqa6PgNXmb8JHZiMAIH3RrdZhAiRe7UlrIlc=; b=LEzgM+2c6NMWribnQiZQnWhYvvYpyQfLrZYvUFawmjv/rHI616hjYylC690DlTtEsZ xAXzL04YxWcyqPjKPmhMtN29QZYtn/dcgjmGaZ9r8dtR7ncYsANRqaPQklQ8vM7/xFnL JOFsMCIo2iLN8dWnFsEjOhfRJxDS+pvO+nNaFayF4FIYS2NICT8k4k6wT5Y4Al5Bak0J 23/C8m93GW3oBC9aMoDy4yXaLw2Ei7iZIQglB3F0K3fHh+0DrZNhFf4un/aga4Sc+nkO okKUouVcnU3BGX0DFK8yYoHL12eFiJtdTt7vPkE81E8YvcFNOxq+EuwTKCkEnoV3Xmvw mt5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832907; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1BeHJ2jhqa6PgNXmb8JHZiMAIH3RrdZhAiRe7UlrIlc=; b=s3ZZTTbLnXSRBGLtTGgq+G3IQTrq85RQa9qsIZ+O/hnVFc7xGB2I3+lrO76YhwQ9RY b1uovy1T8q5umUx7veApd9nIhtGqD2Ss0VXFgs4GktA3UrvXRih98cwBqzd6qkErcaWT DlMkvurDDmpqUD3wjIevHpRMSPSc/4ybplhsiaKXU/ZgjrhBnMqM0lXk6CksueVs7QU1 Ttj2ukL9XwijdfRDXmDVibNZypc78Ri6RTBndwH+jpOxzFnxKUz/3bohe4+2GpOoYy8K 4Rtvpp68rOTGI/2I0ZQxkWFpKDk16ZDndhgPQ8AGTYuhxQgo+OcFFPo1dg3hXWLw+ll3 eJCw== X-Gm-Message-State: AO0yUKU+KFiGhzIAZ7HnUhwm9A2qQJvkcXSWJ67NfpNiYLXZjFQzHUn1 BBjZviIXnVT2snAr/QcevSmD0HO747FRrVkY X-Google-Smtp-Source: AK7set8v6HNkj3e7G1j9Q0HDdRBChHZxW3FRIjhT3NJIp5WNR84S8k6D/q8v5BdvMTuvMkeMB5iqUg== X-Received: by 2002:a17:902:e842:b0:19a:b4a9:9ddb with SMTP id t2-20020a170902e84200b0019ab4a99ddbmr1482741plg.49.1677832907114; Fri, 03 Mar 2023 00:41:47 -0800 (PST) Subject: [PULL 21/59] target/riscv: Add support for Zvfh/zvfhmin extensions Date: Fri, 3 Mar 2023 00:37:02 -0800 Message-Id: <20230303083740.12817-22-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833444866100001 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Zvfh supports vector float point instructions with SEW =3D 16 and supports conversions between 8-bit integers and binary16 values. Zvfhmin supports vfwcvt.f.f.v and vfncvt.f.f.w instructions. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-12-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_rvv.c.inc | 31 +++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 9053759546..9b2c5c9ac0 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -40,6 +40,7 @@ static bool require_rvf(DisasContext *s) =20 switch (s->sew) { case MO_16: + return s->cfg_ptr->ext_zvfh; case MO_32: return s->cfg_ptr->ext_zve32f; case MO_64: @@ -57,6 +58,25 @@ static bool require_scale_rvf(DisasContext *s) =20 switch (s->sew) { case MO_8: + return s->cfg_ptr->ext_zvfh; + case MO_16: + return s->cfg_ptr->ext_zve32f; + case MO_32: + return s->cfg_ptr->ext_zve64d; + default: + return false; + } +} + +static bool require_scale_rvfmin(DisasContext *s) +{ + if (s->mstatus_fs =3D=3D 0) { + return false; + } + + switch (s->sew) { + case MO_8: + return s->cfg_ptr->ext_zvfhmin; case MO_16: return s->cfg_ptr->ext_zve32f; case MO_32: @@ -2798,7 +2818,7 @@ static bool opxfv_widen_check(DisasContext *s, arg_rm= r *a) static bool opffv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && - require_scale_rvf(s) && + require_scale_rvfmin(s) && (s->sew !=3D MO_8); } =20 @@ -2909,6 +2929,13 @@ static bool opfxv_narrow_check(DisasContext *s, arg_= rmr *a) } =20 static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) +{ + return opfv_narrow_check(s, a) && + require_scale_rvfmin(s) && + (s->sew !=3D MO_8); +} + +static bool opffv_rod_narrow_check(DisasContext *s, arg_rmr *a) { return opfv_narrow_check(s, a) && require_scale_rvf(s) && @@ -2952,7 +2979,7 @@ GEN_OPFV_NARROW_TRANS(vfncvt_f_x_w, opfxv_narrow_chec= k, vfncvt_f_x_w, GEN_OPFV_NARROW_TRANS(vfncvt_f_f_w, opffv_narrow_check, vfncvt_f_f_w, RISCV_FRM_DYN) /* Reuse the helper function from vfncvt.f.f.w */ -GEN_OPFV_NARROW_TRANS(vfncvt_rod_f_f_w, opffv_narrow_check, vfncvt_f_f_w, +GEN_OPFV_NARROW_TRANS(vfncvt_rod_f_f_w, opffv_rod_narrow_check, vfncvt_f_f= _w, RISCV_FRM_ROD) =20 static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833613; cv=none; d=zohomail.com; s=zohoarc; b=nc39H9ZsRvEQEmGvVQefhN4mymEDG8i/Rf2JFYnAtFxp/x68sC+OCUlV/pN+Gv3s7NCPOovp66kmghfiWu0TRyaSzLNtMY6kP8GbbOdIerwtQ08yKHCKznI6hdyJUyzgGZa2R/zQM+UipDzDsuD/nas51GZK2vmiUoqvGegwJj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833613; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=23+QsQv5VG4gpEQ2Er0+nLjEcRytljERqxt4Mubuags=; b=CO8fLjMTyY0nBYI4tsJymYPMbY+Ii1LkgcikYIRHQGUZ2+HxXQKj27HlEaj+VMEo7JS1ZVqAIduqdSPK4XJm36E9uVALRCfgoeQSikPV8WY5NQuU+IbeMhHSZfPK2qkHl3aZ67Zx6x/9nlQ5mFD5MwaviLsx7Hnpfpbm/3JUSiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833613760196.43473260870485; Fri, 3 Mar 2023 00:53:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zA-000836-Sj; Fri, 03 Mar 2023 03:41:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0z9-00080K-Cg for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:51 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z7-0007wn-Sg for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:51 -0500 Received: by mail-pj1-x102a.google.com with SMTP id bo22so1784953pjb.4 for ; Fri, 03 Mar 2023 00:41:49 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kj16-20020a17090306d000b0019a97f180fcsm982463plb.37.2023.03.03.00.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832908; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=23+QsQv5VG4gpEQ2Er0+nLjEcRytljERqxt4Mubuags=; b=NaHdoBQCeDIKpyy42smmupeSjMD9nj3uzxkI04k2mRsxq+ekuWKgz9y2yhppmH+6HQ geKwetk1C1kDhfoHvdYRz6C7ogkU8RkruTAsII8hp6osf5WpLov1SaCgRUzyVMMgWabQ xNTDuTneSHOPL4YO1tkEtjkJ8EqLkHAFJ+HMgeVc0b25pb3h1NG7BzN+sLDmvOXcVVI0 nUtgEsiX9Nng+UQZ4CO4B1eW4iHkXkyAQF4x3AuYadhMYkfvJGeMCVVpucuaIZEdAny/ n/oJCCk/6Dy/wOelUqsMsDLb3qMEwEcZaTlT/z4snLYC4QRoeIoTM0UUKdqgIN5e8frx C0lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832908; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=23+QsQv5VG4gpEQ2Er0+nLjEcRytljERqxt4Mubuags=; b=OELRUh6VsRweqgctyfxho/0PnsfOCHvEFL4Qcyo9GpJcBs2TFeQFgBvnaq54TWh/lK P9dOXYr86CMDtE2HL08ErXukHdwN8AzoX5QtPvIV4mC/fsTpj9/JuwsgRlSvWZXWk3CG DNj0ATtTr+2zxBzI67jWDrENoGfnLSMCf8PRre8rht6JjQ9jMVzUufexlzDSCHh14xy+ +k31Ec8yfYhD0l7T9cjAMQ2T4mLgBS4pWgSbEuoQ2tKjLfpNLa3byUsldLTdRg9dO+0L 1dTXxKUwDmS0cpUgcE6eV0eNISH0HLIy6dVtHYeOY5KbWeII17DeS4DLo4Y/GZMqKETU yjBg== X-Gm-Message-State: AO0yUKVsKP9Cp6+qDpDJepxR3GdAgqSWgL5ohCdRVH5134y5Gp4Yfn0i y8w/DvlndnnrSQJCTWrUEFPh8g== X-Google-Smtp-Source: AK7set+lnc02RtELGKYYyvLZyyFybOd7+lDAm4ufW6idrl7dpNy/Zj4QFJM7DmaPDTtAvI/Z7EUrow== X-Received: by 2002:a17:90b:4c42:b0:22c:d44:5669 with SMTP id np2-20020a17090b4c4200b0022c0d445669mr847264pjb.22.1677832908342; Fri, 03 Mar 2023 00:41:48 -0800 (PST) Subject: [PULL 22/59] target/riscv: Fix check for vector load/store instructions when EEW=64 Date: Fri, 3 Mar 2023 00:37:03 -0800 Message-Id: <20230303083740.12817-23-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833614288100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li The V extension supports all vector load and store instructions except the V extension does not support EEW=3D64 for index values when XLEN=3D32. (Section 18.3) Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-13-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_rvv.c.inc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 9b2c5c9ac0..5dbdce073b 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -287,13 +287,12 @@ static bool vext_check_st_index(DisasContext *s, int = vd, int vs2, int nf, require_nf(vd, nf, s->lmul); =20 /* - * All Zve* extensions support all vector load and store instructions, - * except Zve64* extensions do not support EEW=3D64 for index values - * when XLEN=3D32. (Section 18.2) + * V extension supports all vector load and store instructions, + * except V extension does not support EEW=3D64 for index values + * when XLEN=3D32. (Section 18.3) */ if (get_xl(s) =3D=3D MXL_RV32) { - ret &=3D (!has_ext(s, RVV) && - s->cfg_ptr->ext_zve64f ? eew !=3D MO_64 : true); + ret &=3D (eew !=3D MO_64); } =20 return ret; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833071; cv=none; d=zohomail.com; s=zohoarc; b=YAde5ci2gf9kjO+2rreBnmFt/xG+fvrYhyFPqeCKBzkbaJv47hMJWEfjm1jwWH11uxqVYCDpg3nJTr7iDcuHVNFNZAi+g97R6IfDfgNBJxCIZslqd+F8Xb3i4mMbeXNQiItnEeDQFlD288vIXXkioJy2+2+Z5tR+uJ91ds6EHOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833071; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dje010AVV2QeyT/FX8byAIDnwjz48KiaRt3orgmfVv8=; b=bveuZlQDWOjbOBBsPhA3HmD1pNTxvqQV1YCTY6O/K0iOBbbfo2R5vjisVSXTGrSLz22YxBe4VomylwP5N0xLxbNvhW5T3RB0ePjQZUOmx/MLu8opJmUKHReUFkI9SRoJRKRLuHClJKuXEysesw0dHuYeMxNcfMV+T7ESs7RDB0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833071247894.3216556522831; Fri, 3 Mar 2023 00:44:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zF-00086B-Gx; Fri, 03 Mar 2023 03:41:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zA-00082M-HB for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:52 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0z8-0007n9-Nr for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:52 -0500 Received: by mail-pj1-x1035.google.com with SMTP id l1so1811408pjt.2 for ; Fri, 03 Mar 2023 00:41:50 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id m8-20020aa79008000000b005dae7d1b61asm1022277pfo.154.2023.03.03.00.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832910; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=dje010AVV2QeyT/FX8byAIDnwjz48KiaRt3orgmfVv8=; b=AG2+x8MM7CaNbBIWYD8C0jVL5biCj8aqVwEYTfszSxWvSGn64u3+xU21AE/kV1ydKh FdBSY9LsIaF6xYmfRaQHhZBGaXrKBsxjOG1vRs+41XbfB+kztEyaN3vkSPqpnvPRYKLW FVxdAXyuFyiL6iYU7N4RwFKbktNnHe0A7IAbiZHbQ72mNC3qU7IB2Z1C50PPmy6ABDMh ON2l56DsXYvyU0OuvLiXbEvOfAEHVHSynmis5P4Y1TeoZ9fBwXy34uiUXvbb3XuxtlLU crh64Vq0+692e6Y04mbs0ZXcWSfyNlJaAJ2r/GZXXMhtlD/Pp/urlhlQmrvw7fEwhxV4 4RqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832910; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dje010AVV2QeyT/FX8byAIDnwjz48KiaRt3orgmfVv8=; b=MgNH2FfLLtArHdEga83H6e5bSIo6GpGgMMWnmminMWGqvlYLdAx0aNqsNy8uKvsQCD SWDpIJyLm7x1lXzM/uEl/eNejRUb7oqYUIcZT68W7SrVG30erjQrsTEXM9EqvgQrRN8V IMQA+0mgSoZVYXnxrc9OuNLC8lSNKBpRZXtOPsTRbGkUnaw9fur2/8vDpbt02OYvqMyI ytZVbM7EJHn3TD111BRJqmSi969lRlrpu60KJozcsNSzJNXYga1GOewyo55BTWniXvzy Jj7V7o7mGINlXerhugTyP0JPG2P8tIjERPwHaWdbbYrV/omKJCOG/GrqZF5Z3jC5X4CT vd+Q== X-Gm-Message-State: AO0yUKVdDcmc6emDRXRX8RSymkIroZKBBJW9bgOvlDabffj5EHwvsY4R 2eQeXDBUxQamaoBlwFPjoU1dvQ== X-Google-Smtp-Source: AK7set/c8y9Vn/ZPgDHxB+vMXOhGvlNK/LN/FVUs8xh9ZoC3qAzRJQNbzly5tDtbhS3KBFA5Wi2stA== X-Received: by 2002:a05:6a20:c510:b0:cc:ac05:88f7 with SMTP id gm16-20020a056a20c51000b000ccac0588f7mr1111818pzb.34.1677832909947; Fri, 03 Mar 2023 00:41:49 -0800 (PST) Subject: [PULL 23/59] target/riscv: Simplify check for EEW = 64 in trans_rvv.c.inc Date: Fri, 3 Mar 2023 00:37:04 -0800 Message-Id: <20230303083740.12817-24-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833073083100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Only V extension supports EEW =3D 64 in these cases: Zve64* extensions don't support EEW =3D 64 in these cases as commented before the check. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-14-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_rvv.c.inc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 5dbdce073b..fc0d0d60e8 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -1998,8 +1998,7 @@ static bool vmulh_vv_check(DisasContext *s, arg_rmrr = *a) * are not included for EEW=3D64 in Zve64*. (Section 18.2) */ return opivv_check(s, a) && - (!has_ext(s, RVV) && - s->cfg_ptr->ext_zve64f ? s->sew !=3D MO_64 : true); + (!has_ext(s, RVV) ? s->sew !=3D MO_64 : true); } =20 static bool vmulh_vx_check(DisasContext *s, arg_rmrr *a) @@ -2012,8 +2011,7 @@ static bool vmulh_vx_check(DisasContext *s, arg_rmrr = *a) * are not included for EEW=3D64 in Zve64*. (Section 18.2) */ return opivx_check(s, a) && - (!has_ext(s, RVV) && - s->cfg_ptr->ext_zve64f ? s->sew !=3D MO_64 : true); + (!has_ext(s, RVV) ? s->sew !=3D MO_64 : true); } =20 GEN_OPIVV_GVEC_TRANS(vmul_vv, mul) @@ -2230,8 +2228,7 @@ static bool vsmul_vv_check(DisasContext *s, arg_rmrr = *a) * for EEW=3D64 in Zve64*. (Section 18.2) */ return opivv_check(s, a) && - (!has_ext(s, RVV) && - s->cfg_ptr->ext_zve64f ? s->sew !=3D MO_64 : true); + (!has_ext(s, RVV) ? s->sew !=3D MO_64 : true); } =20 static bool vsmul_vx_check(DisasContext *s, arg_rmrr *a) @@ -2242,8 +2239,7 @@ static bool vsmul_vx_check(DisasContext *s, arg_rmrr = *a) * for EEW=3D64 in Zve64*. (Section 18.2) */ return opivx_check(s, a) && - (!has_ext(s, RVV) && - s->cfg_ptr->ext_zve64f ? s->sew !=3D MO_64 : true); + (!has_ext(s, RVV) ? s->sew !=3D MO_64 : true); } =20 GEN_OPIVV_TRANS(vsmul_vv, vsmul_vv_check) --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833034; cv=none; d=zohomail.com; s=zohoarc; b=ZAVDxx/nKK89gIAUS1T4N2ROyAdtWF5xoD/nNo+Hcy4DtpRFaaur6+ydqkGUmCaqhmec88brJy6FbeI+4TUNWOpr2pswBRZ4S4FRvxU26IGFsWxnKcwR7SYmD7tV6Z85uHhNLx4OgUIIA99AbeHTIHAvQUJ4yheSL1L0sfHELM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833034; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XBFShlq0Mtiviu35cbAP5uhkLUId7RlJPqqDmZVwaNg=; b=IIBxCsZ48ctnGGol9xmCiuZdXmgy+VPL3+MC3X6RAgbPabgx+BWaQ0LkA+BsZ7YnZYFhxpgCv7Tzr8COsUwKxqT4HGR7ez5Ap9GWaDXq/Ua0DEHospyh3YxqFetXvjAnRfKbP6I29KvpEfjEvswvFvHmVTKN4sbTXzWkk3bS+a0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833034450720.392259247417; Fri, 3 Mar 2023 00:43:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zG-000872-FR; Fri, 03 Mar 2023 03:41:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zC-00083u-FH for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:54 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zA-0007xz-II for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:53 -0500 Received: by mail-pj1-x102b.google.com with SMTP id l1so1811442pjt.2 for ; Fri, 03 Mar 2023 00:41:52 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kz14-20020a170902f9ce00b0019a733a75a2sm979406plb.60.2023.03.03.00.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832911; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=XBFShlq0Mtiviu35cbAP5uhkLUId7RlJPqqDmZVwaNg=; b=xirFmfVUod07P7pa/XjEM8cMjT468Tgyyrd9rkdG3BGq2FKKGv8ypJR3QAvb8H0l/G 8id1jZA/NDUcLXy7j/86dr6l52jXd+C7wbZuCouV3MqOw61tT/biwPjGHsKc6nhMblsb cLf4GLnWBmiy2eCGMyU1HU2m0oDHBkYh/fdKLPa4axowMkKUffvnsAHucSmRb7AC9Ey7 QnD4INeihTIv9qetxHOlj0yDX4AiuWFY37sJo51vABEVD5EjTz6pvRrpbd5M8tUS82hw UFVjyGuGAV8JxM00RrWrKCdjoK7lTg2m6YHP8FNZ0RUDtO6ztnqFejMcjND1/NZptMgc UdjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832911; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XBFShlq0Mtiviu35cbAP5uhkLUId7RlJPqqDmZVwaNg=; b=4iy3BFqTi3GbUG90XFEeGHVfTgqG9A6Pfa4KL8rreB6gLhiMU/8imrNyqTSSN0yTW/ rMwO/SQ6zImsr/+t+g3r6nMoUhS9dwzXKAWQ4TH9OiIcTeeYnLpZWYkYE62rzck90bsJ eXqy+iqodcK6UdFx7utkPD+m4dhAIeXhMpfHa1OjY4XdYnmTdjgYlttdN6RkKt8Dr4Dl GRoemijWEtkMlWHau9gM2kxq8kZR4WxxLpS1pI30tsUn0eDvbwyWfaWEazlVQIV2DTYu ljWvbTKxiJJnXYt7uI10qxoc9QTnWGOtfxZdess0q6wUsrCHvkak+wFlU3mP7303k90w mOZQ== X-Gm-Message-State: AO0yUKX5DcJOI74nAVYYrQZZuPyxAfkYcJnavz0AQbxE/pegk9zt3kf7 t1xBdIdogJRsQOFka81ifDbwFQ== X-Google-Smtp-Source: AK7set8JLVsVYr9oI/lKgb+DcO4W+oSVT0pZlxlskrp0UHxki+YkU9cBvQ9ozjJypNKMydjzw2uVJg== X-Received: by 2002:a17:903:11cc:b0:19c:eb50:88b9 with SMTP id q12-20020a17090311cc00b0019ceb5088b9mr1538220plh.29.1677832911260; Fri, 03 Mar 2023 00:41:51 -0800 (PST) Subject: [PULL 24/59] target/riscv: Expose properties for Zv* extensions Date: Fri, 3 Mar 2023 00:37:05 -0800 Message-Id: <20230303083740.12817-25-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833034899100001 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Expose Zve64d,Zvfh,Zvfhmin properties. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230215020539.4788-15-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 9b8747ab15..b7f212c59e 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -101,6 +101,9 @@ static const struct isa_ext_data isa_edata_arr[] =3D { ISA_EXT_DATA_ENTRY(zkt, true, PRIV_VERSION_1_12_0, ext_zkt), ISA_EXT_DATA_ENTRY(zve32f, true, PRIV_VERSION_1_12_0, ext_zve32f), ISA_EXT_DATA_ENTRY(zve64f, true, PRIV_VERSION_1_12_0, ext_zve64f), + ISA_EXT_DATA_ENTRY(zve64d, true, PRIV_VERSION_1_12_0, ext_zve64d), + ISA_EXT_DATA_ENTRY(zvfh, true, PRIV_VERSION_1_12_0, ext_zvfh), + ISA_EXT_DATA_ENTRY(zvfhmin, true, PRIV_VERSION_1_12_0, ext_zvfhmin), ISA_EXT_DATA_ENTRY(zhinx, true, PRIV_VERSION_1_12_0, ext_zhinx), ISA_EXT_DATA_ENTRY(zhinxmin, true, PRIV_VERSION_1_12_0, ext_zhinxmin), ISA_EXT_DATA_ENTRY(smaia, true, PRIV_VERSION_1_12_0, ext_smaia), @@ -1126,6 +1129,7 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("Zfhmin", RISCVCPU, cfg.ext_zfhmin, false), DEFINE_PROP_BOOL("Zve32f", RISCVCPU, cfg.ext_zve32f, false), DEFINE_PROP_BOOL("Zve64f", RISCVCPU, cfg.ext_zve64f, false), + DEFINE_PROP_BOOL("Zve64d", RISCVCPU, cfg.ext_zve64d, false), DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), DEFINE_PROP_BOOL("sstc", RISCVCPU, cfg.ext_sstc, true), @@ -1185,6 +1189,9 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("x-smaia", RISCVCPU, cfg.ext_smaia, false), DEFINE_PROP_BOOL("x-ssaia", RISCVCPU, cfg.ext_ssaia, false), =20 + DEFINE_PROP_BOOL("x-zvfh", RISCVCPU, cfg.ext_zvfh, false), + DEFINE_PROP_BOOL("x-zvfhmin", RISCVCPU, cfg.ext_zvfhmin, false), + DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833256; cv=none; d=zohomail.com; s=zohoarc; b=eDxe8XVpRnoa4rcT/v5wnDSw6Td0KMWaOs9K2KIxiOUqDtZEoq+poJ3ZtO7tykeA0xmOJ09rzxgX2yej7Li2DAz6Zifs//GqFfqSRMRqv7EKOSQivK7849uZm/7tMF/c+CTqQGOLsKxaYEshgsj8d7c4gXJ7Ub4niTwcQYQ/wCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833256; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pRW11J/J45CAJ0uTYQ2YvgkRQZQK3nFD6G/IjMnU3Tg=; b=ngIVTChPA4mwqLBH8VVYK7N/89AgOPdbr7KdttVdJN+/rAXDO00YszdKwIuA3Vh01ct7SDpjbZksXQtAXQ/ei2DTTMBWavKmS3BvL8P9aFQaHCfvayYBLVfAiCGv7fkzkIqHHdtn0clB+URdUNs2YvEmBrX+nNOlTvmBhJJkmV4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833256404374.7910733312593; Fri, 3 Mar 2023 00:47:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zE-00085m-Go; Fri, 03 Mar 2023 03:41:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zC-00084M-RE for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:54 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zB-0007l9-Bi for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:54 -0500 Received: by mail-pl1-x632.google.com with SMTP id i10so1958862plr.9 for ; Fri, 03 Mar 2023 00:41:52 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id h4-20020a170902f54400b0019a6cce205bsm972175plf.154.2023.03.03.00.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832912; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=pRW11J/J45CAJ0uTYQ2YvgkRQZQK3nFD6G/IjMnU3Tg=; b=c6gVhheHWLm/RKENoG/nXrH59Vg0xamP9DsDMygzFBkYSYrbSaLyEItECxC/ToQ99p wcJ9KHzrJGUKTOp6Qq6/cX4TqLr0516tYFmwkKzQzymtG08fUzNbHFianRye8WJceYXv sMhnRq1EturNCbpY/7tFrzmBt4iIMfnAtd9ZB+S/wgSnv9oF71ojynDMH9nfGI8M44Ei GdB+IfOOugv1X0h2t8FO112cuhw4oSI/z60lUb0+s2662lTnxNFAEITG/Bz0sjl1NqZp TTxR7NfW0oB9pv/QtIxF9PIzgW7niENRGjcQ8OCh8Dpc81xyepfPBoTBMV5kKSgch+Qw FTFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832912; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pRW11J/J45CAJ0uTYQ2YvgkRQZQK3nFD6G/IjMnU3Tg=; b=M/Va7MB00tliZa1zXdvv5TNtJjXxSvEdcNnQz5zcozMYNo3MCWvdoZpd5Y6E/UrAkQ CJig2AZ8n8lupzA+8xjR5SzAxy1dhujw+cSnYY6MjhWWw0Vo8QYSa8QWooB3h+2mDlLe HZKn4nMo0b+xO5lbEninu/mBQFLZepLxW+iMWzIKeRJwQ3cySok9WqiPleyUBfb2UwqN khkv8mPWWbRqVKiaLEPZwGnlHKoVlc+FQSchVcL0VbC7EkRuYxI3F4DsCDwgEwLp8cnT cHvPXgFwHOVYu7TRp3mR72vUmNLOp3wH/CIK2nUlwHy/1lBqrfrBC1w0cC/h4H8tRxug fDcw== X-Gm-Message-State: AO0yUKV0ojB7ce2JaPxXFKWtzy1oGIGOdw4OA/rCXdSWRrU1hCMwS/5d bYT4eGI3irN3HRsOok64Sjj5uQ== X-Google-Smtp-Source: AK7set8NALu8qq8g53l2mJG9wcKMSpf1y8LAtZgaeVo9siV3cyrKK531NEG3Qh9hvGoGYtmPnDSOWQ== X-Received: by 2002:a17:90b:1d0e:b0:234:d42:163e with SMTP id on14-20020a17090b1d0e00b002340d42163emr901180pjb.28.1677832912623; Fri, 03 Mar 2023 00:41:52 -0800 (PST) Subject: [PULL 25/59] target/riscv: gdbstub: Check priv spec version before reporting CSR Date: Fri, 3 Mar 2023 00:37:06 -0800 Message-Id: <20230303083740.12817-26-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833257756100015 Content-Type: text/plain; charset="utf-8" From: Bin Meng The gdbstub CSR XML is dynamically generated according to the result of the CSR predicate() result. This has been working fine until commit 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12") introduced the privilege spec version check in riscv_csrrw_check(). When debugging the 'sifive_u' machine whose priv spec is at 1.10, gdbstub reports priv spec 1.12 CSRs like menvcfg in the XML, hence we see "remote failure reply 'E14'" message when examining all CSRs via "info register system" from gdb. Add the priv spec version check in the CSR XML generation logic to fix this issue. Fixes: 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12") Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-2-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/gdbstub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 6e7bbdbd5e..e57372db38 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -290,6 +290,9 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int = base_reg) g_string_append_printf(s, ""= ); =20 for (i =3D 0; i < CSR_TABLE_SIZE; i++) { + if (env->priv_ver < csr_ops[i].min_priv_ver) { + continue; + } predicate =3D csr_ops[i].predicate; if (predicate && (predicate(env, i) =3D=3D RISCV_EXCP_NONE)) { if (csr_ops[i].name) { --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833050; cv=none; d=zohomail.com; s=zohoarc; b=iWNBAZtA4IhGEFm5IM4wKvV3vWEUtPC4VCHe4V7SVPHHC/aBPMJ/7anx9gZNAl6HcrQ+L4PazciK2/0VYwkUvuQOStPBiTFp1xVqaVm+mmpEpWQDYPpUJYu76jS4PYW8t+V0WvtwpKIkqq6lQZBQdfXXmReMFSdmarUGhYyrCy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833050; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H0kfUACxjxhg5dNp8nYzlobKUc0cuKo9GjRqKYGyZNk=; b=c7Bp7zs1DiWN0dwsChLI+zKiW24CSmDzhG80ipqcm11wIuD1Ir8khckgrEkhJKN2wY6bk4MmskE9YnJrRlcmNk8BO/RspO6Gxv1lRmqya9HyKy/rWvDKzAXlyEtp7PwWwFX1YCOawCjPsUrPMx4AczOpIu36Dw4fPoRtjwqa4dM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833050563996.1128731586684; Fri, 3 Mar 2023 00:44:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zG-000873-J3; Fri, 03 Mar 2023 03:41:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zE-00085K-6y for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:56 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zC-0007t6-J0 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:55 -0500 Received: by mail-pj1-x1033.google.com with SMTP id y2so1790957pjg.3 for ; Fri, 03 Mar 2023 00:41:54 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id ka14-20020a170903334e00b0019ccded6a46sm963721plb.228.2023.03.03.00.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832914; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=H0kfUACxjxhg5dNp8nYzlobKUc0cuKo9GjRqKYGyZNk=; b=qLTOQKQYbXOcZgLF2RjarNO5V1E7u0nQhyOS8r7PN5ur3XOMHWLoyxrlY9fOs6c+1M HUfq1FBbqeeht1fn1GcBOCGkKNIn+IZgXDTN7wPi82gLypgMGKSQ4NMqSxEv7eb0UfnY mf/p57VEO2ooc8Amz+8rHU5+E+SK8fU4StiMITl5hmAghiaK2WsNqfe8HcKlpJ4ucsQ8 Ie4xkg4T/eNhfh43o4HBEsw0IjixW/o4zBCpTm0fSiQtd676EB4sQiFc7arlPOZJXjrR 1bkfTQfZIcA/E3NR13WbgNEgJFJb4PBvKjgQekDK/dVD3vw33SV6GunLouz2iL/4xMNU gs8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832914; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H0kfUACxjxhg5dNp8nYzlobKUc0cuKo9GjRqKYGyZNk=; b=xCAy/MOhdNYi7kRA+/2URGc+tFK4HepnHSawVet49pxcPuA8CPl6+dtcoedOeTp+VF T33njFJfnUVglAa1JP+wKS3z7hnGItp9mSRODsqOXwaKoA/TBy4lDjheJOtRp/8NxOwg aKf5fAEVzQmTc+hr8fGZsfja+pzaO4n5n42PLZChsWuQlq6RNh328t2g2VY21CsZvSTQ Y6cEBToRIDojxTgruS407AE4rU+DGlfQZhB3PjoGyxrEfPKYVcZEBHxojFKn3eZpdVKt euvjQBFNHuSAMdslTcp1lA19Sn/YqAFdBRxZ5gVrVkz2zU6LCWlepiHUN4+m0ypTKnZ/ G8Bw== X-Gm-Message-State: AO0yUKXDBQAyj/lm3ysJiSssHmzxNS+GMf+P/2X7uQJNeu4Qzo+NzIA/ BWPv5rs623u9CwamGilj72KWYg== X-Google-Smtp-Source: AK7set/Fah9yVJBmS8pR/H3Z8db1xc51j259sv5z+8u0syJy9iZa5dQPUK9zpjxMD2gUappwRlw1qA== X-Received: by 2002:a17:902:cec6:b0:196:8292:e879 with SMTP id d6-20020a170902cec600b001968292e879mr1629021plg.1.1677832913753; Fri, 03 Mar 2023 00:41:53 -0800 (PST) Subject: [PULL 26/59] target/riscv: Add some comments to clarify the priority policy of riscv_csrrw_check() Date: Fri, 3 Mar 2023 00:37:07 -0800 Message-Id: <20230303083740.12817-27-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833050965100001 Content-Type: text/plain; charset="utf-8" From: Bin Meng The priority policy of riscv_csrrw_check() was once adjusted in commit eacaf4401956 ("target/riscv: Fix priority of csr related check in ri= scv_csrrw_check") whose commit message says the CSR existence check should come before the access control check, but the code changes did not agree with the commit message, that the predicate() check actually came after the read / write check. In fact this was intentional. Add some comments there so that people won't bother trying to change it without a solid reason. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Message-ID: <20230228104035.1879882-3-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 75a540bfcb..4cc2c6370f 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3776,11 +3776,12 @@ static inline RISCVException riscv_csrrw_check(CPUR= ISCVState *env, int read_only =3D get_field(csrno, 0xC00) =3D=3D 3; int csr_min_priv =3D csr_ops[csrno].min_priv_ver; =20 - /* ensure the CSR extension is enabled. */ + /* ensure the CSR extension is enabled */ if (!cpu->cfg.ext_icsr) { return RISCV_EXCP_ILLEGAL_INST; } =20 + /* privileged spec version check */ if (env->priv_ver < csr_min_priv) { return RISCV_EXCP_ILLEGAL_INST; } @@ -3790,10 +3791,18 @@ static inline RISCVException riscv_csrrw_check(CPUR= ISCVState *env, return RISCV_EXCP_ILLEGAL_INST; } =20 + /* read / write check */ if (write_mask && read_only) { return RISCV_EXCP_ILLEGAL_INST; } =20 + /* + * The predicate() not only does existence check but also does some + * access control check which triggers for example virtual instruction + * exception in some cases. When writing read-only CSRs in those cases + * illegal instruction exception should be triggered instead of virtual + * instruction exception. Hence this comes after the read / write chec= k. + */ RISCVException ret =3D csr_ops[csrno].predicate(env, csrno); if (ret !=3D RISCV_EXCP_NONE) { return ret; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833178; cv=none; d=zohomail.com; s=zohoarc; b=AMbgrItonhelRcdxzCIGylPz6qfvzZuj0x+zcAqtME042suuQhIETs/XcFSl3ZR9HIZv5IULbIKGl8393bopEU0E/USDuED1jyDFzAyQQbh94E2Q8oq1yotrcvLDJLsbugdqMEzF6IVgKE8AqlwOXhthgGVQHVvJyhxswWuqNJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833178; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fGLjFr3btl6TtpgGulCBgf0V4/Wyfa5gKk1cozGOLoE=; b=MRn6b/7t/x/HGzSS6amXKbyeDMILTHPBjooNbESp7dxmc9usx29+S3RrxWR0Dp0VYme4mtfAXz5ebGBZXVj2lRmf2hhOjEm/JkOQYN/9t0Clds42iG0TdSRUdDuiQVz50QozegII9Yn99uMW1ZjkjdNgz0cwGPgwA9onU0zAL2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833178270839.0575092064917; Fri, 3 Mar 2023 00:46:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zH-00087k-6d; Fri, 03 Mar 2023 03:41:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zF-000860-8P for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:57 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zD-0007l9-ME for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:56 -0500 Received: by mail-pl1-x632.google.com with SMTP id i10so1958940plr.9 for ; Fri, 03 Mar 2023 00:41:55 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id 25-20020aa79259000000b005d866d184b5sm1033003pfp.46.2023.03.03.00.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832915; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=fGLjFr3btl6TtpgGulCBgf0V4/Wyfa5gKk1cozGOLoE=; b=uYP5zV+rCQ2kp4O5ryJd1dYyaTjcGCJ4Fri3Txw0JO3YKhzoPHmAUeJ+trEIMYGyWE hrHPvUhlL7msCiR7OGzMcPmVDAu+lzkhs6RQ1MjNkj8NJ66jMqPimW9R/iVdVZ14+OU5 7XwjoWrknPE1yBo7sUT2z8j0SclyjbjqRJlahnclHrlsfG7ZSZqFdO5eTylptrZjOC/Q VT9uCaJqLM5fMVLLwZaEm7oOp4i+zcJ+G2RD126wclXjA9SecQ8TjfwyDbp55HQ8jJIS 5512hHUBUzDegFp490+l2zbI+MPMpLoPXht53odKtLpvQro8cbX2sejRaKvJ511h4PXr e3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832915; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fGLjFr3btl6TtpgGulCBgf0V4/Wyfa5gKk1cozGOLoE=; b=u1jxupiU6k7OaziKM/rxQRrRfwhSqngGi8mnSjzPbmVB3Ia80amk6+RWtWa+8qlRUg zDERgG2uivractZVUsOcSitvmrj7H9COX8Tkq6bZedha30Tk46TI3xDZGbuxLp5PrRRt seQqaIIVQcPPdI23gACoH+3hTV9mpG6uSwcRu2a3hH/FuFtb1wWONZn2iRlWN7vdCNPG npMnc6FbiZrHolDAjezX8dvkzqkOGpiCdpl/bQrTh7MH7KB6juEb4xTya43nvJ0RspIM /TRaAS1vbj91NRO3GlqPzXJ9T6B4A0xji/JUWuoj1vo0suYK2bjP99zgG8aub76Stut1 zi0g== X-Gm-Message-State: AO0yUKXHDot28Qv5lRQxDd5cLjxCevxK86gR5vkwdK2UUc0oqxHSkgQU nSrvOYHEEHxemdwuTyGGzzpUBA== X-Google-Smtp-Source: AK7set+14tkEpA9JDNTQbo3XrPbLXncfatzqDkQqTirip0+znyoNu931pV0ZRDTSSKx6W82zpEuxQA== X-Received: by 2002:a05:6a21:6da9:b0:c7:73ad:1071 with SMTP id wl41-20020a056a216da900b000c773ad1071mr1919025pzb.14.1677832914987; Fri, 03 Mar 2023 00:41:54 -0800 (PST) Subject: [PULL 27/59] target/riscv: Use g_assert() for the predicate() NULL check Date: Fri, 3 Mar 2023 00:37:08 -0800 Message-Id: <20230303083740.12817-28-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833179477100005 Content-Type: text/plain; charset="utf-8" From: Bin Meng At present riscv_csrrw_check() checks the CSR predicate() against NULL and throws RISCV_EXCP_ILLEGAL_INST if it is NULL. But this is a pure software check, and has nothing to do with the emulation of the hardware behavior, thus it is inappropriate to return illegal instruction exception when software forgets to install the hook. Change to use g_assert() instead. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Message-ID: <20230228104035.1879882-4-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 4cc2c6370f..cfd7ffc5c2 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3786,11 +3786,6 @@ static inline RISCVException riscv_csrrw_check(CPURI= SCVState *env, return RISCV_EXCP_ILLEGAL_INST; } =20 - /* check predicate */ - if (!csr_ops[csrno].predicate) { - return RISCV_EXCP_ILLEGAL_INST; - } - /* read / write check */ if (write_mask && read_only) { return RISCV_EXCP_ILLEGAL_INST; @@ -3803,6 +3798,7 @@ static inline RISCVException riscv_csrrw_check(CPURIS= CVState *env, * illegal instruction exception should be triggered instead of virtual * instruction exception. Hence this comes after the read / write chec= k. */ + g_assert(csr_ops[csrno].predicate !=3D NULL); RISCVException ret =3D csr_ops[csrno].predicate(env, csrno); if (ret !=3D RISCV_EXCP_NONE) { return ret; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833427; cv=none; d=zohomail.com; s=zohoarc; b=bzUPpAQy2EfiEQZHUmvBIjhgy8zoRQCPCL5QrgZwrPYf6zOPLQh5EKrXagCPfFY4PvFvxi84DcQIDOqHN6Ky5CDq5CSaIdPLOoawuNupys3skEHNSOZ4wIS/xpUihhpWtpanYzFWI0j5+qqEvvkuWp8Q36j2hMKZYP8OJFPmy38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833427; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xX9YoSlLa+3ihvCOlNB2JgR3BNTq1PpQmJ+xcNb0lYg=; b=S7uhmyHodXBwbcmPVNi6xpUP+Wr4c29upbR+l9a9XXGj83PbQ39KSq9pVf2motMvnMnPlIl/FheBK8js5Ab/m4kECp9ZtQiUO6YZWY9Q46Y3mrxL3iS/wnTpUnojzkU5o7TbWTP0VvLbFe094SGXZDAw+jRcvbdxAlapLKudz44= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833427168682.4603276536719; Fri, 3 Mar 2023 00:50:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zI-00088K-3j; Fri, 03 Mar 2023 03:42:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zG-000874-Ff for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:58 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zE-0007qA-TI for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:41:58 -0500 Received: by mail-pl1-x62e.google.com with SMTP id u5so1973634plq.7 for ; Fri, 03 Mar 2023 00:41:56 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id ka12-20020a170903334c00b0019d1f42b00csm1002981plb.17.2023.03.03.00.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832916; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=xX9YoSlLa+3ihvCOlNB2JgR3BNTq1PpQmJ+xcNb0lYg=; b=ClK2y2OfxJm7n0NGGgdJ7jLJ7wByicD9GPynkVoRAtW0NXINqAwIdbYTHxilLH/xJW dpHblgq5dWQQ23/OxG2IGpbcNnuO3nTxWdHbfcJHpkVQHvpp5tjuJXZesz/53+NYCx/K 7DeTCOE1uRYQuboyzpkyzWITvrBcTuLhivlCnoynIqw+EQV7T/N1qFNGXrdI8dLMuqp4 hiNtdFcU1Hmr3KiIKaBQDB/gvKzRLIBBZQ/gPzsAkqi9iFBqqgHV27L2qSt2yxp9GEFM BPd3AdO3t+uPNg9+DTO9uSW/7jfRnpfVL7HNXf+audKbZeJlmJq6oW54hv0CyvKf1Tuq GToA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832916; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xX9YoSlLa+3ihvCOlNB2JgR3BNTq1PpQmJ+xcNb0lYg=; b=Q4k+xy0Nf9mO1LQaaUQIRoql5L/E8aglRGdlo4pKiXYuFwMjhT+Ez9c4FIP55Lw7WW 3rPX82lg5QASEnKNXmrVpzzFYB7PEzhbJEZ8AGXMGyrCQrIMnqhBKshDKB9u2B24ud7M ZrptERWjZkJNhzcz8MiEhrA3I8/iw/a4gBzdZCjOANgGC2ZXCx0RMs1q6gbkJGIcG2A8 hVvSAj70yf9cdzXFhzzEqC4hvS+H1lclJB9PecedH24FapjJVt6ICakphsZc78NOAYPJ VUep7wZE7nKmIFCZHxegJ4j2KJwaDQKnXykOVlWekpuORx9ihyDetS5QOcrZo0F0KMct LxGg== X-Gm-Message-State: AO0yUKV+2ZYpiWElkDSmKvOO/DpEQZv976ZxV+5wpZpvdL9kzckQKZOn pauhKGCIW5jmAsY6CDjm7mB8/Q== X-Google-Smtp-Source: AK7set9+lqxqXkM3zJ2QMCLDUUa2AAoohVUAGFzHc2rxQIRrDs4zAIp1cCT27bUswx31wY5scLyEdA== X-Received: by 2002:a17:902:a985:b0:19e:7f80:4165 with SMTP id bh5-20020a170902a98500b0019e7f804165mr1132240plb.17.1677832916136; Fri, 03 Mar 2023 00:41:56 -0800 (PST) Subject: [PULL 28/59] target/riscv: gdbstub: Minor change for better readability Date: Fri, 3 Mar 2023 00:37:09 -0800 Message-Id: <20230303083740.12817-29-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833428829100007 Content-Type: text/plain; charset="utf-8" From: Bin Meng Use a variable 'base_reg' to represent cs->gdb_num_regs so that the call to ricsv_gen_dynamic_vector_xml() can be placed in one single line for better readability. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-5-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index e57372db38..704f3d6922 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -385,9 +385,9 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState = *cs) 32, "riscv-32bit-fpu.xml", 0); } if (env->misa_ext & RVV) { + int base_reg =3D cs->gdb_num_regs; gdb_register_coprocessor(cs, riscv_gdb_get_vector, riscv_gdb_set_v= ector, - ricsv_gen_dynamic_vector_xml(cs, - cs->gdb_num_= regs), + ricsv_gen_dynamic_vector_xml(cs, base_reg= ), "riscv-vector.xml", 0); } switch (env->misa_mxl_max) { --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833046; cv=none; d=zohomail.com; s=zohoarc; b=JjXSEiDdCg9hYc1PwKRiHRxV/7QK3cmXVmOHfbUwvHV7Zon6++Wi8e/YfiXaJAOLnjhhOA9sCaMD9ufrJrMMUZ0X0y6RI53IN+eM+xkRISQ37EoC+v2I8FGURv2YcoIT/GfMreXCAE0mhrwOK/hUe87jQjuA0YiFq5MHXhitwD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833046; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Zjgp+PZMaWiPK4UX+pTmFsQnk+WXuCTXJqH5LtU5wDA=; b=c310vO8LkhFsfsmNqDkcBV+oKMvw8Uf1P5cdrDs0YgekiKq3CWyobVEM+xLVPafXQ51w+kYKYdol5UQU0RxlJsHWQdBC9lnDwtQX25jeq6a8Y4r1/Ub3d7h4aawhJVki5069u6fKFXi0LzT+0CTX9qAWNVm5gJQJPkeMQpR79kI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833046346485.6951001206223; Fri, 3 Mar 2023 00:44:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zK-00089L-4X; Fri, 03 Mar 2023 03:42:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zI-00088f-Nh for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:00 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zG-0007zl-LI for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:00 -0500 Received: by mail-pg1-x531.google.com with SMTP id s17so1026070pgv.4 for ; Fri, 03 Mar 2023 00:41:58 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id j22-20020aa78d16000000b005a909290425sm1040513pfe.172.2023.03.03.00.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832917; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=Zjgp+PZMaWiPK4UX+pTmFsQnk+WXuCTXJqH5LtU5wDA=; b=LMiFugxt6tuA1vSy+w4WV55ONLcA35CYtF3LwPrB6qPm5VtdEzROJQu20D4ZsshxDJ sAPVH6WVd0HmVCd17PPtL5Fn41OAOqDZctUesGgwwajjUelJkn8/SgQ2Batod2edUdCb QotppfhwkpiHTRkJwFgLFDHgZMCowuHsWW0ilFqozL24l7mD+b6nPxOb1auiTbQuJkSk gJkMoA1ws81iAvwcanWnlh1caP1d5mtA1MGGcL4w76KDwg6GKxfUM6bQ5Ut4iLwoMRZE /CapJ+dRUMjlAMieD8j5aJ5l312GvnuA+CFcawzilUDyFW5zT6d40Lli0tcba9NvH523 DXcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832917; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zjgp+PZMaWiPK4UX+pTmFsQnk+WXuCTXJqH5LtU5wDA=; b=RHsTcluadB77fJXjDYGc83zR6Q19u13J+kMSNmHmTQiDP/KbPNv77j5PbiwpvmvjV5 RarNih2++CUFzuq3MPA7kgPxbw+6X5A3saudFr5CVtO2bf+284qnQLfo2ASN2XQ6XUhL FRACdzBDkk9vzoHiq/k420GT3hkpvgL/qSo0Gn9YoNPPIsmNvdPqXnrRALPFiIerRdq+ N7Cic0QvaMDywD0QkGFN/TdLhDSXxxjQbckSUmaaV8zW3Gb84xUwF17FF2jD8NZUFWLL Dl/AY/HUJfMwPZcWVxqbsp+3t5yiDDYjvcpvpfnXWxcwuTTepoR/9Cg8+NpxrTHOtuZf pN5A== X-Gm-Message-State: AO0yUKXDm6O+lv4MT+dthfAFsAOCCjma/IK0pLCc5FJSnsjP06naqx4K fCRD0/Poh4Ud/9/K4w45CfUFKw== X-Google-Smtp-Source: AK7set/D5otJUcezw4pvpJxpT+/kC43+ob2y2ReD7oBCL0bYDZNjjjP/mD8IiBccc47TGIjk8471Fg== X-Received: by 2002:aa7:982d:0:b0:5a9:e8dd:80ea with SMTP id q13-20020aa7982d000000b005a9e8dd80eamr1425195pfl.17.1677832917354; Fri, 03 Mar 2023 00:41:57 -0800 (PST) Subject: [PULL 29/59] target/riscv: gdbstub: Do not generate CSR XML if Zicsr is disabled Date: Fri, 3 Mar 2023 00:37:10 -0800 Message-Id: <20230303083740.12817-30-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=palmer@rivosinc.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833047266100001 Content-Type: text/plain; charset="utf-8" From: Bin Meng There is no need to generate the CSR XML if the Zicsr extension is not enabled. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-6-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/gdbstub.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 704f3d6922..294f0ceb1c 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -406,7 +406,10 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState= *cs) g_assert_not_reached(); } =20 - gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, - riscv_gen_dynamic_csr_xml(cs, cs->gdb_num_reg= s), - "riscv-csr.xml", 0); + if (cpu->cfg.ext_icsr) { + int base_reg =3D cs->gdb_num_regs; + gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, + riscv_gen_dynamic_csr_xml(cs, base_reg), + "riscv-csr.xml", 0); + } } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833397; cv=none; d=zohomail.com; s=zohoarc; b=fx1t0AUHTxZI5qjMTVnfy8W/ZZBGrksynp9u8SiBSAMzYq5VDkj8O/2L+ODZuwuOPNfuLIce3dC+7tZpxk9v73BJBSZdwDE0c3pbP+bOZl4CkAhTVOR8apbMGWk+JiOLpIsSVgAbRk/sWtW9zaMuedVFSUs0Hkv5KAlz2oIEIzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833397; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q0kQSpRL/F8639JcEBcyLWbpB+TpTlZt5SKgFo4+lBo=; b=EClFTjK+IJSJ8xe8TOVLq2C8+zdMMj4BykaI5XFQviNgT1H+2tySZuOfUobbIGhGiabp8/vT+7h6hB5a0AeV6EE0m0z4f1bZKLJAicQQsxQ7T8yUsUc9IWeCpvOgpT7rkS2RGdML6LJ4Y6UnZWVY04dHGTEdfC3r8XtfUH1n1ko= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833397161524.8347221669395; Fri, 3 Mar 2023 00:49:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zP-0008B1-Rv; Fri, 03 Mar 2023 03:42:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zJ-000896-Gy for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:01 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zH-0007yS-C9 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:01 -0500 Received: by mail-pl1-x629.google.com with SMTP id p20so1937954plw.13 for ; Fri, 03 Mar 2023 00:41:58 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id s21-20020aa78295000000b0060c7f4f39b4sm1036701pfm.171.2023.03.03.00.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832918; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=q0kQSpRL/F8639JcEBcyLWbpB+TpTlZt5SKgFo4+lBo=; b=KG+G/SDU8pbf5S8ALNdntgRYjJG1JQaT1GIVblIDdIBrMbbQzlZQyLVpq4tXYwv71K /n1NQsCDYM7Gl6Q5VsCobFTTHusNSn99xOhYbTGgIBXjvVwzWNl6SfX0b3YzeJ1QcEo3 EuqwUPLaBfXOJ2HcgEFUxwCdEFCU6Jgu+H5fvl3SxeLPZhUuD73A0Kxjw0lG8iq9wagU tGilTqGZzi3LLLLYHKnEsVFjKT4nCYOUJnqkH+L+YLQJUcVjuSLYfWcg8Ideu9UQyaC2 HOku3axy5ZmClumLp1f7h/8v5AXg+IVpFQA8osesHEntX7sKmQd7xiYWJu7wvcbT5+B7 FIKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832918; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q0kQSpRL/F8639JcEBcyLWbpB+TpTlZt5SKgFo4+lBo=; b=YIwXcF8BUSg/Kgym5/hRYivN8Xg8maeEute9VI2ceIVHCaVNqZum5pzTOwzQBzP5dd l1x4YhkK0TZUgaS6mPE3OldnDkGHClSZOMMlCUEzquhVNTNParksShzWryQK+A5N4mih tc4qaQ2e7XQJr/snxp59Vso3g6Cy5827IqJWllJcQoxjvHUY1v4jzfq5urejp6KuUQ9n TQh85eYh0ku0tIRGra1hK1Dv/9zjpNn9w8w6q/ozZratowR29GX6XQY7w8tmtDmr2IuC BHemi1Ry+px6WzE0iHQ/7TtEri5Hs/rzoFr4zvbVyTMZOZuCy5EW4AEszDnYDdS65DFa XRlA== X-Gm-Message-State: AO0yUKXmj/7fWIxQR3sGO8tvn5IpOnr6fsNWz9Ib2dVmtHJY/BBUyRGS 4Hov920ES2TTy7XW2itf68Lj+Q== X-Google-Smtp-Source: AK7set8cto3Imish7uUpye9lq04OTh2+jD7xG77Yfk/O7nnea47LmBCeRT2qJX2ycTU7sW0sB5ZwgQ== X-Received: by 2002:a05:6a20:8c23:b0:bc:5a6:1b2a with SMTP id j35-20020a056a208c2300b000bc05a61b2amr1245249pzh.49.1677832918542; Fri, 03 Mar 2023 00:41:58 -0800 (PST) Subject: [PULL 30/59] target/riscv: Coding style fixes in csr.c Date: Fri, 3 Mar 2023 00:37:11 -0800 Message-Id: <20230303083740.12817-31-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833398614100001 Content-Type: text/plain; charset="utf-8" From: Bin Meng Fix various places that violate QEMU coding style: - correct multi-line comment format - indent to opening parenthesis Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-7-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 62 ++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index cfd7ffc5c2..6a82628749 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -963,7 +963,7 @@ static RISCVException sstc_32(CPURISCVState *env, int c= srno) } =20 static RISCVException read_vstimecmp(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->vstimecmp; =20 @@ -971,7 +971,7 @@ static RISCVException read_vstimecmp(CPURISCVState *env= , int csrno, } =20 static RISCVException read_vstimecmph(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->vstimecmp >> 32; =20 @@ -979,7 +979,7 @@ static RISCVException read_vstimecmph(CPURISCVState *en= v, int csrno, } =20 static RISCVException write_vstimecmp(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { RISCVCPU *cpu =3D env_archcpu(env); =20 @@ -996,7 +996,7 @@ static RISCVException write_vstimecmp(CPURISCVState *en= v, int csrno, } =20 static RISCVException write_vstimecmph(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { RISCVCPU *cpu =3D env_archcpu(env); =20 @@ -1020,7 +1020,7 @@ static RISCVException read_stimecmp(CPURISCVState *en= v, int csrno, } =20 static RISCVException read_stimecmph(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { if (riscv_cpu_virt_enabled(env)) { *val =3D env->vstimecmp >> 32; @@ -1032,7 +1032,7 @@ static RISCVException read_stimecmph(CPURISCVState *e= nv, int csrno, } =20 static RISCVException write_stimecmp(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { RISCVCPU *cpu =3D env_archcpu(env); =20 @@ -1055,7 +1055,7 @@ static RISCVException write_stimecmp(CPURISCVState *e= nv, int csrno, } =20 static RISCVException write_stimecmph(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { RISCVCPU *cpu =3D env_archcpu(env); =20 @@ -1342,7 +1342,8 @@ static RISCVException write_misa(CPURISCVState *env, = int csrno, =20 /* 'E' excludes all other extensions */ if (val & RVE) { - /* when we support 'E' we can do "val =3D RVE;" however + /* + * when we support 'E' we can do "val =3D RVE;" however * for now we just drop writes if 'E' is present. */ return RISCV_EXCP_NONE; @@ -1361,7 +1362,8 @@ static RISCVException write_misa(CPURISCVState *env, = int csrno, val &=3D ~RVD; } =20 - /* Suppress 'C' if next instruction is not aligned + /* + * Suppress 'C' if next instruction is not aligned * TODO: this should check next_pc */ if ((val & RVC) && (GETPC() & ~3) !=3D 0) { @@ -1830,28 +1832,28 @@ static RISCVException write_mscratch(CPURISCVState = *env, int csrno, } =20 static RISCVException read_mepc(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->mepc; return RISCV_EXCP_NONE; } =20 static RISCVException write_mepc(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { env->mepc =3D val; return RISCV_EXCP_NONE; } =20 static RISCVException read_mcause(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->mcause; return RISCV_EXCP_NONE; } =20 static RISCVException write_mcause(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { env->mcause =3D val; return RISCV_EXCP_NONE; @@ -1873,14 +1875,14 @@ static RISCVException write_mtval(CPURISCVState *en= v, int csrno, =20 /* Execution environment configuration setup */ static RISCVException read_menvcfg(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->menvcfg; return RISCV_EXCP_NONE; } =20 static RISCVException write_menvcfg(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { uint64_t mask =3D MENVCFG_FIOM | MENVCFG_CBIE | MENVCFG_CBCFE | MENVCF= G_CBZE; =20 @@ -1893,14 +1895,14 @@ static RISCVException write_menvcfg(CPURISCVState *= env, int csrno, } =20 static RISCVException read_menvcfgh(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->menvcfg >> 32; return RISCV_EXCP_NONE; } =20 static RISCVException write_menvcfgh(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { uint64_t mask =3D MENVCFG_PBMTE | MENVCFG_STCE; uint64_t valh =3D (uint64_t)val << 32; @@ -1911,7 +1913,7 @@ static RISCVException write_menvcfgh(CPURISCVState *e= nv, int csrno, } =20 static RISCVException read_senvcfg(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { RISCVException ret; =20 @@ -1925,7 +1927,7 @@ static RISCVException read_senvcfg(CPURISCVState *env= , int csrno, } =20 static RISCVException write_senvcfg(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { uint64_t mask =3D SENVCFG_FIOM | SENVCFG_CBIE | SENVCFG_CBCFE | SENVCF= G_CBZE; RISCVException ret; @@ -1940,7 +1942,7 @@ static RISCVException write_senvcfg(CPURISCVState *en= v, int csrno, } =20 static RISCVException read_henvcfg(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { RISCVException ret; =20 @@ -1954,7 +1956,7 @@ static RISCVException read_henvcfg(CPURISCVState *env= , int csrno, } =20 static RISCVException write_henvcfg(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { uint64_t mask =3D HENVCFG_FIOM | HENVCFG_CBIE | HENVCFG_CBCFE | HENVCF= G_CBZE; RISCVException ret; @@ -1974,7 +1976,7 @@ static RISCVException write_henvcfg(CPURISCVState *en= v, int csrno, } =20 static RISCVException read_henvcfgh(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { RISCVException ret; =20 @@ -1988,7 +1990,7 @@ static RISCVException read_henvcfgh(CPURISCVState *en= v, int csrno, } =20 static RISCVException write_henvcfgh(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { uint64_t mask =3D HENVCFG_PBMTE | HENVCFG_STCE; uint64_t valh =3D (uint64_t)val << 32; @@ -2031,13 +2033,13 @@ static RISCVException write_mstateen0(CPURISCVState= *env, int csrno, } =20 static RISCVException write_mstateen_1_3(CPURISCVState *env, int csrno, - target_ulong new_val) + target_ulong new_val) { return write_mstateen(env, csrno, SMSTATEEN_STATEEN, new_val); } =20 static RISCVException read_mstateenh(CPURISCVState *env, int csrno, - target_ulong *val) + target_ulong *val) { *val =3D env->mstateen[csrno - CSR_MSTATEEN0H] >> 32; =20 @@ -2058,7 +2060,7 @@ static RISCVException write_mstateenh(CPURISCVState *= env, int csrno, } =20 static RISCVException write_mstateen0h(CPURISCVState *env, int csrno, - target_ulong new_val) + target_ulong new_val) { uint64_t wr_mask =3D SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG; =20 @@ -2066,7 +2068,7 @@ static RISCVException write_mstateen0h(CPURISCVState = *env, int csrno, } =20 static RISCVException write_mstateenh_1_3(CPURISCVState *env, int csrno, - target_ulong new_val) + target_ulong new_val) { return write_mstateenh(env, csrno, SMSTATEEN_STATEEN, new_val); } @@ -2103,7 +2105,7 @@ static RISCVException write_hstateen0(CPURISCVState *= env, int csrno, } =20 static RISCVException write_hstateen_1_3(CPURISCVState *env, int csrno, - target_ulong new_val) + target_ulong new_val) { return write_hstateen(env, csrno, SMSTATEEN_STATEEN, new_val); } @@ -2142,7 +2144,7 @@ static RISCVException write_hstateen0h(CPURISCVState = *env, int csrno, } =20 static RISCVException write_hstateenh_1_3(CPURISCVState *env, int csrno, - target_ulong new_val) + target_ulong new_val) { return write_hstateenh(env, csrno, SMSTATEEN_STATEEN, new_val); } @@ -3335,7 +3337,7 @@ static RISCVException read_mseccfg(CPURISCVState *env= , int csrno, } =20 static RISCVException write_mseccfg(CPURISCVState *env, int csrno, - target_ulong val) + target_ulong val) { mseccfg_csr_write(env, val); return RISCV_EXCP_NONE; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833558; cv=none; d=zohomail.com; s=zohoarc; b=C4vK+s0jpUanBDOybHI5ppCZwCoSu1p0Z6cJDVqdl/CV89GTLUOApr+XqJ80wcmyTPqcedIKXG1I4l0ZRQoJwIIgckCm+SL13gLi9cI+C63+3PoW/EnJYRavd7sCw2HW4QYBug9GLFYyxBVOV9aJc8BkYuBlqJZylY/ADkTN0oo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833558; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Iar28XWCjKHLpwhZETdxylE8DjmCp9sM51vAD+CbMx4=; b=n0MYi0/zehL6qSvsp35JvwhmcwKJT1L5O7w0hxjiEXWAeRjA/mJybuRO8iRRW0n6EQ1o69djme6NiaNMBqftGTBO0NyqlWAfxqSijKsju+/Q/j3JeuO31krXERQuxyFoJkbOKSPsVTGcLpqIWayX4J+W4MQBQEJQ4RBcjrtHmSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833558346451.24393180652976; Fri, 3 Mar 2023 00:52:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zR-0008JR-T0; Fri, 03 Mar 2023 03:42:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zK-00089O-H8 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:03 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zJ-00080Q-1T for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:02 -0500 Received: by mail-pj1-x1035.google.com with SMTP id h17-20020a17090aea9100b0023739b10792so1588978pjz.1 for ; Fri, 03 Mar 2023 00:42:00 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id ks12-20020a170903084c00b001933b4b1a49sm965246plb.183.2023.03.03.00.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832920; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=Iar28XWCjKHLpwhZETdxylE8DjmCp9sM51vAD+CbMx4=; b=4SD9s8xHQILfjjhhwkVS8WcK396iE99Yz8sX4il8p4elV4EC2KE8Zp3o74EaTNP9LQ eVR7h+1Lkv0w/Jdbdw0N/VfrMyddL52FfInuhnae83U3SQBzUK6SNGUOYgN9U4B5i4AX ticwoG6NikHjuu6YRXMJlfUffQN6ouePQr7kzWiVP04pBSW+SjDfoCaK1RbqaiDKl88K JF3V3GfY/bdpGTRbXxSD/rbovccqbcgSg403qItduSeHtcnAhNxjO0BvootouIK1O9gN m8CZMNJQLy0tJtS+vE39rb5X8hty7GKFFYK3OSPbwlnKo7A+CxHZwpyhDZ1CegqgOWaw 5+KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832920; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iar28XWCjKHLpwhZETdxylE8DjmCp9sM51vAD+CbMx4=; b=p68Wbe7Ps8KElxAMc6uQCoABkTZgTSkGS9sogpFtRy3SuvtycT5VHdzsd/tR/zjmu9 6HI7Ioaw4Odk9aH2BRWwqLBaOJdzd/qZ827mYx2HDmTopaFymjTY3OANHg3WvVSvmu9d U2L1u+td9k4tKvzLa8NFqcxloL3mnpnc5ZahLWqS1CO3ktoEQHcZbYXIk2y69yJ8Fjc5 sMv5k+fR6D0UP89hkTPjo7WSacQRZxqXuhLcnW9mac3KVuCCQjCq44NRWEYM0Mg49TLP 8KO29oHfr3+z/5QvZAoeMHYzoeuvXzp+saUgxYi8ykMkj/RFubl5VFwxl3RcGeVdTmHD Czjg== X-Gm-Message-State: AO0yUKV5mrPW36ahpdScttJBIhxwuUlojtUEcuxGvAbtw9BjBMq/V/JF 6XsLPcQjBQSHmYZrfJQQVMN07Q== X-Google-Smtp-Source: AK7set++LCv3z6jZhGCZ1qC0XUeRSz2J/8tYXg/W1BgSzLeIfdzHc/VAua9lXvRR2mtNB3+lC6cFmg== X-Received: by 2002:a17:902:d4c9:b0:19d:323:e70 with SMTP id o9-20020a170902d4c900b0019d03230e70mr1623087plg.33.1677832919839; Fri, 03 Mar 2023 00:41:59 -0800 (PST) Subject: [PULL 31/59] target/riscv: Use 'bool' type for read_only Date: Fri, 3 Mar 2023 00:37:12 -0800 Message-Id: <20230303083740.12817-32-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833560037100009 Content-Type: text/plain; charset="utf-8" From: Bin Meng The read_only variable is currently declared as an 'int', but it should really be a 'bool'. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-8-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 6a82628749..9264db6110 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3775,7 +3775,7 @@ static inline RISCVException riscv_csrrw_check(CPURIS= CVState *env, RISCVCPU *cpu) { /* check privileges and return RISCV_EXCP_ILLEGAL_INST if check fails = */ - int read_only =3D get_field(csrno, 0xC00) =3D=3D 3; + bool read_only =3D get_field(csrno, 0xC00) =3D=3D 3; int csr_min_priv =3D csr_ops[csrno].min_priv_ver; =20 /* ensure the CSR extension is enabled */ --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833254; cv=none; d=zohomail.com; s=zohoarc; b=P66sOdVqCP1OIg5jUAue4auW2c+m60u8GkmUDGgxCXj05lbY0syxs4mluFUYocAws3al2OeJ2HZLIb/kSWcGAhTXCfABXCNM+w5xPQF0VgvPDvd3eyz3wsnr5Vm5FN0ZnDXVm/pZXpTANNhW8VuhPyob1wm4lej8oBvsYnp4xfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833254; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JeC9UIsIrP9BmX3HUZg1DweVzMp1+h1saYBBS3xuZqw=; b=ke380HQlDvnKBUY0+cIV5zF+D8SEHdkr6TpEcG1dGrmxSvUrfwS4uG58kPZynz2AKpSWJTPwlpmBfDk6r45/TvcFaMo4KCAMA19tTc3aeNhkj/zJ7auVmseaHVv47IpzDuLv6rpyB3glOptV4C7lG2fF19M1YYZZYCQGEYR71aw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833254747785.9266180534261; Fri, 3 Mar 2023 00:47:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zQ-0008F8-P0; Fri, 03 Mar 2023 03:42:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zL-00089S-AJ for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:03 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zJ-0007mo-P3 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:03 -0500 Received: by mail-pj1-x102b.google.com with SMTP id p3-20020a17090ad30300b0023a1cd5065fso1616490pju.0 for ; Fri, 03 Mar 2023 00:42:01 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id z9-20020a63e109000000b004fbd91d9716sm990809pgh.15.2023.03.03.00.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832921; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=JeC9UIsIrP9BmX3HUZg1DweVzMp1+h1saYBBS3xuZqw=; b=lQ2tp3kILmlPTHMwahAWnpfWpRafKzlpw1Rj2YOEEe83L9AESfb885bq54Rwj9quYj N/G8JptlUkqA0yZEl+kRm1hjlzy+7A5drlkYEUYKHQUXpei1RwnzbKrelNcW6nvo2jQ+ AkWsde3xTn7v6U5BsLsffKY9PtN5QCzrWm+YFcQBSn98dLqMfZ2/Qr+v98SDg1g6DB6M u6DSgxnMYgk61afv0lfPGtpGPmrAHY3f7S5GMpOFu3r7NUxYC3pPZle1ZHH51gkAjaH4 7FuaRXsvrmboGfxtq/OsOH/8DkobsfTABA+7a2iDJSH5GQ5DocfKRXA87SUEweAn3XY0 w1yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832921; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JeC9UIsIrP9BmX3HUZg1DweVzMp1+h1saYBBS3xuZqw=; b=BfDBc7E2XlAUphSTyhlCWzJrR0pmelYono1zqEUtCywCMWR9XXA4g4bEPaUEABxgHE hRyG1Xnhmh2yIylrMekkGVRApcC8l7MfQOGgA0DxkbzHzyAjJTaz5NNKorjsF5JCN9QO nF6J41Z7dNQQu+KUEq/gDhwuz2kVUOE3yhqgsaAidbStPgYDcCHf9FSh6bf3xitkvvSW pGGfGlf66rU9QZdEOEk5pnY7iEG3Qx4WC/cwhfFyUJ1F87FQzaJqtwEqOLDUqh5u/o/z lyy6b3xKgfVXsjhl0A/a2pf5tFy3C9gPitSBhRbrMIoq1c0mXL86XtwVYfamlhHpjlXH /kmg== X-Gm-Message-State: AO0yUKVETpPyZ4fl0wRJLb6L5/1LwVW2bqEJ0HK49PH36VRUsxzsQVFp S/7f9j0FEfqUtmQIdhy6zhqw4A== X-Google-Smtp-Source: AK7set9qeJL5QOyz08Yxf06+pz88LeowsMEQXlwC5pyCjtacf/ud6VUCdKJUgQHqB5Wf94C1cqk3tw== X-Received: by 2002:a17:90a:e7c3:b0:236:6dea:8795 with SMTP id kb3-20020a17090ae7c300b002366dea8795mr919973pjb.14.1677832920976; Fri, 03 Mar 2023 00:42:00 -0800 (PST) Subject: [PULL 32/59] target/riscv: Simplify {read, write}_pmpcfg() a little bit Date: Fri, 3 Mar 2023 00:37:13 -0800 Message-Id: <20230303083740.12817-33-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833255890100011 Content-Type: text/plain; charset="utf-8" From: Bin Meng Use the register index that has already been calculated in the pmpcfg_csr_{read,write} call. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-9-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 9264db6110..a3e0e5755c 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3360,7 +3360,7 @@ static RISCVException read_pmpcfg(CPURISCVState *env,= int csrno, if (!check_pmp_reg_index(env, reg_index)) { return RISCV_EXCP_ILLEGAL_INST; } - *val =3D pmpcfg_csr_read(env, csrno - CSR_PMPCFG0); + *val =3D pmpcfg_csr_read(env, reg_index); return RISCV_EXCP_NONE; } =20 @@ -3372,7 +3372,7 @@ static RISCVException write_pmpcfg(CPURISCVState *env= , int csrno, if (!check_pmp_reg_index(env, reg_index)) { return RISCV_EXCP_ILLEGAL_INST; } - pmpcfg_csr_write(env, csrno - CSR_PMPCFG0, val); + pmpcfg_csr_write(env, reg_index, val); return RISCV_EXCP_NONE; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833558; cv=none; d=zohomail.com; s=zohoarc; b=DwJiDXy9KvKbne8evZzNFMeX2eF8bHVVKgASAzwaN8Nyn6bjW1im/zVmcUC74e087kVH6tHulvifXkuCB90QGfi491IkD1+HK87gh282QxNrd7BDjiTZKZJCdf8yPiJ2rIo6Rx/ViBV3m0dmJbsqtpl2MixLJE6zyVFMNr67yAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833558; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ANT6yA8og6cp2JQNgcvNlobtrKvjn+I9WXjZe6xjdC4=; b=QvOK1h8HHrpDxqexBsPJAf53GqU3Hj1B9QG/RLs0OvtMvqktcYnm7ggkXm0JK4Z7E9IqpuLgZsOPKJWwjECKJT1ydsT2YwLgXH+SGsP1LiiYuSC8oh1WI+IjCs2PfU/sEI/Cw2sFbjyDQA7nwP0799R2e0l9KAQZOjPVfT9GLNs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783355805656.332026948020484; Fri, 3 Mar 2023 00:52:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zR-0008JV-U7; Fri, 03 Mar 2023 03:42:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zM-0008A8-JY for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:05 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zK-0007vc-Vd for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:04 -0500 Received: by mail-pj1-x102e.google.com with SMTP id cp7-20020a17090afb8700b0023756229427so5449996pjb.1 for ; Fri, 03 Mar 2023 00:42:02 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id 15-20020a17090a0f0f00b002310ed024adsm678130pjy.12.2023.03.03.00.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832922; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=ANT6yA8og6cp2JQNgcvNlobtrKvjn+I9WXjZe6xjdC4=; b=tqdWQAQMXsh5yVQc6+BuzL+1Dkw1OUiZx9Y+uOLX+ckQWJiyWPCyAids08zQ7CRCgr VT7BaZY42qn+zlzBf7dTKheu6EwDicIxqwIyQ1po3TmXZou5CbxjvtYiSr8q9seljT+z mAbspahSMa7tkvijuqeO+vXUHd8hRN2D6/PqJ5Z6bSSrTDlzm0R2ZsXtpNHy8pvJWhlF kwxJfrZNLt2OK7p5347B5/eq+O/AHuxi0V2xG3jl2aQXQjdHsjaBLyGQxpbaA4ff1cbO 2PMQymV0QaKkaIfUO1eOBC9haiszSpCbG/V5bV9P/Yf3HDXKIK/MqvI4nLf0zBUho9Qy R4LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832922; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ANT6yA8og6cp2JQNgcvNlobtrKvjn+I9WXjZe6xjdC4=; b=VemhtVYN6G0CErmJKFOLdZPCm7BrLALWkEIC7fQ5SdewKkSd9YhbO3tZ5QFmcIiPYe H8w1L5dMMrCRhGT+dNY2q0OlBY957TIXIVikTmQp6S1X14Q4jrXz4BghjUn0UwIOpjjp RW/Sjj9/9MNdo8z6WkSi8+a6KhnAKOMJzzXGCbL9Undko2+HmIg1NUpubOLaTHDy/rSm biMpwCdJADacHrQbN+abGClBFpR0HWOHkcECIo2ZlgIoJqKxUp4Jyx1xXjHPQ4hig5cq MxsiBDD7Q3CB8gYTKz1e3agw0uSCy7Gh0ntaCi/e2yZu2BOa9GOWohFI7yO5vGN6OuDO jspQ== X-Gm-Message-State: AO0yUKVwFTfFphGw3A8TNseZIdyJ0WCUvopD8ybOjRDGWLJWRSa0gTyB GS60If/SibSoN7fV0CCEG9I3PQ== X-Google-Smtp-Source: AK7set/N6XcF6ldW4ZLzt0yvjXIhS5OhVpfnV0qmm11CDtuPdAxMBv0a/5f2gn7P/R0dCXY0WOPunw== X-Received: by 2002:a17:90b:3e8e:b0:233:ee50:d28b with SMTP id rj14-20020a17090b3e8e00b00233ee50d28bmr963340pjb.16.1677832922195; Fri, 03 Mar 2023 00:42:02 -0800 (PST) Subject: [PULL 33/59] target/riscv: Simplify getting RISCVCPU pointer from env Date: Fri, 3 Mar 2023 00:37:14 -0800 Message-Id: <20230303083740.12817-34-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833560037100010 Content-Type: text/plain; charset="utf-8" From: Bin Meng Use env_archcpu() to get RISCVCPU pointer from env directly. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-10-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index a3e0e5755c..8e827362cc 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -46,8 +46,7 @@ static RISCVException smstateen_acc_ok(CPURISCVState *env= , int index, uint64_t bit) { bool virt =3D riscv_cpu_virt_enabled(env); - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 if (env->priv =3D=3D PRV_M || !cpu->cfg.ext_smstateen) { return RISCV_EXCP_NONE; @@ -90,8 +89,7 @@ static RISCVException fs(CPURISCVState *env, int csrno) =20 static RISCVException vs(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 if (env->misa_ext & RVV || cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) { @@ -108,8 +106,7 @@ static RISCVException vs(CPURISCVState *env, int csrno) static RISCVException ctr(CPURISCVState *env, int csrno) { #if !defined(CONFIG_USER_ONLY) - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); int ctr_index; target_ulong ctr_mask; int base_csrno =3D CSR_CYCLE; @@ -166,8 +163,7 @@ static RISCVException ctr32(CPURISCVState *env, int csr= no) #if !defined(CONFIG_USER_ONLY) static RISCVException mctr(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); int ctr_index; int base_csrno =3D CSR_MHPMCOUNTER3; =20 @@ -195,8 +191,7 @@ static RISCVException mctr32(CPURISCVState *env, int cs= rno) =20 static RISCVException sscofpmf(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 if (!cpu->cfg.ext_sscofpmf) { return RISCV_EXCP_ILLEGAL_INST; @@ -321,8 +316,7 @@ static RISCVException umode32(CPURISCVState *env, int c= srno) =20 static RISCVException mstateen(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 if (!cpu->cfg.ext_smstateen) { return RISCV_EXCP_ILLEGAL_INST; @@ -333,8 +327,7 @@ static RISCVException mstateen(CPURISCVState *env, int = csrno) =20 static RISCVException hstateen_pred(CPURISCVState *env, int csrno, int bas= e) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 if (!cpu->cfg.ext_smstateen) { return RISCV_EXCP_ILLEGAL_INST; @@ -363,8 +356,7 @@ static RISCVException sstateen(CPURISCVState *env, int = csrno) { bool virt =3D riscv_cpu_virt_enabled(env); int index =3D csrno - CSR_SSTATEEN0; - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 if (!cpu->cfg.ext_smstateen) { return RISCV_EXCP_ILLEGAL_INST; @@ -918,8 +910,7 @@ static RISCVException read_timeh(CPURISCVState *env, in= t csrno, =20 static RISCVException sstc(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); bool hmode_check =3D false; =20 if (!cpu->cfg.ext_sstc || !env->rdtime_fn) { @@ -1152,8 +1143,7 @@ static RISCVException write_ignore(CPURISCVState *env= , int csrno, static RISCVException read_mvendorid(CPURISCVState *env, int csrno, target_ulong *val) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 *val =3D cpu->cfg.mvendorid; return RISCV_EXCP_NONE; @@ -1162,8 +1152,7 @@ static RISCVException read_mvendorid(CPURISCVState *e= nv, int csrno, static RISCVException read_marchid(CPURISCVState *env, int csrno, target_ulong *val) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 *val =3D cpu->cfg.marchid; return RISCV_EXCP_NONE; @@ -1172,8 +1161,7 @@ static RISCVException read_marchid(CPURISCVState *env= , int csrno, static RISCVException read_mimpid(CPURISCVState *env, int csrno, target_ulong *val) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); =20 *val =3D cpu->cfg.mimpid; return RISCV_EXCP_NONE; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833484; cv=none; d=zohomail.com; s=zohoarc; b=MXNkJ/6GnHQedV/UQ07lsWhZGUHLNQnfjY6C08z5pXA6B+oLLRO3gy+JqUsKUHWYdPnfTzIFx6OOp0MJf/ArUS7TfDzXQ33lBiwfq8Fp8Vkj+DnkvtVDMsbEhdCEx+3usn6eVX42wnxRy/ayTnfP3V/4qRxNq/R75ZL6AJEJciI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833484; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xVge5eYF4AHTDYM9NZKBwRnMkT36zpgg9PzKCyvzH58=; b=doBwxNCevoEvpDCzyuyqtDbnUrKMKSBf9OBvkaGFoJff+wf++FuNSk+LHqioGmGqUZEIil3PJx0dz1VJcUTiBrI/z7PAFL1rWlX8c6DNZHmjlPKyeDev/EYOP8zJPvfdpocVENo0d1TMIYlwc2nCApiEZ+LLNIfi1vcpc3dUtCc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833484012421.6500975532216; Fri, 3 Mar 2023 00:51:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zU-0008Lk-JR; Fri, 03 Mar 2023 03:42:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zN-0008Ac-SH for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:06 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zM-0007n9-9g for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:05 -0500 Received: by mail-pj1-x1035.google.com with SMTP id l1so1811863pjt.2 for ; Fri, 03 Mar 2023 00:42:03 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id 5-20020aa79205000000b00593ce7ebbaasm1018494pfo.184.2023.03.03.00.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832923; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=xVge5eYF4AHTDYM9NZKBwRnMkT36zpgg9PzKCyvzH58=; b=Ov3EgEHhU0h+WUBa1ESpFar3LeckmZHpndVV4bHbCJTzl8OlB6TcMimsq3U61RCZTx FkxvvwIypblqRLTO2ewkE5Q9EafgHXjkuHL0z1WTcaX21vj4WXpsmZfqPM9EZlVhbqZA 4fhrzXQOcMW9jgFbCzzlpItJGFODUkMF1qKqniwXwPXa5GLjTdeEa63aa1FqjizYzqzA HwSFKokUmBKToic5j/LoV9hKaV8dWCmb1Ppsuz92UyBS45zxm4UvcUx4aMtMyEFzdYW+ 2+zgkGrEoGuRmgVWOZjU+W2XWIv3ySzR8wFj1tGRXLRm+lxlWpr8F/x6RRU2j2JoJrFi sQeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832923; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xVge5eYF4AHTDYM9NZKBwRnMkT36zpgg9PzKCyvzH58=; b=bPlPQITPf1Oeq/O6jIpbwsR/t2s09SHEAQ2V3lkqlaH2cFUGYVpo/KOOVBo+N6rskl WkRXomWkJJEY6xh2s9g+Pp36ASkgqpBUOocyD8uNi9r2JMk2u6PIteko04FNf8X+9Old wrMpcfcPP2fJNSa9eH/RwIEudZD6SA2Jf11Y52irP5WPyBU77f2I+46IDZhh3sKPODU/ 5Zal5ZGszqyR2xhsb0zIArtTiTBytMtUdaWJbza0NN65u1/r3/LXcATj/yzJ4j1CLw9Y uzVp0Kf4Nit0+qhzMbyVOIajASTGkwb1eqUWJ0+d3VkOssGcZt+BAHPcRFx9etZNbny6 873Q== X-Gm-Message-State: AO0yUKX60rtLPAex+ZlDBKFLb3+BKDX+GZ2iz3iqzgUyyj28XyKTk256 xLl8J2YcX8zEERRIt1SXsZgHtQ== X-Google-Smtp-Source: AK7set+Vq87ze9oHP7avO2IN8NCAvTCj1zx2H0ZBTateULcwANLS7DvdgJx+wUdARFNExFiDecTZIA== X-Received: by 2002:a05:6a20:1e5a:b0:be:bc70:6810 with SMTP id cy26-20020a056a201e5a00b000bebc706810mr1198489pzb.5.1677832923444; Fri, 03 Mar 2023 00:42:03 -0800 (PST) Subject: [PULL 34/59] target/riscv: Avoid reporting odd-numbered pmpcfgX in the CSR XML for RV64 Date: Fri, 3 Mar 2023 00:37:15 -0800 Message-Id: <20230303083740.12817-35-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833485024100001 Content-Type: text/plain; charset="utf-8" From: Bin Meng At present the odd-numbered PMP configuration registers for RV64 are reported in the CSR XML by QEMU gdbstub. However these registers do not exist on RV64 so trying to access them from gdb results in 'E14'. Move the pmpcfgX index check from the actual read/write routine to the PMP CSR predicate() routine, so that non-existent pmpcfgX won't be reported in the CSR XML for RV64. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-11-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 8e827362cc..7284fd8a0d 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -412,6 +412,15 @@ static int aia_hmode32(CPURISCVState *env, int csrno) static RISCVException pmp(CPURISCVState *env, int csrno) { if (riscv_cpu_cfg(env)->pmp) { + if (csrno <=3D CSR_PMPCFG3) { + uint32_t reg_index =3D csrno - CSR_PMPCFG0; + + /* TODO: RV128 restriction check */ + if ((reg_index & 1) && (riscv_cpu_mxl(env) =3D=3D MXL_RV64)) { + return RISCV_EXCP_ILLEGAL_INST; + } + } + return RISCV_EXCP_NONE; } =20 @@ -3331,23 +3340,11 @@ static RISCVException write_mseccfg(CPURISCVState *= env, int csrno, return RISCV_EXCP_NONE; } =20 -static bool check_pmp_reg_index(CPURISCVState *env, uint32_t reg_index) -{ - /* TODO: RV128 restriction check */ - if ((reg_index & 1) && (riscv_cpu_mxl(env) =3D=3D MXL_RV64)) { - return false; - } - return true; -} - static RISCVException read_pmpcfg(CPURISCVState *env, int csrno, target_ulong *val) { uint32_t reg_index =3D csrno - CSR_PMPCFG0; =20 - if (!check_pmp_reg_index(env, reg_index)) { - return RISCV_EXCP_ILLEGAL_INST; - } *val =3D pmpcfg_csr_read(env, reg_index); return RISCV_EXCP_NONE; } @@ -3357,9 +3354,6 @@ static RISCVException write_pmpcfg(CPURISCVState *env= , int csrno, { uint32_t reg_index =3D csrno - CSR_PMPCFG0; =20 - if (!check_pmp_reg_index(env, reg_index)) { - return RISCV_EXCP_ILLEGAL_INST; - } pmpcfg_csr_write(env, reg_index, val); return RISCV_EXCP_NONE; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833536; cv=none; d=zohomail.com; s=zohoarc; b=HofZwBpwO6caXoNfXx5S1q7Dqu+N9XCWWg9I+xEwJjdobL7Eu5scPeaqqjqhdhifdi+jQSiiGy4PMhq0gm2EADw1XivNd8BtppXCjWTM6EMDixrU62bG+YaSPiJKSRGMZfcfkxC6YlD+g4TaFIKWZiDtxv56ajgQQZDZSuEV/jc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833536; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QrDNSJ01MNe4AZXUogDwvS66/gkFhC+s8KaVpjsj/Go=; b=eTlpy+bZ+uk7Q1JQJIkvtuzzygH55kOAhpEgtHuHmDUMou4SiZNuefklMYD4pFUR4wX3UulGbJEHSJvwRavkshpiJarEWWCpmedkvP4SzBaSL0L6d0E5H4GEhvdlekhcekpwt3i9UfSdOxQuAJ8czXobyYofizo4D0QHRklvdIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833535998538.836125470299; Fri, 3 Mar 2023 00:52:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zU-0008Kk-Dv; Fri, 03 Mar 2023 03:42:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zP-0008Az-6K for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:07 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zN-0007vc-Kj for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:06 -0500 Received: by mail-pj1-x102e.google.com with SMTP id cp7-20020a17090afb8700b0023756229427so5450102pjb.1 for ; Fri, 03 Mar 2023 00:42:05 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id b13-20020aa7870d000000b0058dbd7a5e0esm1028113pfo.89.2023.03.03.00.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832925; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=QrDNSJ01MNe4AZXUogDwvS66/gkFhC+s8KaVpjsj/Go=; b=cY+01czx0GDG0q30miN71rwDnbe+cNDymj71s7DGyMLnhhFtADQ4Mf/jE0uWX17GTP AJjyj4bgPIQI845o4k/5bBBRXwBUl6zuT1wNcj9koa4GMq4uXi3AVur4vHuL6dsBmd2h Z7xPP443EFN+aO6RR9R78ADwprefIvYwJ9yXEjlx57Cumr7M5rlKVWhiC22GT4fS/beR rgMn84uF7dxatN9rxAGQavUO6t9znPDYeqy0Rzf0KYpdrLhVmUjcC9oRnNVZpuejNZ8B X8VacJ9QL7+A32I1yGNFix6aF7dZem9itykOdz7gtwkiI/dKg5n0dBBD73nNVGFiHQdb 0/oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832925; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QrDNSJ01MNe4AZXUogDwvS66/gkFhC+s8KaVpjsj/Go=; b=03pliGHtPkwq26MpGRs9Fkme9wQOhYwRnpILDwefVjeocx9RSdWqp4fpmtvZ+YXuHI fWPSWjyz0+QoJFbKErFGPy3zdjFBxsDi55z1N70s1yADxyxV3OS8BhLo57NGZnbc1uaF opjZtiMBB+Dw+GkRW4AgB+fHHNYKBjrsvVjOElXgEvIPyEpLTIlG6twBwPtmjFWNBB0b hqLGNyQIIQuDZ/+XrE2gJO9xRxkeB3+tU+SQL08OuN8xmONhnQ/6MJEVtJZ//lGELpP8 EJJRutGZTWm/Bd0DYkbel8Lj6KuxYGd491aCK96xLx2KsH4pT5gcj5GqjXdNoVXmBKd6 nwBA== X-Gm-Message-State: AO0yUKVaBzTxEvUeNPIe6962HrwI9h8mvyG7PEbup2vHapqOuIPAv5dr lUuMXBi7Vs8AdBv/nEqFjYvZFGcPbZxKET79 X-Google-Smtp-Source: AK7set8U+HRbMNTXrUD5d4kntWKvfl0yzqKA2SWDZ27fnPtaFV3ZOHACszKb7zshwcj5AVIKjFH+tg== X-Received: by 2002:a05:6a20:65a8:b0:cc:491f:420b with SMTP id p40-20020a056a2065a800b000cc491f420bmr1437459pzh.8.1677832924845; Fri, 03 Mar 2023 00:42:04 -0800 (PST) Subject: [PULL 35/59] target/riscv: gdbstub: Turn on debugger mode before calling CSR predicate() Date: Fri, 3 Mar 2023 00:37:16 -0800 Message-Id: <20230303083740.12817-36-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833537995100003 Content-Type: text/plain; charset="utf-8" From: Bin Meng Since commit 94452ac4cf26 ("target/riscv: remove fflags, frm, and fcsr from= riscv-*-fpu.xml") the 3 FPU CSRs are removed from the XML target decription. The original intent of that commit was based on the assumption that the 3 FPU CSRs will show up in the riscv-csr.xml so the ones in riscv-*-fpu.xml are redundant. But unforuantely that is not true. As the FPU CSR predicate() has a run-time check on MSTATUS.FS, at the time when CSR XML is generated MSTATUS.FS is unset, hence no FPU CSRs will be reported. The FPU CSR predicate() already considered such a case of being accessed by a debugger. All we need to do is to turn on debugger mode before calling predicate(). Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-12-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/gdbstub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 294f0ceb1c..ef52f41460 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -280,6 +280,10 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int= base_reg) int bitsize =3D 16 << env->misa_mxl_max; int i; =20 +#if !defined(CONFIG_USER_ONLY) + env->debugger =3D true; +#endif + /* Until gdb knows about 128-bit registers */ if (bitsize > 64) { bitsize =3D 64; @@ -308,6 +312,11 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int= base_reg) g_string_append_printf(s, ""); =20 cpu->dyn_csr_xml =3D g_string_free(s, false); + +#if !defined(CONFIG_USER_ONLY) + env->debugger =3D false; +#endif + return CSR_TABLE_SIZE; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833303; cv=none; d=zohomail.com; s=zohoarc; b=jEBJSG6WCw2RZY1m97+XciHK9eQJDLuHv2H09Z/EFTxW5V11yeGR8S3+KREvQW4JeKl+HKWgMBvLaql/+tZkt9CVZUj5mVlWwokFmb0yN09FW/aLk+i+FleXAwpjnJlZ1CkmaIJMYQ5Zb9IWmswjeJj6At4W6qPCjXQ7cP8oKmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833303; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PBboFqD/kSBEIR1p31nwYTGVAdZxVLQHofC0o83aLNg=; b=Ey2lu6c8etJkJWzbA1z+6X+SOn3pP722m1Q9Zxlgmlis/fgkibCLdXNwUYIB/bGsZ/fooKcMA61AemLbLqHoz9SAiJYRo8qDMTheeNlZhOBh2r7pMi4aDRORb20jCRCfTkienZZrCQv+jgg58O3dnOtRu2BM0qVS1qUx6p5uIys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833303370776.7061361569124; Fri, 3 Mar 2023 00:48:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zi-00007k-CG; Fri, 03 Mar 2023 03:42:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zQ-0008FN-Gi for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:08 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zO-0007qA-OS for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:08 -0500 Received: by mail-pl1-x62e.google.com with SMTP id u5so1973969plq.7 for ; Fri, 03 Mar 2023 00:42:06 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id a17-20020a170902b59100b001991f07f41dsm952602pls.297.2023.03.03.00.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832926; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=PBboFqD/kSBEIR1p31nwYTGVAdZxVLQHofC0o83aLNg=; b=OCVkaDkvXnlYArcuiotlg1w5PWUPyEz28rRS1lpa+XpvF3qoFBHoJPIDl+Y5b8rE1N xif97/82BwVgRufN/7AN9r2EEZk/X3OEovyVwsVtzT3ipzR+KZQCtMcoOCEk1NzZEJEy /xl4be8J/H+gJNqw3NeOUPb6/x9x0lczK/TQ7fNUce0Jg9wmdlHwrY2mZ/RSqgGufCtb 9FhKzqAP1QPCQdo8YATOXL4TjUl1qShE7fmZ9uq7rVUPa6BULKFV31I1QNeaH3s5lFgg uFbzYwzDZYoTzhI4l4UObR7Zh/9aHe8TsCDSsV+Cfs4uoVg7eq5gKCs6Iz44OkEKLYPU IrgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832926; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PBboFqD/kSBEIR1p31nwYTGVAdZxVLQHofC0o83aLNg=; b=gWSmNIhjV6+AoKPmMSfM4+0J6zW/SiVUR8hYpPntiwS8v1kwrZAxyl06fU976LvPKV OPHB3Szs30khyWAXsqSAAci1R6ifagHjJWPA/87YduD0jbI4Wc9C92YEfNGyn9zT/vLb 3HkxMc49tdB8e2CkenJORBUj1C9ON+SfPxGVKOb+XP14Ji0BUlNFp3IOEwXgzMJmCipr juPUGHfQ9jcmqfVdpxkqeyg4ZZdZzypxtAHTkJrGelfFMF9zQITNLbG2+mSId/EM7H4i J6Rh5B5BnAJbQCCv0i5pRcs7ELypd5hkebmHKeRAsiGmNYGFCBZEXMmpz7POvMkUG+8C yX8g== X-Gm-Message-State: AO0yUKWO77yGnn8ae9i5h3xsgMHqNGcXN2PZJ+ZM3/hEObWpBhIvSY2x MUaxjPx93mRTn4oD96QoqfDUzA== X-Google-Smtp-Source: AK7set9yXCtCADC3lfxxEYaKAIqkY9b2OqkFxn1Sfy8dtJDJwjsTrwJbnvSaKYOgR4pJHBjtNliuiw== X-Received: by 2002:a17:903:187:b0:19e:6d83:8277 with SMTP id z7-20020a170903018700b0019e6d838277mr1516563plg.51.1677832925945; Fri, 03 Mar 2023 00:42:05 -0800 (PST) Subject: [PULL 36/59] target/riscv: gdbstub: Drop the vector CSRs in riscv-vector.xml Date: Fri, 3 Mar 2023 00:37:17 -0800 Message-Id: <20230303083740.12817-37-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833304158100012 Content-Type: text/plain; charset="utf-8" From: Bin Meng It's worth noting that the vector CSR predicate() has a similar run-time check logic to the FPU CSR. With the previous patch our gdbstub can correctly report these vector CSRs via the CSR xml. Commit 719d3561b269 ("target/riscv: gdb: support vector registers for rv64 = & rv32") inserted these vector CSRs in an ad-hoc, non-standard way in the riscv-vector.xml. Now we can treat these CSRs no different from other CSRs. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-13-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/gdbstub.c | 75 ------------------------------------------ 1 file changed, 75 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index ef52f41460..6048541606 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -127,40 +127,6 @@ static int riscv_gdb_set_fpu(CPURISCVState *env, uint8= _t *mem_buf, int n) return 0; } =20 -/* - * Convert register index number passed by GDB to the correspond - * vector CSR number. Vector CSRs are defined after vector registers - * in dynamic generated riscv-vector.xml, thus the starting register index - * of vector CSRs is 32. - * Return 0 if register index number is out of range. - */ -static int riscv_gdb_vector_csrno(int num_regs) -{ - /* - * The order of vector CSRs in the switch case - * should match with the order defined in csr_ops[]. - */ - switch (num_regs) { - case 32: - return CSR_VSTART; - case 33: - return CSR_VXSAT; - case 34: - return CSR_VXRM; - case 35: - return CSR_VCSR; - case 36: - return CSR_VL; - case 37: - return CSR_VTYPE; - case 38: - return CSR_VLENB; - default: - /* Unknown register. */ - return 0; - } -} - static int riscv_gdb_get_vector(CPURISCVState *env, GByteArray *buf, int n) { uint16_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; @@ -174,19 +140,6 @@ static int riscv_gdb_get_vector(CPURISCVState *env, GB= yteArray *buf, int n) return cnt; } =20 - int csrno =3D riscv_gdb_vector_csrno(n); - - if (!csrno) { - return 0; - } - - target_ulong val =3D 0; - int result =3D riscv_csrrw_debug(env, csrno, &val, 0, 0); - - if (result =3D=3D RISCV_EXCP_NONE) { - return gdb_get_regl(buf, val); - } - return 0; } =20 @@ -201,19 +154,6 @@ static int riscv_gdb_set_vector(CPURISCVState *env, ui= nt8_t *mem_buf, int n) return vlenb; } =20 - int csrno =3D riscv_gdb_vector_csrno(n); - - if (!csrno) { - return 0; - } - - target_ulong val =3D ldtul_p(mem_buf); - int result =3D riscv_csrrw_debug(env, csrno, NULL, val, -1); - - if (result =3D=3D RISCV_EXCP_NONE) { - return sizeof(target_ulong); - } - return 0; } =20 @@ -361,21 +301,6 @@ static int ricsv_gen_dynamic_vector_xml(CPUState *cs, = int base_reg) num_regs++; } =20 - /* Define vector CSRs */ - const char *vector_csrs[7] =3D { - "vstart", "vxsat", "vxrm", "vcsr", - "vl", "vtype", "vlenb" - }; - - for (i =3D 0; i < 7; i++) { - g_string_append_printf(s, - "", - vector_csrs[i], TARGET_LONG_BITS, base_reg+= +); - num_regs++; - } - g_string_append_printf(s, ""); =20 cpu->dyn_vreg_xml =3D g_string_free(s, false); --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833558; cv=none; d=zohomail.com; s=zohoarc; b=MGIa90uLQNOJpcchFW3Z/ZoMpVwNuJlgxJWnT9cR4nzXxMYfjxKxzuZ2B5d98+czs4zvRwb6DjH+l2NMzCLhXlSYKvZvLyCTFv8QfGJ1kMpE3YD2aYmfdZ6OmmVFOv0oRGuabMfDXdO9YFGDfB9FbtsIHisX8AKmOwG/57J8ePg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833558; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cVGv5A6n5nDBuoDvZ7Dj19W/tsB8uDWCqYxpjR3oN5A=; b=IiAn0Jn1MoPgbx9Jah71VmBc2qRFXTi1vg83C8NZtgpCXdzdhX5bYuUNxEH9VPk7Cco52lnVTQ4wocbNrzb8bAHkU/3QNhjEa3tzUHHgZ58M3eVEJznc6q1bHcM3bPQMAEOqepey622zaiICIPWSqN57FkSpdqGmHACJCeqG4Y8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833558484600.1996943148032; Fri, 3 Mar 2023 00:52:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zc-0008QC-4l; Fri, 03 Mar 2023 03:42:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zR-0008JP-NZ for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:09 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zQ-0007wn-3J for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:09 -0500 Received: by mail-pj1-x102a.google.com with SMTP id bo22so1785592pjb.4 for ; Fri, 03 Mar 2023 00:42:07 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kw6-20020a170902f90600b0019cad2de86bsm975020plb.156.2023.03.03.00.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832927; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=cVGv5A6n5nDBuoDvZ7Dj19W/tsB8uDWCqYxpjR3oN5A=; b=JM1r19QFyOabMzjhsD3qyNFwASqda9cW79YkUsvFlXT8adlSUbG/2dMtQkutwH7PaQ TbB30qeouPxOimz743dHS+mJNr9pJhDZWcEWYuYQldl2Dr9xFzwWPtfoCXFjbg1RjEV8 VF0E9qkobrMc8q5ibXwb70CrG90CicZ65TlG9oIlsUZl81vCXzEUrcuYD3//Ou5OtfCJ yEj9JXyCy499q1c1K1nlqC/lSxOLQu8XL4UJBgfCzpSg8TJKbUckJlHIN4/EcACxLYlb QhGHlkHlZQDizO0Wr6ssvdp2Jn/B0TjXKUnwHtYajDpKQuTcM9ClGMSCdYgbPzPcL3F3 qwBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832927; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cVGv5A6n5nDBuoDvZ7Dj19W/tsB8uDWCqYxpjR3oN5A=; b=ggur+4NGCFd5iRbEa3pUEZILeRPzH6PknOldx6uL9Gce8PcCqXw3wTdPpjLTDPJF1M IkdtWkcyQwL8LqU+ljEMp6jshipv18wsJcevAnL4l9xWRaWrFcsLeaJSJGDp/UMSNwte tXPXVdEZM9ZXwVtpnJlD2RhAhnpdCDWWgk19nHg2QNQMFhZCv+hbsAgwmv5nD5Hjr53/ LW7UoH26ffavSM3VYtjqYoCS/kEO14LDMbiiitEpbG2bxVVJd4NNNNIoqmKyZ1Y2zzDf EICCkSNROzAfjHwDnJEXiP/Ihc2JvTHcSQIVEnPeep97bsQ5DSIkaxI0cYFo8MwxFlSa TpLA== X-Gm-Message-State: AO0yUKXbNmSqm9wxFcEaFyMNsnAggI/OG0IAbaXw/URPmPnWn1TbQ5Af WCDeDjXnLcTr/luAehJdcvL0JQ== X-Google-Smtp-Source: AK7set/Hc1iLzH5tVm2dNh6nfSbGwv9Rw0alwxbYUIfNxjsAioejBHdSsljGSNHeurOdhnMxjrq2FQ== X-Received: by 2002:a17:90b:3e8c:b0:237:85e5:3294 with SMTP id rj12-20020a17090b3e8c00b0023785e53294mr922194pjb.20.1677832927239; Fri, 03 Mar 2023 00:42:07 -0800 (PST) Subject: [PULL 37/59] target/riscv: Allow debugger to access user timer and counter CSRs Date: Fri, 3 Mar 2023 00:37:18 -0800 Message-Id: <20230303083740.12817-38-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833560064100012 Content-Type: text/plain; charset="utf-8" From: Bin Meng At present user timer and counter CSRs are not reported in the CSR XML hence gdb cannot access them. Fix it by adding a debugger check in their predicate() routine. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-14-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 7284fd8a0d..10ae5df5e6 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -131,6 +131,10 @@ static RISCVException ctr(CPURISCVState *env, int csrn= o) =20 skip_ext_pmu_check: =20 + if (env->debugger) { + return RISCV_EXCP_NONE; + } + if (env->priv < PRV_M && !get_field(env->mcounteren, ctr_mask)) { return RISCV_EXCP_ILLEGAL_INST; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833302; cv=none; d=zohomail.com; s=zohoarc; b=NnvNMWaBpksKqxQepsN5JTcSvkliCQmX2ql3kpcBM/7g2thknhrRFpNS0tDGK9cSAx5WGoFbL1EA+T9o/JHths2YmE/oiHqAkRkEmSMQ88NQXkZ5KUhiPQ1D4jsAz7hcdCOjSjUVfdSN8j4BQ7sa7bsiXq4hKBdvYbiPzkoC3OA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833302; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FJ3kazGOVFLnf4MghwTEirDnBq83iazSIg0TJyibaMc=; b=AgiTd/Cwnil7pTeoku9c1kB2pPqhhvGWP+nEUNarwXbCyor1YXAGO4ONgEp3fhMZj/L8rMdbaj+24P/nOIE1QvqGJ0aq1ubt9kQ3pX/gzmtEjM3oTAJtmZHwWxliWu1J6eeSUJdFo+yQoiE4NzRiGE8knx/OxrjtA1l2n9cCsgs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833302151795.0215250232302; Fri, 3 Mar 2023 00:48:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zi-00006l-5q; Fri, 03 Mar 2023 03:42:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zS-0008Kb-Ku for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:11 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zR-0007yS-5n for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:10 -0500 Received: by mail-pl1-x629.google.com with SMTP id p20so1938264plw.13 for ; Fri, 03 Mar 2023 00:42:08 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id w19-20020a17090aaf9300b00229bc852468sm2934170pjq.0.2023.03.03.00.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832928; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=FJ3kazGOVFLnf4MghwTEirDnBq83iazSIg0TJyibaMc=; b=hnKMQUuVoWneCpN53EdiLiUuq+qqkbkG+lYAy8NtU1mGV8pQm62oN1JJMP9JvKBTLl loPPCn7QbfyIXy9zi2UKbFlHGQlATi+ShifJlzETPyVqb/KaDfCh7HioTUylblkqvg84 Yn8wTkSO7zsRLbTatKDDuA32/UWZo+AFGnbd916MIflMB4G4ZNCER58zwB50kmk7G3gn yOioWd8wNRvFR00FBnTZr8sMj21Zgx2c7Pijf8HnvQ2BRYge1TVR3bfZPAC+GlIvpTZb mdUd2kb06CDcdOcMvPxrlU+mI1LaFHZrAlVRlq5S1wXo7PXuNAIBZb+1i5//toT/KQWi 6VHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832928; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FJ3kazGOVFLnf4MghwTEirDnBq83iazSIg0TJyibaMc=; b=ElWUwCzDuHxPCMovPBEgqjoqfCgfhCV8J/H/rHBS+bSNDnyLih0H5VUZeUhGZn6Lrx WLlCmlnip03fnuVeUDfhfTRJkl6LY+/apSkFPtIWS12W2Muuu1CGgA/fkfwTac03y+xG onks6st84tJAhvSckMCvRX5+PFGutuMW+0qNo8ixxGLaagNI2MgoJJz/UfkzT+QEa4xI Yiln4rbPzlFfDreq0inkFtycdtOQRd5stXcEQaorPNw2FH9O8rzUUWuprFqmydKld22R AN1drPeSzkkZDSsrM1aGChdxvQGb/dIajGhNn84gbANWSa2J4q8ZwdpeoDlYRZw35YqV yuqg== X-Gm-Message-State: AO0yUKWqRBdNrwZBMef0ZlIsvHAb85tBqMbr0pIJIlFQX+FMlaIpQXQ7 HFqNvdzwudCb6WVCMZRLHw5E0w== X-Google-Smtp-Source: AK7set+b00eHBhEdehWuyWQvxlIt6cisRGFxsZUgBNsLei8ii2CuahMvOU/EfitfhBIWxj+WB74CFw== X-Received: by 2002:a17:90b:4acd:b0:236:a3c2:168a with SMTP id mh13-20020a17090b4acd00b00236a3c2168amr888247pjb.33.1677832928439; Fri, 03 Mar 2023 00:42:08 -0800 (PST) Subject: [PULL 38/59] target/riscv: Allow debugger to access seed CSR Date: Fri, 3 Mar 2023 00:37:19 -0800 Message-Id: <20230303083740.12817-39-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833304145100010 Content-Type: text/plain; charset="utf-8" From: Bin Meng At present seed CSR is not reported in the CSR XML hence gdb cannot access it. Fix it by adding a debugger check in its predicate() routine. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-15-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 10ae5df5e6..15b23b9b5a 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -459,6 +459,10 @@ static RISCVException seed(CPURISCVState *env, int csr= no) } =20 #if !defined(CONFIG_USER_ONLY) + if (env->debugger) { + return RISCV_EXCP_NONE; + } + /* * With a CSR read-write instruction: * 1) The seed CSR is always available in machine mode as normal. --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833421; cv=none; d=zohomail.com; s=zohoarc; b=GhYFlYgWejuBzwWX3pSvL6LvssOlfKVJL17kM8ZluU/VLUxBlGNIibONMoR9j6Elvz53KxZFn46CBEj4C/eG560fUf9qp9XKTOx8JTi4dlFN40q4SdAtOsysSHsHTDcgY117Z4tIBxzUZC/24tEsA57vpmzpZOeVcDGKHxRPdIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833421; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aE/CF2t05zhOlTcgA6pdglWjLf3mWNbikxW4FBHcrTU=; b=CanEc76PI7fD4BVfwoFuWNe+YHWYBB+ycYR6SQuYRsu9tBorsqiNBmww5y+ELv2lx9llnAnO7aasZ4pzEfusaeqrllMyJCR1pNdA1N8Sa0LJ1UDdEOv38bmy0SLtDI/D/+PyQ2h/GFCiy+flM25/bFoFT3YGUeN25Zy975NhnwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833421509729.0016709521266; Fri, 3 Mar 2023 00:50:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0za-0008Ol-1U; Fri, 03 Mar 2023 03:42:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zU-0008Kp-CZ for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:12 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zS-00083X-T2 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:12 -0500 Received: by mail-pl1-x635.google.com with SMTP id ky4so2002187plb.3 for ; Fri, 03 Mar 2023 00:42:10 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kb8-20020a170903338800b00194d14d8e54sm978032plb.96.2023.03.03.00.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832929; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=aE/CF2t05zhOlTcgA6pdglWjLf3mWNbikxW4FBHcrTU=; b=gERCMg1jtI6Uns9QUZaIb+5c8QyHueede6Sv9kRyve/gUf63rc/vHhkk7Yoi+jwVhB ZXtORWW/FZdSuwh+RLjQsYWRKpWNilqL8oUFWDpj0XaEfP6xZPNEcyzT7uQZKtXeR+H9 WSXVkP7RxNphoQUEoSv0KlbnvyPyS/T71T6G3Z7HlAJqa+6W169bJUFHtt/KNcveK9yI tAmGcBqewQfnUY71gM4MrspoE+4emklhFOtBKlDHbLwhO0/kD7pNg9UD6DrHUJdaoe7v YMwAm+oJwDHQvkASb4H++Mz9TRrPr1afzYQwGTQOOBQr+JU7fds3PY85n+GH/tvYAemH PQyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832929; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aE/CF2t05zhOlTcgA6pdglWjLf3mWNbikxW4FBHcrTU=; b=ibNVz6PONlMlzAAd9jh7vMr1OiFZ3lkEhKxfQP+XEWLgekL6LSR/4u9h6jd7Thg/B9 ioHOyaHKJq55MUKsMsEFALVqxJAuyZ9hDOl6VsMREksg2+OVqswfoZvD1pUx/JNThFPR VshcVzcwBN1Lqc7EwXvTxwtOb9vLO0fRPB35Zn9eUCUwV0MFPdJo/pLXYySd+CFBscTb ie1na8xqKzkthVXRl1cGuc+VJ8VOCbm94i3y7X8V0+lbAj0+uHHZSv2zX8Uj//vem+Z5 8MUrj3OMT1KCe31RNFWmu5/HOU3pOig1QcPAq6nkuTjeKZt5aqFK8+hPcndZS6/U80uX r0JA== X-Gm-Message-State: AO0yUKXoTVw9IOGj4kWHieWRdQVE5ou8C/VDSYI1g/qXJwoX3BQtY99t SirbVOHQWQWmotB6WUDQb/35bQ== X-Google-Smtp-Source: AK7set8s3EUVXFdmEyaqAd9enpocrY6KYbEfO78PxU1Nm9tCmhPtwK4CJDlfD/o5K5Iyyvth8waqtQ== X-Received: by 2002:a17:902:db0f:b0:19e:7a2d:19f2 with SMTP id m15-20020a170902db0f00b0019e7a2d19f2mr1747928plx.19.1677832929621; Fri, 03 Mar 2023 00:42:09 -0800 (PST) Subject: [PULL 39/59] target/riscv: Allow debugger to access {h, s}stateen CSRs Date: Fri, 3 Mar 2023 00:37:20 -0800 Message-Id: <20230303083740.12817-40-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833422684100005 Content-Type: text/plain; charset="utf-8" From: Bin Meng At present {h,s}stateen CSRs are not reported in the CSR XML hence gdb cannot access them. Fix it by adjusting their predicate() routine logic so that the static config check comes before the run-time check, as well as adding a debugger check. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Message-ID: <20230228104035.1879882-16-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 15b23b9b5a..a0e70f5ba0 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -337,13 +337,22 @@ static RISCVException hstateen_pred(CPURISCVState *en= v, int csrno, int base) return RISCV_EXCP_ILLEGAL_INST; } =20 + RISCVException ret =3D hmode(env, csrno); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + if (env->debugger) { + return RISCV_EXCP_NONE; + } + if (env->priv < PRV_M) { if (!(env->mstateen[csrno - base] & SMSTATEEN_STATEEN)) { return RISCV_EXCP_ILLEGAL_INST; } } =20 - return hmode(env, csrno); + return RISCV_EXCP_NONE; } =20 static RISCVException hstateen(CPURISCVState *env, int csrno) @@ -366,6 +375,15 @@ static RISCVException sstateen(CPURISCVState *env, int= csrno) return RISCV_EXCP_ILLEGAL_INST; } =20 + RISCVException ret =3D smode(env, csrno); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + if (env->debugger) { + return RISCV_EXCP_NONE; + } + if (env->priv < PRV_M) { if (!(env->mstateen[index] & SMSTATEEN_STATEEN)) { return RISCV_EXCP_ILLEGAL_INST; @@ -378,7 +396,7 @@ static RISCVException sstateen(CPURISCVState *env, int = csrno) } } =20 - return smode(env, csrno); + return RISCV_EXCP_NONE; } =20 /* Checks if PointerMasking registers could be accessed */ --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833254; cv=none; d=zohomail.com; s=zohoarc; b=c+3R4mm01TWRcx78qPTnsuurZuyGA+mg1e1ah2NKJA1/bneGI4Z9SVI2KU4fIljPj8F1Si4M9q47J7m5KXbf8f57EfWUYpXdLjRj5DJmwlMlfScccfbIaXXole/DJ9kuVfEMfbewzHKqWN6iZfzZvjeK76UJ8NAJ89/yNDsxDpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833254; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u6fyKisPdjjsilTntlaBwsWAkLGaTDh+b2bnlD1SK5I=; b=X/9Vh7z6AQ0ycGRav/iO1mAOTxMMyqw2w7MmqB8Zy8ZaEyBaEgZtDI4RAO6iBFLX46k76ICNNpxfahOGll3MNkYQB1WpbohWw7J3187FFYgoEdbN9+U7wOsocRVwIendxDYCmRPszjQ0aEulm+NP0utBnhXcA2G7m12ECQlNGuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833254088601.9129047339044; Fri, 3 Mar 2023 00:47:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zi-00007i-8o; Fri, 03 Mar 2023 03:42:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zW-0008Nj-Cg for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:14 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zT-0007m8-W3 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:13 -0500 Received: by mail-pj1-x102e.google.com with SMTP id kb15so1814798pjb.1 for ; Fri, 03 Mar 2023 00:42:11 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id s26-20020a63215a000000b005034a57b963sm957276pgm.58.2023.03.03.00.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832931; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=u6fyKisPdjjsilTntlaBwsWAkLGaTDh+b2bnlD1SK5I=; b=2c/B/xXbeDjVkEFRtJUhMazvt2HWeMfzrAuYb9BGrjAwNeQQRTPQ6yhf9UuhiaZgm1 ywQ4OsQx/hBgQsM0ij1hWaYFzlNxEvKsnBUVaxsD58ljAV6ZyQscuUc9UN3RIamHLK2i v5XfiHwLiOqUvJAk2kaBWPlPxHSpW685G/WidwJsh4W4sXexL3Sh7a8O0J0EprFNa4zJ eobGitIrhZspi94kL0RvUAnMqilAyq3mPbZcmboFhTq5522ynB0YCSAjMrVAnHoRhAVK jYvWGK6kiNI+KdDU42IEsNo5Ey39TuuyOwPb54GVqPRW0d0t4pRbm8E0Xa/ShRRz//R6 54Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832931; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u6fyKisPdjjsilTntlaBwsWAkLGaTDh+b2bnlD1SK5I=; b=INjyPJSm4XiTxYfroXlTWCvgWWMToEEJSgwweup8NT5TBWwGQZPwRwVEJYqZaKHzH5 9yDwq5ECITIpIhgnZpcw+H0NGCSWlMSKIhomUM1Va8b8AS8NfPldcDIZcD/Y7R6fA5h2 yqfN8sdOZ9J+yEJgK2KFEye+orSzSJAGSWsVwufWKIyZV6naWQjveFF62cUqDdVwPEi4 XHSVWxEYgWHQFnhp5Dz3SQZjVgH4LdyQK+moeX3k266gmBTtSRVWBW/bH9RcF4rzKYnM lQnxJiBeZ481vNXzf2T20EmTyyytmaclKd2VN1FUO8GELpy31/hzGO1mWwaFNalwHdOp idVQ== X-Gm-Message-State: AO0yUKV1rPenfX0BAyTatMxWNEOLK/MPdLpoCIcEHrUUEbjgTl5t6b8N DCF6W3dKAIo8tgJC6224p4q9BA== X-Google-Smtp-Source: AK7set+Tk4Fz9yLdiHMWciN4CxZbTktjDwfcyN1W1+inW8EeuBaJJO623cTOk+eouH5nwLroOkg80w== X-Received: by 2002:a05:6a20:394b:b0:b8:c6ec:a269 with SMTP id r11-20020a056a20394b00b000b8c6eca269mr1696566pzg.16.1677832931244; Fri, 03 Mar 2023 00:42:11 -0800 (PST) Subject: [PULL 40/59] target/riscv: Allow debugger to access sstc CSRs Date: Fri, 3 Mar 2023 00:37:21 -0800 Message-Id: <20230303083740.12817-41-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833255898100012 Content-Type: text/plain; charset="utf-8" From: Bin Meng At present with a debugger attached sstc CSRs can only be accssed when CPU is in M-mode, or configured correctly. Fix it by adjusting their predicate() routine logic so that the static config check comes before the run-time check, as well as adding a debugger check. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Message-ID: <20230228104035.1879882-17-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index a0e70f5ba0..020c3f524f 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -952,6 +952,19 @@ static RISCVException sstc(CPURISCVState *env, int csr= no) return RISCV_EXCP_ILLEGAL_INST; } =20 + if ((csrno =3D=3D CSR_VSTIMECMP) || (csrno =3D=3D CSR_VSTIMECMPH)) { + hmode_check =3D true; + } + + RISCVException ret =3D hmode_check ? hmode(env, csrno) : smode(env, cs= rno); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + if (env->debugger) { + return RISCV_EXCP_NONE; + } + if (env->priv =3D=3D PRV_M) { return RISCV_EXCP_NONE; } @@ -972,11 +985,7 @@ static RISCVException sstc(CPURISCVState *env, int csr= no) } } =20 - if ((csrno =3D=3D CSR_VSTIMECMP) || (csrno =3D=3D CSR_VSTIMECMPH)) { - hmode_check =3D true; - } - - return hmode_check ? hmode(env, csrno) : smode(env, csrno); + return RISCV_EXCP_NONE; } =20 static RISCVException sstc_32(CPURISCVState *env, int csrno) --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833641; cv=none; d=zohomail.com; s=zohoarc; b=GmYo3IUtY7gdQ5GZuGqjvIxSXYr79oxHik40ArK8AEVMEV5lkSiFJG7DS4+SbWAWr67WLG3EN4c7wI94DDoKrMLMHztC7ehE6VGiOKeo43TDEPvhIKdCnzGvebZZXiX3s13/A78H80HpRF1kkJgD/fmTnZmez5KoSGplLgtrh1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833641; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NwSaqIljDGqRHOmYCGFY9iTgR6Kz3jS20l1Meea2Ofo=; b=J7s3jEk31h7hV1kEgq6tntTLnlXcrwSpoC+oxdznivcr8+iSTAqjPlvmhQ0Nm9o4IDmk2d7mTJ5L1SI68/VK9m4uic0HfxK9HLpIx3GAr2EJCFI+UvFkxdp6KsXglUhzti94fI/7Fzsa/rJyal1Yht13GgpOH0g73/Z/zP+2dMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16778336416261006.1291508846227; Fri, 3 Mar 2023 00:54:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zj-0000AK-5q; Fri, 03 Mar 2023 03:42:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zX-0008OX-Ji for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:16 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zW-0007t6-48 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:15 -0500 Received: by mail-pj1-x1033.google.com with SMTP id y2so1791639pjg.3 for ; Fri, 03 Mar 2023 00:42:13 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id ky8-20020a170902f98800b0019337bf957dsm947794plb.296.2023.03.03.00.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832933; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=NwSaqIljDGqRHOmYCGFY9iTgR6Kz3jS20l1Meea2Ofo=; b=Ivlee9R/JpZSB0ANxueb5frIRClksxLPymUxXTqpGu4k71xz/wYqcnBzw0g4afb9uk YcQ74QFWAu0IepXy3aWRo6415a5UkDLJXvgKxLToYWLcZCaB3cS50N0n1MgZIm5oAKGb JRA3IVSwUS6cugZpTSUv9R+6B1oLT2rUs1/5OI0EMew95L3ugxRBViVZKuXlw5sLbWk6 HIHHl6ZG+AnMLwmIA7REafb/rzIMkPbqs8zyhRr73ENFerY8z/iKXqXS8zYznIcrtJaT hxDDdaIHPK9cB07ZpL/ty0ngXSjAJzTxAZDhULHy34l4/b2ibCfAa9ILN1i65wTcXScG NmCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832933; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NwSaqIljDGqRHOmYCGFY9iTgR6Kz3jS20l1Meea2Ofo=; b=pqnsShzfNL++zKsNbEEnimISrO9K/aEyWta6DQRcCOwdN2slWpx8bJrYlGBNxIoA5o pkr26JTxnQFNu0LF4XK6N3RuA8L/xIIRV/skg4n0PzmnsIiPstYMEHOGbZ+Ht0HgckOF PxaonTfmTcVW0vYLQ6BriL7zGF+qNW6QfE3PR7DpaTgJHXNJ4Ll9W88GPF54u1FApq6n pEBP4Y3iC8uC+fi79fpFcfhQAjy/2ie7lAAxo2Xi1GCNYVGG0iVMYXMij+A7qJaECHsH tnsE4bMPeBLcfZ5mO6Vv3f+XwJm8seuCeaOAMUpaGmWgyPACQ+kXCMyfGex+GeF5K5uF MUcg== X-Gm-Message-State: AO0yUKX4RLUVDy/tBcmOAwekIW/WQvonrdlMpul91PTZSJmJ+U/WIw11 54vooEkPdTEyiNnM5aGA/YhUMA== X-Google-Smtp-Source: AK7set87CisatLFGQv8au15xAgHz3rwBLV6fSFMPK4TtAj9/u2kQpNjuUgbWWZYFy5Z2CbwTNtWr3A== X-Received: by 2002:a17:902:eb8b:b0:19e:6afd:86eb with SMTP id q11-20020a170902eb8b00b0019e6afd86ebmr1065861plg.56.1677832932706; Fri, 03 Mar 2023 00:42:12 -0800 (PST) Subject: [PULL 41/59] target/riscv: Drop priv level check in mseccfg predicate() Date: Fri, 3 Mar 2023 00:37:22 -0800 Message-Id: <20230303083740.12817-42-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833642463100007 Content-Type: text/plain; charset="utf-8" From: Bin Meng riscv_csrrw_check() already does the generic privilege level check hence there is no need to do the specific M-mode access check in the mseccfg predicate(). With this change debugger can access the mseccfg CSR anytime. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Message-ID: <20230228104035.1879882-18-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 020c3f524f..785f6f4d45 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -451,7 +451,7 @@ static RISCVException pmp(CPURISCVState *env, int csrno) =20 static RISCVException epmp(CPURISCVState *env, int csrno) { - if (env->priv =3D=3D PRV_M && riscv_cpu_cfg(env)->epmp) { + if (riscv_cpu_cfg(env)->epmp) { return RISCV_EXCP_NONE; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833089; cv=none; d=zohomail.com; s=zohoarc; b=OibZCz79Au9VXeEmRlzmiu3DpZq4pFaw4Zu8y46Bksv3eVoehMftXCRs0HMpuhJpa+jon3pAxGeKATD8QCLZRjp8dxzkNUOrR12M81ADCU4Cf3OqLlwb74PpCKqe5vOHL+eNYKQyKke31k7LVsQ7aU8grxDjd90kVcOfYAlZQ7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833089; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HHuyOCh1zMm0s3QvDd4RzkwJUE9fBUpcK5wFEakP9Oo=; b=ZK5W/uF3GwSd/yzpfyCmspyR0zVzWXlm5XqfBkBWpPmFsC4wqZxhyuyx7D+B8OlkIkiMWHtBlF0T/z2psHdaTebyQEQp8YZMZQZfagBLzvq5YmH1h0/n2kVa3UuNdM2V555OhOP+/JV7HSip/mbXP4qmT8u2vmDZbO6TzoI64zM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833089033936.6733374895168; Fri, 3 Mar 2023 00:44:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zp-0000mP-GB; Fri, 03 Mar 2023 03:42:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zZ-0008Op-4C for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:17 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zW-0007xz-Nr for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:16 -0500 Received: by mail-pj1-x102b.google.com with SMTP id l1so1812160pjt.2 for ; Fri, 03 Mar 2023 00:42:14 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kj16-20020a17090306d000b0019a97f180fcsm983364plb.37.2023.03.03.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832934; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=HHuyOCh1zMm0s3QvDd4RzkwJUE9fBUpcK5wFEakP9Oo=; b=3qheq1kH2eYv2wGqvNGulyD4S30tGIzmK4iac6YR5tyhn141UMGHyQZ1LLH+SfGDPI T5wuu3j5jcs7GUPfQlrZFhNs9l8B9fHHlCfEo0EdBMHn6ui3AfCi4CGY6GUSEC528mQ1 8AvBYNfN3x7CFwL/3W+LyPwKgcTEp+42cWDfTauBhMmwEFX68hc/9ojuMsdJEKYiTx/P 8DAqlRfs74NnnRJzlvknMtmdod2fZJJF48cC/XxhiORVGL6EtF6b1t/DN6IJLgPbqWDr h7lw/VqHibBUTH2m18kUFd26/RDIBLplpuR4LcVXW3OjWT3/fP7bI3fxv2qLKJIjPfe7 3ATQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832934; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HHuyOCh1zMm0s3QvDd4RzkwJUE9fBUpcK5wFEakP9Oo=; b=AIO4292cRCche9fx5NLZ1CH4f6Uk+Ojb11t2zHY4u4/x2SyRBGMJmZftGdvZoqqp8P 9icRY6exMvJeYkZKMWKlb5NJerVGcSqfUhkf6fOrmDvlvFxOWww2+i5iRpwu+9TlC8Su vRdUHY83eTkvQn1MdgcRv5OKhApOf3rFHLK2G7XMe6n0BrnskQ/T/XRE25/rtruFFTiP LDkBSXygU2UEdMwPJ0nPbJzaX+E+BdIBLlk92VZjwDQKELhMs7KuoaNHI9W19wJ5r5YF Mw52tXWTQ7/41taEPGEKHBCwK3H0Mf7X/hdCECO8AN9w7DYj/kh1YzPe2PGDWFz8ZNVX QU/Q== X-Gm-Message-State: AO0yUKUSGtpl8qg66FC6IhmJh+gsOs11iY3LHZeRvJWcZsoclRmMNBpg jQX27qmMDQNUfnvZZw+McShxWPNXY2HqSsoj X-Google-Smtp-Source: AK7set/9x7yYM+Gy1hF4pgydKEL1ydN4Kw21W4tfchPbt1LldiG8Ggy45WX0Wl5SXUEa3OkMC3+WqA== X-Received: by 2002:a17:90a:bc85:b0:237:aade:444 with SMTP id x5-20020a17090abc8500b00237aade0444mr819449pjr.42.1677832933952; Fri, 03 Mar 2023 00:42:13 -0800 (PST) Subject: [PULL 42/59] target/riscv: Group all predicate() routines together Date: Fri, 3 Mar 2023 00:37:23 -0800 Message-Id: <20230303083740.12817-43-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Weiwei Li , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833091124100007 Content-Type: text/plain; charset="utf-8" From: Bin Meng Move sstc()/sstc32() to where all predicate() routines live, and smstateen_acc_ok() to near {read,write}_xenvcfg(). Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Message-ID: <20230228104035.1879882-19-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 177 ++++++++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 90 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 785f6f4d45..3a7e0217e2 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -40,42 +40,6 @@ void riscv_set_csr_ops(int csrno, riscv_csr_operations *= ops) csr_ops[csrno & (CSR_TABLE_SIZE - 1)] =3D *ops; } =20 -/* Predicates */ -#if !defined(CONFIG_USER_ONLY) -static RISCVException smstateen_acc_ok(CPURISCVState *env, int index, - uint64_t bit) -{ - bool virt =3D riscv_cpu_virt_enabled(env); - RISCVCPU *cpu =3D env_archcpu(env); - - if (env->priv =3D=3D PRV_M || !cpu->cfg.ext_smstateen) { - return RISCV_EXCP_NONE; - } - - if (!(env->mstateen[index] & bit)) { - return RISCV_EXCP_ILLEGAL_INST; - } - - if (virt) { - if (!(env->hstateen[index] & bit)) { - return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; - } - - if (env->priv =3D=3D PRV_U && !(env->sstateen[index] & bit)) { - return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; - } - } - - if (env->priv =3D=3D PRV_U && riscv_has_ext(env, RVS)) { - if (!(env->sstateen[index] & bit)) { - return RISCV_EXCP_ILLEGAL_INST; - } - } - - return RISCV_EXCP_NONE; -} -#endif - static RISCVException fs(CPURISCVState *env, int csrno) { #if !defined(CONFIG_USER_ONLY) @@ -399,6 +363,60 @@ static RISCVException sstateen(CPURISCVState *env, int= csrno) return RISCV_EXCP_NONE; } =20 +static RISCVException sstc(CPURISCVState *env, int csrno) +{ + RISCVCPU *cpu =3D env_archcpu(env); + bool hmode_check =3D false; + + if (!cpu->cfg.ext_sstc || !env->rdtime_fn) { + return RISCV_EXCP_ILLEGAL_INST; + } + + if ((csrno =3D=3D CSR_VSTIMECMP) || (csrno =3D=3D CSR_VSTIMECMPH)) { + hmode_check =3D true; + } + + RISCVException ret =3D hmode_check ? hmode(env, csrno) : smode(env, cs= rno); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + if (env->debugger) { + return RISCV_EXCP_NONE; + } + + if (env->priv =3D=3D PRV_M) { + return RISCV_EXCP_NONE; + } + + /* + * No need of separate function for rv32 as menvcfg stores both menvcfg + * menvcfgh for RV32. + */ + if (!(get_field(env->mcounteren, COUNTEREN_TM) && + get_field(env->menvcfg, MENVCFG_STCE))) { + return RISCV_EXCP_ILLEGAL_INST; + } + + if (riscv_cpu_virt_enabled(env)) { + if (!(get_field(env->hcounteren, COUNTEREN_TM) && + get_field(env->henvcfg, HENVCFG_STCE))) { + return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + } + + return RISCV_EXCP_NONE; +} + +static RISCVException sstc_32(CPURISCVState *env, int csrno) +{ + if (riscv_cpu_mxl(env) !=3D MXL_RV32) { + return RISCV_EXCP_ILLEGAL_INST; + } + + return sstc(env, csrno); +} + /* Checks if PointerMasking registers could be accessed */ static RISCVException pointer_masking(CPURISCVState *env, int csrno) { @@ -943,60 +961,6 @@ static RISCVException read_timeh(CPURISCVState *env, i= nt csrno, return RISCV_EXCP_NONE; } =20 -static RISCVException sstc(CPURISCVState *env, int csrno) -{ - RISCVCPU *cpu =3D env_archcpu(env); - bool hmode_check =3D false; - - if (!cpu->cfg.ext_sstc || !env->rdtime_fn) { - return RISCV_EXCP_ILLEGAL_INST; - } - - if ((csrno =3D=3D CSR_VSTIMECMP) || (csrno =3D=3D CSR_VSTIMECMPH)) { - hmode_check =3D true; - } - - RISCVException ret =3D hmode_check ? hmode(env, csrno) : smode(env, cs= rno); - if (ret !=3D RISCV_EXCP_NONE) { - return ret; - } - - if (env->debugger) { - return RISCV_EXCP_NONE; - } - - if (env->priv =3D=3D PRV_M) { - return RISCV_EXCP_NONE; - } - - /* - * No need of separate function for rv32 as menvcfg stores both menvcfg - * menvcfgh for RV32. - */ - if (!(get_field(env->mcounteren, COUNTEREN_TM) && - get_field(env->menvcfg, MENVCFG_STCE))) { - return RISCV_EXCP_ILLEGAL_INST; - } - - if (riscv_cpu_virt_enabled(env)) { - if (!(get_field(env->hcounteren, COUNTEREN_TM) && - get_field(env->henvcfg, HENVCFG_STCE))) { - return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; - } - } - - return RISCV_EXCP_NONE; -} - -static RISCVException sstc_32(CPURISCVState *env, int csrno) -{ - if (riscv_cpu_mxl(env) !=3D MXL_RV32) { - return RISCV_EXCP_ILLEGAL_INST; - } - - return sstc(env, csrno); -} - static RISCVException read_vstimecmp(CPURISCVState *env, int csrno, target_ulong *val) { @@ -1944,6 +1908,39 @@ static RISCVException write_menvcfgh(CPURISCVState *= env, int csrno, return RISCV_EXCP_NONE; } =20 +static RISCVException smstateen_acc_ok(CPURISCVState *env, int index, + uint64_t bit) +{ + bool virt =3D riscv_cpu_virt_enabled(env); + RISCVCPU *cpu =3D env_archcpu(env); + + if (env->priv =3D=3D PRV_M || !cpu->cfg.ext_smstateen) { + return RISCV_EXCP_NONE; + } + + if (!(env->mstateen[index] & bit)) { + return RISCV_EXCP_ILLEGAL_INST; + } + + if (virt) { + if (!(env->hstateen[index] & bit)) { + return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + + if (env->priv =3D=3D PRV_U && !(env->sstateen[index] & bit)) { + return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + } + + if (env->priv =3D=3D PRV_U && riscv_has_ext(env, RVS)) { + if (!(env->sstateen[index] & bit)) { + return RISCV_EXCP_ILLEGAL_INST; + } + } + + return RISCV_EXCP_NONE; +} + static RISCVException read_senvcfg(CPURISCVState *env, int csrno, target_ulong *val) { --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833007; cv=none; d=zohomail.com; s=zohoarc; b=SaMYWdJSs0vFmpQ4hCxdJGmqLSBV5Z8oslWhWmeU/xtxBhuVDYvSRfPhByyeMA8KdULP4ZL1XghPKbKFdEGtEtn4uKQJ26KaOj5Xn28j07s4eMq6Q83JDd9Q2Jy8/TD9hRMXR6iU09BLFjBOUsFuMb2fKAr0IFgtV81x3nevvcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833007; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=41l2hXF3TddEpsVwVpvNZTk5y5JWJWpku/WJD6CdFb0=; b=jrrBay39aB03RtB6DLycDkSzHX4qaHZKRTkZRyDRR4rgjd1Hb2I1afsYRE5xKAFVu1sHnzY8z3mnWrGMQ0jsZTxIiNh58VJuPfHzPbvi3dzWyJ/wEjwNMQCcRyFe/XoiW8s6VDJ0DDmajmGGyy+yOiuUzJxSBKfV007KJh8HZ0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783300726860.18560809248538; Fri, 3 Mar 2023 00:43:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zk-0000Jz-Tm; Fri, 03 Mar 2023 03:42:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0za-0008QA-6R for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:19 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zY-00084p-Ki for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:17 -0500 Received: by mail-pj1-x1034.google.com with SMTP id u3-20020a17090a450300b00239db6d7d47so1559842pjg.4 for ; Fri, 03 Mar 2023 00:42:16 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id v3-20020a170902b7c300b0019682e27995sm959020plz.223.2023.03.03.00.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832935; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=41l2hXF3TddEpsVwVpvNZTk5y5JWJWpku/WJD6CdFb0=; b=47sI5aim0R38ON+SuY9s+l+D33vfqAVVnRR4PyVJwHbpMIR49qkvXADSJ4a1t7rXfG XN4894LqDjpYtEBIzhnW92PDcZ2x3kQmfbyvPqhSQXlm3eBxVeoB5vurbCaaCwf3uEVu AOmYL717MQ2ilx6uo0j6LegRlKt6AffviZhiEZXyQaub8CJSSgZ/S7tJj+TkzrYdvg8P c8ZLPFGTKihIOCVcyo6xK8d2oCl6dSYihKUZF5LrvI9Qq6EaRF+i5lz5dDHXgPCp7YmH PNyMIPVRLrkgY6iJPhXWPAGz4CioS0WicrvKSAl/jd4T3nE8x5UsXqggQbSBjfip5NKl zLew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832935; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=41l2hXF3TddEpsVwVpvNZTk5y5JWJWpku/WJD6CdFb0=; b=DzFC5m09XMONwKsuiNqFM8ebmHtu3lu82R8W6iC2dB44pd5D8MzwfPQN1B+rqPVROg V0wY9dqYJ2nRjpTVAIi7XzdJO4zy0stgavReqKcoQJnhImEkPTus5Jm2cWDXil7LFvrE k3b7K4HWjYBbAww+8TPnBRZs8NoGGYWdS/1hSXsyTfWLCeaoD8IgLJ3SrlPBFnqQ/Lf1 8MHorJi7QuTJ84JL2NNwe0Y39rEa6nyoI6sDGCoS1aQczWL3ts9aUyu7y4vtcAbdtK2n QTuuEQvroj2nQHT6pIuHocJyNdKnrtMUR3jEeOpU6o2JG0/Og8ZielE0ULgnfjxt0z3S V7oQ== X-Gm-Message-State: AO0yUKXfto+1qglkZWbxy8V3bc8AAPlcmyEzlVE9vyBgZ0IokqfEX0Wi Gvf6JwBfyS62eJzD6ImWRlJDZQ== X-Google-Smtp-Source: AK7set9ZF6U8GsdiEuqr+wsibR9KgEXcNrFKlcLLCH1ASlIYjzi5pXKwyTOHTbecsziT1xgHIAYT4A== X-Received: by 2002:a17:902:f693:b0:19c:ff5d:1fd2 with SMTP id l19-20020a170902f69300b0019cff5d1fd2mr982686plg.8.1677832935247; Fri, 03 Mar 2023 00:42:15 -0800 (PST) Subject: [PULL 43/59] target/riscv: Fix checking of whether instruciton at 'pc_next' spans pages Date: Fri, 3 Mar 2023 00:37:24 -0800 Message-Id: <20230303083740.12817-44-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Shaobo Song , Richard Henderson , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833009046100005 Content-Type: text/plain; charset="utf-8" From: Shaobo Song This bug has a noticeable behavior of falling back to the main loop and respawning a redundant translation block including a single instruction when the end address of the compressive instruction is exactly on a page boundary, and slows down running system performance. Signed-off-by: Shaobo Song Reviewed-by: Richard Henderson Message-ID: <20230220072732.568-1-songshaobo@eswincomputing.com> Signed-off-by: Palmer Dabbelt --- target/riscv/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 772f9d7973..8ffa2116e0 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1261,7 +1261,7 @@ static void riscv_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) uint16_t next_insn =3D cpu_lduw_code(env, ctx->base.pc_nex= t); int len =3D insn_len(next_insn); =20 - if (!is_same_page(&ctx->base, ctx->base.pc_next + len)) { + if (!is_same_page(&ctx->base, ctx->base.pc_next + len - 1)= ) { ctx->base.is_jmp =3D DISAS_TOO_MANY; } } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833067; cv=none; d=zohomail.com; s=zohoarc; b=nXWsZFw/8tOl7h0hEZT2JMU+dWiOzEZtsiN2oYM0v4MJ3S4OVDDFnO4a0dg+3VE2/ExvuHY3vpyGigRnkCupd01nM0oGeSMReMF/shiwfwr9UPh6BfKa7ChzWWlvDoeOfjm3gFCToYV7VrOP619DPFHp2B4JucHgWnbx+eZlELM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nhVcyaR+wUHNG6/4VyYZTf+bfbXlrY349GdOzrTycmU=; b=QaZyBcXiVh/zUD2Divy/sMXIxefaw0IQVs3JTz0pzxAVR6zAe1CvBKLw5Ngq5bSE7fb/Vrfcy5gTBkzhKi9gsS0OK6dqmzdA2KRewPPbzFD/kUQEz2THxzwf0ptu8m/lgYLIa83omH8klSugFy7EXIuzDLLPI5LGtiUcVUYUps0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833067320829.7311002432957; Fri, 3 Mar 2023 00:44:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zo-0000fy-Kn; Fri, 03 Mar 2023 03:42:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zb-0008QF-7C for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:20 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zZ-000858-P6 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:18 -0500 Received: by mail-pj1-x102c.google.com with SMTP id h17-20020a17090aea9100b0023739b10792so1589567pjz.1 for ; Fri, 03 Mar 2023 00:42:17 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id lj10-20020a17090b344a00b00233e937fef9sm1035279pjb.18.2023.03.03.00.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832936; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=nhVcyaR+wUHNG6/4VyYZTf+bfbXlrY349GdOzrTycmU=; b=dgk9U7kLWVlJ9PxwoGsoKY/S6CAm//dppwNf0gBPZcwvTkwRVLafmFrl0OX1yiTSv1 RDufYx3H2iyE3J5PbUWJLOjXMQ9X2IZ/M34pxbq/cF1o90gZs/LapXoRopE8CCIvLrpb NLci7//FwpH4VP7HhT2IhQKD3/L+gMlrFrlQgxI4xcOhfm9k9pNVV6L/WThjB26OjgwL 74zbFwqB0gJYNKpzJQskMe+GFLxYG0/bmOT6dUq2kfLqfwt3ewy1DZfBDSh1vFJdQ1v9 WHi08ow15G4hUgp3D0sIacskFBy31KLtQ+9Ntk41pFKSG6SHaq5jf85eDikAnLi2IiU6 P//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832936; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nhVcyaR+wUHNG6/4VyYZTf+bfbXlrY349GdOzrTycmU=; b=uKx+Ii7b3UFu0++NFtZH0v7IH51GdIjV7zg5KHuQ5Cwyh8u5Q7LnlxRC1zJQAHvL/R 29Ur1TM02x3m5opLD/gIqUd7EGIL5LUr0EUS595WcdxdvmS4GOqFe3FJbnqsmDU/AO3g Z5Pfgvo2KMdhvPuWgP/TwDLPyR7e7qYLl9mb3SskO+fAFG3Jrf6sw5CT8WNU5b5tznJB UignGG9B8kSfLpKgCQTOpNyUz8IN4/i1JDjwO/p8PVAZzbE6vpgRqfsmP7F9wYV5XoOQ Ib7CzVdhWN2UozZy3UQ4ninJE6h3Udg+YUsslEKBW8Jnfh32h+qlKSXXzzQg21fREfst mW5Q== X-Gm-Message-State: AO0yUKUlszHEhB6C/ydwG1tkJQgrROocOT0XXjRgUtKhygOImY+DyqKG BLZ1PlfgoE/mUF5KkfVwTUjmaA== X-Google-Smtp-Source: AK7set+S1HNkb2BFMOesMBPEGQQepTlPKZbLQVOcRVUKIEhib1EqOiCqhXvXJOsYsvz7OTS6aRnz8A== X-Received: by 2002:a17:90a:194c:b0:237:ae98:a47f with SMTP id 12-20020a17090a194c00b00237ae98a47fmr5195634pjh.1.1677832936545; Fri, 03 Mar 2023 00:42:16 -0800 (PST) Subject: [PULL 44/59] RISC-V: XTheadMemPair: Remove register restrictions for store-pair Date: Fri, 3 Mar 2023 00:37:25 -0800 Message-Id: <20230303083740.12817-45-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, ristoph=20M=C3=BCllner?= , LIU Zhiwei , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833069014100003 From: Christoph M=C3=BCllner The XTheadMemPair does not define any restrictions for store-pair instructions (th.sdd or th.swd). However, the current code enforces the restrictions that are required for load-pair instructions. Let's fix this by removing this code. Signed-off-by: Christoph M=C3=BCllner Reviewed-by: LIU Zhiwei Message-ID: <20230220095612.1529031-1-christoph.muellner@vrull.eu> Signed-off-by: Palmer Dabbelt --- target/riscv/insn_trans/trans_xthead.c.inc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/riscv/insn_trans/trans_xthead.c.inc b/target/riscv/insn= _trans/trans_xthead.c.inc index be87c34f56..cf1731b08d 100644 --- a/target/riscv/insn_trans/trans_xthead.c.inc +++ b/target/riscv/insn_trans/trans_xthead.c.inc @@ -980,10 +980,6 @@ static bool trans_th_lwud(DisasContext *ctx, arg_th_pa= ir *a) static bool gen_storepair_tl(DisasContext *ctx, arg_th_pair *a, MemOp memo= p, int shamt) { - if (a->rs =3D=3D a->rd1 || a->rs =3D=3D a->rd2 || a->rd1 =3D=3D a->rd2= ) { - return false; - } - TCGv data1 =3D get_gpr(ctx, a->rd1, EXT_NONE); TCGv data2 =3D get_gpr(ctx, a->rd2, EXT_NONE); TCGv addr1 =3D tcg_temp_new(); --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833056; cv=none; d=zohomail.com; s=zohoarc; b=FbbuF+85KSpQvJx/MIBiwhnqbJsznpEi4O1fekum7geBZwbbsXlyaKTU1Tu4MHsRs7IH7C6WC2oBKLmIPC3WH235G7KwjY2Gnme1wJqEFZ87HoWDmLNSoTjyinGtbxktelXb4kpLSx7uAlyR1gyvIfCIrYuEiK2oBEJpVtRfQpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833056; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wFw20b6Bz2FDDW0u4vx4mlXe6VxyRQIjZ8e8ySZmec4=; b=DGF/XWOFprhcuK6mt2POPnk6UD0OFqfCg+N0j3DRomPJ/ffUMi5O6uMbyBGtS67I+CGn6PAY9XyobA7hnryP+NnbN/zGoEDqgIZ/vuR/uunH9mY3JhE7pJ6IkiThI+jwEMEo0C18ta40rywco+sc/h5A6jSusZmM1P8GWgLWSg4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833056392556.2058597925546; Fri, 3 Mar 2023 00:44:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zk-0000Bw-0H; Fri, 03 Mar 2023 03:42:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zc-0008RN-T5 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:21 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zb-00085Y-3D for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:20 -0500 Received: by mail-pj1-x1031.google.com with SMTP id m20-20020a17090ab79400b00239d8e182efso5408221pjr.5 for ; Fri, 03 Mar 2023 00:42:18 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kq13-20020a170903284d00b0019a7f427b79sm980473plb.119.2023.03.03.00.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832938; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=wFw20b6Bz2FDDW0u4vx4mlXe6VxyRQIjZ8e8ySZmec4=; b=JJv49+xJPwm7CbGC7jbqaw9T1jrXdi0hxF890fnmDgch7Y7TbTYjy3obngVqGr3AmY YJq1wO8O14qDnbKVEoKDaYF2VXlGOplrxRCY+XolxFpm3iiHwkSOLus+bIGxAGiy1W4/ Gnj1w7xwtfq3uhPEttIPIeEnw0+4VAfu5+gKU77kuJS2XPNvEtWsKFPIHq7zlDNVcJNC eIvxly0LR9cwLlMMbIrzxCkDM/V5egxdRZqonHXpC+yU7rdBOba7RuxH2DOQc9IK0BBC cyzlpoQ0yBpbcdNCQcjGwh4y3DHRgfnF1Dy+WMZcjHL/7Ni/c0AMwX5vDuOFYNRnQpAE eJOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832938; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wFw20b6Bz2FDDW0u4vx4mlXe6VxyRQIjZ8e8ySZmec4=; b=m3Pzsb5+TP+C0CSlnwCE+v2JEOJorHSmximu5kNkuHVEiAMvWwXGrkzznaTlDlFPVO v1mieAjCM7aIU8M5a/5L/N8tcbz3qmuLmZDrlMZ2v9NAQpAN96fBs72XIQi1EQuBxsPX okgRmHsR8ecMO31sbuJRxNJI4HpeRty0yjB9ijwk6XYfY0x3n7G8wdeLTZXYAvoGH53Q KwPeo5WRqrappVae6ogef1/AdzhWRWtdo7P3AQ9FcsevrViPgXY90askbxQFabtcPAj+ oUMpSl51JIzN9oh5WsHK8OLcQ5oO21q5DXfnlic/wzhr2bhQVK6Kixm1HGUexp9K/1Gf 4KsA== X-Gm-Message-State: AO0yUKV95dNxvGDPI1QOsEt1wqOiRC/KH0fFnntPURx8r8+DXKgQDFGz aqAtGEalvTsf84W+Rx76E53JHg== X-Google-Smtp-Source: AK7set+3rzih3CAQS7KCWNydca64HEoVGSS6DKv04ZcgVE2A+THcbfWej7FSV4WADjjR2HPB2xIGQQ== X-Received: by 2002:a17:902:e80a:b0:19d:243:d5d3 with SMTP id u10-20020a170902e80a00b0019d0243d5d3mr1066350plg.33.1677832937841; Fri, 03 Mar 2023 00:42:17 -0800 (PST) Subject: [PULL 45/59] target/riscv: Add support for Zicond extension Date: Fri, 3 Mar 2023 00:37:26 -0800 Message-Id: <20230303083740.12817-46-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Frank Chang , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833057024100001 Content-Type: text/plain; charset="utf-8" From: Weiwei Li The spec can be found in https://github.com/riscv/riscv-zicond. Two instructions are added: - czero.eqz: Moves zero to a register rd, if the condition rs2 is equal to zero, otherwise moves rs1 to rd. - czero.nez: Moves zero to a register rd, if the condition rs2 is nonzero, otherwise moves rs1 to rd. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Frank Chang Message-ID: <20230221091009.36545-1-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 2 + target/riscv/cpu.h | 1 + target/riscv/insn32.decode | 4 ++ target/riscv/insn_trans/trans_rvzicond.c.inc | 49 ++++++++++++++++++++ target/riscv/translate.c | 1 + 5 files changed, 57 insertions(+) create mode 100644 target/riscv/insn_trans/trans_rvzicond.c.inc diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 9e726d106e..3d41016eb4 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -74,6 +74,7 @@ struct isa_ext_data { static const struct isa_ext_data isa_edata_arr[] =3D { ISA_EXT_DATA_ENTRY(h, false, PRIV_VERSION_1_12_0, ext_h), ISA_EXT_DATA_ENTRY(v, false, PRIV_VERSION_1_10_0, ext_v), + ISA_EXT_DATA_ENTRY(zicond, true, PRIV_VERSION_1_12_0, ext_zicond), ISA_EXT_DATA_ENTRY(zicsr, true, PRIV_VERSION_1_10_0, ext_icsr), ISA_EXT_DATA_ENTRY(zifencei, true, PRIV_VERSION_1_10_0, ext_ifencei), ISA_EXT_DATA_ENTRY(zihintpause, true, PRIV_VERSION_1_10_0, ext_zihintp= ause), @@ -1172,6 +1173,7 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps,= false), =20 /* These are experimental so mark with 'x-' */ + DEFINE_PROP_BOOL("x-zicond", RISCVCPU, cfg.ext_zicond, false), DEFINE_PROP_BOOL("x-j", RISCVCPU, cfg.ext_j, false), /* ePMP 0.9.3 */ DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false), diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index d8e47b87e3..30c75bf7d6 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -434,6 +434,7 @@ struct RISCVCPUConfig { bool ext_zkt; bool ext_ifencei; bool ext_icsr; + bool ext_zicond; bool ext_zihintpause; bool ext_smstateen; bool ext_sstc; diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index b7e7613ea2..fb537e922e 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -890,3 +890,7 @@ sm3p1 00 01000 01001 ..... 001 ..... 0010011 @r2 # *** RV32 Zksed Standard Extension *** sm4ed .. 11000 ..... ..... 000 ..... 0110011 @k_aes sm4ks .. 11010 ..... ..... 000 ..... 0110011 @k_aes + +# *** RV32 Zicond Standard Extension *** +czero_eqz 0000111 ..... ..... 101 ..... 0110011 @r +czero_nez 0000111 ..... ..... 111 ..... 0110011 @r diff --git a/target/riscv/insn_trans/trans_rvzicond.c.inc b/target/riscv/in= sn_trans/trans_rvzicond.c.inc new file mode 100644 index 0000000000..645260164e --- /dev/null +++ b/target/riscv/insn_trans/trans_rvzicond.c.inc @@ -0,0 +1,49 @@ +/* + * RISC-V translation routines for the Zicond Standard Extension. + * + * Copyright (c) 2020-2023 PLCT Lab + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License f= or + * more details. + * + * You should have received a copy of the GNU General Public License along= with + * this program. If not, see . + */ + +#define REQUIRE_ZICOND(ctx) do { \ + if (!ctx->cfg_ptr->ext_zicond) { \ + return false; \ + } \ +} while (0) + +static bool trans_czero_eqz(DisasContext *ctx, arg_czero_eqz *a) +{ + REQUIRE_ZICOND(ctx); + + TCGv dest =3D dest_gpr(ctx, a->rd); + TCGv src1 =3D get_gpr(ctx, a->rs1, EXT_NONE); + TCGv src2 =3D get_gpr(ctx, a->rs2, EXT_NONE); + + tcg_gen_movcond_tl(TCG_COND_EQ, dest, src2, ctx->zero, ctx->zero, src1= ); + gen_set_gpr(ctx, a->rd, dest); + return true; +} + +static bool trans_czero_nez(DisasContext *ctx, arg_czero_nez *a) +{ + REQUIRE_ZICOND(ctx); + + TCGv dest =3D dest_gpr(ctx, a->rd); + TCGv src1 =3D get_gpr(ctx, a->rs1, EXT_NONE); + TCGv src2 =3D get_gpr(ctx, a->rs2, EXT_NONE); + + tcg_gen_movcond_tl(TCG_COND_NE, dest, src2, ctx->zero, ctx->zero, src1= ); + gen_set_gpr(ctx, a->rd, dest); + return true; +} diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 8ffa2116e0..4a957a50b5 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1103,6 +1103,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, t= arget_ulong pc) #include "insn_trans/trans_rvh.c.inc" #include "insn_trans/trans_rvv.c.inc" #include "insn_trans/trans_rvb.c.inc" +#include "insn_trans/trans_rvzicond.c.inc" #include "insn_trans/trans_rvzawrs.c.inc" #include "insn_trans/trans_rvzfh.c.inc" #include "insn_trans/trans_rvk.c.inc" --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833626; cv=none; d=zohomail.com; s=zohoarc; b=kPR+4+fxz2/uw54zgaEMs0vjjmGDl9lQYCzhlxdlL8OScwL6r8lwO9oxg5pPKaVaYthiWBH5IpX67p/TR6QzBObZ0KpcIXXq6NsPr72Xadq/RfyzmDVxvZX8s/38xQn1uX3PrJAO49xSje71ZBt1DpYDUk1WFvoOoovxz0Cebmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833626; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cTBqTOX66ilKzC7xCByUy9pfB1RZcSI16KtCXQgik/w=; b=Xksc9evAUBTnyILpifj+2F1h4dePhS7s5PviM7ZuWehwCdtfoD837xE7yiD5xmZF5gFqdXXtNHO7XsHb9m29DEoMNbdP1BvRCPH/K3i/36kxW4641R5sflXU2yIJ5JNVWegnS7pNXPXL3y11lBqe4cUa1PApXAn1RGSS8JwrNvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833626384444.7748194056195; Fri, 3 Mar 2023 00:53:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zs-0001B3-Vm; Fri, 03 Mar 2023 03:42:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0ze-0008Ri-50 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:22 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zc-000860-8v for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:21 -0500 Received: by mail-pj1-x1035.google.com with SMTP id oj5so1780806pjb.5 for ; Fri, 03 Mar 2023 00:42:19 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id v10-20020aa7808a000000b005a8ae0c52cfsm1076799pff.16.2023.03.03.00.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832939; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=cTBqTOX66ilKzC7xCByUy9pfB1RZcSI16KtCXQgik/w=; b=H9hYXgKDq5dd2Jz0x0M6pigS/BK9EuBFi8sw+wbaj9S5Ai9CD35p5zOOpYqBjLY34G wOJm9IrPCUTO+doFVSt1HCeVkReJ/YSmvP9hWKFWnaAPct06Z7zgONh4HpoIO2UrovOR FzW6WGVXApQn7DaCC4XtZxc1p+J20CPxdCANtunG6NdNVnAMevJt3+a1DMxCuvXXnIv0 izcTsIblZLHPyT7MYUt8a9CuWOZBJc7l239icadKaPt85eb5VrZW9B2BjhEXVehJhl+f A7/+I0DrbQbV8XZ5sGer8iXBUHRQr7vj6+R8Rye9QwOaG/mMGPnhfxZkN2sfUecz5Li3 HM7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832939; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cTBqTOX66ilKzC7xCByUy9pfB1RZcSI16KtCXQgik/w=; b=Js4A6fUwo9mq9bEuCvGTq0nfAdLnK08Y3Z0tPO7g9ssXHZAvh/xsHs76IHXGsu+u0v w2iSL/4bpzQspYVTzqTGbKaBSqR1egsHrnqgYf3etlEa/D3m1tl3+fb1zaGJdFhIJ6us puHSRyixgvWduOXJpyLTWH2PKiuvU7nRk+IkMCX6hd5hp2y6uPx2bFfQcpKR3N8wDmCH ECQLbjq+c5ER4Mc6KOt2GRneXEA4FgMeYCaNb/O+3sYq7VwB6ToL8ARN0igLGBBCD1LC roV9MCfYDAWvqagL9jP/7MUIZy+WaIMD+vj0Ea85FRix7ybVSsfghgjcd8Tb5bBXVUB9 Kppg== X-Gm-Message-State: AO0yUKUnrm9UmJPDC6LIZ1+n34zCJFNf4QYE1tGFG4TS1jley//dJweN eQm3V9N7776Pd3uX2wFY4gYQ2Q== X-Google-Smtp-Source: AK7set9QthMOGSe9jeUqpVue0nmX4FAhMN6Es1x89zQOAxgiE9xdACmE8hVgmR+8aNgkcOzPiC29vQ== X-Received: by 2002:a05:6a20:258a:b0:cc:868f:37b3 with SMTP id k10-20020a056a20258a00b000cc868f37b3mr1287882pzd.58.1677832939061; Fri, 03 Mar 2023 00:42:19 -0800 (PST) Subject: [PULL 46/59] hw/riscv: Skip re-generating DT nodes for a given DTB Date: Fri, 3 Mar 2023 00:37:27 -0800 Message-Id: <20230303083740.12817-47-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833628327100003 Content-Type: text/plain; charset="utf-8" From: Bin Meng Launch qemu-system-riscv64 with a given dtb for 'sifive_u' and 'virt' machines, QEMU complains: qemu_fdt_add_subnode: Failed to create subnode /soc: FDT_ERR_EXISTS The whole DT generation logic should be skipped when a given DTB is present. Fixes: b1f19f238cae ("hw/riscv: write bootargs 'chosen' FDT after riscv_loa= d_kernel()") Signed-off-by: Bin Meng Reviewed-by: Daniel Henrique Barboza Message-ID: <20230228074522.1845007-1-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- hw/riscv/sifive_u.c | 1 + hw/riscv/virt.c | 1 + 2 files changed, 2 insertions(+) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index ad3bb35b34..76db5ed3dd 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -118,6 +118,7 @@ static void create_fdt(SiFiveUState *s, const MemMapEnt= ry *memmap, error_report("load_device_tree() failed"); exit(1); } + return; } else { fdt =3D ms->fdt =3D create_device_tree(&fdt_size); if (!fdt) { diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 49f2c157f7..981392c0bb 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1015,6 +1015,7 @@ static void create_fdt(RISCVVirtState *s, const MemMa= pEntry *memmap) error_report("load_device_tree() failed"); exit(1); } + return; } else { ms->fdt =3D create_device_tree(&s->fdt_size); if (!ms->fdt) { --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833181; cv=none; d=zohomail.com; s=zohoarc; b=iZ8aEAQcEX1K/QYYRChl1ONs+C8fQw5HHNQJRrUwsDiuVtfwrfpEtQcviC69QFb6UzBpuD5fcWwnwiXVyLOnWRzm9Hd3ok3Vsj56oJsGPiYM1f+VOw8hZEcVTUPCXUtY762M4slSgRCTPo+5epp+/knykv24yE2VP7CL1s5FpFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833181; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9t3N2UJPfcfoD4pGjTXsSm1eTae8jmXFNY8cb9vfdLw=; b=mHRPn25ivYQ3C7njrAMhdF7ky+qFTid46cqylvRx3RiSQWj7xHH+0WEBLtN+SIYVwHTu9Ho/OoKQ6v7ZBdhFm/2rLhX6O5vXj9MnPkAVeYK4ICEIqP7pVg7RZP2/ECIswF4go1TLEI24gI3WHqMhMhSn5LZ7IxgFx7gj9fiL27Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833181445980.2963190546993; Fri, 3 Mar 2023 00:46:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zn-0000Wp-6i; Fri, 03 Mar 2023 03:42:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zf-0008Tu-Im for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:23 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zd-00086S-OL for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:23 -0500 Received: by mail-pf1-x436.google.com with SMTP id n5so1064249pfv.11 for ; Fri, 03 Mar 2023 00:42:21 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id u1-20020aa78381000000b005cd81a74821sm1020965pfm.152.2023.03.03.00.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832940; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=9t3N2UJPfcfoD4pGjTXsSm1eTae8jmXFNY8cb9vfdLw=; b=3/g0ekRdndJexqm9TtVz45tN+0+V05Sk+0/ONZyKc7FH0bMyXRhdMcIwWCGVOwc/LN zt4B/RLcCrGnfOyZrxo8L7a4Eop19p7pv5+qDLSzFy73KHdXHJQVRUUgaplvHzAvvxXo 5tNZK9/GIIKItzmGT+lp+Qp+9cdXRVq6LfokwR5naBGul+1gWBRQkyRhExNTciAxv7fY SyLbUMiCj6+54o6JlDYTQ2O9eqgo9fDkQITpJCBRjJCdsFYIJ3rWXoej9fmagahvdptU FKDY669H/kIdS412SrHskVxUJo+q2810Wsd+SHH+hXdpXCjr51S8PCzOrO40vmodA3Aa yEIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832940; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9t3N2UJPfcfoD4pGjTXsSm1eTae8jmXFNY8cb9vfdLw=; b=AfwYfaFsdcypzfjAQtJiBAYLQ0VaW3YEAKoyMvnw0d1Ty+huhhGTl/hBh51U/FfxA+ 8w3T/fIneFzxbO/mR/LoaWWgrVCLsu3lA0J7tcRPfaykmvQGvUH+CPPzwMpfUwLDRg2v GR8ueC3QXMQDbeVHOhw/w4dcaAEPaQKRm2F9dX2qHeJEoB04WIDcQxhGgGYolS4lkLZC Xpn7WTyEn+wK5oZSvedq/zesDhTvcaRYOs4hG1xKryebMlUd5uum+ND3WKsHY0ZhyA/t Fjr3Y7quJNJhvkSs2OoresHEIraQC9ECq68cWBnjLTKo8buNpHld/qZfAuG69YC3/vdi nyZg== X-Gm-Message-State: AO0yUKXZvDiZlirLrTUJR97qOaJIMEt0e7kwjir4Ro2wm7tm5qtUS8db CAZCjlafozFY4cxGJneSpOuPzg== X-Google-Smtp-Source: AK7set/NosIjhB4gLHiILgAz8rl+s0AyDsA5qz33xC+XWL7lnsC1V0ZQzBC4iJiXCnAVmh7kExQuvA== X-Received: by 2002:aa7:9f1a:0:b0:5dc:2de8:f500 with SMTP id g26-20020aa79f1a000000b005dc2de8f500mr1249125pfr.22.1677832940347; Fri, 03 Mar 2023 00:42:20 -0800 (PST) Subject: [PULL 47/59] hw/riscv: Move the dtb load bits outside of create_fdt() Date: Fri, 3 Mar 2023 00:37:28 -0800 Message-Id: <20230303083740.12817-48-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=palmer@rivosinc.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833183509100003 Content-Type: text/plain; charset="utf-8" From: Bin Meng Move the dtb load bits outside of create_fdt(), and put it explicitly in sifive_u_machine_init() and virt_machine_init(). With such change create_fdt() does exactly what its function name tells us. Suggested-by: Daniel Henrique Barboza Signed-off-by: Bin Meng Reviewed-by: Daniel Henrique Barboza Message-ID: <20230228074522.1845007-2-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- hw/riscv/sifive_u.c | 31 +++++++++++++++---------------- hw/riscv/virt.c | 29 ++++++++++++++--------------- include/hw/riscv/sifive_u.h | 1 + 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 76db5ed3dd..35a335b8d0 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -99,7 +99,7 @@ static void create_fdt(SiFiveUState *s, const MemMapEntry= *memmap, MachineState *ms =3D MACHINE(s); uint64_t mem_size =3D ms->ram_size; void *fdt; - int cpu, fdt_size; + int cpu; uint32_t *cells; char *nodename; uint32_t plic_phandle, prci_phandle, gpio_phandle, phandle =3D 1; @@ -112,19 +112,10 @@ static void create_fdt(SiFiveUState *s, const MemMapE= ntry *memmap, "sifive,plic-1.0.0", "riscv,plic0" }; =20 - if (ms->dtb) { - fdt =3D ms->fdt =3D load_device_tree(ms->dtb, &fdt_size); - if (!fdt) { - error_report("load_device_tree() failed"); - exit(1); - } - return; - } else { - fdt =3D ms->fdt =3D create_device_tree(&fdt_size); - if (!fdt) { - error_report("create_device_tree() failed"); - exit(1); - } + fdt =3D ms->fdt =3D create_device_tree(&s->fdt_size); + if (!fdt) { + error_report("create_device_tree() failed"); + exit(1); } =20 qemu_fdt_setprop_string(fdt, "/", "model", "SiFive HiFive Unleashed A0= 0"); @@ -561,8 +552,16 @@ static void sifive_u_machine_init(MachineState *machin= e) qdev_connect_gpio_out(DEVICE(&(s->soc.gpio)), 10, qemu_allocate_irq(sifive_u_machine_reset, NULL, = 0)); =20 - /* create device tree */ - create_fdt(s, memmap, riscv_is_32bit(&s->soc.u_cpus)); + /* load/create device tree */ + if (machine->dtb) { + machine->fdt =3D load_device_tree(machine->dtb, &s->fdt_size); + if (!machine->fdt) { + error_report("load_device_tree() failed"); + exit(1); + } + } else { + create_fdt(s, memmap, riscv_is_32bit(&s->soc.u_cpus)); + } =20 if (s->start_in_flash) { /* diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 981392c0bb..4f8191860b 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1009,19 +1009,10 @@ static void create_fdt(RISCVVirtState *s, const Mem= MapEntry *memmap) uint32_t irq_pcie_phandle =3D 1, irq_virtio_phandle =3D 1; uint8_t rng_seed[32]; =20 - if (ms->dtb) { - ms->fdt =3D load_device_tree(ms->dtb, &s->fdt_size); - if (!ms->fdt) { - error_report("load_device_tree() failed"); - exit(1); - } - return; - } else { - ms->fdt =3D create_device_tree(&s->fdt_size); - if (!ms->fdt) { - error_report("create_device_tree() failed"); - exit(1); - } + ms->fdt =3D create_device_tree(&s->fdt_size); + if (!ms->fdt) { + error_report("create_device_tree() failed"); + exit(1); } =20 qemu_fdt_setprop_string(ms->fdt, "/", "model", "riscv-virtio,qemu"); @@ -1506,8 +1497,16 @@ static void virt_machine_init(MachineState *machine) } virt_flash_map(s, system_memory); =20 - /* create device tree */ - create_fdt(s, memmap); + /* load/create device tree */ + if (machine->dtb) { + machine->fdt =3D load_device_tree(machine->dtb, &s->fdt_size); + if (!machine->fdt) { + error_report("load_device_tree() failed"); + exit(1); + } + } else { + create_fdt(s, memmap); + } =20 s->machine_done.notify =3D virt_machine_done; qemu_add_machine_init_done_notifier(&s->machine_done); diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 65af306963..0696f85942 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -68,6 +68,7 @@ typedef struct SiFiveUState { =20 /*< public >*/ SiFiveUSoCState soc; + int fdt_size; =20 bool start_in_flash; uint32_t msel; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833404; cv=none; d=zohomail.com; s=zohoarc; b=ndZ3ryNyMdSTANGs2DKl2I+8wwomUzWA3E7V/hSvGSvpMvGluss7BH5Ip5TKTOqgXOLq1T0l2lRhkKzeLvZ3jQF7UYH34bqCzgo/wvArz0To7HcudCF1gP4VT8e3osZPmzSw03Pf9y4AQdcqJVGBqzw7Hd/y2P4K+CF3aE0SzcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833404; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YwFKiArhbxJLyBVT/Z+JtOcropCSjORrRpC5cWL6qGo=; b=k3KIUIFtD2wZtxSQwY/Li9Kf2cJNHNxGk9PBi6n0/7ueOZFr6aBgz0b/CIOK31rTIOBVM3X+NI48M1XkbbMI16o6QkdeijvhYn/mAhOq7APX+4c5xte6Q7TrYDbP6+LsmO0l8g9ooPp4TLt92FvooniDfDCnpDcgivOip5OPIIo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833404851829.6873967942913; Fri, 3 Mar 2023 00:50:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zm-0000Uh-O8; Fri, 03 Mar 2023 03:42:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zg-0008V9-QC for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:25 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zf-00086w-B7 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:24 -0500 Received: by mail-pl1-x62d.google.com with SMTP id n6so1987360plf.5 for ; Fri, 03 Mar 2023 00:42:22 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id i22-20020aa78d96000000b005d932d0c029sm1044509pfr.65.2023.03.03.00.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832942; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=YwFKiArhbxJLyBVT/Z+JtOcropCSjORrRpC5cWL6qGo=; b=XMVZpgvz+3T+O9QwKocc7Keysdq6Qzgf/L8/cNGuEbz0227eSJNkVsZKV2kBbS/ayy 8OkB8kVpcytZjNFfYE0fjJRPp6he4+/mBsl1vGPMKfctIRXWd+V3kHG1R5OLdyh59Ue5 gv/fjywgNwlDWITjiaAJP1njr6nx1pY3DBuuTepeKFxXRF4InFAPdRrWJ4CHHadyQdkP PqrPtxpsG7vLLxAMZry8LaHz23jdZu7+1Fv9x8ar4/zow92srW7qwoNtin0hrLTyNcqq fEOUCiFLIUvoNw+sPErgj1fNdkBAws+omgQajF3/PX+J9Bk8/HZdOq6EBjMgaGnOny+k r3vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832942; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YwFKiArhbxJLyBVT/Z+JtOcropCSjORrRpC5cWL6qGo=; b=ehOLjGrOjExRHWYLzzPJuVOmvwQRJurhvLGYmiZrxegDqa4hT6zXu7dJUCjaFeDLpp o6GDoY/rP/47pUC/F6ECzPJ9knbORk9o/pPdSHmcIXRIx8OH3NcsZ2yAG54ntT7JfIed MKASBdE3Roz3g6NwRn/PednjO4L6c+kkPiwK/1TV66J1E9Ka6icBzIilwgLpnK1uJWuf PyEH4xgmXp+v1bL6/LO6va6H4haGh2VuMWByNwjZmClz2m/fIOce+rVW77aKdaz5Yfow 4NiHbnyB1ZYGbOdt2kJDH1rIZEXfZZJH+D53klbLcmGBNwi4cv3TylLXhykz8FGd5YKm ENfw== X-Gm-Message-State: AO0yUKXreRxtEQJT2741mLxuZoqjlnIBiEraK56je27hIh6Oc4WepIQP 1s5ykG26Ua7pDewhAsB0blUvZw== X-Google-Smtp-Source: AK7set8ZuYT41+MzIaUOWYmZiQyuse4/dntmjpUUtJWYgvJUxWjL1IVLcUl7L86VbO+mxS/wUwmltg== X-Received: by 2002:a05:6a20:158e:b0:cd:929d:27fc with SMTP id h14-20020a056a20158e00b000cd929d27fcmr1810423pzj.45.1677832941938; Fri, 03 Mar 2023 00:42:21 -0800 (PST) Subject: [PULL 48/59] target/riscv: Fix the relationship between menvcfg.PBMTE/STCE and Svpbmt/Sstc extensions Date: Fri, 3 Mar 2023 00:37:29 -0800 Message-Id: <20230303083740.12817-49-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833406622100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li menvcfg.PBMTE/STCE are read-only zero if Svpbmt/Sstc are not implemented. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230224040852.37109-2-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 1b0a0c1693..b20b00a9a7 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1885,10 +1885,12 @@ static RISCVException read_menvcfg(CPURISCVState *e= nv, int csrno, static RISCVException write_menvcfg(CPURISCVState *env, int csrno, target_ulong val) { + RISCVCPUConfig *cfg =3D &env_archcpu(env)->cfg; uint64_t mask =3D MENVCFG_FIOM | MENVCFG_CBIE | MENVCFG_CBCFE | MENVCF= G_CBZE; =20 if (riscv_cpu_mxl(env) =3D=3D MXL_RV64) { - mask |=3D MENVCFG_PBMTE | MENVCFG_STCE; + mask |=3D (cfg->ext_svpbmt ? MENVCFG_PBMTE : 0) | + (cfg->ext_sstc ? MENVCFG_STCE : 0); } env->menvcfg =3D (env->menvcfg & ~mask) | (val & mask); =20 @@ -1905,7 +1907,9 @@ static RISCVException read_menvcfgh(CPURISCVState *en= v, int csrno, static RISCVException write_menvcfgh(CPURISCVState *env, int csrno, target_ulong val) { - uint64_t mask =3D MENVCFG_PBMTE | MENVCFG_STCE; + RISCVCPUConfig *cfg =3D &env_archcpu(env)->cfg; + uint64_t mask =3D (cfg->ext_svpbmt ? MENVCFG_PBMTE : 0) | + (cfg->ext_sstc ? MENVCFG_STCE : 0); uint64_t valh =3D (uint64_t)val << 32; =20 env->menvcfg =3D (env->menvcfg & ~mask) | (valh & mask); --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833086; cv=none; d=zohomail.com; s=zohoarc; b=OVkWfaOnYMdYHf6HoZ37VJ4JTMrTRQk7Q+a0HFjt/DuR8bqJt+Ch2PwKqYgLOwK+Ny1KSXlyg4Zw56QOlwwF/HxjN8DYd13SfrrmCWsTXFDS20On8vVZeGwoK06jH6h8QBzDokPg/2fTyWNDidn7y5qyBBdxyVlI3rODA7zHHbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833086; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PUkOCCts2DVch5VnVOvAOKGqLYUpNhJBdp+jfQXvKAo=; b=Ja3nm+f5eGQavnrvFuPI0MHilAJRFFiXccqMCwzE90rUvZOOyKM4LwzU0lFR2KnMApG4Be8hyT6IDWZ/mB4KzQQ9odXYXEoOsQVSZDmBwxy3CwipV2HXr7ME1LfesArmnCzdRA9Z5a0n858xSsy0Td9QwOMWLwi/tRxxRQAqZTg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833086284745.977131608041; Fri, 3 Mar 2023 00:44:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zq-0000rx-D2; Fri, 03 Mar 2023 03:42:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zi-00007B-1w for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:26 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zg-00087I-HN for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:25 -0500 Received: by mail-pf1-x42f.google.com with SMTP id ay18so1095164pfb.2 for ; Fri, 03 Mar 2023 00:42:24 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id t13-20020aa7938d000000b0058837da69edsm1019540pfe.128.2023.03.03.00.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832943; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=PUkOCCts2DVch5VnVOvAOKGqLYUpNhJBdp+jfQXvKAo=; b=tmIWCJb8VV8xbWmoVFdDJkEGHEp68cFRkn8ADAUYqnS0HPcz1XOl2ip+0Uw7DC/K8O 6LvQsj8g/CHAg3He7/vTjogQLFBynHw459zJ2+3iSxDrIbRVvZEX9Uq1Ir26AoPp8lGn IunKxt+9KCqQc2hkLvuZ1XmU8Dc3v+iBr1fQFv2vFZEbRKsFyru7GeFojYzaEAneuUJR 17cQwhSB9WanwP4gzTtnrz9zvuAGz59/yKu0mzQOQTc0kBn9mPzU+U4Xlwn9a+iX0S3q F+H+kJsLRbMPSt/Wa64TCRp7hKtYR6KzPTUXlBX1XSJR1cbuIM25pTrrxsPz5wMmPX3h ywIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832943; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PUkOCCts2DVch5VnVOvAOKGqLYUpNhJBdp+jfQXvKAo=; b=dOnU5BZPCa8hOZmd2nM+dqxuhkA8Cl4Q+aKq343pZfFffv2aZQugxLqL35pesIj9vd LgdJ8j+PWKW9xedhCwh55KGsyoJ+Q1uOBNRTwz0qwYtXhiiZeNrmOgUjUW35Ks4Hl46/ cKqRukF8gyjp3WYeDAhVyn4QQhpSIHlNTH1neD6x6dRl2333axWtIQFuHWhvsc6suIJc pgkaHybrrfdv6WvQ9vista1aeDfunXk8y4bqgaTRzNR6eB683q8We2uagpw8ptKosbWg 3dDTd+G7iTjztTLvmE60dQ2GRoWwl9wjVHMd21zwrjUsb3IS+EMHuagkxHslgAzbK3fK MPqQ== X-Gm-Message-State: AO0yUKXIA1NsVsBz/r16KoeLHWiYzCWuh9+SfbdJ3JOdsPyXFS9zoTea HDCv+GnW2IrUesdl8NXunSIQGg== X-Google-Smtp-Source: AK7set+GtcCiGFWS5DSNlwLaPAuQAQKHCq5nbBpEa9VB2lJKgOJWWlPM+Jra5hX+kCW+rtSCLbQ8IQ== X-Received: by 2002:aa7:8f3d:0:b0:5a9:bcf7:ea75 with SMTP id y29-20020aa78f3d000000b005a9bcf7ea75mr1310363pfr.10.1677832943043; Fri, 03 Mar 2023 00:42:23 -0800 (PST) Subject: [PULL 49/59] target/riscv: Fix the relationship of PBMTE/STCE fields between menvcfg and henvcfg Date: Fri, 3 Mar 2023 00:37:30 -0800 Message-Id: <20230303083740.12817-50-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=palmer@rivosinc.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833087095100001 Content-Type: text/plain; charset="utf-8" From: Weiwei Li henvcfg.PBMTE/STCE are read-only zero if menvcfg.PBMTE/STCE are zero. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230224040852.37109-3-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index b20b00a9a7..b86c1aa6fa 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1956,7 +1956,11 @@ static RISCVException read_henvcfg(CPURISCVState *en= v, int csrno, return ret; } =20 - *val =3D env->henvcfg; + /* + * henvcfg.pbmte is read_only 0 when menvcfg.pbmte =3D 0 + * henvcfg.stce is read_only 0 when menvcfg.stce =3D 0 + */ + *val =3D env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE) | env->menvcf= g); return RISCV_EXCP_NONE; } =20 @@ -1972,7 +1976,7 @@ static RISCVException write_henvcfg(CPURISCVState *en= v, int csrno, } =20 if (riscv_cpu_mxl(env) =3D=3D MXL_RV64) { - mask |=3D HENVCFG_PBMTE | HENVCFG_STCE; + mask |=3D env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE); } =20 env->henvcfg =3D (env->henvcfg & ~mask) | (val & mask); @@ -1990,14 +1994,15 @@ static RISCVException read_henvcfgh(CPURISCVState *= env, int csrno, return ret; } =20 - *val =3D env->henvcfg >> 32; + *val =3D (env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE) | + env->menvcfg)) >> 32; return RISCV_EXCP_NONE; } =20 static RISCVException write_henvcfgh(CPURISCVState *env, int csrno, target_ulong val) { - uint64_t mask =3D HENVCFG_PBMTE | HENVCFG_STCE; + uint64_t mask =3D env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE); uint64_t valh =3D (uint64_t)val << 32; RISCVException ret; =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833337; cv=none; d=zohomail.com; s=zohoarc; b=PesZrRNR7WOUroZem+wrowUxal6DpGjMT/bpm1Ps46KTPA2e7hyi0gAlRUb70LjwsuKIP8TLRF9NlvlTLhj6GnoW2DL3WTalHKcXxmdzq/iLny57nOy0OD6Wd7wYhNh5hlRB19DWQg470kNsGwK3v0W9PQgHu4KQKmXUWubL01M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833337; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5m2PUYsFAY3FX5JhuJCzoKPCRU6d188hHgGxLD/laJI=; b=kEOhivaGgFhLWBI7d2fxRsm5Otrnllk+eUViUkpkwKd2dv/8aPsp/iaHPhx8hMLIeGRPZB3y1TcFCZ8Q0UfufjLU21yNsLxSMKsZESWMOsJpVzRVy/OQCarKRZA+ryora3bt4oKZN6LFqhvqJwBV6vVOMN6G86Y0+fLeg4hP/Gw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783333741715.83735411191492; Fri, 3 Mar 2023 00:48:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zv-0001PL-4j; Fri, 03 Mar 2023 03:42:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zj-0000B6-Hh for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:27 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zh-0007p0-GN for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:27 -0500 Received: by mail-pf1-x42b.google.com with SMTP id fd25so1102389pfb.1 for ; Fri, 03 Mar 2023 00:42:24 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id r9-20020a62e409000000b005a54a978c1bsm1042607pfh.7.2023.03.03.00.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832944; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=5m2PUYsFAY3FX5JhuJCzoKPCRU6d188hHgGxLD/laJI=; b=nhf/5s+myYaLMgZbWaXTsTdJTllY1FCYFj1uZ8e6KuUf9Wq+GtQ/+i7Nz527lhzacH BpKsR7bR0siaUr4a8iYpO5taQi5O0+kx3PHD0kBCRqY2N9jwCQWqKUBbBQM7ZbVo1I5I 5tV3Fw6b0U9c9ITpgdd4J/YFFcETT5Yhj7eCTTT0yGwg2gmErCbBcNAA/QmNTYi/rFWZ LImwanIKnNK1xbe7NGGLZ3xHTf8EfPstjnoG85ZRCiOuC6gyQf3OOT2RCJloD/bcS9R+ e5f8vCjmCYJKH7NuBjO3jAAZHr01IPZ93M9qQJgOQ2VncJplUvqiQfbUlge5l+tbWpzj wHMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832944; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5m2PUYsFAY3FX5JhuJCzoKPCRU6d188hHgGxLD/laJI=; b=p71zB4RHqTy2i9eXqarEcgi+AnXaQzWuZx5eLEdV3e33ewJs9pMVNld2aJV36JYkik S/FurZjgpEPidHDA/EeN/kTOsdz7h8zl5fxqB+Jfg1ZijexAgHyACZ0WCuuQxUI31V7K MtsomPOeUtvKvYTcCsZPfp2C6G8W5YmFQXGmGL3BFOx5VqjRqILAs9/NvQEX4b1555+I qgGWr5uL8+eagLcfE87PoN7ngNdwUP2mkcEUonWyF4Kr3sOVbqj+QFoEUGuy34x36c0t BtdRymODh5zCM2HEMyrgN7tl2VN2pgAUcJzhw1jW1JkHAGE6OEjnoGRzpAbrNlAr7VNc 2SJA== X-Gm-Message-State: AO0yUKUf/czLgeUPwHVI7hjeTx+xqxoAkdqbM/mqmI7sWshQQgGUwkpB xUIbDrWXiebhEhyXWJJJVkTdng== X-Google-Smtp-Source: AK7set9MGRj/+RwCy0oNoz1f5sSPCuAwPG0YXKDf0DpeoKpab3me/go0x3NTm1wAxORiavrrUJG79g== X-Received: by 2002:aa7:9f1a:0:b0:5a8:ae60:eb4a with SMTP id g26-20020aa79f1a000000b005a8ae60eb4amr1206329pfr.28.1677832944362; Fri, 03 Mar 2023 00:42:24 -0800 (PST) Subject: [PULL 50/59] target/riscv: Add csr support for svadu Date: Fri, 3 Mar 2023 00:37:31 -0800 Message-Id: <20230303083740.12817-51-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=palmer@rivosinc.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833338286100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Add ext_svadu property Add HADE field in *envcfg: * menvcfg.HADE is read-only zero if Svadu is not implemented. * henvcfg.HADE is read-only zero if menvcfg.HADE is zero. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230224040852.37109-4-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.h | 1 + target/riscv/cpu_bits.h | 4 ++++ target/riscv/csr.c | 17 +++++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 31537fc05f..3991eab5e5 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -450,6 +450,7 @@ struct RISCVCPUConfig { bool ext_zihintpause; bool ext_smstateen; bool ext_sstc; + bool ext_svadu; bool ext_svinval; bool ext_svnapot; bool ext_svpbmt; diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 8b0d7e20ea..fca7ef0cef 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -747,10 +747,12 @@ typedef enum RISCVException { #define MENVCFG_CBIE (3UL << 4) #define MENVCFG_CBCFE BIT(6) #define MENVCFG_CBZE BIT(7) +#define MENVCFG_HADE (1ULL << 61) #define MENVCFG_PBMTE (1ULL << 62) #define MENVCFG_STCE (1ULL << 63) =20 /* For RV32 */ +#define MENVCFGH_HADE BIT(29) #define MENVCFGH_PBMTE BIT(30) #define MENVCFGH_STCE BIT(31) =20 @@ -763,10 +765,12 @@ typedef enum RISCVException { #define HENVCFG_CBIE MENVCFG_CBIE #define HENVCFG_CBCFE MENVCFG_CBCFE #define HENVCFG_CBZE MENVCFG_CBZE +#define HENVCFG_HADE MENVCFG_HADE #define HENVCFG_PBMTE MENVCFG_PBMTE #define HENVCFG_STCE MENVCFG_STCE =20 /* For RV32 */ +#define HENVCFGH_HADE MENVCFGH_HADE #define HENVCFGH_PBMTE MENVCFGH_PBMTE #define HENVCFGH_STCE MENVCFGH_STCE =20 diff --git a/target/riscv/csr.c b/target/riscv/csr.c index b86c1aa6fa..be71c50f09 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1890,7 +1890,8 @@ static RISCVException write_menvcfg(CPURISCVState *en= v, int csrno, =20 if (riscv_cpu_mxl(env) =3D=3D MXL_RV64) { mask |=3D (cfg->ext_svpbmt ? MENVCFG_PBMTE : 0) | - (cfg->ext_sstc ? MENVCFG_STCE : 0); + (cfg->ext_sstc ? MENVCFG_STCE : 0) | + (cfg->ext_svadu ? MENVCFG_HADE : 0); } env->menvcfg =3D (env->menvcfg & ~mask) | (val & mask); =20 @@ -1909,7 +1910,8 @@ static RISCVException write_menvcfgh(CPURISCVState *e= nv, int csrno, { RISCVCPUConfig *cfg =3D &env_archcpu(env)->cfg; uint64_t mask =3D (cfg->ext_svpbmt ? MENVCFG_PBMTE : 0) | - (cfg->ext_sstc ? MENVCFG_STCE : 0); + (cfg->ext_sstc ? MENVCFG_STCE : 0) | + (cfg->ext_svadu ? MENVCFG_HADE : 0); uint64_t valh =3D (uint64_t)val << 32; =20 env->menvcfg =3D (env->menvcfg & ~mask) | (valh & mask); @@ -1959,8 +1961,10 @@ static RISCVException read_henvcfg(CPURISCVState *en= v, int csrno, /* * henvcfg.pbmte is read_only 0 when menvcfg.pbmte =3D 0 * henvcfg.stce is read_only 0 when menvcfg.stce =3D 0 + * henvcfg.hade is read_only 0 when menvcfg.hade =3D 0 */ - *val =3D env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE) | env->menvcf= g); + *val =3D env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE | HENVCFG_HADE= ) | + env->menvcfg); return RISCV_EXCP_NONE; } =20 @@ -1976,7 +1980,7 @@ static RISCVException write_henvcfg(CPURISCVState *en= v, int csrno, } =20 if (riscv_cpu_mxl(env) =3D=3D MXL_RV64) { - mask |=3D env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE); + mask |=3D env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE | HENVCFG_H= ADE); } =20 env->henvcfg =3D (env->henvcfg & ~mask) | (val & mask); @@ -1994,7 +1998,7 @@ static RISCVException read_henvcfgh(CPURISCVState *en= v, int csrno, return ret; } =20 - *val =3D (env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE) | + *val =3D (env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE | HENVCFG_HAD= E) | env->menvcfg)) >> 32; return RISCV_EXCP_NONE; } @@ -2002,7 +2006,8 @@ static RISCVException read_henvcfgh(CPURISCVState *en= v, int csrno, static RISCVException write_henvcfgh(CPURISCVState *env, int csrno, target_ulong val) { - uint64_t mask =3D env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE); + uint64_t mask =3D env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE | + HENVCFG_HADE); uint64_t valh =3D (uint64_t)val << 32; RISCVException ret; =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833083; cv=none; d=zohomail.com; s=zohoarc; b=IzHkUnOq40Ve5G4oChQ4mpI/bnBgL8SrtI0gDqjLETq76QZGzEzfnPYBy5B2RN4OQPeOCQ9tu0kescr9C8rNjiDh8kodCUAUm4Xm+Ff0m6GLL6tyv9+ZaVhip22Q/ObEabnhr6CZN32A8e6WcZ4xPbrUeR1WaFlwhq3DunMUdxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833083; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wEG7mxfnOkIxV6CDCb4kC+5QOReGUUxDqvx9Y/+Rtxk=; b=LsoFPWOy7w5rV5qDfbRyZFdcvPKDKQ1fT/rYdWLe3OPIbcBS76nux4Lt2iMPdKJKux6hji5bywAnxyLf5OPVuqsr2Su8+aDvY7hPh4s479leL1b//6KfmLDqkZiB+8OvEbnmBZ+Ex/plwcsnIe1VLg6OP5VdUNOnTizlOLx/lzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833083200708.3647693010056; Fri, 3 Mar 2023 00:44:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zq-0000so-EL; Fri, 03 Mar 2023 03:42:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zk-0000Jq-DQ for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:28 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zi-0007mo-F6 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:28 -0500 Received: by mail-pj1-x102b.google.com with SMTP id p3-20020a17090ad30300b0023a1cd5065fso1617321pju.0 for ; Fri, 03 Mar 2023 00:42:26 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kl13-20020a170903074d00b0019a88c1cf63sm967345plb.180.2023.03.03.00.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832945; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=wEG7mxfnOkIxV6CDCb4kC+5QOReGUUxDqvx9Y/+Rtxk=; b=m8yLLbm6UZL2YA1fkfhaKl72Hn8cWH5yidV0M4t9EERqoeQGk87HAKZdCMmu2g3FoY ugdciknrOZLdV6uIgqOwQjBU7a2eldYZ/IXfLFwlBUcUyo2HcEkQ3FKbr3dqtFv8uam9 jB0DqD5uh2wvrBUvsZORbN2QSwLduo3Hpfu+R5B/dfxjH948Ci4mihfrU4/1yNgxVZO5 byCY7YiqYJtaxeIYs0XyL6A4jpaSoUeFkihm4g2BhdyyVLOfX8jwFpfMjQeEhJ7GX/sl Cxsrzdged6RNPXkFZiROLkn8Z8tFoHMI6hgbL1vPUBlCcc5jIeM0UGtIcGrYcWVZz/xk h6Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832945; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wEG7mxfnOkIxV6CDCb4kC+5QOReGUUxDqvx9Y/+Rtxk=; b=ERM/L6mz6JN5/+FBlL8NVuO0wvV81Tk0w9DStFMCik/kpTq3L38FD9cJnvqwCUmrbA EL4Y5hUNMMukltZDU60mKB3w/aOujlJu/HHI7CJJwUb2D1H52tcM4/TIPVnc6ORFxTw5 P6ORJhhYuGs3oL4nxY2A4yEnJb/RzzgfiO5yTSewqC64T2/UULvZuu3JOdQLKa3J+ZTF psMwIbd79SSe6TYcQkDqcfZ3kwOs4rvUvaKGN2f68w8CSaxl41j5D6YawgrqFVTTTZFy +InrgEcYWIpYHDb+xp4MdtZ5aGOjSH6cDFDW+8dd24Z9Uo+5vhAjnRzJHa9ni6z/f14M zSWQ== X-Gm-Message-State: AO0yUKW3/J1Sou/IIR5olbpjBDuzehlnIt5GfQ6vyHHcS1Kjhq7/DOlX ncRNFJCwT2Fk9/XwoXmz+qOIug== X-Google-Smtp-Source: AK7set+o6NuPg26G2f6XZT0jKCocZv61Le4Do71tXoid0KhDstEHWTAAvaNxAUsARqug1PyXe8hRmw== X-Received: by 2002:a17:90a:1957:b0:237:659a:a44d with SMTP id 23-20020a17090a195700b00237659aa44dmr1001355pjh.9.1677832945575; Fri, 03 Mar 2023 00:42:25 -0800 (PST) Subject: [PULL 51/59] target/riscv: Add *envcfg.PBMTE related check in address translation Date: Fri, 3 Mar 2023 00:37:32 -0800 Message-Id: <20230303083740.12817-52-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833085069100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li menvcfg.PBMTE bit controls whether the Svpbmt extension is available for use in S-mode and G-stage address translation. henvcfg.PBMTE bit controls whether the Svpbmt extension is available for use in VS-stage address translation. Set *envcfg.PBMTE default true for backward compatibility. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230224040852.37109-5-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 3 +++ target/riscv/cpu_helper.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 93b52b826c..c8580f0c80 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -613,6 +613,9 @@ static void riscv_cpu_reset_hold(Object *obj) env->bins =3D 0; env->two_stage_lookup =3D false; =20 + env->menvcfg =3D (cpu->cfg.ext_svpbmt ? MENVCFG_PBMTE : 0); + env->henvcfg =3D (cpu->cfg.ext_svpbmt ? HENVCFG_PBMTE : 0); + /* Initialized default priorities of local interrupts. */ for (i =3D 0; i < ARRAY_SIZE(env->miprio); i++) { iprio =3D riscv_cpu_default_priority(i); diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 3a9472a2ff..44a8f267ae 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -936,9 +936,15 @@ restart: return TRANSLATE_FAIL; } =20 + bool pbmte =3D env->menvcfg & MENVCFG_PBMTE; + + if (first_stage && two_stage && riscv_cpu_virt_enabled(env)) { + pbmte =3D pbmte && (env->henvcfg & HENVCFG_PBMTE); + } + if (riscv_cpu_sxl(env) =3D=3D MXL_RV32) { ppn =3D pte >> PTE_PPN_SHIFT; - } else if (cpu->cfg.ext_svpbmt || cpu->cfg.ext_svnapot) { + } else if (pbmte || cpu->cfg.ext_svnapot) { ppn =3D (pte & (target_ulong)PTE_PPN_MASK) >> PTE_PPN_SHIFT; } else { ppn =3D pte >> PTE_PPN_SHIFT; @@ -950,7 +956,7 @@ restart: if (!(pte & PTE_V)) { /* Invalid PTE */ return TRANSLATE_FAIL; - } else if (!cpu->cfg.ext_svpbmt && (pte & PTE_PBMT)) { + } else if (!pbmte && (pte & PTE_PBMT)) { return TRANSLATE_FAIL; } else if (!(pte & (PTE_R | PTE_W | PTE_X))) { /* Inner PTE, continue walking */ --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833362; cv=none; d=zohomail.com; s=zohoarc; b=nhVRrEiMfWm2nmjoMUw7N/1GzJPixiJd4J3Qqfw8jwFpMRw/VPKmXZpThaqJrYb6QK0wKd+OmnEBHK9n7Ghqefzskfd+AR3HUFbMhuDsJ1MVjhvvnsbfhin7xhDbx+Hx8mauh+7GQcygmniEQy4etGgKMFGe3dor7bC+08COchk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833362; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fZYYFQkf7br/XYCwuLnMNO1BPXLZr4qEybUL4n7cJiY=; b=X9kGds34lm+iiyaUICvxeNldXRwmEKZoGwyLu7BS3qeCW8YwT0oSSOdNixjoIPDioU1bwguEiM8m4dkl4v5jK9Du+i36kAIF/im8ggkSbjZGIQed0gBFOMK1uaOQ57szqQHqa1K91yKlGG2eTfdov9EqJJwstz3f3BniZO60Qc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833362752232.67814992795934; Fri, 3 Mar 2023 00:49:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zw-0001aU-FO; Fri, 03 Mar 2023 03:42:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zl-0000Ob-Cd for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:29 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zj-00083X-Lv for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:29 -0500 Received: by mail-pl1-x635.google.com with SMTP id ky4so2002755plb.3 for ; Fri, 03 Mar 2023 00:42:27 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id u5-20020a654c05000000b0050376cedb3asm1003844pgq.24.2023.03.03.00.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832947; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=fZYYFQkf7br/XYCwuLnMNO1BPXLZr4qEybUL4n7cJiY=; b=VdagSACTnvPU46mGK5+SarJgHik7Sp/HHnkfKVsDZF9LWMZW2su2rg1SNvazTmTq+3 noU4YEWQPtl8W1Qy55oDNy8g8q74LR5MFqTLMH2T01N54nh5vzHiBdya2K+IvpkoX7xc IUool7l/q0fEQYtMpzuMNEHcqmPzaqtgnE80ZejgPIsO59uSHx++aoWR2RpbENhqoRCK j7qofs1k0iEylKYqz0InP0qr7zUW1MPJnZSVmrv6rbyi6JOw0Ny0u2vIvpG0m5cd6NES /m5fSXqsQJtvzSKeKZ2/83a7rsMzfXr8ZLjD8xRpkKCXaRy/7RLvJjVT7sL5glqWXNZ8 tAOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832947; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fZYYFQkf7br/XYCwuLnMNO1BPXLZr4qEybUL4n7cJiY=; b=ea0zws6RXAfI1+PbsHquBzFrNbiPcJv5BkFbvro+FVwKjqqpmg+RnV8bqmFsnwu858 qKZO2J6rHk9sPI/Jk/Cy7t6hwQXfUFi3sBTsVGFX1HHk/b8f1deth1jjVonzpAMhiFqK 6KiZ4JMRhKpd/7gnCGB5zEKzNVIbE0sHxaOe/ks2934GzL+gL3liM2I+8nkGh1yWPDDv wZLvOba9/yx9mt/buSVKidp8bziXnGcrtWXqZYKIN3p3Z/yMbOSVJRfrOq5kTIsPfHWI XzBxgCIXZaCl9dBlCG25/Ckhfes7Il+EVROdn2apF0DCUnBfi4r1OLVuC+c8P7nPHhlI nA3w== X-Gm-Message-State: AO0yUKXGuZMu41lIQoa8oeNkVcD2UuOf+RgPHFNjxCrYoRwy/qEhzDvW 6LvfiDWORs5aGs1DfOHMuoW6YdUUWPN4DbEJ X-Google-Smtp-Source: AK7set9Xlo2YLH5StYx2rh1bbhR1WKrf1lUgrubCXuRJugu8sDhhKRaztkysjJ7E+dJ2kuqvuNsJ1A== X-Received: by 2002:a17:90a:1c3:b0:237:3f83:61f3 with SMTP id 3-20020a17090a01c300b002373f8361f3mr944748pjd.16.1677832946849; Fri, 03 Mar 2023 00:42:26 -0800 (PST) Subject: [PULL 52/59] target/riscv: Add *envcfg.HADE related check in address translation Date: Fri, 3 Mar 2023 00:37:33 -0800 Message-Id: <20230303083740.12817-53-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833364421100007 Content-Type: text/plain; charset="utf-8" From: Weiwei Li When menvcfg.HADE is 1, hardware updating of PTE A/D bits is enabled during single-stage address translation. When the hypervisor extension is implemented, if menvcfg.HADE is 1, hardware updating of PTE A/D bits is enabled during G-stage address translation. Set *envcfg.HADE default true for backward compatibility. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230224040852.37109-6-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 6 ++++-- target/riscv/cpu_helper.c | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index c8580f0c80..32cb297cfe 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -613,8 +613,10 @@ static void riscv_cpu_reset_hold(Object *obj) env->bins =3D 0; env->two_stage_lookup =3D false; =20 - env->menvcfg =3D (cpu->cfg.ext_svpbmt ? MENVCFG_PBMTE : 0); - env->henvcfg =3D (cpu->cfg.ext_svpbmt ? HENVCFG_PBMTE : 0); + env->menvcfg =3D (cpu->cfg.ext_svpbmt ? MENVCFG_PBMTE : 0) | + (cpu->cfg.ext_svadu ? MENVCFG_HADE : 0); + env->henvcfg =3D (cpu->cfg.ext_svpbmt ? HENVCFG_PBMTE : 0) | + (cpu->cfg.ext_svadu ? HENVCFG_HADE : 0); =20 /* Initialized default priorities of local interrupts. */ for (i =3D 0; i < ARRAY_SIZE(env->miprio); i++) { diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 44a8f267ae..7b7df01935 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -937,9 +937,11 @@ restart: } =20 bool pbmte =3D env->menvcfg & MENVCFG_PBMTE; + bool hade =3D env->menvcfg & MENVCFG_HADE; =20 if (first_stage && two_stage && riscv_cpu_virt_enabled(env)) { pbmte =3D pbmte && (env->henvcfg & HENVCFG_PBMTE); + hade =3D hade && (env->henvcfg & HENVCFG_HADE); } =20 if (riscv_cpu_sxl(env) =3D=3D MXL_RV32) { @@ -998,6 +1000,10 @@ restart: =20 /* Page table updates need to be atomic with MTTCG enabled */ if (updated_pte !=3D pte) { + if (!hade) { + return TRANSLATE_FAIL; + } + /* * - if accessed or dirty bits need updating, and the PTE = is * in RAM, then we do so atomically with a compare and s= wap. --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833485; cv=none; d=zohomail.com; s=zohoarc; b=QTWnQFeDBI1EEz1XWMv3NUhSeqzVFyW8i8lqm4hZzte/GVJtfgMwbV/VrENl0AfotImGZ9JAGkjzbJaPgvVknH67TXX6r6tyk6G3WftWDL53D8tC6AM5pRrxwXUor6IIW17XM+ow8FA3F/qMbP+9cOoeiHMywt1KHE/OO2aiCpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833485; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UjoHNib20pIew68vmS2SQnjR8Wl4697BfKVl8VxrneI=; b=ivIZpawSPdavUHnjGJrjgSbekZPL/WCVQk3WjCucJrumTowcMqoWfxE7zioH0P2drOmNUmzCemQRmJcnBO/H3NBfdnrZ15IzZJ/z6SOOkXxhRpPGBQNRfOmZUwPCAprwvC1Bx+GI+pGetVQxGwGZ2m4sMFAL/unYFHTMZz0TzKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833485065446.2929370736515; Fri, 3 Mar 2023 00:51:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zx-0001eH-9t; Fri, 03 Mar 2023 03:42:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zn-0000WY-2B for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:31 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zl-00088k-FZ for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:30 -0500 Received: by mail-pj1-x102f.google.com with SMTP id 6-20020a17090a190600b00237c5b6ecd7so5414846pjg.4 for ; Fri, 03 Mar 2023 00:42:29 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id f34-20020a635562000000b00502fd141ffbsm974595pgm.49.2023.03.03.00.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832948; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=UjoHNib20pIew68vmS2SQnjR8Wl4697BfKVl8VxrneI=; b=b3j5GJOL5QdaxDL/LTpOcHtWvm3s79jA+JOHqOpb7XZqllJdW6fTFoZoC+79ylznlF Ik3gwSdv2SnHsIZm/yPxeVLZHJ50wyK3ROUXIU11xAeQT+Tf4SNsrJLHUzKZ99kUfDuX aXq2t63K5qsAa6CB4fABwFUifwJuxkuxCF/RjEo6esE8tiO1qNdFjieb7KVudhLfifAe 2TqWZm98Xa4VwQJ6wUEYbnF4JnOL+DgOugiT+0zC8mzsuP9JIGmbXJCek+92qVctvgE/ 5fpz74Kfk0qcdx1R3474s0dE+0i46W8pyKDExPCe+g2Lv6rrD2yDN6zZ53FTvqnKgbzD J/Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832948; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UjoHNib20pIew68vmS2SQnjR8Wl4697BfKVl8VxrneI=; b=uE30NbNnY6xBzTO6VpujIpChbxPFesZ9IGclpdB97QdOLCxAGpZ8QVtois5olHXB3n hF+Xrn+YsmFQGG6rVRYoGHRnehNpsToxe1uUHqlzM5grVjMHj6WCJLkS2P4QLRFxcuvS jLKYu9drNtS3MkHzlUKyxvWXLHhWeXQ3WDLnHE7hzDWtXCl9WasmRUBBSr7tR8QKJror lSdKYcC5vT0k7zrfgMWHWvTsULX4xrxMmAEIK8lGex6TUQQYRRnOS45OAVVnO7dM+UXb vFgUb3cSycNuPrShxXFXCSNQk+DK71rHEuTBWGR4dJLGR6RwI2hQQby6hsrC6QE+KwMt /ajA== X-Gm-Message-State: AO0yUKUA/uy0ZZpMuQJ7VHct67tzngFU/lacldbC4Qu76XOl3ay08Pgg htB7jviNakXdTFG+xUDodmKH9A== X-Google-Smtp-Source: AK7set+m8h+lB3RMD8f5BO1sG16b5O4P9UN0Lqpv/dArizhBfuNz2Emd7CTpR7aMRGT/FLcHUnbirQ== X-Received: by 2002:a05:6a20:3d92:b0:bf:58d1:ce86 with SMTP id s18-20020a056a203d9200b000bf58d1ce86mr4746868pzi.5.1677832947977; Fri, 03 Mar 2023 00:42:27 -0800 (PST) Subject: [PULL 53/59] target/riscv: Export Svadu property Date: Fri, 3 Mar 2023 00:37:34 -0800 Message-Id: <20230303083740.12817-54-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Weiwei Li , Junqiang Wang , Daniel Henrique Barboza , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833486996100003 Content-Type: text/plain; charset="utf-8" From: Weiwei Li Set it default true for backward compatibility Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Daniel Henrique Barboza Message-ID: <20230224040852.37109-7-liweiwei@iscas.ac.cn> Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 32cb297cfe..1be9f3f836 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -107,6 +107,7 @@ static const struct isa_ext_data isa_edata_arr[] =3D { ISA_EXT_DATA_ENTRY(ssaia, true, PRIV_VERSION_1_12_0, ext_ssaia), ISA_EXT_DATA_ENTRY(sscofpmf, true, PRIV_VERSION_1_12_0, ext_sscofpmf), ISA_EXT_DATA_ENTRY(sstc, true, PRIV_VERSION_1_12_0, ext_sstc), + ISA_EXT_DATA_ENTRY(svadu, true, PRIV_VERSION_1_12_0, ext_svadu), ISA_EXT_DATA_ENTRY(svinval, true, PRIV_VERSION_1_12_0, ext_svinval), ISA_EXT_DATA_ENTRY(svnapot, true, PRIV_VERSION_1_12_0, ext_svnapot), ISA_EXT_DATA_ENTRY(svpbmt, true, PRIV_VERSION_1_12_0, ext_svpbmt), @@ -1104,6 +1105,8 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128), DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64), =20 + DEFINE_PROP_BOOL("svadu", RISCVCPU, cfg.ext_svadu, true), + DEFINE_PROP_BOOL("svinval", RISCVCPU, cfg.ext_svinval, false), DEFINE_PROP_BOOL("svnapot", RISCVCPU, cfg.ext_svnapot, false), DEFINE_PROP_BOOL("svpbmt", RISCVCPU, cfg.ext_svpbmt, false), --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833558; cv=none; d=zohomail.com; s=zohoarc; b=f1NVxVvFMRedt0u+RwlgSLuqpXiYFiEuJPH65L/N0qJNM7KRi1IjqUNJZD6jCqZcjGZAAYwpQoKOc8wwyIa2a7hqdDC/E4DiHGpVDPQgh+CMaKWd1jk+tRyEbnGXwpsoKj0Vl6M7tavfZRBqC4r8E1JC5MVMsW6/N6AkamBLLPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833558; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=82h2vRR5TSHW1u0Jlt4giv+BcWArhc5iaQ4XkWCBX7g=; b=cBhSIlvsdYjrq0BosC+Se3Gb2dnHu2EzkZbN7lBF/xNwgXTD8zzSXpzU1JNncVFgd3lHiwYTHBVz1F20qcfvVweuPBebBZ0l6CymDKjAce+pwxWBlQ5CbS9mEwaOjhClZcrifUWGI4SfFH4XA9V7aAW9icMvTLoQh96OTL2lIwU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783355818660.752455645527675; Fri, 3 Mar 2023 00:52:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY0zs-0001AB-R6; Fri, 03 Mar 2023 03:42:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zn-0000av-LD for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:31 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zm-0007pD-0n for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:31 -0500 Received: by mail-pj1-x102c.google.com with SMTP id qa18-20020a17090b4fd200b0023750b675f5so5423706pjb.3 for ; Fri, 03 Mar 2023 00:42:29 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id q15-20020a170902f78f00b001948ff5cc32sm952250pln.215.2023.03.03.00.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832949; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=82h2vRR5TSHW1u0Jlt4giv+BcWArhc5iaQ4XkWCBX7g=; b=qJCsSRycIws//tyhMVjGLu6ywxNbUWq/EpBAYtt06a5aefUYr9IFX6c51tozNobEbO mNaXIP774C4yY/J55Wv4vaVZbYU5AGBBP+3oX5PBvLr3A1/Jcggfwkzn/gOmZTvKW21l 5dPXStv+gHjE1LKElcX8wDarRwy/ykr1x+B5WduZB/fHkIHXp9OzKy3vYd6EnNiY7wVk jYmXkJ8mg2saBK8GTkdDvSLu2pGDNAscnrv20F3SP8zl/H1U+bJX8+4D3twnLbVwX8JA dJeBGxxyhEQkbeFhrCfoawRKdk//MWOM15MWk3oTzLGCaymC3oNFQj4CwVXCrSRo9k7S OrLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832949; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=82h2vRR5TSHW1u0Jlt4giv+BcWArhc5iaQ4XkWCBX7g=; b=2FI50lV1ZnPWr0whL4EIfeyuXt8mD9RyGcmZPW/DUMtFO1rTj40vzhHtuGMHLHmnnz o6zVwy+QmaN40LB+0u0vdU9OI1XjuAJ8yL+jxONRO9grpZiuPIQwgre8y63qq0vkqGwe Dq1BEtKxv+P7BysJdFlxY45giennLAtk/XJ5BglZwviehevCimaEY6V/f6vcDq/uQLcb WExy9d3mALinS0X6mMbUn6OD+9lBG1Yw1HIVsAoMfsvw2zVrIQP1YwGX1/7qTx4CHQXy gRWuVUUXPtpT/7WZYCUL4lKqXFRD2cc1upYWrTc60CGpOgF8eOVpUK7YJDsAEvOGYBP6 dcuw== X-Gm-Message-State: AO0yUKXgykUIH+WNyUTcq5bhZAh50brdye7JJc/0N1vgArtj4ABwaSNE JgiHi4+1ac7/0RjMqbkKkV5w+g== X-Google-Smtp-Source: AK7set+8Om/t/KPnpoGXM3eem1NSHfyvFzkxi8WyxVpX4Vu3HXvCoLIMpf7IYVLPGZAjCD+V8sPgQg== X-Received: by 2002:a17:902:db02:b0:19c:bfe3:6f73 with SMTP id m2-20020a170902db0200b0019cbfe36f73mr3509935plx.16.1677832949204; Fri, 03 Mar 2023 00:42:29 -0800 (PST) Subject: [PULL 54/59] target/riscv/csr.c: use env_archcpu() in ctr() Date: Fri, 3 Mar 2023 00:37:35 -0800 Message-Id: <20230303083740.12817-55-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Richard Henderson , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833560064100011 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We don't need to use env_cpu() and CPUState(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson Message-ID: <20230224174520.92490-2-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 1b0a0c1693..d047d8b45c 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -108,8 +108,7 @@ static RISCVException vs(CPURISCVState *env, int csrno) static RISCVException ctr(CPURISCVState *env, int csrno) { #if !defined(CONFIG_USER_ONLY) - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + RISCVCPU *cpu =3D env_archcpu(env); int ctr_index; target_ulong ctr_mask; int base_csrno =3D CSR_CYCLE; --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833302; cv=none; d=zohomail.com; s=zohoarc; b=F8T914DBLTR5b51WHZ7y2txw7Rbav4SQ6zvZGsedayV/PlglqNJMu+DhrxIcY2OeE0H843l8jv6tRSz1rC5U7OFlDvR5Xk6fSfPjIaezFB7fKYt1yMq/fcjDjVM3tEzNfhO2Z+gctJTTjOaQNfrV+VILz2Yogps40iyFP8UyktY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833302; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3xo32Q/W9exIcQSQRk26MLcHrnaSeK2Ei0hlw6FIGGU=; b=Xa3keH/SC+A+icb1KvB2MOUPTPGssM0Uc+scv9mzBcrb6lBDBOh+sTYqthb5M3j3wFQyag6yxBWbYcOETLv5V/d2qhSE5LZ52/19rI8cT2IHQEp0ao4MFwopsa0gUV39B6EmSJPGPl2DqrAaUDyh0uIS9fr431gw77jb8wOntDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833302341575.2460905427918; Fri, 3 Mar 2023 00:48:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY100-0001q3-5M; Fri, 03 Mar 2023 03:42:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zp-0000rS-US for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:34 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zo-00089L-2f for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:33 -0500 Received: by mail-pg1-x52b.google.com with SMTP id q23so1017743pgt.7 for ; Fri, 03 Mar 2023 00:42:31 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id p3-20020a62ab03000000b005a9cb8edee3sm1034433pff.85.2023.03.03.00.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832950; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=3xo32Q/W9exIcQSQRk26MLcHrnaSeK2Ei0hlw6FIGGU=; b=avYThU0ZFYYCrYit9saFZvsyJokVo0iUFu5PTwBoTzUB1x/PrbYaNR39VlDA7d/zRe ih1BAIks/L2rh91kizls5JOWx8CLnRZvrEud/I0wJ5gi9BdLCPMeKNRCABRMCB56vyfg AdKGyiRkhEOS+XWI/RS1TbPJCYcXiY4g6OzUU1VVQ8WugYABR4og994cPtXkPB63dXQx ag6dyudxjfJSply2UwPmFWx9u17M1Vj+zZvXqwmdf8Q8SmZUOLJcLP2JyxDfX4cKta6t ezatxslb+DeaeVKE5uu1wIWqKTBHF5kMqj3eIqs5HvJYAGf2LqTUypQni8P7vOnCPABq n89A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832950; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3xo32Q/W9exIcQSQRk26MLcHrnaSeK2Ei0hlw6FIGGU=; b=z8ETFl/E+v3Hub+PK+qJI8Ohg2BGvolH5+Ily6462EDR32o8P/TKxmTwgzMU4WpJh4 kjK0mkU5aPJ3bAekQd//bonWy8op7jwXRBnznCslbGuoTdvadUqZBKvJWNl1/ku57ceL Iu7BISM+pIeMvRMTRKD/Wekg8nhGlWM3b7yK5EWzARi4Rv1roI8eV21af4mNvYMCe8Cp JL1SHKpqnZiyrdGLObh2f219DZCOs7zq1Dct/I/QMD/8p1KPjMzJKNwJ0TgWUQ/yU2s4 KxopBYyBybw4vxX9BlvU0wHRmtkQKck0uKll9RyW4k95OauOP5Lu8BgXY+xBsP6lRo+7 zF4w== X-Gm-Message-State: AO0yUKU+FO7FxEkgmQ42GV+ohOAO3fdCzDwZTpefFiIhyrS+jwNRp4yV AHnmkx8pQAZrbjxI0I0vweichg== X-Google-Smtp-Source: AK7set89KiXBQT6AtGNz17PQj2AeJWb4BlzOlmSv5DX66IbJcMjlACWoumSNRfX2VqoeXY71GyftFw== X-Received: by 2002:a62:3813:0:b0:5a8:9858:750a with SMTP id f19-20020a623813000000b005a89858750amr925422pfa.13.1677832950448; Fri, 03 Mar 2023 00:42:30 -0800 (PST) Subject: [PULL 55/59] target/riscv/csr.c: simplify mctr() Date: Fri, 3 Mar 2023 00:37:36 -0800 Message-Id: <20230303083740.12817-56-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Richard Henderson , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=palmer@rivosinc.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833304146100011 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza Use riscv_cpu_cfg() to retrieve pmu_num. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Richard Henderson Message-ID: <20230224174520.92490-3-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index d047d8b45c..bf456fe87c 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -165,8 +165,7 @@ static RISCVException ctr32(CPURISCVState *env, int csr= no) #if !defined(CONFIG_USER_ONLY) static RISCVException mctr(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); + int pmu_num =3D riscv_cpu_cfg(env)->pmu_num; int ctr_index; int base_csrno =3D CSR_MHPMCOUNTER3; =20 @@ -175,7 +174,7 @@ static RISCVException mctr(CPURISCVState *env, int csrn= o) base_csrno +=3D 0x80; } ctr_index =3D csrno - base_csrno; - if (!cpu->cfg.pmu_num || ctr_index >=3D cpu->cfg.pmu_num) { + if (!pmu_num || ctr_index >=3D pmu_num) { /* The PMU is not enabled or counter is out of range*/ return RISCV_EXCP_ILLEGAL_INST; } --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833460; cv=none; d=zohomail.com; s=zohoarc; b=NFFtXTct9wQwGRwsiehXNOa2xLbWQMTX68uayHAglRx8OcMCMscBwAHLDySL1EH4ie/TUraryAzdpFCGCKntatyZMt9VCcqxsVICo6JMsIURUVCz8OYNOEh/zILaOyNlS826kNY43rUzzY1zVcaqpQrb7KtY1rEOSXULOfgOnUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833460; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ybZ1Wm5+uUB4TzT2Lbg88p+dBjPYzHhvb9w1IkoxOKs=; b=OPqnTMSOUOd/cmJlfz03O33tI1FjDWhKdPGiFBZLyLzuapyA3ehyfdcG+wZoN7CFpVqQFK7tqOuEKUNsQDGk8I44IFH1UMNeEXJjFkUWJL15FcR46DVJ1XWpw3EdkYOY0pq3E7X0OVqD8/QhNHvgnc0234hiaB3mac88O8JhTb8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833460218136.67573973449544; Fri, 3 Mar 2023 00:51:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY100-0001rz-HW; Fri, 03 Mar 2023 03:42:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zq-0000yW-QP for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:34 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zo-0007qA-Po for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:34 -0500 Received: by mail-pl1-x62e.google.com with SMTP id u5so1974793plq.7 for ; Fri, 03 Mar 2023 00:42:32 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id kf3-20020a17090305c300b0019c90f8c831sm882700plb.242.2023.03.03.00.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832952; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=ybZ1Wm5+uUB4TzT2Lbg88p+dBjPYzHhvb9w1IkoxOKs=; b=vSk4p6YovOJ92WSG+YP/fxtONcHFul6wIdTBD388L4p2r/L4Jnjvaduf2S/z7/zX93 4eaGsr3Z8rjkMPmGIKcsVhmtDIdxqtIs3jP6n97qGsn3zF3XobqPAu1IZr7P59qcOC1d dmR9hQi5uJ2F2yZfZVk40kcD5ErIsfK7+mHi3chrdqcNCODgGIgfBuNUGPl6dNYvoZcJ aNMxMIclwQs8wR0+BnEUQ3/zJVZjXVDYRxe6ARB114eTP9GkWIG+xrJlYJ/wqaqJYHGh 8/csGk1FAlX4ztDnEEMlLUUOFdgRQeXAvtsbErZTTbc4aoJrrEqZ38MHSyRE3YoT5xGe BX+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832952; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ybZ1Wm5+uUB4TzT2Lbg88p+dBjPYzHhvb9w1IkoxOKs=; b=ZjhlMUg+ZGEbhS4I6xvu6eprlu2TO3u5483h6hlPGgVqCB1sGrSsVZBG8GX0Asq3hV 5Wtv35QdDuNeKOPHk/QbHATPZ4G7kJfq5q3SMrlBwFLhWpw7boSbeuO2ziARvGG5tYIM h6XSz7xpQyei4VopSOsoKAoIb+8uARxSyet7pIKL/qpO9SUgAYiju7ATCxAcYACdvGKZ kzhSeM9bEORFCY6rL4A+mSB8vZXXzbF2L5l9mJfYyALjPpaG6YEkK3oEmTKeZzJiXI4G JoPZ+X7iIHVKQOKPMCZ7sdfCvKxTMJZgt5ZdO8y5XtaO9kLurzJZBlaKcNaL9o0SChCg MOEQ== X-Gm-Message-State: AO0yUKXVfNdfmYxDhjR4QE0iIQ//UWp8US3I23hg28ox1q00xmpDB1ea xDQk7kEpjOBAQVIkghaV8hH6s7hAtYYLGRrz X-Google-Smtp-Source: AK7set85budnT5FxQbkBqPuO/bFYb803pFnnkOOcnZT9lqwGODsUU1jyiMBLcFO0pctxM+WQsOLasg== X-Received: by 2002:a17:903:18e:b0:19a:75b8:f4ff with SMTP id z14-20020a170903018e00b0019a75b8f4ffmr1527686plg.35.1677832951859; Fri, 03 Mar 2023 00:42:31 -0800 (PST) Subject: [PULL 56/59] target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers Date: Fri, 3 Mar 2023 00:37:37 -0800 Message-Id: <20230303083740.12817-57-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , LIU Zhiwei , Weiwei Li , Richard Henderson , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833460925100005 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza A common trend in this file is to retrieve a RISCVCPU pointer by first retrieving a CPUState pointer via env_cpu(). The CPU pointer is used only to access the RISCVCPUConfig object and nothing else. Let's use riscv_cpu_cfg() to access what we need directly without these 2 pointers. Suggested-by: LIU Zhiwei Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Richard Henderson Message-ID: <20230224174520.92490-4-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 50 +++++++++++----------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index bf456fe87c..86e183feb3 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -46,10 +46,8 @@ static RISCVException smstateen_acc_ok(CPURISCVState *en= v, int index, uint64_t bit) { bool virt =3D riscv_cpu_virt_enabled(env); - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); =20 - if (env->priv =3D=3D PRV_M || !cpu->cfg.ext_smstateen) { + if (env->priv =3D=3D PRV_M || !riscv_cpu_cfg(env)->ext_smstateen) { return RISCV_EXCP_NONE; } =20 @@ -81,7 +79,7 @@ static RISCVException fs(CPURISCVState *env, int csrno) { #if !defined(CONFIG_USER_ONLY) if (!env->debugger && !riscv_cpu_fp_enabled(env) && - !RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) { + !riscv_cpu_cfg(env)->ext_zfinx) { return RISCV_EXCP_ILLEGAL_INST; } #endif @@ -90,11 +88,9 @@ static RISCVException fs(CPURISCVState *env, int csrno) =20 static RISCVException vs(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - if (env->misa_ext & RVV || - cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) { + riscv_cpu_cfg(env)->ext_zve32f || + riscv_cpu_cfg(env)->ext_zve64f) { #if !defined(CONFIG_USER_ONLY) if (!env->debugger && !riscv_cpu_vector_enabled(env)) { return RISCV_EXCP_ILLEGAL_INST; @@ -193,10 +189,7 @@ static RISCVException mctr32(CPURISCVState *env, int c= srno) =20 static RISCVException sscofpmf(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - - if (!cpu->cfg.ext_sscofpmf) { + if (!riscv_cpu_cfg(env)->ext_sscofpmf) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -319,10 +312,7 @@ static RISCVException umode32(CPURISCVState *env, int = csrno) =20 static RISCVException mstateen(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - - if (!cpu->cfg.ext_smstateen) { + if (!riscv_cpu_cfg(env)->ext_smstateen) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -331,10 +321,7 @@ static RISCVException mstateen(CPURISCVState *env, int= csrno) =20 static RISCVException hstateen_pred(CPURISCVState *env, int csrno, int bas= e) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - - if (!cpu->cfg.ext_smstateen) { + if (!riscv_cpu_cfg(env)->ext_smstateen) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -361,10 +348,8 @@ static RISCVException sstateen(CPURISCVState *env, int= csrno) { bool virt =3D riscv_cpu_virt_enabled(env); int index =3D csrno - CSR_SSTATEEN0; - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); =20 - if (!cpu->cfg.ext_smstateen) { + if (!riscv_cpu_cfg(env)->ext_smstateen) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -916,11 +901,9 @@ static RISCVException read_timeh(CPURISCVState *env, i= nt csrno, =20 static RISCVException sstc(CPURISCVState *env, int csrno) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); bool hmode_check =3D false; =20 - if (!cpu->cfg.ext_sstc || !env->rdtime_fn) { + if (!riscv_cpu_cfg(env)->ext_sstc || !env->rdtime_fn) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -1150,30 +1133,21 @@ static RISCVException write_ignore(CPURISCVState *e= nv, int csrno, static RISCVException read_mvendorid(CPURISCVState *env, int csrno, target_ulong *val) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - - *val =3D cpu->cfg.mvendorid; + *val =3D riscv_cpu_cfg(env)->mvendorid; return RISCV_EXCP_NONE; } =20 static RISCVException read_marchid(CPURISCVState *env, int csrno, target_ulong *val) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - - *val =3D cpu->cfg.marchid; + *val =3D riscv_cpu_cfg(env)->marchid; return RISCV_EXCP_NONE; } =20 static RISCVException read_mimpid(CPURISCVState *env, int csrno, target_ulong *val) { - CPUState *cs =3D env_cpu(env); - RISCVCPU *cpu =3D RISCV_CPU(cs); - - *val =3D cpu->cfg.mimpid; + *val =3D riscv_cpu_cfg(env)->mimpid; return RISCV_EXCP_NONE; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833375; cv=none; d=zohomail.com; s=zohoarc; b=nEEmXCRQRIrnQcTrqh/4OQ95R674XGMXwZaq1kUGcm/4qM+jgqMX9FqYSsFLIqfdjKexDuoiL0J9/19qOQ0prEoki3x/F5CbBnIq6nUt3laHcbOJ32OKTyd+GNOP0AzVuOryGMyf2qhD9spwI9okoBaRf51vMDAdUuAglo6HowU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833375; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FU1WZWfhUrClQ+i/10j1huFdXLlOZ65xQbsUS0p/yqk=; b=bfvbaFEdBDTJN/OXdtvtTVD8ppHQZLcMqB5k1jnwsqUMubn8Mb/puAV5ebpx+aCoJGVBHF7nwrp09jScv8NnKEKOLl0ur84+lPt4B5MU9xstY3oN7prua9xGSyAJJ1tfLHl5K8nv/6aOpfJDjhipO+zqjxh3q3sxez6XSPYv16w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783337596870.59680904825098; Fri, 3 Mar 2023 00:49:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY101-0001wq-6R; Fri, 03 Mar 2023 03:42:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zs-00019Y-CN for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:36 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zq-0008A6-Bo for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:36 -0500 Received: by mail-pl1-x62d.google.com with SMTP id y11so2014336plg.1 for ; Fri, 03 Mar 2023 00:42:33 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id hv11-20020a17090ae40b00b002369d3b282csm999347pjb.40.2023.03.03.00.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832953; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=FU1WZWfhUrClQ+i/10j1huFdXLlOZ65xQbsUS0p/yqk=; b=W4kF7CifQpRfEGs0KoBc19sK4yjem2wk8p1fGcon7m++xTm+aQCbhLSLL8xAQ0RhsY cljAcW5HQetm7Y6U6q/aF6nwfYm01AVu2tHc66PcseQkMvaz/kTtsSVUKX4eFhit9cQ/ CQr9XoC6CWP5TgBBKgrceLMJMAJxKwQbBQIPyYgNgqSY4XkNRR7vMuPV31SpLyLiaX33 G1skKPAfI8hGMX4vPlkw+29RKsM8sSHHmv94njgYlDomthFiEUDFFa34CPqdhI8CO3Ak /eLRt3foy7GK6VyzuDhj/FNBXDty7CTZslmRFZg/pBTNCzvHQwGdhFabPvtqrlZIA06z ElWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832953; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FU1WZWfhUrClQ+i/10j1huFdXLlOZ65xQbsUS0p/yqk=; b=eAhLDSpauQBXZ7hbhb9VTJJc1r9sPwBCAR15qYhgahu9Xw7ejYChsTxBuPqJymqsKV 16LZtm+qOzbm0CzuAhK9adugl873jJdxpxZSprI930jOq5CIo+x3R1Iujt4o4d+wCTQq cASMzLGetuf65clvkC3Zlu3IxTGI72xgVy2jLOKAp1bd2MO9KTNSCEYRVKg0YmHKm0Z4 ztvbdoFtg2hEywJmypC1IeJ6W7ZswT9j0/85//FN2Tjx3ICWETnmP+77enKT9hGqdSsf 0qNKWNnbBOO6mPTV8kBxlNA/+KAGOJfcwYgX4iLwyZqJ9vttGPX018sRaFhaVgkrRkm9 U+KQ== X-Gm-Message-State: AO0yUKXSx8d8kxbnuglDHJ+RoABrrweQrBJds37gtLehr6+oSTGicfwp gIj+D7quncLaOcEZdecY4yl/nw== X-Google-Smtp-Source: AK7set99C9AKD0vChMFMq546xbyTSR+fsg37SnVHIJsXSvMJCXi9QbGJwXZpQg3OuGp/Z6g05//L6g== X-Received: by 2002:a17:90b:4d8c:b0:22c:8686:5f04 with SMTP id oj12-20020a17090b4d8c00b0022c86865f04mr940938pjb.15.1677832953040; Fri, 03 Mar 2023 00:42:33 -0800 (PST) Subject: [PULL 57/59] target/riscv/csr.c: avoid env_archcpu() usages when reading RISCVCPUConfig Date: Fri, 3 Mar 2023 00:37:38 -0800 Message-Id: <20230303083740.12817-58-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , LIU Zhiwei , Weiwei Li , Richard Henderson , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833376520100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza Retrieving the CPU pointer using env_archcpu() just to access cpu->cfg can be avoided by using riscv_cpu_cfg(). Suggested-by: LIU Zhiwei Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Richard Henderson Message-ID: <20230224174520.92490-5-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/csr.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 86e183feb3..78c3b6d5f6 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -213,9 +213,7 @@ static RISCVException any32(CPURISCVState *env, int csr= no) =20 static int aia_any(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_smaia) { + if (!riscv_cpu_cfg(env)->ext_smaia) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -224,9 +222,7 @@ static int aia_any(CPURISCVState *env, int csrno) =20 static int aia_any32(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_smaia) { + if (!riscv_cpu_cfg(env)->ext_smaia) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -253,9 +249,7 @@ static int smode32(CPURISCVState *env, int csrno) =20 static int aia_smode(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_ssaia) { + if (!riscv_cpu_cfg(env)->ext_ssaia) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -264,9 +258,7 @@ static int aia_smode(CPURISCVState *env, int csrno) =20 static int aia_smode32(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_ssaia) { + if (!riscv_cpu_cfg(env)->ext_ssaia) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -380,9 +372,7 @@ static RISCVException pointer_masking(CPURISCVState *en= v, int csrno) =20 static int aia_hmode(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_ssaia) { + if (!riscv_cpu_cfg(env)->ext_ssaia) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -391,9 +381,7 @@ static int aia_hmode(CPURISCVState *env, int csrno) =20 static int aia_hmode32(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_ssaia) { + if (!riscv_cpu_cfg(env)->ext_ssaia) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -430,9 +418,7 @@ static RISCVException debug(CPURISCVState *env, int csr= no) =20 static RISCVException seed(CPURISCVState *env, int csrno) { - RISCVCPU *cpu =3D env_archcpu(env); - - if (!cpu->cfg.ext_zkr) { + if (!riscv_cpu_cfg(env)->ext_zkr) { return RISCV_EXCP_ILLEGAL_INST; } =20 @@ -555,7 +541,7 @@ static RISCVException read_vl(CPURISCVState *env, int c= srno, =20 static int read_vlenb(CPURISCVState *env, int csrno, target_ulong *val) { - *val =3D env_archcpu(env)->cfg.vlen >> 3; + *val =3D riscv_cpu_cfg(env)->vlen >> 3; return RISCV_EXCP_NONE; } =20 @@ -610,7 +596,7 @@ static RISCVException write_vstart(CPURISCVState *env, = int csrno, * The vstart CSR is defined to have only enough writable bits * to hold the largest element index, i.e. lg2(VLEN) bits. */ - env->vstart =3D val & ~(~0ULL << ctzl(env_archcpu(env)->cfg.vlen)); + env->vstart =3D val & ~(~0ULL << ctzl(riscv_cpu_cfg(env)->vlen)); return RISCV_EXCP_NONE; } =20 --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833445; cv=none; d=zohomail.com; s=zohoarc; b=aQ9IT4mfgZdtb68eodYwnfI49RojMkq5s7ElnldV2dBTmu8PzrDsIF2SIi2yZShSzFz1g/anGdEMQf64msy2PGTOJwEIM6mJCdLHsWpm79O7Tdc+zEv2wwMOboAx0klcx2eEk7vXODoc6/D8UuD41k85YVRXGck/WDxAVFneh/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833445; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7cOCkkpY1/6w/mGzzZZmxagwohDu2O0n7RpZ/Apo/tc=; b=nK1IOo4fo0VN0cuSXT0sZheXR3UhLqm59GL7sEgoLQK9vDzRdcr08yWwT/aaoLeWUUrnt1xkA6IkCZ8H0W5JacOy5GaZuFO0K/MNGvPUnLuOPZJIKQkljH76AKH66Nq41QeZRUREFpfvG1vqsbuq+L7BRZM7mKPlBust625lG+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167783344560235.85997146997522; Fri, 3 Mar 2023 00:50:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY100-0001s6-IX; Fri, 03 Mar 2023 03:42:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zt-0001EE-AO for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:37 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zr-00084V-6t for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:37 -0500 Received: by mail-pj1-x102f.google.com with SMTP id x34so1847589pjj.0 for ; Fri, 03 Mar 2023 00:42:34 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id p22-20020aa78616000000b005d55225fc07sm1036211pfn.73.2023.03.03.00.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832954; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=7cOCkkpY1/6w/mGzzZZmxagwohDu2O0n7RpZ/Apo/tc=; b=g15ydl0N6qW2rZ4UUIL9sPF1fQCK6S1aqiZnUuBxes3bBlhh5hvjW0C8k7ZaobLe/3 4wXLHIS946YfMPVQdRdyCGd8bxFQh+Ss2RHL8vKAfAKOcP0lUnwYkSnRrhUXxWKyWGlp C4UUYLa3ukdpZq/wJq/aj5IHP+QtUlGWTOLz/4X3RLDqD0j1gszU0FUwyS8QKajGAEQH uPio8EZYSdo3KsRK5qMlFxPWdblEqYMsvoim8PHYUlu6b2282QgEt6ls9ONkXwQFYsdC WEXx9uXPxKi90ksToq7oUtlVVZVgzfJ7t+Vrfc0FqEwE0cIm+SLf7cwHDJ7cucA5+sx8 XaWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832954; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7cOCkkpY1/6w/mGzzZZmxagwohDu2O0n7RpZ/Apo/tc=; b=HfOAXLSgBvFnK88fjhJ1wLQHpWNJvNCxtslcqTQkelDvEfIukWJXBFnae7KdkYBB72 D7l0kQRj9Nip0bPRGqgA1A2//KeCUG3h3Gcqt0cU7GgtcLPf0+fqSzfM+UKD0ftiTrzj jkd8zjX4lX33LbFjaeGlegFDdQ7F3zp/kfZqoEpe0f1wGreDRhoPoe3xSlwNw0aWdClG 8PuSjyBYP01JnpPw6ToPDIg2YCP+L6j0otFVMU9TTU0NY7wWaDAvsYszNowVlXJ0Bu00 YgqHHIOmxXMd2bOtR/51bzSUH3RGksldfI/Le/wDB1JocMncLZ7pMsgssocyLfkO7szd zeAA== X-Gm-Message-State: AO0yUKWXQaaS5A0p67JpcQACnpGkZm5oFRxCAD+sEMbGc1Rxt1Rr/yHc 63auVQP0SlhgsPrii7lnXbsVdQrXkN3j9G0/ X-Google-Smtp-Source: AK7set8KOlWhCXZlDKIc733KoWMKa5mDRMKEVQTrOwe/lJf1xUN0kuPtZn7Ye7T34/RG5SOVGR+u7g== X-Received: by 2002:a05:6a20:4c92:b0:cd:42cf:6e03 with SMTP id fq18-20020a056a204c9200b000cd42cf6e03mr1304085pzb.26.1677832954255; Fri, 03 Mar 2023 00:42:34 -0800 (PST) Subject: [PULL 58/59] target/riscv/vector_helper.c: create vext_set_tail_elems_1s() Date: Fri, 3 Mar 2023 00:37:39 -0800 Message-Id: <20230303083740.12817-59-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , Frank Chang , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=palmer@rivosinc.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833447367100007 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza Commit 752614cab8e6 ("target/riscv: rvv: Add tail agnostic for vector load / store instructions") added code to set the tail elements to 1 in the end of vext_ldst_stride(), vext_ldst_us(), vext_ldst_index() and vext_ldff(). Aside from a env->vl versus an evl value being used in the first loop, the code is being repeated 4 times. Create a helper to avoid code repetition in all those functions. Arguments that are used in the callers (nf, esz and max_elems) are passed as arguments. All other values are being derived inside the helper. Reviewed-by: Weiwei Li Reviewed-by: Frank Chang Signed-off-by: Daniel Henrique Barboza Message-ID: <20230226170514.588071-2-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/vector_helper.c | 86 +++++++++++++----------------------- 1 file changed, 30 insertions(+), 56 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 3073c54871..7e476ea8c3 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -267,6 +267,28 @@ GEN_VEXT_ST_ELEM(ste_h, int16_t, H2, stw) GEN_VEXT_ST_ELEM(ste_w, int32_t, H4, stl) GEN_VEXT_ST_ELEM(ste_d, int64_t, H8, stq) =20 +static void vext_set_tail_elems_1s(CPURISCVState *env, target_ulong vl, + void *vd, uint32_t desc, uint32_t nf, + uint32_t esz, uint32_t max_elems) +{ + uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); + uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; + uint32_t vta =3D vext_vta(desc); + uint32_t registers_used; + int k; + + for (k =3D 0; k < nf; ++k) { + vext_set_elems_1s(vd, vta, (k * max_elems + vl) * esz, + (k * max_elems + max_elems) * esz); + } + + if (nf * max_elems % total_elems !=3D 0) { + registers_used =3D ((nf * max_elems) * esz + (vlenb - 1)) / vlenb; + vext_set_elems_1s(vd, vta, (nf * max_elems) * esz, + registers_used * vlenb); + } +} + /* *** stride: access vector element from strided memory */ @@ -281,8 +303,6 @@ vext_ldst_stride(void *vd, void *v0, target_ulong base, uint32_t nf =3D vext_nf(desc); uint32_t max_elems =3D vext_max_elems(desc, log2_esz); uint32_t esz =3D 1 << log2_esz; - uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); - uint32_t vta =3D vext_vta(desc); uint32_t vma =3D vext_vma(desc); =20 for (i =3D env->vstart; i < env->vl; i++, env->vstart++) { @@ -301,18 +321,8 @@ vext_ldst_stride(void *vd, void *v0, target_ulong base, } } env->vstart =3D 0; - /* set tail elements to 1s */ - for (k =3D 0; k < nf; ++k) { - vext_set_elems_1s(vd, vta, (k * max_elems + env->vl) * esz, - (k * max_elems + max_elems) * esz); - } - if (nf * max_elems % total_elems !=3D 0) { - uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; - uint32_t registers_used =3D - ((nf * max_elems) * esz + (vlenb - 1)) / vlenb; - vext_set_elems_1s(vd, vta, (nf * max_elems) * esz, - registers_used * vlenb); - } + + vext_set_tail_elems_1s(env, env->vl, vd, desc, nf, esz, max_elems); } =20 #define GEN_VEXT_LD_STRIDE(NAME, ETYPE, LOAD_FN) \ @@ -359,8 +369,6 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState= *env, uint32_t desc, uint32_t nf =3D vext_nf(desc); uint32_t max_elems =3D vext_max_elems(desc, log2_esz); uint32_t esz =3D 1 << log2_esz; - uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); - uint32_t vta =3D vext_vta(desc); =20 /* load bytes from guest memory */ for (i =3D env->vstart; i < evl; i++, env->vstart++) { @@ -372,18 +380,8 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVStat= e *env, uint32_t desc, } } env->vstart =3D 0; - /* set tail elements to 1s */ - for (k =3D 0; k < nf; ++k) { - vext_set_elems_1s(vd, vta, (k * max_elems + evl) * esz, - (k * max_elems + max_elems) * esz); - } - if (nf * max_elems % total_elems !=3D 0) { - uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; - uint32_t registers_used =3D - ((nf * max_elems) * esz + (vlenb - 1)) / vlenb; - vext_set_elems_1s(vd, vta, (nf * max_elems) * esz, - registers_used * vlenb); - } + + vext_set_tail_elems_1s(env, evl, vd, desc, nf, esz, max_elems); } =20 /* @@ -484,8 +482,6 @@ vext_ldst_index(void *vd, void *v0, target_ulong base, uint32_t vm =3D vext_vm(desc); uint32_t max_elems =3D vext_max_elems(desc, log2_esz); uint32_t esz =3D 1 << log2_esz; - uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); - uint32_t vta =3D vext_vta(desc); uint32_t vma =3D vext_vma(desc); =20 /* load bytes from guest memory */ @@ -505,18 +501,8 @@ vext_ldst_index(void *vd, void *v0, target_ulong base, } } env->vstart =3D 0; - /* set tail elements to 1s */ - for (k =3D 0; k < nf; ++k) { - vext_set_elems_1s(vd, vta, (k * max_elems + env->vl) * esz, - (k * max_elems + max_elems) * esz); - } - if (nf * max_elems % total_elems !=3D 0) { - uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; - uint32_t registers_used =3D - ((nf * max_elems) * esz + (vlenb - 1)) / vlenb; - vext_set_elems_1s(vd, vta, (nf * max_elems) * esz, - registers_used * vlenb); - } + + vext_set_tail_elems_1s(env, env->vl, vd, desc, nf, esz, max_elems); } =20 #define GEN_VEXT_LD_INDEX(NAME, ETYPE, INDEX_FN, LOAD_FN) = \ @@ -585,8 +571,6 @@ vext_ldff(void *vd, void *v0, target_ulong base, uint32_t vm =3D vext_vm(desc); uint32_t max_elems =3D vext_max_elems(desc, log2_esz); uint32_t esz =3D 1 << log2_esz; - uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); - uint32_t vta =3D vext_vta(desc); uint32_t vma =3D vext_vma(desc); target_ulong addr, offset, remain; =20 @@ -647,18 +631,8 @@ ProbeSuccess: } } env->vstart =3D 0; - /* set tail elements to 1s */ - for (k =3D 0; k < nf; ++k) { - vext_set_elems_1s(vd, vta, (k * max_elems + env->vl) * esz, - (k * max_elems + max_elems) * esz); - } - if (nf * max_elems % total_elems !=3D 0) { - uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; - uint32_t registers_used =3D - ((nf * max_elems) * esz + (vlenb - 1)) / vlenb; - vext_set_elems_1s(vd, vta, (nf * max_elems) * esz, - registers_used * vlenb); - } + + vext_set_tail_elems_1s(env, env->vl, vd, desc, nf, esz, max_elems); } =20 #define GEN_VEXT_LDFF(NAME, ETYPE, LOAD_FN) \ --=20 2.39.2 From nobody Sun Apr 28 05:40:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1677833304; cv=none; d=zohomail.com; s=zohoarc; b=n2jkcelcbsW8ORzWKzkZBZVLHUh7UHAFX7Rlv94LMN4W+V8KzNqBtRzQ1F30hJbPUZW1wkvQbFd7QfYhd1fBcVj5916YfBbrz3MWS8H6Ogsnx7QqPnLqQCzCmSLFD3cZU5/3mmL3PxA6vPiXcMfoENJPeLqN/+FRUO93OXPol10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677833304; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0rHQcn1c3RoxIEMYQmBzf3qgrVCMNlGeLy55RgmobpQ=; b=lULywEhQsEyMVJC8lRRX6BLY9Khx9eHgOOEaOxb3GZTf/Mshp/UF4QHh/ypvQxrrqE5AnOuGrvXBL9Am4RLMRSoPsClTgyNDrjafRNN8+b18Vt/IIgQNzD7VueIni3MMtqk1WlRCk2SaRjmKWMlasgx2/hV/OuiJsh4nvc17+LU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677833304349715.214844186993; Fri, 3 Mar 2023 00:48:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY101-00020x-RQ; Fri, 03 Mar 2023 03:42:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY0zu-0001LM-Cl for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:38 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY0zs-000815-E5 for qemu-devel@nongnu.org; Fri, 03 Mar 2023 03:42:38 -0500 Received: by mail-pl1-x635.google.com with SMTP id h8so1956406plf.10 for ; Fri, 03 Mar 2023 00:42:35 -0800 (PST) Received: from localhost ([135.180.224.71]) by smtp.gmail.com with ESMTPSA id ki4-20020a170903068400b0019309be03e7sm983435plb.66.2023.03.03.00.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 00:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677832955; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:from:to:cc:subject:date :message-id:reply-to; bh=0rHQcn1c3RoxIEMYQmBzf3qgrVCMNlGeLy55RgmobpQ=; b=Fpus1Gd3jc18L2P5mUkI+RBj8lvpTN6CF+trBI69PYs492/dWFAjKNUFW68XF3EleB 0+iXAc4jp4iXZ7317GW7N0Vsc2Ox07C6yZ6b7fqzd8qaBMKWH9ZlA1ZLnXa+DGD3jkZu e5efUAVdWJibTPVSYeseEBZSWobD8kQsPRlAJVJodanrKvKXuD4kw9Y71PAnv4Y+uVnN R7XsKdZMwNo7kip4WirwQieUFl8JjuYP7lBs85EEwIbd0/5K0AE+aDju0vhO6PcYMeGa xUWnujYnbxKGo6Ps1KZbAJgUaumqJBwSJXFGj0gr2MPeXa/ICCfy85pwVPWwrWC7S39f kMQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677832955; h=to:from:cc:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0rHQcn1c3RoxIEMYQmBzf3qgrVCMNlGeLy55RgmobpQ=; b=g+AHMZEvxlCSZO/rpRoXQIiTUm+XNZty1rcCj0iKR4waueqGMwZU7JIY7KoTiA6TIB 4A8AeP5GpYLdHVQ1SRJGXFcSWDTuOeENfsUKLjILw6/Ci5bYURGawDRCyh6Gqw13ctT1 pJ9eGcLkMUlgp5uIiTAGDsBEeV3SwviRw6JSiIbi68gZJw0b/T+0eFr/pajSgOyphDaK rWYh3ivXvXLt94x1jbXU4qYRI1jYzwtYh8BwcYPiHJNa1A39ZFQoMLTepxAk4dRdXSua /PntrMb9fjtIKKIIEnWC3C63JZvhAh8zLHpHBgRM7NXn1/42O2IXf9zxKojBZHiBrCmN wnoA== X-Gm-Message-State: AO0yUKURbMR9wTyNlwmrK474NS9+AOKeR2rzczxyQRshQ3cRv6aPPIHy C9MPYr3y1tcxEf4L/4ZAEqOiWQ== X-Google-Smtp-Source: AK7set88nqLx/p/eDDnZ6jshl5fpPIkwn4UArH3x1oIsdsHagaDCqekt8siKhhs37jdjfcmGV87hhw== X-Received: by 2002:a17:90b:3505:b0:234:dc4:2006 with SMTP id ls5-20020a17090b350500b002340dc42006mr1075443pjb.4.1677832955444; Fri, 03 Mar 2023 00:42:35 -0800 (PST) Subject: [PULL 59/59] target/riscv/vector_helper.c: avoid env_archcpu() when reading RISCVCPUConfig Date: Fri, 3 Mar 2023 00:37:40 -0800 Message-Id: <20230303083740.12817-60-palmer@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303083740.12817-1-palmer@rivosinc.com> References: <20230303083740.12817-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Daniel Henrique Barboza , Weiwei Li , ilippe=20Mathieu-Daud=C3=A9?= , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=palmer@rivosinc.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1677833306125100019 From: Daniel Henrique Barboza This file has several uses of env_archcpu() that are used solely to read cfg->vlen. Use the new riscv_cpu_cfg() inline instead. Suggested-by: Weiwei Li Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Weiwei Li Message-ID: <20230226170514.588071-3-dbarboza@ventanamicro.com> Signed-off-by: Palmer Dabbelt --- target/riscv/vector_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 7e476ea8c3..2423affe37 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -272,7 +272,7 @@ static void vext_set_tail_elems_1s(CPURISCVState *env, = target_ulong vl, uint32_t esz, uint32_t max_elems) { uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); - uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; + uint32_t vlenb =3D riscv_cpu_cfg(env)->vlen >> 3; uint32_t vta =3D vext_vta(desc); uint32_t registers_used; int k; @@ -671,7 +671,7 @@ vext_ldst_whole(void *vd, target_ulong base, CPURISCVSt= ate *env, uint32_t desc, { uint32_t i, k, off, pos; uint32_t nf =3D vext_nf(desc); - uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; + uint32_t vlenb =3D riscv_cpu_cfg(env)->vlen >> 3; uint32_t max_elems =3D vlenb >> log2_esz; =20 k =3D env->vstart / max_elems; @@ -1141,7 +1141,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void= *vs2, \ { \ uint32_t vl =3D env->vl; \ uint32_t vm =3D vext_vm(desc); \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t i; \ \ @@ -1177,7 +1177,7 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1= , \ { \ uint32_t vl =3D env->vl; \ uint32_t vm =3D vext_vm(desc); \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t i; \ \ @@ -1376,7 +1376,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void= *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -1439,7 +1439,7 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1= , void *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -4152,7 +4152,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void= *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -4190,7 +4190,7 @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, vo= id *vs2, \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t vma =3D vext_vma(desc); \ uint32_t i; \ @@ -4721,7 +4721,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, = \ uint32_t desc) \ { \ uint32_t vl =3D env->vl; \ - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; \ + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; \ uint32_t vta_all_1s =3D vext_vta_all_1s(desc); \ uint32_t i; \ int a, b; \ @@ -4808,7 +4808,7 @@ static void vmsetm(void *vd, void *v0, void *vs2, CPU= RISCVState *env, { uint32_t vm =3D vext_vm(desc); uint32_t vl =3D env->vl; - uint32_t total_elems =3D env_archcpu(env)->cfg.vlen; + uint32_t total_elems =3D riscv_cpu_cfg(env)->vlen; uint32_t vta_all_1s =3D vext_vta_all_1s(desc); uint32_t vma =3D vext_vma(desc); int i; --=20 2.39.2