On 11/7/2026 10:15 AM, Tan Chi wrote:
> 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 <tanchi25@mails.ucas.ac.cn>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> 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)
>
> typedef void riscv_iommu_process_fn(RISCVIOMMUState *s);
>
> +static void riscv_iommu_process_fctl(RISCVIOMMUState *s)
> +{
> + s->fctl = riscv_iommu_reg_get32(s, RISCV_IOMMU_REG_FCTL);
> +}
> +
> static void riscv_iommu_update_icvec(RISCVIOMMUState *s, uint64_t data)
> {
> uint64_t icvec = 0;
> @@ -2538,6 +2543,10 @@ static MemTxResult riscv_iommu_mmio_write(void *opaque, hwaddr addr,
>
> /* Track actionable MMIO write. */
> switch (regb) {
> + case RISCV_IOMMU_REG_FCTL:
> + process_fn = riscv_iommu_process_fctl;
> + break;
> +
> case RISCV_IOMMU_REG_DDTP:
> case RISCV_IOMMU_REG_DDTP + 4:
> process_fn = riscv_iommu_process_ddtp;