[PATCH v2 5/7] ati-vga: Disable GUI engine MMIO writes when CCE enabled

Chad Jablonski posted 7 patches 6 days, 5 hours ago
[PATCH v2 5/7] ati-vga: Disable GUI engine MMIO writes when CCE enabled
Posted by Chad Jablonski 6 days, 5 hours ago
When the CCE engine is enabled, real hardware ignores any MMIO writes to
GUI registers (0x1400-0x1fff range). Writes made by the CCE engine are
not affected by this.

Signed-off-by: Chad Jablonski <chad@jablonski.xyz>
---
 hw/display/ati.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/display/ati.c b/hw/display/ati.c
index 5f52739d33..29a89b3f80 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -1011,6 +1011,13 @@ static void ati_mm_write(void *opaque, hwaddr addr,
     if (addr < CUR_OFFSET || addr > CUR_CLR1 || ATI_DEBUG_HW_CURSOR) {
         trace_ati_mm_write(size, addr, ati_reg_name(addr & ~3ULL), data);
     }
+    if (addr >= 0x1400 && addr <= 0x1fff && s->cce.buffer_mode != 0) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+            "ati_mm_write: wrote 0x%lx to gui register 0x%lx while cce engine enabled, ignored.\n",
+            data, addr);
+        return;
+    }
+
     ati_reg_write(s, addr, data, size);
 }
 
-- 
2.51.2
Re: [PATCH v2 5/7] ati-vga: Disable GUI engine MMIO writes when CCE enabled
Posted by BALATON Zoltan 5 days, 19 hours ago
On Wed, 31 Dec 2025, Chad Jablonski wrote:
> When the CCE engine is enabled, real hardware ignores any MMIO writes to
> GUI registers (0x1400-0x1fff range). Writes made by the CCE engine are
> not affected by this.
>
> Signed-off-by: Chad Jablonski <chad@jablonski.xyz>
> ---
> hw/display/ati.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/display/ati.c b/hw/display/ati.c
> index 5f52739d33..29a89b3f80 100644
> --- a/hw/display/ati.c
> +++ b/hw/display/ati.c
> @@ -1011,6 +1011,13 @@ static void ati_mm_write(void *opaque, hwaddr addr,
>     if (addr < CUR_OFFSET || addr > CUR_CLR1 || ATI_DEBUG_HW_CURSOR) {
>         trace_ati_mm_write(size, addr, ati_reg_name(addr & ~3ULL), data);
>     }
> +    if (addr >= 0x1400 && addr <= 0x1fff && s->cce.buffer_mode != 0) {

Small nit, I'd write this as

(s->cce.buffer_mode && addr >= 0x1400 && addr <= 0x1fff)

to make it shorter and to skip testing the addr when not needed.

Regards,
BALATON Zoltan

> +        qemu_log_mask(LOG_GUEST_ERROR,
> +            "ati_mm_write: wrote 0x%lx to gui register 0x%lx while cce engine enabled, ignored.\n",
> +            data, addr);
> +        return;
> +    }
> +
>     ati_reg_write(s, addr, data, size);
> }
>
>