CR2 writes currently update the register even when the SMMU is enabled.
Ignore these writes after SMMUEN has been updated to one.

The model acknowledges SMMUEN synchronously, so checking the selected
bank's enable state is sufficient. Retain writes while it is disabled.

Fixes: fae4be38b35d ("hw/arm/smmuv3: Implement MMIO write operations")
Signed-off-by: Tao Tang <[email protected]>
Reviewed-by: Pierrick Bouvier <[email protected]>
---
 hw/arm/smmuv3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 144993243eb..bd680375b1b 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -1797,7 +1797,10 @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr 
offset,
         bank->cr[1] = data;
         break;
     case A_CR2:
-        bank->cr[2] = data;
+        if (!smmu_enabled(s, reg_sec_sid)) {
+            /* SMMUEN is acknowledged synchronously in this model. */
+            bank->cr[2] = data;
+        }
         break;
     case A_IRQ_CTRL:
         bank->irq_ctrl = data;
-- 
2.34.1


Reply via email to