From nobody Mon Nov 23 04:38:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794057380413567.1573657961225; Sat, 7 Nov 2026 05:16:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPgGw-0007l0-Ld; Sat, 07 Nov 2026 08:15:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPgGn-0007kT-SA; Sat, 07 Nov 2026 08:15:45 -0500 Received: from smtp81.cstnet.cn ([159.226.251.81] helo=cstnet.cn) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1xPgGk-0005jQ-4M; Sat, 07 Nov 2026 08:15:44 -0500 Received: from k3-03 (unknown [159.226.43.8]) by APP-03 (Coremail) with SMTP id rQCowADn9ZZgJO9qRbN+AA--.22918S2; Sat, 07 Nov 2026 21:15:21 +0800 (CST) From: Tan Chi To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, palmer@dabbelt.com, alistair.francis@wdc.com, liwei1518@gmail.com, daniel.barboza@oss.qualcomm.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, Tan Chi Subject: [PATCH] hw/riscv: Synchronize IOMMU FCTL state after MMIO writes Date: Sat, 7 Nov 2026 21:15:10 +0800 Message-ID: <20261107131510.102469-1-tanchi25@mails.ucas.ac.cn> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: rQCowADn9ZZgJO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xZFpf9x0JU3uc_UUUUU= X-Originating-IP: [159.226.43.8] X-CM-SenderInfo: pwdquxrlsvqzpdlo2hpxfd2hldfou0/ 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=lists1p.gnu.org; Received-SPF: pass client-ip=159.226.251.81; envelope-from=tanchi25@mails.ucas.ac.cn; helo=cstnet.cn X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development 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-ZM-MESSAGEID: 1794057397047158500 Content-Type: text/plain; charset="utf-8" MMIO writes to FCTL only update the register storage, leaving s->fctl unchanged. As a result, setting FCTL.GXL does not enable Sv32x4 translation in the page-table walkers. Synchronize s->fctl with the guest-visible FCTL register after MMIO writes, following the existing register processing mechanism. Signed-off-by: Tan Chi Reviewed-by: Daniel Henrique Barboza --- hw/riscv/riscv-iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c index 3f999bf292..6ef2e3ae6f 100644 --- a/hw/riscv/riscv-iommu.c +++ b/hw/riscv/riscv-iommu.c @@ -2398,6 +2398,11 @@ static void riscv_iommu_process_dbg(RISCVIOMMUState = *s) =20 typedef void riscv_iommu_process_fn(RISCVIOMMUState *s); =20 +static void riscv_iommu_process_fctl(RISCVIOMMUState *s) +{ + s->fctl =3D riscv_iommu_reg_get32(s, RISCV_IOMMU_REG_FCTL); +} + static void riscv_iommu_update_icvec(RISCVIOMMUState *s, uint64_t data) { uint64_t icvec =3D 0; @@ -2538,6 +2543,10 @@ static MemTxResult riscv_iommu_mmio_write(void *opaq= ue, hwaddr addr, =20 /* Track actionable MMIO write. */ switch (regb) { + case RISCV_IOMMU_REG_FCTL: + process_fn =3D riscv_iommu_process_fctl; + break; + case RISCV_IOMMU_REG_DDTP: case RISCV_IOMMU_REG_DDTP + 4: process_fn =3D riscv_iommu_process_ddtp; --=20 2.53.0