From nobody Thu Oct 31 23:46:48 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=1674219701; cv=none; d=zohomail.com; s=zohoarc; b=amETBb4WB2hACeibAIytDKOOlYf/uIoE6YRCZ8yikh5mPMLakd7L668875KZScV7HiTSXN+wMRLv2PJFtS70GpYZbdLfad1aSh5CuEOlfGhUQQdxTB7FTO+2kYjcfTgyXrx5VtCZ7InMydykJrjjQACC0SpvmuFOnr4S6z6Fnnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674219701; 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=jhhgQogAthhvWskxErYyVviUIAb5WWWhMnae0hKG2Ik=; b=Wcall/iCyHItRWzT1yeByG0Ka1jLo3y2lkS7TRgbAEDAdJKyqv17fXc9U4Lw/U+9V3maH8ZrltFm3K7lduntCTkJibuONxV2BrYurIMuUEdOqSMpukWwpTOjY30PGJEaehbKQ55m7+a/Fp7/4KCsA9QbehlOe+pn4tjWDZ4DtAk= 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 1674219701322351.6514046879638; Fri, 20 Jan 2023 05:01:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIr0J-0007NT-Sm; Fri, 20 Jan 2023 08:00:23 -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 1pIr08-0007Ld-Eg for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:19 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIr06-0006G3-U1 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:12 -0500 Received: by mail-pl1-x630.google.com with SMTP id jm10so5211293plb.13 for ; Fri, 20 Jan 2023 05:00:10 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e5c700b0017f72a430adsm7279610plf.71.2023.01.20.05.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 05:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jhhgQogAthhvWskxErYyVviUIAb5WWWhMnae0hKG2Ik=; b=HOIZH/ACOEXLZTTM8+6S3ZY5iyO2KC6laUnwk9j6hbmvr2Ix+0FiWMFheVZHpfUAui IE3tFtfCDK8DitxjRds16MducHAlrge8eE6NQ1Q3VZjISzv9PouD0kzhtR+Sr3vJAr+R ZinlZ2ncCJTxwrNa/uaDv1REP1Y+yhKojrPOT+M5ypbxM7rZcUGOD/f2gqDjxvvYz8hN +vwMepS4RU+pp4Oyh1GcmjrXJ91yqiKtwkM5tzDNanDZDocxIET48WtLh1pectsvYVOZ ME9SaTQJ+j11Vcfo87ZEy2UKy3cgS6eA2QxekbK2zsylDz+1nUpgBwFY4mlPCSSU1qOq ZaaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jhhgQogAthhvWskxErYyVviUIAb5WWWhMnae0hKG2Ik=; b=NOHha2Yeo9w+ZnM2dOkJfj0hk3b/vmlb39D4EGxTBpNafd1V/r14xV016Iqt9ewPT3 t1WOkBkCZjbvpO9ryIITjc4Z0x+Hq179U8BGr5YQbCt5CEYnf3KV3f/CilAo1a4SnHQN J97SXsdFMHE9XVIYFAxRUOKJyuLL+fQuNPKJu//nQ9QmOOLr8oL5pC3ZJPEcXzt3IeGK 3UiC666jnF5TlRhe16J3k5CqxIigtNG6lozLZS96bdo9ruPO3k+obakY0gEL4lsY8zZY pa8oGNngHXlMoA7fvJHtPMF8+7pl1/5QjJGXVfvb2YKnOxHiR/0+hlqr+JIiJ4gz0n2a e2qg== X-Gm-Message-State: AFqh2kpnP5NHGS9VTMvo36+20AyvgMnhRGTJQKWvtkDJhh8mhuVeLbnj L2sFXb65m8Wd7oczQTw32ZF/Rw== X-Google-Smtp-Source: AMrXdXvpPoNaU1fqtF07PHP8TPU7yAVUqU/At3pTWwuxnt/Wec8mklyC16wBNmEj44jAbCIlFl42kw== X-Received: by 2002:a17:902:6a89:b0:194:88a3:6e28 with SMTP id n9-20020a1709026a8900b0019488a36e28mr15050887plk.51.1674219609223; Fri, 20 Jan 2023 05:00:09 -0800 (PST) From: Anup Patel To: Peter Maydell , Palmer Dabbelt , Alistair Francis , Sagar Karandikar Cc: Atish Patra , Richard Henderson , Anup Patel , qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Anup Patel , Alistair Francis Subject: [PATCH v3 1/4] target/riscv: Update VS timer whenever htimedelta changes Date: Fri, 20 Jan 2023 18:29:47 +0530 Message-Id: <20230120125950.2246378-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120125950.2246378-1-apatel@ventanamicro.com> References: <20230120125950.2246378-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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::630; envelope-from=apatel@ventanamicro.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @ventanamicro.com) X-ZM-MESSAGEID: 1674219702513100003 Content-Type: text/plain; charset="utf-8" The htimedelta[h] CSR has impact on the VS timer comparison so we should call riscv_timer_write_timecmp() whenever htimedelta changes. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/csr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 62e6c4acbd..fa17d7770c 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3045,6 +3045,8 @@ static RISCVException read_htimedelta(CPURISCVState *= env, int csrno, static RISCVException write_htimedelta(CPURISCVState *env, int csrno, target_ulong val) { + RISCVCPU *cpu =3D env_archcpu(env); + if (!env->rdtime_fn) { return RISCV_EXCP_ILLEGAL_INST; } @@ -3054,6 +3056,12 @@ static RISCVException write_htimedelta(CPURISCVState= *env, int csrno, } else { env->htimedelta =3D val; } + + if (cpu->cfg.ext_sstc && env->rdtime_fn) { + riscv_timer_write_timecmp(cpu, env->vstimer, env->vstimecmp, + env->htimedelta, MIP_VSTIP); + } + return RISCV_EXCP_NONE; } =20 @@ -3071,11 +3079,19 @@ static RISCVException read_htimedeltah(CPURISCVStat= e *env, int csrno, static RISCVException write_htimedeltah(CPURISCVState *env, int csrno, target_ulong val) { + RISCVCPU *cpu =3D env_archcpu(env); + if (!env->rdtime_fn) { return RISCV_EXCP_ILLEGAL_INST; } =20 env->htimedelta =3D deposit64(env->htimedelta, 32, 32, (uint64_t)val); + + if (cpu->cfg.ext_sstc && env->rdtime_fn) { + riscv_timer_write_timecmp(cpu, env->vstimer, env->vstimecmp, + env->htimedelta, MIP_VSTIP); + } + return RISCV_EXCP_NONE; } =20 --=20 2.34.1 From nobody Thu Oct 31 23:46:48 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=1674219722; cv=none; d=zohomail.com; s=zohoarc; b=lP5WidIZn/AN3VKhH4qD7jem1hUeoSJALX9Lrz5gUaJ/Ff//hFvuVmauoLkVlloP+d7yte6sC7EwIevx9oa0XKTUxEWM/BqeAH3/1V1oHZDE2Gk7aiwGLS2VXKNPqYVh+XLucFrwK0HZGQsIoVmQaHKzPEvQHgpvCXxIoaMHeEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674219722; 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=8ebxx67c2QVmctcxn5YFSMEPnvQ8qAF16FaANSYYEiw=; b=fXUEqlPoL1RmkjuODq6x5EkMb3TKLTnP53iigfp+qcU6CM1cHIFUYdAAtcYy7Iqa6LMNSqhKhuLMB2/QMxVhcSMG83yed/uTgMJxdEf165IEFU2aJNL3djnAk98Z1RplPNCaeypsQ/dUA0187EotWoM9TXq40fn5KTNAR6MMqXQ= 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 1674219722521648.383026901857; Fri, 20 Jan 2023 05:02:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIr0O-0007Qf-6Q; Fri, 20 Jan 2023 08:00: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 1pIr0I-0007Me-Qr for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:22 -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 1pIr0D-0006HE-PB for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:21 -0500 Received: by mail-pj1-x1031.google.com with SMTP id lp10so2098580pjb.4 for ; Fri, 20 Jan 2023 05:00:15 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e5c700b0017f72a430adsm7279610plf.71.2023.01.20.05.00.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 05:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8ebxx67c2QVmctcxn5YFSMEPnvQ8qAF16FaANSYYEiw=; b=YDWzP6QscbbwPjaLfDUMMrQpwpeiZiMSG4VFVeGo5CdNtC2oQPW1DDAFVaZwh282CG FTMXVKgJYskHpxuOQXHl8uFpc/fYUkqxsZoW0jGZL60cg9fe19/d7SPdMJ6k+kTLSUUA dF9XA+mn5PMGpHnH0rWFwg2B7jGIQcECfFC/oqhKzCZ45Jo2uHDIaqmEkCKY5D6Z52tp vRC4vplz04aurTRWdeTlQ3D/8a/+VPk3nCh40xkbepnVRpfS6qp7rNn37etcaQFwznvA 5tGnARB+KOYqgMqEeXZqf5R381WKnpYWqk07WTjMB+0WyTSTOpoBMYFABr7fv9YSqW3a /a+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8ebxx67c2QVmctcxn5YFSMEPnvQ8qAF16FaANSYYEiw=; b=qtBsn/zamCrHKD4hr46Opw4ep96VK3VpOiM4FhGMkwfPdtJ+iebJFvq0hbKM2zo6jz TQJDTWOTcZSCzCy6nKUAyxiQvjM+EcRSKcwxcffXZ3/R+pdLLET984h9GitXneGf4pIN NY1PIS8kBXvrJ/2qm4BqT7vWuqTiTQZtHrYXXBjEuZRn4HO62OjFHfgF7CT61qtkpbvG O4ix3R652tXe6eCl27swtjq0NrOrfgN+7x2CBtsDtXpPSrbf2NKbmcIaH5CIJh/OZpnH C0a5XYBKb1l9qGbAZGi7g+mzajVuh5V6zYd0HQG2as+k3mIXjbOI98R/7+gUlwSVRZl0 TWlQ== X-Gm-Message-State: AFqh2kpVkTxXyJMwQR/rMBqm4nKdlntPlWKitYmHDgRTlSXkxeEPY/SV U/1Kn6kiKwCtzuLx0lsEQ8wE5Q== X-Google-Smtp-Source: AMrXdXsvR+dyGy81viuym6fHS7edAPrwnsEnU7ioxb+cFbmZgJskHfFPw5M6JE+1q8lMc3jDZX51bA== X-Received: by 2002:a17:902:d50f:b0:195:f3d5:beb0 with SMTP id b15-20020a170902d50f00b00195f3d5beb0mr16657plg.64.1674219614206; Fri, 20 Jan 2023 05:00:14 -0800 (PST) From: Anup Patel To: Peter Maydell , Palmer Dabbelt , Alistair Francis , Sagar Karandikar Cc: Atish Patra , Richard Henderson , Anup Patel , qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Anup Patel , Alistair Francis Subject: [PATCH v3 2/4] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP Date: Fri, 20 Jan 2023 18:29:48 +0530 Message-Id: <20230120125950.2246378-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120125950.2246378-1-apatel@ventanamicro.com> References: <20230120125950.2246378-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=apatel@ventanamicro.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @ventanamicro.com) X-ZM-MESSAGEID: 1674219724764100003 Content-Type: text/plain; charset="utf-8" Instead of clearing mask in riscv_cpu_update_mip() for VSTIP, we should call riscv_cpu_update_mip() with mask =3D=3D 0 from timer_helper.c for VSTIP. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/cpu_helper.c | 2 -- target/riscv/time_helper.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 8ea3442b4a..84f84b2bae 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -621,8 +621,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t m= ask, uint64_t value) vsgein =3D (env->hgeip & (1ULL << gein)) ? MIP_VSEIP : 0; } =20 - /* No need to update mip for VSTIP */ - mask =3D ((mask =3D=3D MIP_VSTIP) && env->vstime_irq) ? 0 : mask; vstip =3D env->vstime_irq ? MIP_VSTIP : 0; =20 QEMU_IOTHREAD_LOCK_GUARD(); diff --git a/target/riscv/time_helper.c b/target/riscv/time_helper.c index 8cce667dfd..4fb2a471a9 100644 --- a/target/riscv/time_helper.c +++ b/target/riscv/time_helper.c @@ -27,7 +27,7 @@ static void riscv_vstimer_cb(void *opaque) RISCVCPU *cpu =3D opaque; CPURISCVState *env =3D &cpu->env; env->vstime_irq =3D 1; - riscv_cpu_update_mip(cpu, MIP_VSTIP, BOOL_TO_MASK(1)); + riscv_cpu_update_mip(cpu, 0, BOOL_TO_MASK(1)); } =20 static void riscv_stimer_cb(void *opaque) @@ -57,16 +57,20 @@ void riscv_timer_write_timecmp(RISCVCPU *cpu, QEMUTimer= *timer, */ if (timer_irq =3D=3D MIP_VSTIP) { env->vstime_irq =3D 1; + riscv_cpu_update_mip(cpu, 0, BOOL_TO_MASK(1)); + } else { + riscv_cpu_update_mip(cpu, MIP_STIP, BOOL_TO_MASK(1)); } - riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(1)); return; } =20 + /* Clear the [VS|S]TIP bit in mip */ if (timer_irq =3D=3D MIP_VSTIP) { env->vstime_irq =3D 0; + riscv_cpu_update_mip(cpu, 0, BOOL_TO_MASK(0)); + } else { + riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(0)); } - /* Clear the [V]STIP bit in mip */ - riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(0)); =20 /* otherwise, set up the future timer interrupt */ diff =3D timecmp - rtc_r; --=20 2.34.1 From nobody Thu Oct 31 23:46:48 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=1674219746; cv=none; d=zohomail.com; s=zohoarc; b=aWwY+D/EoF9JZBipkZvRxucP+k4nL7A9ngqXkKbcTEi/ai48VMsdiIfqMbY2c/Wzx7+no9U/47S9EuxWGLgLNQw+PzQYqsk/nQBK4hneonsV+FCI8n2J3kbTcXwEpZCPap4CQBZ/EcaRFEHEpJhTDVAcmqOCC7Ys+lwHwwsd/G4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674219746; 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=w6GWMr4kgqdcL841ipfLZDMDmhXesxTjEaat87znEVA=; b=mipUj+TMPRHS7S1rbyNLPYqo1ytuWEHOOXPSX7smsl8VDVhZKUVrx/mzGbya7J0pGQUNXI1hJPlf2PUBYTeW5lcl03bm/aTGkJ41tUWqfXWoaY95Ra2VRBybzdDSkk2tqfuqPis8NQYySovMH/cGosH2oduio6Fl9V6g1n2QehU= 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 167421974644667.31454432772443; Fri, 20 Jan 2023 05:02:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIr0P-0007RE-A2; Fri, 20 Jan 2023 08:00: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 1pIr0I-0007Mi-R1 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:22 -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 1pIr0G-0006Hi-UZ for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:22 -0500 Received: by mail-pl1-x629.google.com with SMTP id d3so5232109plr.10 for ; Fri, 20 Jan 2023 05:00:20 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e5c700b0017f72a430adsm7279610plf.71.2023.01.20.05.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 05:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w6GWMr4kgqdcL841ipfLZDMDmhXesxTjEaat87znEVA=; b=l6ZB0DFwPcu0v18d1WUWdk00j0UwcY2hRLsDNJ9W4WQTug5eufdiXyZ9zZ4dcJkU1l +rsgtlyYCqq2Xqtkpa7dDFpOrZcT7Y2L1K0hBYkKuWqyjzx7Qv5+eNLQi61wb4Q/dbhs sx2cQ65piApC18YN6z/okQd1Cwkhoxokc5TOR5TMR6Gkot5G/HPqS1X3w8RRG6UE2Urc 6D/TgdYEhWZpEFwgkoqNwc0b8+67B+paBvYxInLmLdpsdkArh+wURJ8suQFAajPfOZKU Q9GRijELNCUx2LbUerX4GfMVN6/zHROuxRHC7y0D/NHZkx15jPHFciKosFc3PVVUkl1U AZew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w6GWMr4kgqdcL841ipfLZDMDmhXesxTjEaat87znEVA=; b=s27yP7zXEpDiUQsLOfj1eQTDReikG4QPuHXUr0W56karN8QB9vR02KfA6Zi0FUpu0a mNYCJBgxRqAjbo7WmB6lqRpwWKqbt4Na/+90j3EukjDS3XtPmFuQhpCBnQodxJhSrXyu OhSEcz44X9GbhwAz7zxDLTx7G8xLhF2alXo36cJbjIXWJjV+p2sfzvf0dAeAMEe4kZgW zapGGVeSUz0QqNSnkiSG+P6NDmgoApRkg+qtv54LpmXiGhDeFFMXcxQrBVUw25yVXRbU QsykalL04zjmH12I5zdfoaEpTqf2ckqz5Q2jH/GS+pRmh/NDbUploN9vpa+DJ49Rkw94 m5GA== X-Gm-Message-State: AFqh2krSwLNQq5XEikJaVWX0IYV7u9WgL7OYEHnTgDzCZ2AQEfB6YvtM yyO/BcS3928cLR9Fa7nfHG8W9A== X-Google-Smtp-Source: AMrXdXuuyhIYUn+WjwQ1F1lApMhscds+yd4usswIglrlY4Yw2RGHSkCdCpIujSbGKcG+kppdUqRFLg== X-Received: by 2002:a17:902:e5c9:b0:194:d0ad:53f0 with SMTP id u9-20020a170902e5c900b00194d0ad53f0mr7405861plf.9.1674219618781; Fri, 20 Jan 2023 05:00:18 -0800 (PST) From: Anup Patel To: Peter Maydell , Palmer Dabbelt , Alistair Francis , Sagar Karandikar Cc: Atish Patra , Richard Henderson , Anup Patel , qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Anup Patel , Alistair Francis Subject: [PATCH v3 3/4] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX Date: Fri, 20 Jan 2023 18:29:49 +0530 Message-Id: <20230120125950.2246378-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120125950.2246378-1-apatel@ventanamicro.com> References: <20230120125950.2246378-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=apatel@ventanamicro.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @ventanamicro.com) X-ZM-MESSAGEID: 1674219746718100001 Content-Type: text/plain; charset="utf-8" The time CSR will wrap-around immediately after reaching UINT64_MAX so we don't need to re-start QEMU timer when timecmp =3D=3D UINT64_MAX in riscv_timer_write_timecmp(). Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/time_helper.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/riscv/time_helper.c b/target/riscv/time_helper.c index 4fb2a471a9..b654f91af9 100644 --- a/target/riscv/time_helper.c +++ b/target/riscv/time_helper.c @@ -72,6 +72,30 @@ void riscv_timer_write_timecmp(RISCVCPU *cpu, QEMUTimer = *timer, riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(0)); } =20 + /* + * Sstc specification says the following about timer interrupt: + * "A supervisor timer interrupt becomes pending - as reflected in + * the STIP bit in the mip and sip registers - whenever time contains + * a value greater than or equal to stimecmp, treating the values + * as unsigned integers. Writes to stimecmp are guaranteed to be + * reflected in STIP eventually, but not necessarily immediately. + * The interrupt remains posted until stimecmp becomes greater + * than time - typically as a result of writing stimecmp." + * + * When timecmp =3D UINT64_MAX, the time CSR will eventually reach + * timecmp value but on next timer tick the time CSR will wrap-around + * and become zero which is less than UINT64_MAX. Now, the timer + * interrupt behaves like a level triggered interrupt so it will + * become 1 when time =3D timecmp =3D UINT64_MAX and next timer tick + * it will become 0 again because time =3D 0 < timecmp =3D UINT64_MAX. + * + * Based on above, we don't re-start the QEMU timer when timecmp + * equals UINT64_MAX. + */ + if (timecmp =3D=3D UINT64_MAX) { + return; + } + /* otherwise, set up the future timer interrupt */ diff =3D timecmp - rtc_r; /* back to ns (note args switched in muldiv64) */ --=20 2.34.1 From nobody Thu Oct 31 23:46:48 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=1674219700; cv=none; d=zohomail.com; s=zohoarc; b=O14e287KFJlmUMqOIyR9KpkB1O7w27ph6KKwcgNmC26HGJslKSyVN+WmYruWIQ0AekYVk4N7wG2mewyEhDrIv0/YMJQBavH+GCFL0M7L9z1gZM/8cviBrb/gD98XqrS4uFqj2tUjcvRs0Fv8pCRTKBdUcgZ7TwlgG/1967t4zH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674219700; 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=UXFj+TsARYhyAgQ44IDyO3msxHENfQx3g7RXDPoLpl8=; b=JIKCNIHAAVZrGsQOSP5yMTXYqjjKtarpTzlTNEc6f0hZRqhPGXHXxhQAkpQut6ldNgyrtvQZSl7n4Fb4mYIL5Cr7AV4rf9/h5MPxJIwE1yhJfgHjTBKu4C2fnER4qUJpeToT64J5ghz/v8mSjfm5ZcNDxUjeb/tbjCqwX0OZcVU= 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 1674219700393794.8293800434041; Fri, 20 Jan 2023 05:01:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIr0X-0007So-Bg; Fri, 20 Jan 2023 08:00: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 1pIr0N-0007QR-K6 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:28 -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 1pIr0K-0006HE-Ih for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:00:27 -0500 Received: by mail-pj1-x1031.google.com with SMTP id lp10so2099178pjb.4 for ; Fri, 20 Jan 2023 05:00:24 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id u7-20020a170902e5c700b0017f72a430adsm7279610plf.71.2023.01.20.05.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 05:00:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UXFj+TsARYhyAgQ44IDyO3msxHENfQx3g7RXDPoLpl8=; b=fFXzg6IfJFbd54MhU8YS0nZbsBNgGnZasdpbRAVJcLSZKlpnw0MW5/5bQIFg8BblFk 0LEDEyasyRTnF29ZoRxXFI1y+pv/sa7hYn3QiiRJz1uiF035ax6WA2B7IcXyVj6ji/UF 10b1kGoOG54B4k1jY1heu1AW5sqdSfazsRo87S6100nTqxrhUEx6eNBSQ61pwLXrseHc a3CEInwIYki4KGcr7+MB7QsLc1SsnGmXvhE0wN3SR2atz2VfGv+WN54JYqcV8g86+qVE AxSJGnoWj22WrOI1XSb0AdXltXOgisx2XixFffIvG/N8ZLe2q9pgdTMwjRBumz2w9Xea ds1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UXFj+TsARYhyAgQ44IDyO3msxHENfQx3g7RXDPoLpl8=; b=jxi3clrU3DD+YsDLY9mU/3NojvizSU2s3kmZB3HE9t+zcSfeFGF7JSKwUicbrz1DcI 2Zb9ifnBxk4Ub80Zq3B6OWWRyLrYS2+eJR8oUm27s3clPXftoXBII61qMKWjNuXFHa+s XtZvZOEreo23NAZh+GThVhAx7HAtjmPZOzpKNo0tSB2DMfApAv3g2q0OiFp9OmPkgoHJ 2NVavWJgC1F9tPJ7hn8E4JjpRzBauFzIoLJt/LmW2o940I0bmJsurkBHLu13kUnZOQ+3 fIxsjtXr6GhqgGjWVxC4lY6gCrPK9GKMYDLGkIAWpNKi/YBO0x5aKL9sgQevwtxNgAe+ Zwjg== X-Gm-Message-State: AFqh2krs4iV94h6l0FIDsvCg7G65TOcZgmNuoNdN4zZERd3r2mxOSQC4 8p6kQUEuc6EUXCaf3Wb1IDGo7w== X-Google-Smtp-Source: AMrXdXuA2FNidxqpWO+6f8WMO+OiA2gfBsF33p6oUoJb6qofsQmMX0coaat1P5Le6e4xAMMsZJfcVg== X-Received: by 2002:a05:6a21:32a6:b0:a7:9022:5d5e with SMTP id yt38-20020a056a2132a600b000a790225d5emr20327875pzb.2.1674219623704; Fri, 20 Jan 2023 05:00:23 -0800 (PST) From: Anup Patel To: Peter Maydell , Palmer Dabbelt , Alistair Francis , Sagar Karandikar Cc: Atish Patra , Richard Henderson , Anup Patel , qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Anup Patel Subject: [PATCH v3 4/4] target/riscv: Ensure opcode is saved for all relevant instructions Date: Fri, 20 Jan 2023 18:29:50 +0530 Message-Id: <20230120125950.2246378-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120125950.2246378-1-apatel@ventanamicro.com> References: <20230120125950.2246378-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=apatel@ventanamicro.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @ventanamicro.com) X-ZM-MESSAGEID: 1674219702504100002 Content-Type: text/plain; charset="utf-8" We should call decode_save_opc() for all relevant instructions which can potentially generate a virtual instruction fault or a guest page fault because generating transformed instruction upon guest page fault expects opcode to be available. Without this, hypervisor will see transformed instruction as zero in htinst CSR for guest MMIO emulation which makes MMIO emulation in hypervisor slow and also breaks nested virtualization. Fixes: a9814e3e08d2 ("target/riscv: Minimize the calls to decode_save_opc") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/insn_trans/trans_rva.c.inc | 10 +++++++--- target/riscv/insn_trans/trans_rvd.c.inc | 2 ++ target/riscv/insn_trans/trans_rvf.c.inc | 2 ++ target/riscv/insn_trans/trans_rvh.c.inc | 3 +++ target/riscv/insn_trans/trans_rvi.c.inc | 2 ++ target/riscv/insn_trans/trans_rvzfh.c.inc | 2 ++ target/riscv/insn_trans/trans_svinval.c.inc | 3 +++ 7 files changed, 21 insertions(+), 3 deletions(-) diff --git a/target/riscv/insn_trans/trans_rva.c.inc b/target/riscv/insn_tr= ans/trans_rva.c.inc index 45db82c9be..5f194a447b 100644 --- a/target/riscv/insn_trans/trans_rva.c.inc +++ b/target/riscv/insn_trans/trans_rva.c.inc @@ -20,8 +20,10 @@ =20 static bool gen_lr(DisasContext *ctx, arg_atomic *a, MemOp mop) { - TCGv src1 =3D get_address(ctx, a->rs1, 0); + TCGv src1; =20 + decode_save_opc(ctx); + src1 =3D get_address(ctx, a->rs1, 0); if (a->rl) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } @@ -43,6 +45,7 @@ static bool gen_sc(DisasContext *ctx, arg_atomic *a, MemO= p mop) TCGLabel *l1 =3D gen_new_label(); TCGLabel *l2 =3D gen_new_label(); =20 + decode_save_opc(ctx); src1 =3D get_address(ctx, a->rs1, 0); tcg_gen_brcond_tl(TCG_COND_NE, load_res, src1, l1); =20 @@ -81,9 +84,10 @@ static bool gen_amo(DisasContext *ctx, arg_atomic *a, MemOp mop) { TCGv dest =3D dest_gpr(ctx, a->rd); - TCGv src1 =3D get_address(ctx, a->rs1, 0); - TCGv src2 =3D get_gpr(ctx, a->rs2, EXT_NONE); + TCGv src1, src2 =3D get_gpr(ctx, a->rs2, EXT_NONE); =20 + decode_save_opc(ctx); + src1 =3D get_address(ctx, a->rs1, 0); func(dest, src1, src2, ctx->mem_idx, mop); =20 gen_set_gpr(ctx, a->rd, dest); diff --git a/target/riscv/insn_trans/trans_rvd.c.inc b/target/riscv/insn_tr= ans/trans_rvd.c.inc index 1397c1ce1c..6e3159b797 100644 --- a/target/riscv/insn_trans/trans_rvd.c.inc +++ b/target/riscv/insn_trans/trans_rvd.c.inc @@ -38,6 +38,7 @@ static bool trans_fld(DisasContext *ctx, arg_fld *a) REQUIRE_FPU; REQUIRE_EXT(ctx, RVD); =20 + decode_save_opc(ctx); addr =3D get_address(ctx, a->rs1, a->imm); tcg_gen_qemu_ld_i64(cpu_fpr[a->rd], addr, ctx->mem_idx, MO_TEUQ); =20 @@ -52,6 +53,7 @@ static bool trans_fsd(DisasContext *ctx, arg_fsd *a) REQUIRE_FPU; REQUIRE_EXT(ctx, RVD); =20 + decode_save_opc(ctx); addr =3D get_address(ctx, a->rs1, a->imm); tcg_gen_qemu_st_i64(cpu_fpr[a->rs2], addr, ctx->mem_idx, MO_TEUQ); return true; diff --git a/target/riscv/insn_trans/trans_rvf.c.inc b/target/riscv/insn_tr= ans/trans_rvf.c.inc index a1d3eb52ad..965e1f8d11 100644 --- a/target/riscv/insn_trans/trans_rvf.c.inc +++ b/target/riscv/insn_trans/trans_rvf.c.inc @@ -38,6 +38,7 @@ static bool trans_flw(DisasContext *ctx, arg_flw *a) REQUIRE_FPU; REQUIRE_EXT(ctx, RVF); =20 + decode_save_opc(ctx); addr =3D get_address(ctx, a->rs1, a->imm); dest =3D cpu_fpr[a->rd]; tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, MO_TEUL); @@ -54,6 +55,7 @@ static bool trans_fsw(DisasContext *ctx, arg_fsw *a) REQUIRE_FPU; REQUIRE_EXT(ctx, RVF); =20 + decode_save_opc(ctx); addr =3D get_address(ctx, a->rs1, a->imm); tcg_gen_qemu_st_i64(cpu_fpr[a->rs2], addr, ctx->mem_idx, MO_TEUL); return true; diff --git a/target/riscv/insn_trans/trans_rvh.c.inc b/target/riscv/insn_tr= ans/trans_rvh.c.inc index 4f8aecddc7..9248b48c36 100644 --- a/target/riscv/insn_trans/trans_rvh.c.inc +++ b/target/riscv/insn_trans/trans_rvh.c.inc @@ -36,6 +36,7 @@ static bool do_hlv(DisasContext *ctx, arg_r2 *a, MemOp mo= p) #ifdef CONFIG_USER_ONLY return false; #else + decode_save_opc(ctx); if (check_access(ctx)) { TCGv dest =3D dest_gpr(ctx, a->rd); TCGv addr =3D get_gpr(ctx, a->rs1, EXT_NONE); @@ -82,6 +83,7 @@ static bool do_hsv(DisasContext *ctx, arg_r2_s *a, MemOp = mop) #ifdef CONFIG_USER_ONLY return false; #else + decode_save_opc(ctx); if (check_access(ctx)) { TCGv addr =3D get_gpr(ctx, a->rs1, EXT_NONE); TCGv data =3D get_gpr(ctx, a->rs2, EXT_NONE); @@ -135,6 +137,7 @@ static bool trans_hsv_d(DisasContext *ctx, arg_hsv_d *a) static bool do_hlvx(DisasContext *ctx, arg_r2 *a, void (*func)(TCGv, TCGv_env, TCGv)) { + decode_save_opc(ctx); if (check_access(ctx)) { TCGv dest =3D dest_gpr(ctx, a->rd); TCGv addr =3D get_gpr(ctx, a->rs1, EXT_NONE); diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_tr= ans/trans_rvi.c.inc index 5c69b88d1e..4496f21266 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -261,6 +261,7 @@ static bool gen_load_i128(DisasContext *ctx, arg_lb *a,= MemOp memop) =20 static bool gen_load(DisasContext *ctx, arg_lb *a, MemOp memop) { + decode_save_opc(ctx); if (get_xl(ctx) =3D=3D MXL_RV128) { return gen_load_i128(ctx, a, memop); } else { @@ -350,6 +351,7 @@ static bool gen_store_i128(DisasContext *ctx, arg_sb *a= , MemOp memop) =20 static bool gen_store(DisasContext *ctx, arg_sb *a, MemOp memop) { + decode_save_opc(ctx); if (get_xl(ctx) =3D=3D MXL_RV128) { return gen_store_i128(ctx, a, memop); } else { diff --git a/target/riscv/insn_trans/trans_rvzfh.c.inc b/target/riscv/insn_= trans/trans_rvzfh.c.inc index 5d07150cd0..2ad5716312 100644 --- a/target/riscv/insn_trans/trans_rvzfh.c.inc +++ b/target/riscv/insn_trans/trans_rvzfh.c.inc @@ -49,6 +49,7 @@ static bool trans_flh(DisasContext *ctx, arg_flh *a) REQUIRE_FPU; REQUIRE_ZFH_OR_ZFHMIN(ctx); =20 + decode_save_opc(ctx); t0 =3D get_gpr(ctx, a->rs1, EXT_NONE); if (a->imm) { TCGv temp =3D temp_new(ctx); @@ -71,6 +72,7 @@ static bool trans_fsh(DisasContext *ctx, arg_fsh *a) REQUIRE_FPU; REQUIRE_ZFH_OR_ZFHMIN(ctx); =20 + decode_save_opc(ctx); t0 =3D get_gpr(ctx, a->rs1, EXT_NONE); if (a->imm) { TCGv temp =3D tcg_temp_new(); diff --git a/target/riscv/insn_trans/trans_svinval.c.inc b/target/riscv/ins= n_trans/trans_svinval.c.inc index 2682bd969f..f3cd7d5c0b 100644 --- a/target/riscv/insn_trans/trans_svinval.c.inc +++ b/target/riscv/insn_trans/trans_svinval.c.inc @@ -28,6 +28,7 @@ static bool trans_sinval_vma(DisasContext *ctx, arg_sinva= l_vma *a) /* Do the same as sfence.vma currently */ REQUIRE_EXT(ctx, RVS); #ifndef CONFIG_USER_ONLY + decode_save_opc(ctx); gen_helper_tlb_flush(cpu_env); return true; #endif @@ -56,6 +57,7 @@ static bool trans_hinval_vvma(DisasContext *ctx, arg_hinv= al_vvma *a) /* Do the same as hfence.vvma currently */ REQUIRE_EXT(ctx, RVH); #ifndef CONFIG_USER_ONLY + decode_save_opc(ctx); gen_helper_hyp_tlb_flush(cpu_env); return true; #endif @@ -68,6 +70,7 @@ static bool trans_hinval_gvma(DisasContext *ctx, arg_hinv= al_gvma *a) /* Do the same as hfence.gvma currently */ REQUIRE_EXT(ctx, RVH); #ifndef CONFIG_USER_ONLY + decode_save_opc(ctx); gen_helper_hyp_gvma_tlb_flush(cpu_env); return true; #endif --=20 2.34.1